xref: /linux/include/net/cfg80211.h (revision 065563b20a664a6575dc158688dfb0e121c25b38)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2704232c2SJohannes Berg #ifndef __NET_CFG80211_H
3704232c2SJohannes Berg #define __NET_CFG80211_H
4d3236553SJohannes Berg /*
5d3236553SJohannes Berg  * 802.11 device and configuration interface
6d3236553SJohannes Berg  *
7026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
82740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
98585989dSLuca Coelho  * Copyright 2015-2017	Intel Deutschland GmbH
106cf963edSIlan Peer  * Copyright (C) 2018-2021, 2023 Intel Corporation
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13cc69837fSJakub Kicinski #include <linux/ethtool.h>
146f779a66SEmmanuel Grumbach #include <uapi/linux/rfkill.h>
15d3236553SJohannes Berg #include <linux/netdevice.h>
16d3236553SJohannes Berg #include <linux/debugfs.h>
17d3236553SJohannes Berg #include <linux/list.h>
18187f1882SPaul Gortmaker #include <linux/bug.h>
19704232c2SJohannes Berg #include <linux/netlink.h>
20704232c2SJohannes Berg #include <linux/skbuff.h>
2155682965SJohannes Berg #include <linux/nl80211.h>
222a519311SJohannes Berg #include <linux/if_ether.h>
232a519311SJohannes Berg #include <linux/ieee80211.h>
242a0e047eSJohannes Berg #include <linux/net.h>
25358ae888SEmmanuel Grumbach #include <linux/rfkill.h>
26d3236553SJohannes Berg #include <net/regulatory.h>
27d3236553SJohannes Berg 
28d70e9693SJohannes Berg /**
29d70e9693SJohannes Berg  * DOC: Introduction
30d70e9693SJohannes Berg  *
31d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
33d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
35d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
36d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
37d70e9693SJohannes Berg  *
38d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
39d70e9693SJohannes Berg  * use restrictions.
40d70e9693SJohannes Berg  */
41d70e9693SJohannes Berg 
42d70e9693SJohannes Berg 
43d70e9693SJohannes Berg /**
44d70e9693SJohannes Berg  * DOC: Device registration
45d70e9693SJohannes Berg  *
46d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
47d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
48d70e9693SJohannes Berg  * described below.
49d70e9693SJohannes Berg  *
50d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
51d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
52d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
53d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
54d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
56d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
57d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
58d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
59d70e9693SJohannes Berg  *
60d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
61d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
62d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
63d70e9693SJohannes Berg  */
64d70e9693SJohannes Berg 
659f5e8f6eSJohannes Berg struct wiphy;
669f5e8f6eSJohannes Berg 
67704232c2SJohannes Berg /*
68d3236553SJohannes Berg  * wireless hardware capability structures
69d3236553SJohannes Berg  */
70d3236553SJohannes Berg 
71d3236553SJohannes Berg /**
72d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
73d3236553SJohannes Berg  *
74d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
75d3236553SJohannes Berg  *
76d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
778fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
788fe02e16SLuis R. Rodriguez  *	sending probe requests or beaconing.
79d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
80689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
81d3236553SJohannes Berg  *	is not permitted.
82689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
83d3236553SJohannes Berg  *	is not permitted.
8403f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
85c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
86c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
87c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
88c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
89c7a6ee27SJohannes Berg  *	restrictions.
90c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
91c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
92c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
93c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
94c7a6ee27SJohannes Berg  *	restrictions.
95570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9606f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
97ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
98ea077c1cSRostislav Lisovy  *	on this channel.
99ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
100ea077c1cSRostislav Lisovy  *	on this channel.
1011e61d82cSHaim Dreyfuss  * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
102d65a9770SThomas Pedersen  * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
103d65a9770SThomas Pedersen  *	on this channel.
104d65a9770SThomas Pedersen  * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
105d65a9770SThomas Pedersen  *	on this channel.
106d65a9770SThomas Pedersen  * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
107d65a9770SThomas Pedersen  *	on this channel.
108d65a9770SThomas Pedersen  * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
109d65a9770SThomas Pedersen  *	on this channel.
110d65a9770SThomas Pedersen  * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
111d65a9770SThomas Pedersen  *	on this channel.
1123743bec6SJia Ding  * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,
1133743bec6SJia Ding  *	this flag indicates that a 320 MHz channel cannot use this
1143743bec6SJia Ding  *	channel as the control or any of the secondary channels.
1153743bec6SJia Ding  *	This may be due to the driver or due to regulatory bandwidth
1163743bec6SJia Ding  *	restrictions.
11731846b65SIlan Peer  * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.
118d3236553SJohannes Berg  */
119d3236553SJohannes Berg enum ieee80211_channel_flags {
120d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1218fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1228fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
123d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
124689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
125689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12603f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
127c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
128c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
129570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
13006f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
131ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
132ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
1331e61d82cSHaim Dreyfuss 	IEEE80211_CHAN_NO_HE		= 1<<13,
134d65a9770SThomas Pedersen 	IEEE80211_CHAN_1MHZ		= 1<<14,
135d65a9770SThomas Pedersen 	IEEE80211_CHAN_2MHZ		= 1<<15,
136d65a9770SThomas Pedersen 	IEEE80211_CHAN_4MHZ		= 1<<16,
137d65a9770SThomas Pedersen 	IEEE80211_CHAN_8MHZ		= 1<<17,
138d65a9770SThomas Pedersen 	IEEE80211_CHAN_16MHZ		= 1<<18,
1393743bec6SJia Ding 	IEEE80211_CHAN_NO_320MHZ	= 1<<19,
14031846b65SIlan Peer 	IEEE80211_CHAN_NO_EHT		= 1<<20,
141d3236553SJohannes Berg };
142d3236553SJohannes Berg 
143038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
144689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
145038659e7SLuis R. Rodriguez 
14604f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
14704f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
14804f39047SSimon Wunderlich 
149d3236553SJohannes Berg /**
150d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
151d3236553SJohannes Berg  *
152d3236553SJohannes Berg  * This structure describes a single channel for use
153d3236553SJohannes Berg  * with cfg80211.
154d3236553SJohannes Berg  *
155d3236553SJohannes Berg  * @center_freq: center frequency in MHz
156934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
157d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
158d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
159d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
160d3236553SJohannes Berg  *	code to support devices with additional restrictions
161d3236553SJohannes Berg  * @band: band this channel belongs to.
162d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
163d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
164eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
165d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
166d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
16777c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
168d3236553SJohannes Berg  * @orig_mag: internal use
169d3236553SJohannes Berg  * @orig_mpwr: internal use
17004f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
17104f39047SSimon Wunderlich  *	on this channel.
17204f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
173089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
174d3236553SJohannes Berg  */
175d3236553SJohannes Berg struct ieee80211_channel {
17657fbcce3SJohannes Berg 	enum nl80211_band band;
1779cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
178934f4c7dSThomas Pedersen 	u16 freq_offset;
179d3236553SJohannes Berg 	u16 hw_value;
180d3236553SJohannes Berg 	u32 flags;
181d3236553SJohannes Berg 	int max_antenna_gain;
182d3236553SJohannes Berg 	int max_power;
183eccc068eSHong Wu 	int max_reg_power;
184d3236553SJohannes Berg 	bool beacon_found;
185d3236553SJohannes Berg 	u32 orig_flags;
186d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
18704f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
18804f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
189089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
190d3236553SJohannes Berg };
191d3236553SJohannes Berg 
192d3236553SJohannes Berg /**
193d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
194d3236553SJohannes Berg  *
195d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
196d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
197d3236553SJohannes Berg  * different bands/PHY modes.
198d3236553SJohannes Berg  *
199d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
200d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
201d3236553SJohannes Berg  *	with CCK rates.
202d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
203d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
204d3236553SJohannes Berg  *	core code when registering the wiphy.
205d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
206d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
207d3236553SJohannes Berg  *	core code when registering the wiphy.
208d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
209d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
210d3236553SJohannes Berg  *	core code when registering the wiphy.
211d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
21230e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
21330e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
214d3236553SJohannes Berg  */
215d3236553SJohannes Berg enum ieee80211_rate_flags {
216d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
217d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
218d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
219d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
220d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
22130e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
22230e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
223d3236553SJohannes Berg };
224d3236553SJohannes Berg 
225d3236553SJohannes Berg /**
2266eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2276eb18137SDedy Lansky  *
2286eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2296eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2306eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2316eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2326eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2336eb18137SDedy Lansky  */
2346eb18137SDedy Lansky enum ieee80211_bss_type {
2356eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2366eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2376eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2386eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2396eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2406eb18137SDedy Lansky };
2416eb18137SDedy Lansky 
2426eb18137SDedy Lansky /**
2436eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2446eb18137SDedy Lansky  *
2456eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2466eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2476eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2486eb18137SDedy Lansky  */
2496eb18137SDedy Lansky enum ieee80211_privacy {
2506eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2516eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2526eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2536eb18137SDedy Lansky };
2546eb18137SDedy Lansky 
2556eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2566eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2576eb18137SDedy Lansky 
2586eb18137SDedy Lansky /**
259d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
260d3236553SJohannes Berg  *
261d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
262d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
263d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
264d3236553SJohannes Berg  * passed around.
265d3236553SJohannes Berg  *
266d3236553SJohannes Berg  * @flags: rate-specific flags
267d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
268d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
269d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
270d3236553SJohannes Berg  *	short preamble is used
271d3236553SJohannes Berg  */
272d3236553SJohannes Berg struct ieee80211_rate {
273d3236553SJohannes Berg 	u32 flags;
274d3236553SJohannes Berg 	u16 bitrate;
275d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
276d3236553SJohannes Berg };
277d3236553SJohannes Berg 
278d3236553SJohannes Berg /**
279796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
280796e90f4SJohn Crispin  *
281796e90f4SJohn Crispin  * @enable: is the feature enabled.
282f5bec330SRajkumar Manoharan  * @sr_ctrl: The SR Control field of SRP element.
283f5bec330SRajkumar Manoharan  * @non_srg_max_offset: non-SRG maximum tx power offset
284796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
285796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
286f5bec330SRajkumar Manoharan  * @bss_color_bitmap: bitmap that indicates the BSS color values used by
287f5bec330SRajkumar Manoharan  *	members of the SRG
288f5bec330SRajkumar Manoharan  * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
289f5bec330SRajkumar Manoharan  *	used by members of the SRG
290796e90f4SJohn Crispin  */
291796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
292796e90f4SJohn Crispin 	bool enable;
293f5bec330SRajkumar Manoharan 	u8 sr_ctrl;
294f5bec330SRajkumar Manoharan 	u8 non_srg_max_offset;
295796e90f4SJohn Crispin 	u8 min_offset;
296796e90f4SJohn Crispin 	u8 max_offset;
297f5bec330SRajkumar Manoharan 	u8 bss_color_bitmap[8];
298f5bec330SRajkumar Manoharan 	u8 partial_bssid_bitmap[8];
299796e90f4SJohn Crispin };
300796e90f4SJohn Crispin 
301796e90f4SJohn Crispin /**
3025c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
3035c5e52d1SJohn Crispin  *
3045c5e52d1SJohn Crispin  * @color: the current color.
30575e6b594SJohannes Berg  * @enabled: HE BSS color is used
3065c5e52d1SJohn Crispin  * @partial: define the AID equation.
3075c5e52d1SJohn Crispin  */
3085c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
3095c5e52d1SJohn Crispin 	u8 color;
31075e6b594SJohannes Berg 	bool enabled;
3115c5e52d1SJohn Crispin 	bool partial;
3125c5e52d1SJohn Crispin };
3135c5e52d1SJohn Crispin 
3145c5e52d1SJohn Crispin /**
315d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
316d3236553SJohannes Berg  *
317d3236553SJohannes Berg  * This structure describes most essential parameters needed
318d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
319d3236553SJohannes Berg  *
320d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
321d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
322d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
323d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
324d3236553SJohannes Berg  * @mcs: Supported MCS rates
325d3236553SJohannes Berg  */
326d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
327d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
328d3236553SJohannes Berg 	bool ht_supported;
329d3236553SJohannes Berg 	u8 ampdu_factor;
330d3236553SJohannes Berg 	u8 ampdu_density;
331d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
332d3236553SJohannes Berg };
333d3236553SJohannes Berg 
334d3236553SJohannes Berg /**
335bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
336bf0c111eSMahesh Palivela  *
337bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
338bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
339bf0c111eSMahesh Palivela  *
340bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
341bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
342bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
343bf0c111eSMahesh Palivela  */
344bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
345bf0c111eSMahesh Palivela 	bool vht_supported;
346bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
347bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
348bf0c111eSMahesh Palivela };
349bf0c111eSMahesh Palivela 
350c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
351c4cbaf79SLuca Coelho 
352c4cbaf79SLuca Coelho /**
353c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
354c4cbaf79SLuca Coelho  *
355c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
356c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
357c4cbaf79SLuca Coelho  *
358c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
359c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
360c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
361c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
362c4cbaf79SLuca Coelho  */
363c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
364c4cbaf79SLuca Coelho 	bool has_he;
365c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
366c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
367c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
368c4cbaf79SLuca Coelho };
369c4cbaf79SLuca Coelho 
370c4cbaf79SLuca Coelho /**
3715cd5a8a3SIlan Peer  * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
3725cd5a8a3SIlan Peer  *
3735cd5a8a3SIlan Peer  * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
3745cd5a8a3SIlan Peer  * and NSS Set field"
3755cd5a8a3SIlan Peer  *
3765cd5a8a3SIlan Peer  * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
3772d8b08feSMauro Carvalho Chehab  * @bw: MCS/NSS support for 80, 160 and 320 MHz
3785cd5a8a3SIlan Peer  * @bw._80: MCS/NSS support for BW <= 80 MHz
3795cd5a8a3SIlan Peer  * @bw._160: MCS/NSS support for BW = 160 MHz
3805cd5a8a3SIlan Peer  * @bw._320: MCS/NSS support for BW = 320 MHz
3815cd5a8a3SIlan Peer  */
3825cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp {
3835cd5a8a3SIlan Peer 	union {
3845cd5a8a3SIlan Peer 		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
3855cd5a8a3SIlan Peer 		struct {
3865cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _80;
3875cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _160;
3885cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _320;
3895cd5a8a3SIlan Peer 		} __packed bw;
3905cd5a8a3SIlan Peer 	} __packed;
3915cd5a8a3SIlan Peer } __packed;
3925cd5a8a3SIlan Peer 
3935cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
3945cd5a8a3SIlan Peer 
3955cd5a8a3SIlan Peer /**
3965cd5a8a3SIlan Peer  * struct ieee80211_sta_eht_cap - STA's EHT capabilities
3975cd5a8a3SIlan Peer  *
3985cd5a8a3SIlan Peer  * This structure describes most essential parameters needed
3995cd5a8a3SIlan Peer  * to describe 802.11be EHT capabilities for a STA.
4005cd5a8a3SIlan Peer  *
4015cd5a8a3SIlan Peer  * @has_eht: true iff EHT data is valid.
4025cd5a8a3SIlan Peer  * @eht_cap_elem: Fixed portion of the eht capabilities element.
4035cd5a8a3SIlan Peer  * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
4045cd5a8a3SIlan Peer  * @eht_ppe_thres: Holds the PPE Thresholds data.
4055cd5a8a3SIlan Peer  */
4065cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap {
4075cd5a8a3SIlan Peer 	bool has_eht;
4085cd5a8a3SIlan Peer 	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
4095cd5a8a3SIlan Peer 	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
4105cd5a8a3SIlan Peer 	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
4115cd5a8a3SIlan Peer };
4125cd5a8a3SIlan Peer 
4135cd5a8a3SIlan Peer /**
4145d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
415c4cbaf79SLuca Coelho  *
416c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
417c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
418c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
419c4cbaf79SLuca Coelho  *
420c4cbaf79SLuca Coelho  * @types_mask: interface types mask
421c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
42222395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
42322395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
4242d8b08feSMauro Carvalho Chehab  * @eht_cap: STA's EHT capabilities
425f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
426f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
427f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
428c4cbaf79SLuca Coelho  */
429c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
430c4cbaf79SLuca Coelho 	u16 types_mask;
431c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
43222395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
4335cd5a8a3SIlan Peer 	struct ieee80211_sta_eht_cap eht_cap;
434f4f86505SJohannes Berg 	struct {
435f4f86505SJohannes Berg 		const u8 *data;
436f4f86505SJohannes Berg 		unsigned int len;
437f4f86505SJohannes Berg 	} vendor_elems;
438c4cbaf79SLuca Coelho };
439c4cbaf79SLuca Coelho 
440bf0c111eSMahesh Palivela /**
4412a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
4422a38075cSAlexei Avshalom Lazar  *
4432a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
4442a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
4452a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
4462a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
4472a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
4482a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
4492a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
4502a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
4512a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4522a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4532a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4542a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4552a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4562a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4572a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4582a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4592a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4602a38075cSAlexei Avshalom Lazar  */
4612a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4622a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4632a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4642a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4652a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4662a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4672a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
4682a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
4692a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
4702a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
4712a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
4722a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
4732a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4742a38075cSAlexei Avshalom Lazar };
4752a38075cSAlexei Avshalom Lazar 
4762a38075cSAlexei Avshalom Lazar /**
4772a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4782a38075cSAlexei Avshalom Lazar  *
4792a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4802a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4812a38075cSAlexei Avshalom Lazar  *
4822a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4832a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4842a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4852a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4862a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4872a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4882a38075cSAlexei Avshalom Lazar  */
4892a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4902a38075cSAlexei Avshalom Lazar 	u8 channels;
4912a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4922a38075cSAlexei Avshalom Lazar };
4932a38075cSAlexei Avshalom Lazar 
4942a38075cSAlexei Avshalom Lazar /**
495df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
496df78a0c0SThomas Pedersen  *
497df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
498df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
499df78a0c0SThomas Pedersen  *
5002d8b08feSMauro Carvalho Chehab  * @s1g: is STA an S1G STA
501df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
502df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
503df78a0c0SThomas Pedersen  */
504df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
505df78a0c0SThomas Pedersen 	bool s1g;
506df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
507df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
508df78a0c0SThomas Pedersen };
509df78a0c0SThomas Pedersen 
510df78a0c0SThomas Pedersen /**
511d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
512d3236553SJohannes Berg  *
513d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
514d3236553SJohannes Berg  * is able to operate in.
515d3236553SJohannes Berg  *
516085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
517d3236553SJohannes Berg  *	in this band.
518d3236553SJohannes Berg  * @band: the band this structure represents
519d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
520d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
521d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
522d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
523d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
524abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
525c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
5268a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
5272a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
5289ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
529c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
530c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
531c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
532c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
533c4cbaf79SLuca Coelho  *	iftype_data).
534d3236553SJohannes Berg  */
535d3236553SJohannes Berg struct ieee80211_supported_band {
536d3236553SJohannes Berg 	struct ieee80211_channel *channels;
537d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
53857fbcce3SJohannes Berg 	enum nl80211_band band;
539d3236553SJohannes Berg 	int n_channels;
540d3236553SJohannes Berg 	int n_bitrates;
541d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
542bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
543df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
5442a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
545c4cbaf79SLuca Coelho 	u16 n_iftype_data;
546c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
547d3236553SJohannes Berg };
548d3236553SJohannes Berg 
549e691ac2fSRafał Miłecki /**
550c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
551c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
552c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
553c4cbaf79SLuca Coelho  *
554c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
555c4cbaf79SLuca Coelho  */
556c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
557c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
558c4cbaf79SLuca Coelho 				u8 iftype)
559c4cbaf79SLuca Coelho {
560c4cbaf79SLuca Coelho 	int i;
561c4cbaf79SLuca Coelho 
562c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
563c4cbaf79SLuca Coelho 		return NULL;
564c4cbaf79SLuca Coelho 
565c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
566c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
567c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
568c4cbaf79SLuca Coelho 
569c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
570c4cbaf79SLuca Coelho 			return data;
571c4cbaf79SLuca Coelho 	}
572c4cbaf79SLuca Coelho 
573c4cbaf79SLuca Coelho 	return NULL;
574c4cbaf79SLuca Coelho }
575c4cbaf79SLuca Coelho 
576c4cbaf79SLuca Coelho /**
577d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
578d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
579d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
580d7edf40cSJohn Crispin  *
581d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
582d7edf40cSJohn Crispin  */
583d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
584d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
585d7edf40cSJohn Crispin 			    u8 iftype)
586d7edf40cSJohn Crispin {
587d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
588d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
589d7edf40cSJohn Crispin 
590d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
591d7edf40cSJohn Crispin 		return &data->he_cap;
592d7edf40cSJohn Crispin 
593d7edf40cSJohn Crispin 	return NULL;
594d7edf40cSJohn Crispin }
595d7edf40cSJohn Crispin 
596d7edf40cSJohn Crispin /**
5972ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
5982ad2274cSIlan Peer  * @sband: the sband to search for the STA on
5992ad2274cSIlan Peer  * @iftype: the iftype to search for
6002ad2274cSIlan Peer  *
6012ad2274cSIlan Peer  * Return: the 6GHz capabilities
6022ad2274cSIlan Peer  */
6032ad2274cSIlan Peer static inline __le16
6042ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
6052ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
6062ad2274cSIlan Peer {
6072ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6082ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6092ad2274cSIlan Peer 
6102ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
6112ad2274cSIlan Peer 		return 0;
6122ad2274cSIlan Peer 
6132ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
6142ad2274cSIlan Peer }
6152ad2274cSIlan Peer 
6162ad2274cSIlan Peer /**
6175cd5a8a3SIlan Peer  * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
6185cd5a8a3SIlan Peer  * @sband: the sband to search for the iftype on
6195cd5a8a3SIlan Peer  * @iftype: enum nl80211_iftype
6205cd5a8a3SIlan Peer  *
6215cd5a8a3SIlan Peer  * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
6225cd5a8a3SIlan Peer  */
6235cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap *
6245cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
6255cd5a8a3SIlan Peer 			     enum nl80211_iftype iftype)
6265cd5a8a3SIlan Peer {
6275cd5a8a3SIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6285cd5a8a3SIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6295cd5a8a3SIlan Peer 
6305cd5a8a3SIlan Peer 	if (data && data->eht_cap.has_eht)
6315cd5a8a3SIlan Peer 		return &data->eht_cap;
6325cd5a8a3SIlan Peer 
6335cd5a8a3SIlan Peer 	return NULL;
6345cd5a8a3SIlan Peer }
6355cd5a8a3SIlan Peer 
6365cd5a8a3SIlan Peer /**
637e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
638e691ac2fSRafał Miłecki  *
639e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
640e691ac2fSRafał Miłecki  *
641e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
642e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
643e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
644e691ac2fSRafał Miłecki  *
645e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
646e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
647e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
648e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
649e691ac2fSRafał Miłecki  * without affecting other devices.
650e691ac2fSRafał Miłecki  *
651e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
652e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
653e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
654e691ac2fSRafał Miłecki  */
655e691ac2fSRafał Miłecki #ifdef CONFIG_OF
656e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
657e691ac2fSRafał Miłecki #else /* CONFIG_OF */
658e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
659e691ac2fSRafał Miłecki {
660e691ac2fSRafał Miłecki }
661e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
662e691ac2fSRafał Miłecki 
663e691ac2fSRafał Miłecki 
664d3236553SJohannes Berg /*
665d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
666704232c2SJohannes Berg  */
667704232c2SJohannes Berg 
6682ec600d6SLuis Carlos Cobo /**
669d70e9693SJohannes Berg  * DOC: Actions and configuration
670d70e9693SJohannes Berg  *
671d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
672d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
673d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
674d70e9693SJohannes Berg  * operations use are described separately.
675d70e9693SJohannes Berg  *
676d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
677d70e9693SJohannes Berg  * information via some functions that drivers need to call.
678d70e9693SJohannes Berg  *
679d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
680d70e9693SJohannes Berg  * in a separate chapter.
681d70e9693SJohannes Berg  */
682d70e9693SJohannes Berg 
683c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
684c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
685c6e6a0c8SAviya Erenfeld 
686d70e9693SJohannes Berg /**
6872ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
688818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
689818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
6908b787643SFelix Fietkau  * @use_4addr: use 4-address frames
691e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
692e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
693e8f479b1SBen Greear  *	determine the address as needed.
694e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
695e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
696e8f479b1SBen Greear  **	only p2p devices with specified MAC.
697b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
698b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
699b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
700b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
7012ec600d6SLuis Carlos Cobo  */
7022ec600d6SLuis Carlos Cobo struct vif_params {
703818a986eSJohannes Berg 	u32 flags;
7048b787643SFelix Fietkau 	int use_4addr;
7051c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
706b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
707b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
7082ec600d6SLuis Carlos Cobo };
7092ec600d6SLuis Carlos Cobo 
71041ade00fSJohannes Berg /**
71141ade00fSJohannes Berg  * struct key_params - key information
71241ade00fSJohannes Berg  *
71341ade00fSJohannes Berg  * Information about a key
71441ade00fSJohannes Berg  *
71541ade00fSJohannes Berg  * @key: key material
71641ade00fSJohannes Berg  * @key_len: length of key material
71741ade00fSJohannes Berg  * @cipher: cipher suite selector
71841ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
71941ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
72041ade00fSJohannes Berg  *	length given by @seq_len.
721abe37c4bSJohannes Berg  * @seq_len: length of @seq.
72214f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
7236cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
72441ade00fSJohannes Berg  */
72541ade00fSJohannes Berg struct key_params {
726c1e5f471SJohannes Berg 	const u8 *key;
727c1e5f471SJohannes Berg 	const u8 *seq;
72841ade00fSJohannes Berg 	int key_len;
72941ade00fSJohannes Berg 	int seq_len;
73014f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
73141ade00fSJohannes Berg 	u32 cipher;
7326cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
73341ade00fSJohannes Berg };
73441ade00fSJohannes Berg 
735ed1b6cc7SJohannes Berg /**
736683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
737683b6d3bSJohannes Berg  * @chan: the (control) channel
7383d9d1d66SJohannes Berg  * @width: channel width
7393d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
7403d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
7413d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
7422a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
7432a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
7442a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
7452a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
746934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
747683b6d3bSJohannes Berg  */
748683b6d3bSJohannes Berg struct cfg80211_chan_def {
749683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
7503d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
7513d9d1d66SJohannes Berg 	u32 center_freq1;
7523d9d1d66SJohannes Berg 	u32 center_freq2;
7532a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
754934f4c7dSThomas Pedersen 	u16 freq1_offset;
755683b6d3bSJohannes Berg };
756683b6d3bSJohannes Berg 
7579a5f6488STamizh Chelvam /*
7589a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
7599a5f6488STamizh Chelvam  */
7609a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
7619a5f6488STamizh Chelvam 	struct {
7629a5f6488STamizh Chelvam 		u32 legacy;
7639a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
7649a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
765eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
7669a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
767eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
768eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
7699a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
7709a5f6488STamizh Chelvam };
7719a5f6488STamizh Chelvam 
7729a5f6488STamizh Chelvam 
77377f576deSTamizh chelvam /**
7743710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
77577f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
77677f576deSTamizh chelvam  *	of the peer.
7773710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
7783710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
7793710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
78077f576deSTamizh chelvam  * @noack: noack configuration value for the TID
7816a21d16cSTamizh chelvam  * @retry_long: retry count value
7826a21d16cSTamizh chelvam  * @retry_short: retry count value
78333462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
78404f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
78533462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
7869a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
7879a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
78877f576deSTamizh chelvam  */
7893710a8a6SJohannes Berg struct cfg80211_tid_cfg {
79077f576deSTamizh chelvam 	bool config_override;
7913710a8a6SJohannes Berg 	u8 tids;
7922d5d9b7fSSergey Matyukevich 	u64 mask;
79377f576deSTamizh chelvam 	enum nl80211_tid_config noack;
7946a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
795ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
79604f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
79733462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
7989a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
7999a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
80077f576deSTamizh chelvam };
80177f576deSTamizh chelvam 
80277f576deSTamizh chelvam /**
8033710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
80477f576deSTamizh chelvam  * @peer: Station's MAC address
80577f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
80677f576deSTamizh chelvam  * @tid_conf: Configuration change info
80777f576deSTamizh chelvam  */
8083710a8a6SJohannes Berg struct cfg80211_tid_config {
80977f576deSTamizh chelvam 	const u8 *peer;
81077f576deSTamizh chelvam 	u32 n_tid_conf;
8113710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
81277f576deSTamizh chelvam };
81377f576deSTamizh chelvam 
8143d9d1d66SJohannes Berg /**
815e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
816e306784aSSubrat Mishra  * @macaddr: STA MAC address
817e306784aSSubrat Mishra  * @kek: FILS KEK
818e306784aSSubrat Mishra  * @kek_len: FILS KEK length
819e306784aSSubrat Mishra  * @snonce: STA Nonce
820e306784aSSubrat Mishra  * @anonce: AP Nonce
821e306784aSSubrat Mishra  */
822e306784aSSubrat Mishra struct cfg80211_fils_aad {
823e306784aSSubrat Mishra 	const u8 *macaddr;
824e306784aSSubrat Mishra 	const u8 *kek;
825e306784aSSubrat Mishra 	u8 kek_len;
826e306784aSSubrat Mishra 	const u8 *snonce;
827e306784aSSubrat Mishra 	const u8 *anonce;
828e306784aSSubrat Mishra };
829e306784aSSubrat Mishra 
830e306784aSSubrat Mishra /**
831cbbaf2bbSAvraham Stern  * struct cfg80211_set_hw_timestamp - enable/disable HW timestamping
832cbbaf2bbSAvraham Stern  * @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all
833cbbaf2bbSAvraham Stern  *	addresses.
834cbbaf2bbSAvraham Stern  * @enable: if set, enable HW timestamping for the specified MAC address.
835cbbaf2bbSAvraham Stern  *	Otherwise disable HW timestamping for the specified MAC address.
836cbbaf2bbSAvraham Stern  */
837cbbaf2bbSAvraham Stern struct cfg80211_set_hw_timestamp {
838cbbaf2bbSAvraham Stern 	const u8 *macaddr;
839cbbaf2bbSAvraham Stern 	bool enable;
840cbbaf2bbSAvraham Stern };
841cbbaf2bbSAvraham Stern 
842cbbaf2bbSAvraham Stern /**
8433d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
8443d9d1d66SJohannes Berg  * @chandef: the channel definition
8453d9d1d66SJohannes Berg  *
8460ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
8473d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
8483d9d1d66SJohannes Berg  */
849683b6d3bSJohannes Berg static inline enum nl80211_channel_type
850683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
851683b6d3bSJohannes Berg {
8523d9d1d66SJohannes Berg 	switch (chandef->width) {
8533d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
8543d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
8553d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
8563d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
8573d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
8583d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
8593d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
8603d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
8613d9d1d66SJohannes Berg 	default:
8623d9d1d66SJohannes Berg 		WARN_ON(1);
8633d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
864683b6d3bSJohannes Berg 	}
8653d9d1d66SJohannes Berg }
8663d9d1d66SJohannes Berg 
8673d9d1d66SJohannes Berg /**
8683d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
8693d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
8703d9d1d66SJohannes Berg  * @channel: the control channel
8713d9d1d66SJohannes Berg  * @chantype: the channel type
8723d9d1d66SJohannes Berg  *
8733d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
8743d9d1d66SJohannes Berg  */
8753d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
8763d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
8773d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
8783d9d1d66SJohannes Berg 
8793d9d1d66SJohannes Berg /**
8803d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
8813d9d1d66SJohannes Berg  * @chandef1: first channel definition
8823d9d1d66SJohannes Berg  * @chandef2: second channel definition
8833d9d1d66SJohannes Berg  *
8840ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
8853d9d1d66SJohannes Berg  * identical, %false otherwise.
8863d9d1d66SJohannes Berg  */
8873d9d1d66SJohannes Berg static inline bool
8883d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
8893d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
8903d9d1d66SJohannes Berg {
8913d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
8923d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
8933d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
894934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
8953d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
8963d9d1d66SJohannes Berg }
8973d9d1d66SJohannes Berg 
8983d9d1d66SJohannes Berg /**
8992a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
9002a38075cSAlexei Avshalom Lazar  *
9012a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
9022a38075cSAlexei Avshalom Lazar  *
9032a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
9042a38075cSAlexei Avshalom Lazar  */
9052a38075cSAlexei Avshalom Lazar static inline bool
9062a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
9072a38075cSAlexei Avshalom Lazar {
9082a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
9092a38075cSAlexei Avshalom Lazar }
9102a38075cSAlexei Avshalom Lazar 
9112a38075cSAlexei Avshalom Lazar /**
9123d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
9133d9d1d66SJohannes Berg  * @chandef1: first channel definition
9143d9d1d66SJohannes Berg  * @chandef2: second channel definition
9153d9d1d66SJohannes Berg  *
9160ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
9173d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
9183d9d1d66SJohannes Berg  */
9193d9d1d66SJohannes Berg const struct cfg80211_chan_def *
9203d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
9213d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
922683b6d3bSJohannes Berg 
923683b6d3bSJohannes Berg /**
9249f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
9259f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9260ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
9279f5e8f6eSJohannes Berg  */
9289f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
9299f5e8f6eSJohannes Berg 
9309f5e8f6eSJohannes Berg /**
9319f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
9329f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
9339f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9340ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
9350ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
9369f5e8f6eSJohannes Berg  */
9379f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
9389f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
9399f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
9409f5e8f6eSJohannes Berg 
9419f5e8f6eSJohannes Berg /**
942774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
943774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
944774f0734SSimon Wunderlich  * @chandef: the channel definition to check
9452beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
9462beb6dabSLuciano Coelho  * Returns:
9472beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
948774f0734SSimon Wunderlich  */
949774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
9502beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
951c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
952774f0734SSimon Wunderlich 
953774f0734SSimon Wunderlich /**
9545097f844SJaewan Kim  * nl80211_send_chandef - sends the channel definition.
9555097f844SJaewan Kim  * @msg: the msg to send channel definition
9565097f844SJaewan Kim  * @chandef: the channel definition to check
9575097f844SJaewan Kim  *
9585097f844SJaewan Kim  * Returns: 0 if sent the channel definition to msg, < 0 on error
9595097f844SJaewan Kim  **/
9605097f844SJaewan Kim int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);
9615097f844SJaewan Kim 
9625097f844SJaewan Kim /**
96319654a61SJohannes Berg  * ieee80211_chanwidth_rate_flags - return rate flags for channel width
96419654a61SJohannes Berg  * @width: the channel width of the channel
96530e74732SSimon Wunderlich  *
96630e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
96730e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
96830e74732SSimon Wunderlich  *
96919654a61SJohannes Berg  * Returns: rate flags which apply for this channel width
97030e74732SSimon Wunderlich  */
97130e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
97219654a61SJohannes Berg ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)
97330e74732SSimon Wunderlich {
97419654a61SJohannes Berg 	switch (width) {
97530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
97630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
97730e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
97830e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
97930e74732SSimon Wunderlich 	default:
98030e74732SSimon Wunderlich 		break;
98130e74732SSimon Wunderlich 	}
98230e74732SSimon Wunderlich 	return 0;
98330e74732SSimon Wunderlich }
98430e74732SSimon Wunderlich 
98530e74732SSimon Wunderlich /**
98619654a61SJohannes Berg  * ieee80211_chandef_rate_flags - returns rate flags for a channel
98719654a61SJohannes Berg  * @chandef: channel definition for the channel
98819654a61SJohannes Berg  *
98919654a61SJohannes Berg  * See ieee80211_chanwidth_rate_flags().
99019654a61SJohannes Berg  *
99119654a61SJohannes Berg  * Returns: rate flags which apply for this channel
99219654a61SJohannes Berg  */
99319654a61SJohannes Berg static inline enum ieee80211_rate_flags
99419654a61SJohannes Berg ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
99519654a61SJohannes Berg {
99619654a61SJohannes Berg 	return ieee80211_chanwidth_rate_flags(chandef->width);
99719654a61SJohannes Berg }
99819654a61SJohannes Berg 
99919654a61SJohannes Berg /**
10000430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
10010430c883SSimon Wunderlich  *
10020430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
10030430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
10040430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
10050430c883SSimon Wunderlich  *
10060430c883SSimon Wunderlich  * @chandef: channel definition for the channel
10070430c883SSimon Wunderlich  *
10080430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
10090430c883SSimon Wunderlich  */
10100430c883SSimon Wunderlich static inline int
10110430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
10120430c883SSimon Wunderlich {
10130430c883SSimon Wunderlich 	switch (chandef->width) {
10140430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
10150430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
10160430c883SSimon Wunderlich 			   chandef->chan->max_power);
10170430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
10180430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
10190430c883SSimon Wunderlich 			   chandef->chan->max_power);
10200430c883SSimon Wunderlich 	default:
10210430c883SSimon Wunderlich 		break;
10220430c883SSimon Wunderlich 	}
10230430c883SSimon Wunderlich 	return chandef->chan->max_power;
10240430c883SSimon Wunderlich }
10250430c883SSimon Wunderlich 
10260430c883SSimon Wunderlich /**
1027be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
1028be989891SJohannes Berg  * @wiphy: the wiphy to check for
1029be989891SJohannes Berg  * @band_mask: which bands to check on
1030be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
1031be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
1032be989891SJohannes Berg  */
1033be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
1034be989891SJohannes Berg 				  unsigned long band_mask,
1035be989891SJohannes Berg 				  u32 prohibited_flags);
1036be989891SJohannes Berg 
1037be989891SJohannes Berg /**
103861fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
103961fa713cSHolger Schurig  *
1040abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
104117e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
10424ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
10434ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
10444ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
10454ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
10464ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
1047052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
1048c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
1049abe37c4bSJohannes Berg  *
105061fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
105161fa713cSHolger Schurig  * it has filled in during the get_survey().
105261fa713cSHolger Schurig  */
105361fa713cSHolger Schurig enum survey_info_flags {
10544ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
10554ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
10564ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
10574ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
10584ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
10594ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
10604ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
1061052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
1062c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
106361fa713cSHolger Schurig };
106461fa713cSHolger Schurig 
106561fa713cSHolger Schurig /**
106661fa713cSHolger Schurig  * struct survey_info - channel survey response
106761fa713cSHolger Schurig  *
106811f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
106911f78ac3SJohannes Berg  *	record to report global statistics
107061fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
107161fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
107261fa713cSHolger Schurig  *	optional
10734ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
10744ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
10754ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
10764ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
10774ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
1078052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
1079c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
108061fa713cSHolger Schurig  *
1081abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
1082abe37c4bSJohannes Berg  *
108361fa713cSHolger Schurig  * This structure can later be expanded with things like
108461fa713cSHolger Schurig  * channel duty cycle etc.
108561fa713cSHolger Schurig  */
108661fa713cSHolger Schurig struct survey_info {
108761fa713cSHolger Schurig 	struct ieee80211_channel *channel;
10884ed20bebSJohannes Berg 	u64 time;
10894ed20bebSJohannes Berg 	u64 time_busy;
10904ed20bebSJohannes Berg 	u64 time_ext_busy;
10914ed20bebSJohannes Berg 	u64 time_rx;
10924ed20bebSJohannes Berg 	u64 time_tx;
1093052536abSJohannes Berg 	u64 time_scan;
1094c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
109561fa713cSHolger Schurig 	u32 filled;
109661fa713cSHolger Schurig 	s8 noise;
109761fa713cSHolger Schurig };
109861fa713cSHolger Schurig 
1099ecad3b0bSVeerendranath Jakkam #define CFG80211_MAX_NUM_AKM_SUITES	10
1100b8676221SDavid Spinadel 
110161fa713cSHolger Schurig /**
11025fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
11035fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
11045fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
11055fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
11065fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
11075fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
11085fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
11095fb628e9SJouni Malinen  * @akm_suites: AKM suites
11105fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
11115fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
11125fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
11135fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
11145fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
11155fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
11165fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
11175fb628e9SJouni Malinen  *	protocol frames.
111864bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
111964bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1120a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1121a710d214SLothar Rubusch  *	port for mac80211
112291b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
112326f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
112426f7044eSChung-Hsien Hsu  *	offload)
112526f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1126da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1127da1e9dd3SJohannes Berg  *
1128da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1129da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1130da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1131da1e9dd3SJohannes Berg  *	  such a scenario.
1132da1e9dd3SJohannes Berg  *
1133da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1134da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1135da1e9dd3SJohannes Berg  *
1136da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1137da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1138da1e9dd3SJohannes Berg  *
1139da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1140da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
11415fb628e9SJouni Malinen  */
11425fb628e9SJouni Malinen struct cfg80211_crypto_settings {
11435fb628e9SJouni Malinen 	u32 wpa_versions;
11445fb628e9SJouni Malinen 	u32 cipher_group;
11455fb628e9SJouni Malinen 	int n_ciphers_pairwise;
11465fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
11475fb628e9SJouni Malinen 	int n_akm_suites;
1148ecad3b0bSVeerendranath Jakkam 	u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];
11495fb628e9SJouni Malinen 	bool control_port;
11505fb628e9SJouni Malinen 	__be16 control_port_ethertype;
11515fb628e9SJouni Malinen 	bool control_port_no_encrypt;
115264bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
11537f3f96ceSMarkus Theil 	bool control_port_no_preauth;
115491b5ab62SEliad Peller 	const u8 *psk;
115526f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
115626f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
11579f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
11585fb628e9SJouni Malinen };
11595fb628e9SJouni Malinen 
11605fb628e9SJouni Malinen /**
1161dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1162dc1e3cb8SJohn Crispin  *
1163dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1164dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1165dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1166dc1e3cb8SJohn Crispin  */
1167dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1168dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1169dc1e3cb8SJohn Crispin 	u8 index;
1170dc1e3cb8SJohn Crispin 	bool ema;
1171dc1e3cb8SJohn Crispin };
1172dc1e3cb8SJohn Crispin 
1173dc1e3cb8SJohn Crispin /**
1174dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1175dc1e3cb8SJohn Crispin  *
1176dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1177dc1e3cb8SJohn Crispin  *
1178dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1179dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1180dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1181dc1e3cb8SJohn Crispin  */
1182dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1183dc1e3cb8SJohn Crispin 	u8 cnt;
1184dc1e3cb8SJohn Crispin 	struct {
1185dc1e3cb8SJohn Crispin 		const u8 *data;
1186dc1e3cb8SJohn Crispin 		size_t len;
1187dc1e3cb8SJohn Crispin 	} elem[];
1188dc1e3cb8SJohn Crispin };
1189dc1e3cb8SJohn Crispin 
1190dc1e3cb8SJohn Crispin /**
1191dbbb27e1SAloka Dixit  * struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements
1192dbbb27e1SAloka Dixit  *
1193dbbb27e1SAloka Dixit  * @cnt: Number of elements in array %elems.
1194dbbb27e1SAloka Dixit  *
1195dbbb27e1SAloka Dixit  * @elem: Array of RNR element(s) to be added into Beacon frames.
1196dbbb27e1SAloka Dixit  * @elem.data: Data for RNR elements.
1197dbbb27e1SAloka Dixit  * @elem.len: Length of data.
1198dbbb27e1SAloka Dixit  */
1199dbbb27e1SAloka Dixit struct cfg80211_rnr_elems {
1200dbbb27e1SAloka Dixit 	u8 cnt;
1201dbbb27e1SAloka Dixit 	struct {
1202dbbb27e1SAloka Dixit 		const u8 *data;
1203dbbb27e1SAloka Dixit 		size_t len;
1204dbbb27e1SAloka Dixit 	} elem[];
1205dbbb27e1SAloka Dixit };
1206dbbb27e1SAloka Dixit 
1207dbbb27e1SAloka Dixit /**
12088860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
12097b0a0e3cSJohannes Berg  * @link_id: the link ID for the AP MLD link sending this beacon
1210ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1211ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1212ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1213ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1214ed1b6cc7SJohannes Berg  * @head_len: length of @head
1215ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
12169946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
12179946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
12189946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
12199946ecfbSJouni Malinen  *	frames or %NULL
12209946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
12219946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
12229946ecfbSJouni Malinen  *	Response frames or %NULL
12239946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
122400f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
122500f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1226dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
1227dbbb27e1SAloka Dixit  * @rnr_ies: reduced neighbor report elements
122881e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
122981e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
123030db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
123130db641eSJohannes Berg  *	(measurement type 8)
123230db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
123330db641eSJohannes Berg  *	Token (measurement type 11)
123481e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
123581e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
12363d48cb74SRameshkumar Sundaram  * @he_bss_color: BSS Color settings
12373d48cb74SRameshkumar Sundaram  * @he_bss_color_valid: indicates whether bss color
1238ee0e2f51SJohannes Berg  *	attribute is present in beacon data or not.
1239ed1b6cc7SJohannes Berg  */
12408860020eSJohannes Berg struct cfg80211_beacon_data {
12417b0a0e3cSJohannes Berg 	unsigned int link_id;
12427b0a0e3cSJohannes Berg 
12438860020eSJohannes Berg 	const u8 *head, *tail;
12448860020eSJohannes Berg 	const u8 *beacon_ies;
12458860020eSJohannes Berg 	const u8 *proberesp_ies;
12468860020eSJohannes Berg 	const u8 *assocresp_ies;
12478860020eSJohannes Berg 	const u8 *probe_resp;
124881e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
124981e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1250dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
1251dbbb27e1SAloka Dixit 	struct cfg80211_rnr_elems *rnr_ies;
125281e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
12538860020eSJohannes Berg 
12548860020eSJohannes Berg 	size_t head_len, tail_len;
12558860020eSJohannes Berg 	size_t beacon_ies_len;
12568860020eSJohannes Berg 	size_t proberesp_ies_len;
12578860020eSJohannes Berg 	size_t assocresp_ies_len;
12588860020eSJohannes Berg 	size_t probe_resp_len;
125981e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
126081e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
12613d48cb74SRameshkumar Sundaram 	struct cfg80211_he_bss_color he_bss_color;
12623d48cb74SRameshkumar Sundaram 	bool he_bss_color_valid;
12638860020eSJohannes Berg };
12648860020eSJohannes Berg 
12656d45a74bSVasanthakumar Thiagarajan struct mac_address {
12666d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
12676d45a74bSVasanthakumar Thiagarajan };
12686d45a74bSVasanthakumar Thiagarajan 
12698860020eSJohannes Berg /**
127077765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
127177765eafSVasanthakumar Thiagarajan  *
127277765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1273077f897aSJohannes Berg  *	entry specified by mac_addr
127477765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
127577765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
127677765eafSVasanthakumar Thiagarajan  */
127777765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
127877765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
127977765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
128077765eafSVasanthakumar Thiagarajan 
128177765eafSVasanthakumar Thiagarajan 	/* Keep it last */
128277765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
128377765eafSVasanthakumar Thiagarajan };
128477765eafSVasanthakumar Thiagarajan 
12858860020eSJohannes Berg /**
1286291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1287291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1288291c49deSAloka Dixit  *
1289291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1290291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1291291c49deSAloka Dixit  * @tmpl_len: Template length
1292291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1293291c49deSAloka Dixit  *	frame headers.
1294291c49deSAloka Dixit  */
1295291c49deSAloka Dixit struct cfg80211_fils_discovery {
1296291c49deSAloka Dixit 	u32 min_interval;
1297291c49deSAloka Dixit 	u32 max_interval;
1298291c49deSAloka Dixit 	size_t tmpl_len;
1299291c49deSAloka Dixit 	const u8 *tmpl;
1300291c49deSAloka Dixit };
1301291c49deSAloka Dixit 
1302291c49deSAloka Dixit /**
13037443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
13047443dcd1SAloka Dixit  *	response parameters in 6GHz.
13057443dcd1SAloka Dixit  *
13067443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
13077443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
13087443dcd1SAloka Dixit  *	scanning
13097443dcd1SAloka Dixit  * @tmpl_len: Template length
13107443dcd1SAloka Dixit  * @tmpl: Template data for probe response
13117443dcd1SAloka Dixit  */
13127443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
13137443dcd1SAloka Dixit 	u32 interval;
13147443dcd1SAloka Dixit 	size_t tmpl_len;
13157443dcd1SAloka Dixit 	const u8 *tmpl;
13167443dcd1SAloka Dixit };
13177443dcd1SAloka Dixit 
13187443dcd1SAloka Dixit /**
13198860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
13208860020eSJohannes Berg  *
13218860020eSJohannes Berg  * Used to configure an AP interface.
13228860020eSJohannes Berg  *
1323683b6d3bSJohannes Berg  * @chandef: defines the channel to use
13248860020eSJohannes Berg  * @beacon: beacon data
13258860020eSJohannes Berg  * @beacon_interval: beacon interval
13268860020eSJohannes Berg  * @dtim_period: DTIM period
13278860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
13288860020eSJohannes Berg  *	user space)
13298860020eSJohannes Berg  * @ssid_len: length of @ssid
13308860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
13318860020eSJohannes Berg  * @crypto: crypto settings
13328860020eSJohannes Berg  * @privacy: the BSS uses privacy
13338860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
133418998c38SEliad Peller  * @smps_mode: SMPS mode
13351b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
133653cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
133753cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
133877765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
133977765eafSVasanthakumar Thiagarajan  *	MAC address based access control
134034d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
134134d50519SLior David  *	networks.
13428564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
134366cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
134466cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1345244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
13468bc65d38SAloka Dixit  * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)
13478bc65d38SAloka Dixit  * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
134866cd794eSJohannes Berg  * @ht_required: stations must support HT
134966cd794eSJohannes Berg  * @vht_required: stations must support VHT
1350a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
13512a392596SIlan Peer  * @he_required: stations must support HE
1352d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
1353fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1354796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
13557e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1356291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
13577443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1358dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
1359d7c1a9a0SAloka Dixit  * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
1360d7c1a9a0SAloka Dixit  *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
1361d7c1a9a0SAloka Dixit  *	Bit set to 1 indicates that the channel is punctured.
13628860020eSJohannes Berg  */
13638860020eSJohannes Berg struct cfg80211_ap_settings {
1364683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1365aa430da4SJohannes Berg 
13668860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
13678860020eSJohannes Berg 
13688860020eSJohannes Berg 	int beacon_interval, dtim_period;
136932e9de84SJouni Malinen 	const u8 *ssid;
137032e9de84SJouni Malinen 	size_t ssid_len;
137132e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
13725fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
13735fb628e9SJouni Malinen 	bool privacy;
13745fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
137518998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
13761b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
137753cabad7SJohannes Berg 	u8 p2p_ctwindow;
137853cabad7SJohannes Berg 	bool p2p_opp_ps;
137977765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
138034d50519SLior David 	bool pbss;
1381a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
138266cd794eSJohannes Berg 
138366cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
138466cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1385244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
13867e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
13878bc65d38SAloka Dixit 	const struct ieee80211_eht_cap_elem *eht_cap;
13888bc65d38SAloka Dixit 	const struct ieee80211_eht_operation *eht_oper;
1389d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1390a0de1ca3SJohn Crispin 	bool twt_responder;
1391fe494370SSrinivas Dasari 	u32 flags;
1392796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
1393291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
13947443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1395dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1396d7c1a9a0SAloka Dixit 	u16 punct_bitmap;
1397ed1b6cc7SJohannes Berg };
1398ed1b6cc7SJohannes Berg 
13995727ef1bSJohannes Berg /**
140016ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
140116ef1fe2SSimon Wunderlich  *
140216ef1fe2SSimon Wunderlich  * Used for channel switch
140316ef1fe2SSimon Wunderlich  *
140416ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
140516ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
14069a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
14079a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
14089a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
14099a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
141016ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
141116ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
141216ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
141316ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
1414d7c1a9a0SAloka Dixit  * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
1415d7c1a9a0SAloka Dixit  *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
1416d7c1a9a0SAloka Dixit  *	Bit set to 1 indicates that the channel is punctured.
141716ef1fe2SSimon Wunderlich  */
141816ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
141916ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
142016ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
14219a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
14229a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
14239a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
14249a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
142516ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
142616ef1fe2SSimon Wunderlich 	bool radar_required;
142716ef1fe2SSimon Wunderlich 	bool block_tx;
142816ef1fe2SSimon Wunderlich 	u8 count;
1429d7c1a9a0SAloka Dixit 	u16 punct_bitmap;
143016ef1fe2SSimon Wunderlich };
143116ef1fe2SSimon Wunderlich 
143216ef1fe2SSimon Wunderlich /**
14330d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
14340d2ab3aeSJohn Crispin  *
14350d2ab3aeSJohn Crispin  * Used for bss color change
14360d2ab3aeSJohn Crispin  *
14370d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
14382d8b08feSMauro Carvalho Chehab  * @counter_offset_beacon: offsets of the counters within the beacon (tail)
14392d8b08feSMauro Carvalho Chehab  * @counter_offset_presp: offsets of the counters within the probe response
14400d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
14410d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
14420d2ab3aeSJohn Crispin  * @color: the color used after the change
14430d2ab3aeSJohn Crispin  */
14440d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
14450d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
14460d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
14470d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
14480d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
14490d2ab3aeSJohn Crispin 	u8 count;
14500d2ab3aeSJohn Crispin 	u8 color;
14510d2ab3aeSJohn Crispin };
14520d2ab3aeSJohn Crispin 
14530d2ab3aeSJohn Crispin /**
1454e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1455e227300cSPurushottam Kushwaha  *
1456e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1457e227300cSPurushottam Kushwaha  *
1458e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1459e227300cSPurushottam Kushwaha  *	to use for verification
1460e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1461e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1462e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1463e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1464e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1465e227300cSPurushottam Kushwaha  *	nl80211_iftype.
14664c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
14674c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
14684c8dea63SJohannes Berg  *	the verification
1469e227300cSPurushottam Kushwaha  */
1470e227300cSPurushottam Kushwaha struct iface_combination_params {
1471e227300cSPurushottam Kushwaha 	int num_different_channels;
1472e227300cSPurushottam Kushwaha 	u8 radar_detect;
1473e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
14744c8dea63SJohannes Berg 	u32 new_beacon_int;
1475e227300cSPurushottam Kushwaha };
1476e227300cSPurushottam Kushwaha 
1477e227300cSPurushottam Kushwaha /**
14783b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
14793b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
14809d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1481f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
14822d8b08feSMauro Carvalho Chehab  * @STATION_PARAM_APPLY_STA_TXPOWER: apply tx power for STA
14833b9ce80cSJohannes Berg  *
14843b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
14853b9ce80cSJohannes Berg  * for those that don't these flags will are used.
14863b9ce80cSJohannes Berg  */
14873b9ce80cSJohannes Berg enum station_parameters_apply_mask {
14883b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
14899d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1490f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1491e96d1cd2SAshok Raj Nagarajan };
1492e96d1cd2SAshok Raj Nagarajan 
1493e96d1cd2SAshok Raj Nagarajan /**
1494e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1495e96d1cd2SAshok Raj Nagarajan  *
1496e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1497e96d1cd2SAshok Raj Nagarajan  *
1498e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1499e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1500e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1501e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1502e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1503e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1504e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1505e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1506e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1507e96d1cd2SAshok Raj Nagarajan  */
1508e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1509e96d1cd2SAshok Raj Nagarajan 	s16 power;
1510e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
15113b9ce80cSJohannes Berg };
15123b9ce80cSJohannes Berg 
15133b9ce80cSJohannes Berg /**
1514577e5b8cSShaul Triebitz  * struct link_station_parameters - link station parameters
1515577e5b8cSShaul Triebitz  *
1516577e5b8cSShaul Triebitz  * Used to change and create a new link station.
1517577e5b8cSShaul Triebitz  *
1518577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1519577e5b8cSShaul Triebitz  * @link_id: the link id (-1 for non-MLD station)
1520577e5b8cSShaul Triebitz  * @link_mac: MAC address of the link
1521577e5b8cSShaul Triebitz  * @supported_rates: supported rates in IEEE 802.11 format
1522577e5b8cSShaul Triebitz  *	(or NULL for no change)
1523577e5b8cSShaul Triebitz  * @supported_rates_len: number of supported rates
1524577e5b8cSShaul Triebitz  * @ht_capa: HT capabilities of station
1525577e5b8cSShaul Triebitz  * @vht_capa: VHT capabilities of station
1526577e5b8cSShaul Triebitz  * @opmode_notif: operating mode field from Operating Mode Notification
1527577e5b8cSShaul Triebitz  * @opmode_notif_used: information if operating mode field is used
1528577e5b8cSShaul Triebitz  * @he_capa: HE capabilities of station
1529577e5b8cSShaul Triebitz  * @he_capa_len: the length of the HE capabilities
1530577e5b8cSShaul Triebitz  * @txpwr: transmit power for an associated station
1531577e5b8cSShaul Triebitz  * @txpwr_set: txpwr field is set
1532577e5b8cSShaul Triebitz  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1533577e5b8cSShaul Triebitz  * @eht_capa: EHT capabilities of station
1534577e5b8cSShaul Triebitz  * @eht_capa_len: the length of the EHT capabilities
1535577e5b8cSShaul Triebitz  */
1536577e5b8cSShaul Triebitz struct link_station_parameters {
1537577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1538577e5b8cSShaul Triebitz 	int link_id;
1539577e5b8cSShaul Triebitz 	const u8 *link_mac;
1540577e5b8cSShaul Triebitz 	const u8 *supported_rates;
1541577e5b8cSShaul Triebitz 	u8 supported_rates_len;
1542577e5b8cSShaul Triebitz 	const struct ieee80211_ht_cap *ht_capa;
1543577e5b8cSShaul Triebitz 	const struct ieee80211_vht_cap *vht_capa;
1544577e5b8cSShaul Triebitz 	u8 opmode_notif;
1545577e5b8cSShaul Triebitz 	bool opmode_notif_used;
1546577e5b8cSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_capa;
1547577e5b8cSShaul Triebitz 	u8 he_capa_len;
1548577e5b8cSShaul Triebitz 	struct sta_txpwr txpwr;
1549577e5b8cSShaul Triebitz 	bool txpwr_set;
1550577e5b8cSShaul Triebitz 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1551577e5b8cSShaul Triebitz 	const struct ieee80211_eht_cap_elem *eht_capa;
1552577e5b8cSShaul Triebitz 	u8 eht_capa_len;
1553577e5b8cSShaul Triebitz };
1554577e5b8cSShaul Triebitz 
1555577e5b8cSShaul Triebitz /**
1556577e5b8cSShaul Triebitz  * struct link_station_del_parameters - link station deletion parameters
1557577e5b8cSShaul Triebitz  *
1558577e5b8cSShaul Triebitz  * Used to delete a link station entry (or all stations).
1559577e5b8cSShaul Triebitz  *
1560577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1561577e5b8cSShaul Triebitz  * @link_id: the link id
1562577e5b8cSShaul Triebitz  */
1563577e5b8cSShaul Triebitz struct link_station_del_parameters {
1564577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1565577e5b8cSShaul Triebitz 	u32 link_id;
1566577e5b8cSShaul Triebitz };
1567577e5b8cSShaul Triebitz 
1568577e5b8cSShaul Triebitz /**
15695727ef1bSJohannes Berg  * struct station_parameters - station parameters
15705727ef1bSJohannes Berg  *
15715727ef1bSJohannes Berg  * Used to change and create a new station.
15725727ef1bSJohannes Berg  *
15735727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
1574eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1575819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1576eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1577819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
15785727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
15795727ef1bSJohannes Berg  * @aid: AID or zero for no change
158014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
15817d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1582abe37c4bSJohannes Berg  * @plink_action: plink action to take
15839c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1584910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1585910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1586910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1587910868dbSEliad Peller  *	QoS info field (but already shifted down)
1588c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1589c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1590c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
15913b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
15923b1c5a53SMarco Porsch  *	to unknown)
15939d62a986SJouni Malinen  * @capability: station capability
15949d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
15959d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1596c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1597c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1598c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1599c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
160017b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
160136647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1602b95eb7f0SShaul Triebitz  * @link_sta_params: link related params.
16035727ef1bSJohannes Berg  */
16045727ef1bSJohannes Berg struct station_parameters {
16055727ef1bSJohannes Berg 	struct net_device *vlan;
1606eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
16073b9ce80cSJohannes Berg 	u32 sta_modify_mask;
16085727ef1bSJohannes Berg 	int listen_interval;
16095727ef1bSJohannes Berg 	u16 aid;
161014f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
16117d27a0baSMasashi Honma 	u16 peer_aid;
16122ec600d6SLuis Carlos Cobo 	u8 plink_action;
16139c3990aaSJavier Cardona 	u8 plink_state;
1614c75786c9SEliad Peller 	u8 uapsd_queues;
1615c75786c9SEliad Peller 	u8 max_sp;
16163b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
16179d62a986SJouni Malinen 	u16 capability;
16182c1aabf3SJohannes Berg 	const u8 *ext_capab;
16199d62a986SJouni Malinen 	u8 ext_capab_len;
1620c01fc9adSSunil Dutt 	const u8 *supported_channels;
1621c01fc9adSSunil Dutt 	u8 supported_channels_len;
1622c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1623c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
162417b94247SAyala Beker 	int support_p2p_ps;
162536647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1626b95eb7f0SShaul Triebitz 	struct link_station_parameters link_sta_params;
16275727ef1bSJohannes Berg };
16285727ef1bSJohannes Berg 
1629fd5b74dcSJohannes Berg /**
163089c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
163189c771e5SJouni Malinen  *
163289c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
163389c771e5SJouni Malinen  *
163489c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
163598856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
163698856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
163798856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
163889c771e5SJouni Malinen  */
163989c771e5SJouni Malinen struct station_del_parameters {
164089c771e5SJouni Malinen 	const u8 *mac;
164198856866SJouni Malinen 	u8 subtype;
164298856866SJouni Malinen 	u16 reason_code;
164389c771e5SJouni Malinen };
164489c771e5SJouni Malinen 
164589c771e5SJouni Malinen /**
164677ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
164777ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
164847edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
164947edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
165077ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
165177ee7c89SJohannes Berg  *	the AP MLME in the device
165277ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
165377ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
165477ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
165577ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
165677ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
165777ee7c89SJohannes Berg  *	supported/used)
165877ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
165977ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1660eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1661eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
166277ee7c89SJohannes Berg  */
166377ee7c89SJohannes Berg enum cfg80211_station_type {
166477ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
166547edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
166677ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
166777ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
166877ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
166977ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
167077ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1671eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1672eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
167377ee7c89SJohannes Berg };
167477ee7c89SJohannes Berg 
167577ee7c89SJohannes Berg /**
167677ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
167777ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
167877ee7c89SJohannes Berg  * @params: the new parameters for a station
167977ee7c89SJohannes Berg  * @statype: the type of station being modified
168077ee7c89SJohannes Berg  *
168177ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
168277ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
168377ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
168477ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
168577ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
168677ee7c89SJohannes Berg  */
168777ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
168877ee7c89SJohannes Berg 				  struct station_parameters *params,
168977ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
169077ee7c89SJohannes Berg 
169177ee7c89SJohannes Berg /**
1692b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1693420e7fabSHenning Rogge  *
1694420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1695420e7fabSHenning Rogge  * type for 802.11n transmissions.
1696420e7fabSHenning Rogge  *
1697db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1698db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1699420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
17002a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1701c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
17022a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1703d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1704cfb14110SVeerendranath Jakkam  * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
17052ad66fcbSGilad Itzkovitch  * @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS
1706420e7fabSHenning Rogge  */
1707420e7fabSHenning Rogge enum rate_info_flags {
1708db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1709db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1710b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
17112a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1712c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
17132a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1714d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1715cfb14110SVeerendranath Jakkam 	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
17162ad66fcbSGilad Itzkovitch 	RATE_INFO_FLAGS_S1G_MCS			= BIT(8),
1717b51f3beeSJohannes Berg };
1718b51f3beeSJohannes Berg 
1719b51f3beeSJohannes Berg /**
1720b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1721b51f3beeSJohannes Berg  *
1722b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1723b51f3beeSJohannes Berg  *
1724b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1725b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1726b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1727b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1728b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1729b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1730c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1731cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_320: 320 MHz bandwidth
1732cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
17332ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_1: 1 MHz bandwidth
17342ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_2: 2 MHz bandwidth
17352ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_4: 4 MHz bandwidth
17362ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_8: 8 MHz bandwidth
17372ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_16: 16 MHz bandwidth
1738b51f3beeSJohannes Berg  */
1739b51f3beeSJohannes Berg enum rate_info_bw {
1740842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1741b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1742b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1743b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1744b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1745b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1746c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1747cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_320,
1748cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_EHT_RU,
17492ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_1,
17502ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_2,
17512ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_4,
17522ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_8,
17532ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_16,
1754420e7fabSHenning Rogge };
1755420e7fabSHenning Rogge 
1756420e7fabSHenning Rogge /**
1757420e7fabSHenning Rogge  * struct rate_info - bitrate information
1758420e7fabSHenning Rogge  *
1759420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1760420e7fabSHenning Rogge  *
1761420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1762420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
17632ad66fcbSGilad Itzkovitch  * @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate
1764c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1765b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1766c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1767c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1768c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1769c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
17702a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1771cfb14110SVeerendranath Jakkam  * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
1772cfb14110SVeerendranath Jakkam  * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
1773cfb14110SVeerendranath Jakkam  *	only valid if bw is %RATE_INFO_BW_EHT_RU)
1774420e7fabSHenning Rogge  */
1775420e7fabSHenning Rogge struct rate_info {
17762ad66fcbSGilad Itzkovitch 	u16 flags;
1777420e7fabSHenning Rogge 	u16 legacy;
17782ad66fcbSGilad Itzkovitch 	u8 mcs;
1779db9c64cfSJohannes Berg 	u8 nss;
1780b51f3beeSJohannes Berg 	u8 bw;
1781c4cbaf79SLuca Coelho 	u8 he_gi;
1782c4cbaf79SLuca Coelho 	u8 he_dcm;
1783c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
17842a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1785cfb14110SVeerendranath Jakkam 	u8 eht_gi;
1786cfb14110SVeerendranath Jakkam 	u8 eht_ru_alloc;
1787fd5b74dcSJohannes Berg };
1788fd5b74dcSJohannes Berg 
1789fd5b74dcSJohannes Berg /**
1790b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1791f4263c98SPaul Stewart  *
1792f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1793f4263c98SPaul Stewart  * type for 802.11n transmissions.
1794f4263c98SPaul Stewart  *
1795f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1796f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1797f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1798f4263c98SPaul Stewart  */
1799f4263c98SPaul Stewart enum bss_param_flags {
1800f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1801f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1802f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1803f4263c98SPaul Stewart };
1804f4263c98SPaul Stewart 
1805f4263c98SPaul Stewart /**
1806f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1807f4263c98SPaul Stewart  *
1808f4263c98SPaul Stewart  * Information about the currently associated BSS
1809f4263c98SPaul Stewart  *
1810f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1811f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1812f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1813f4263c98SPaul Stewart  */
1814f4263c98SPaul Stewart struct sta_bss_parameters {
1815f4263c98SPaul Stewart 	u8 flags;
1816f4263c98SPaul Stewart 	u8 dtim_period;
1817f4263c98SPaul Stewart 	u16 beacon_interval;
1818f4263c98SPaul Stewart };
1819f4263c98SPaul Stewart 
18206de39808SJohannes Berg /**
182152539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
182252539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
182352539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
182452539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
182552539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
182652539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
182752539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
182852539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
182952539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
183052539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
183152539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
183252539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
183352539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
183452539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
183552539ca8SToke Høiland-Jørgensen  */
183652539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
183752539ca8SToke Høiland-Jørgensen 	u32 filled;
183852539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
183952539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
184052539ca8SToke Høiland-Jørgensen 	u32 flows;
184152539ca8SToke Høiland-Jørgensen 	u32 drops;
184252539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
184352539ca8SToke Høiland-Jørgensen 	u32 overlimit;
184452539ca8SToke Høiland-Jørgensen 	u32 overmemory;
184552539ca8SToke Høiland-Jørgensen 	u32 collisions;
184652539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
184752539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
184852539ca8SToke Høiland-Jørgensen 	u32 max_flows;
184952539ca8SToke Høiland-Jørgensen };
185052539ca8SToke Høiland-Jørgensen 
185152539ca8SToke Høiland-Jørgensen /**
18526de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
18536de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
18546de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
18556de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
18566de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
18576de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
18586de39808SJohannes Berg  *	transmitted MSDUs
18596de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
186052539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
18616de39808SJohannes Berg  */
18626de39808SJohannes Berg struct cfg80211_tid_stats {
18636de39808SJohannes Berg 	u32 filled;
18646de39808SJohannes Berg 	u64 rx_msdu;
18656de39808SJohannes Berg 	u64 tx_msdu;
18666de39808SJohannes Berg 	u64 tx_msdu_retries;
18676de39808SJohannes Berg 	u64 tx_msdu_failed;
186852539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
18696de39808SJohannes Berg };
18706de39808SJohannes Berg 
1871119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1872119363c7SFelix Fietkau 
1873f4263c98SPaul Stewart /**
18742ec600d6SLuis Carlos Cobo  * struct station_info - station information
1875fd5b74dcSJohannes Berg  *
18762ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1877fd5b74dcSJohannes Berg  *
1878319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1879319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1880ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1881fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
18826c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
18838d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
18848d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
18852ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
18862ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
18872ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
188873c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
188973c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
189073c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
189173c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1892119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1893119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1894119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1895858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1896858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
18978d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
18988d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
18998d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
19008d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
19015a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
19021ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1903f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1904f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1905f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1906f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
190750d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
190850d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
190950d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
191050d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
191150d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1912c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1913a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1914d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
19153b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
19163b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
19173b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1918867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1919867d849fSAntonio Quartulli  *	towards this station.
1920a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1921a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1922a76b1942SJohannes Berg  *	from this peer
1923dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1924739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
192536647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
192636647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
19276de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
19286de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
19298689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1930c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
193181d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
193281d5439dSBalaji Pothunoori  *	been sent.
19330d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
19340d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
19350d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
19360d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1937ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
19381303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
1939a42e59ebSVeerendranath Jakkam  * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled
1940a42e59ebSVeerendranath Jakkam  *	by driver. Drivers use this only in cfg80211_new_sta() calls when AP
1941a42e59ebSVeerendranath Jakkam  *	MLD's MLME/SME is offload to driver. Drivers won't fill this
1942a42e59ebSVeerendranath Jakkam  *	information in cfg80211_del_sta_sinfo(), get_station() and
1943a42e59ebSVeerendranath Jakkam  *	dump_station() callbacks.
1944a42e59ebSVeerendranath Jakkam  * @assoc_link_id: Indicates MLO link ID of the AP, with which the station
1945a42e59ebSVeerendranath Jakkam  *	completed (re)association. This information filled for both MLO
1946a42e59ebSVeerendranath Jakkam  *	and non-MLO STA connections when the AP affiliated with an MLD.
1947a42e59ebSVeerendranath Jakkam  * @mld_addr: For MLO STA connection, filled with MLD address of the station.
1948a42e59ebSVeerendranath Jakkam  *	For non-MLO STA connection, filled with all zeros.
1949a42e59ebSVeerendranath Jakkam  * @assoc_resp_ies: IEs from (Re)Association Response.
1950a42e59ebSVeerendranath Jakkam  *	This is used only when in AP mode with drivers that do not use user
1951a42e59ebSVeerendranath Jakkam  *	space MLME/SME implementation. The information is provided only for the
1952a42e59ebSVeerendranath Jakkam  *	cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't
1953a42e59ebSVeerendranath Jakkam  *	fill this information in cfg80211_del_sta_sinfo(), get_station() and
1954a42e59ebSVeerendranath Jakkam  *	dump_station() callbacks. User space needs this information to determine
1955a42e59ebSVeerendranath Jakkam  *	the accepted and rejected affiliated links of the connected station.
1956a42e59ebSVeerendranath Jakkam  * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.
1957fd5b74dcSJohannes Berg  */
19582ec600d6SLuis Carlos Cobo struct station_info {
1959739960f1SMohammed Shafi Shajakhan 	u64 filled;
1960ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1961fd5b74dcSJohannes Berg 	u32 inactive_time;
19626c7a0033SBen Greear 	u64 assoc_at;
196342745e03SVladimir Kondratiev 	u64 rx_bytes;
196442745e03SVladimir Kondratiev 	u64 tx_bytes;
19652ec600d6SLuis Carlos Cobo 	u16 llid;
19662ec600d6SLuis Carlos Cobo 	u16 plid;
19672ec600d6SLuis Carlos Cobo 	u8 plink_state;
1968420e7fabSHenning Rogge 	s8 signal;
1969541a45a1SBruno Randolf 	s8 signal_avg;
1970119363c7SFelix Fietkau 
1971119363c7SFelix Fietkau 	u8 chains;
1972119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1973119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1974119363c7SFelix Fietkau 
1975420e7fabSHenning Rogge 	struct rate_info txrate;
1976c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
197798c8a60aSJouni Malinen 	u32 rx_packets;
197898c8a60aSJouni Malinen 	u32 tx_packets;
1979b206b4efSBruno Randolf 	u32 tx_retries;
1980b206b4efSBruno Randolf 	u32 tx_failed;
19815a5c731aSBen Greear 	u32 rx_dropped_misc;
1982f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1983bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1984f5ea9120SJohannes Berg 
1985f5ea9120SJohannes Berg 	int generation;
198650d3dfb7SJouni Malinen 
198750d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
198850d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1989f612cedfSJouni Malinen 
1990a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1991d299a1f2SJavier Cardona 	s64 t_offset;
19923b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
19933b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
19943b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1995a85e1d55SPaul Stewart 
1996867d849fSAntonio Quartulli 	u32 expected_throughput;
1997a76b1942SJohannes Berg 
199836647055SToke Høiland-Jørgensen 	u64 tx_duration;
1999739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
200036647055SToke Høiland-Jørgensen 	u64 rx_beacon;
2001a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
2002dbdaee7aSBob Copeland 	u8 connected_to_gate;
2003dbdaee7aSBob Copeland 
20048689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
2005c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
200681d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
20070d4e14a3SAnkita Bajaj 
200836647055SToke Høiland-Jørgensen 	u16 airtime_weight;
200936647055SToke Høiland-Jørgensen 
20100d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
20110d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
2012ab60633cSNarayanraddi Masti 
2013ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
20141303a51cSMarkus Theil 
20151303a51cSMarkus Theil 	u8 connected_to_as;
2016a42e59ebSVeerendranath Jakkam 
2017a42e59ebSVeerendranath Jakkam 	bool mlo_params_valid;
2018a42e59ebSVeerendranath Jakkam 	u8 assoc_link_id;
2019a42e59ebSVeerendranath Jakkam 	u8 mld_addr[ETH_ALEN] __aligned(2);
2020a42e59ebSVeerendranath Jakkam 	const u8 *assoc_resp_ies;
2021a42e59ebSVeerendranath Jakkam 	size_t assoc_resp_ies_len;
2022fd5b74dcSJohannes Berg };
2023fd5b74dcSJohannes Berg 
20246bdb68ceSCarl Huang /**
20256bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
20266bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
20276bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
20286bdb68ceSCarl Huang  */
20296bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
20306bdb68ceSCarl Huang 	s32 power;
20316bdb68ceSCarl Huang 	u32 freq_range_index;
20326bdb68ceSCarl Huang };
20336bdb68ceSCarl Huang 
20346bdb68ceSCarl Huang /**
20356bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
20366bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
20376bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
20386bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
20396bdb68ceSCarl Huang  */
20406bdb68ceSCarl Huang struct cfg80211_sar_specs {
20416bdb68ceSCarl Huang 	enum nl80211_sar_type type;
20426bdb68ceSCarl Huang 	u32 num_sub_specs;
20436bdb68ceSCarl Huang 	struct cfg80211_sar_sub_specs sub_specs[];
20446bdb68ceSCarl Huang };
20456bdb68ceSCarl Huang 
20466bdb68ceSCarl Huang 
20476bdb68ceSCarl Huang /**
2048c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
20496bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
20506bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
20516bdb68ceSCarl Huang  */
20526bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
20536bdb68ceSCarl Huang 	u32 start_freq;
20546bdb68ceSCarl Huang 	u32 end_freq;
20556bdb68ceSCarl Huang };
20566bdb68ceSCarl Huang 
20576bdb68ceSCarl Huang /**
20586bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
20596bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
20606bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
20616bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
20626bdb68ceSCarl Huang  *
20636bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
20646bdb68ceSCarl Huang  * range to small ones and then append them.
20656bdb68ceSCarl Huang  */
20666bdb68ceSCarl Huang struct cfg80211_sar_capa {
20676bdb68ceSCarl Huang 	enum nl80211_sar_type type;
20686bdb68ceSCarl Huang 	u32 num_freq_ranges;
20696bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
20706bdb68ceSCarl Huang };
20716bdb68ceSCarl Huang 
207261aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
207366f7ac50SMichael Wu /**
20747406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
20757406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
20767406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
20777406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
20787406353dSAntonio Quartulli  *
20797406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
20807406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
20817406353dSAntonio Quartulli  * considered undefined.
20827406353dSAntonio Quartulli  */
20837406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
20847406353dSAntonio Quartulli 			 struct station_info *sinfo);
208561aaa0e8SLinus Lüssing #else
208661aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
208761aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
208861aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
208961aaa0e8SLinus Lüssing {
209061aaa0e8SLinus Lüssing 	return -ENOENT;
209161aaa0e8SLinus Lüssing }
209261aaa0e8SLinus Lüssing #endif
20937406353dSAntonio Quartulli 
20947406353dSAntonio Quartulli /**
209566f7ac50SMichael Wu  * enum monitor_flags - monitor flags
209666f7ac50SMichael Wu  *
209766f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
209866f7ac50SMichael Wu  * according to the nl80211 flags.
209966f7ac50SMichael Wu  *
2100818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
210166f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
210266f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
210366f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
210466f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
210566f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
2106e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
210766f7ac50SMichael Wu  */
210866f7ac50SMichael Wu enum monitor_flags {
2109818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
211066f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
211166f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
211266f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
211366f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
211466f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
2115e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
211666f7ac50SMichael Wu };
211766f7ac50SMichael Wu 
21182ec600d6SLuis Carlos Cobo /**
21192ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
21202ec600d6SLuis Carlos Cobo  *
21212ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
21222ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
21232ec600d6SLuis Carlos Cobo  *
2124abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
2125abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
2126abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
2127abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
2128abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
2129abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
2130abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
2131cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
21329874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
21332ec600d6SLuis Carlos Cobo  */
21342ec600d6SLuis Carlos Cobo enum mpath_info_flags {
21352ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2136d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
21372ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
21382ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
21392ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
21402ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
21412ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
2142540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
2143540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
21442ec600d6SLuis Carlos Cobo };
21452ec600d6SLuis Carlos Cobo 
21462ec600d6SLuis Carlos Cobo /**
21472ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
21482ec600d6SLuis Carlos Cobo  *
21492ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
21502ec600d6SLuis Carlos Cobo  *
21512ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
21522ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
2153d19b3bf6SRui Paulo  * @sn: target sequence number
21542ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
21552ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
21562ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
21572ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
21582ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
2159f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2160f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
2161f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2162f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
2163cc241636SJulan Hsu  * @hop_count: hops to destination
2164540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
21652ec600d6SLuis Carlos Cobo  */
21662ec600d6SLuis Carlos Cobo struct mpath_info {
21672ec600d6SLuis Carlos Cobo 	u32 filled;
21682ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
2169d19b3bf6SRui Paulo 	u32 sn;
21702ec600d6SLuis Carlos Cobo 	u32 metric;
21712ec600d6SLuis Carlos Cobo 	u32 exptime;
21722ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
21732ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
21742ec600d6SLuis Carlos Cobo 	u8 flags;
2175cc241636SJulan Hsu 	u8 hop_count;
2176540bbcb9SJulan Hsu 	u32 path_change_count;
2177f5ea9120SJohannes Berg 
2178f5ea9120SJohannes Berg 	int generation;
21792ec600d6SLuis Carlos Cobo };
21802ec600d6SLuis Carlos Cobo 
21819f1ba906SJouni Malinen /**
21829f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
21839f1ba906SJouni Malinen  *
21849f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
21859f1ba906SJouni Malinen  *
21861e0f8cc9SJohannes Berg  * @link_id: link_id or -1 for non-MLD
21879f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
21889f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
21899f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
21909f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
21919f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
21929f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
219390c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
219490c97a04SJouni Malinen  *	(or NULL for no change)
219590c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
2196fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
21979d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
219850b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
219950b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
220053cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
220153cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
22029f1ba906SJouni Malinen  */
22039f1ba906SJouni Malinen struct bss_parameters {
22041e0f8cc9SJohannes Berg 	int link_id;
22059f1ba906SJouni Malinen 	int use_cts_prot;
22069f1ba906SJouni Malinen 	int use_short_preamble;
22079f1ba906SJouni Malinen 	int use_short_slot_time;
2208c1e5f471SJohannes Berg 	const u8 *basic_rates;
220990c97a04SJouni Malinen 	u8 basic_rates_len;
2210fd8aaaf3SFelix Fietkau 	int ap_isolate;
221150b12f59SHelmut Schaa 	int ht_opmode;
221253cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
22139f1ba906SJouni Malinen };
22142ec600d6SLuis Carlos Cobo 
22153ddd53f3SChun-Yeow Yeoh /**
221629cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
221729cbe68cSJohannes Berg  *
221829cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
22193ddd53f3SChun-Yeow Yeoh  *
22203ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
22213ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
22223ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
22233ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
22243ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
22253ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
22263ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
22273ddd53f3SChun-Yeow Yeoh  *	mesh interface
22283ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
22293ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
22303ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
22313ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
22323ddd53f3SChun-Yeow Yeoh  *	elements
22333ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
22343ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
22353ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
22363ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
22373ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
22383ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
22393ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
22403ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
22413ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
22423ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
22433ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
22443ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
22453ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
22463ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
22473ddd53f3SChun-Yeow Yeoh  *	element
22483ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
22493ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
22503ddd53f3SChun-Yeow Yeoh  *	element
22513ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
22523ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
22533ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
22543ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
22553ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
22563ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
22573ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
22583ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
22593ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
22603ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
22613ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
22623ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
22633ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
22643ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
22653ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
22663ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2267ac1073a6SChun-Yeow Yeoh  *
2268ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2269ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2270ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2271ac1073a6SChun-Yeow Yeoh  *
2272ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2273ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2274728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2275728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2276728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
22773b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
22783b1c5a53SMarco Porsch  *	setting for new peer links.
22793b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
22803b1c5a53SMarco Porsch  *	after transmitting its beacon.
22818e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
22828e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
22838e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
22842d8b08feSMauro Carvalho Chehab  * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA
22852d8b08feSMauro Carvalho Chehab  *	will advertise that it is connected to a authentication server
22862d8b08feSMauro Carvalho Chehab  *	in the mesh formation field.
228701d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
228801d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
228901d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
229001d66fbdSBob Copeland  *      in the mesh path table
2291e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2292e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2293e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2294e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2295e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
229629cbe68cSJohannes Berg  */
229793da9cc1Scolin@cozybit.com struct mesh_config {
229893da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
229993da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
230093da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
230193da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
230293da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
230393da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
230445904f21SJavier Cardona 	u8 element_ttl;
230593da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2306d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
230793da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
230893da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
230993da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
231093da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
231193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2312dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
231393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
231463c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
231501d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2316184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
23170507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
231816dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
231994f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
232055335137SAshok Nagarajan 	s32 rssi_threshold;
232170c33eaaSAshok Nagarajan 	u16 ht_opmode;
2322ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2323ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2324728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
23253b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
23263b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
23278e7c0538SColleen Twitty 	u32 plink_timeout;
2328e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
232993da9cc1Scolin@cozybit.com };
233093da9cc1Scolin@cozybit.com 
233131888487SJouni Malinen /**
233229cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2333683b6d3bSJohannes Berg  * @chandef: defines the channel to use
233429cbe68cSJohannes Berg  * @mesh_id: the mesh ID
233529cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2336d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2337c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2338c80d545dSJavier Cardona  * @path_metric: which metric to use
23396e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2340581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2341581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2342b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2343b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2344bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
23459bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
23469bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
23474bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2348ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
23498564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2350d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2351d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2352d37d49c2SBenjamin Berg  *	to operate on DFS channels.
23531224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
23541224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
235529cbe68cSJohannes Berg  *
235629cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
235729cbe68cSJohannes Berg  */
235829cbe68cSJohannes Berg struct mesh_setup {
2359683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
236029cbe68cSJohannes Berg 	const u8 *mesh_id;
236129cbe68cSJohannes Berg 	u8 mesh_id_len;
2362d299a1f2SJavier Cardona 	u8 sync_method;
2363c80d545dSJavier Cardona 	u8 path_sel_proto;
2364c80d545dSJavier Cardona 	u8 path_metric;
23656e16d90bSColleen Twitty 	u8 auth_id;
2366581a8b0fSJavier Cardona 	const u8 *ie;
2367581a8b0fSJavier Cardona 	u8 ie_len;
2368b130e5ceSJavier Cardona 	bool is_authenticated;
236915d5dda6SJavier Cardona 	bool is_secure;
2370bb2798d4SThomas Pedersen 	bool user_mpm;
23719bdbf04dSMarco Porsch 	u8 dtim_period;
23729bdbf04dSMarco Porsch 	u16 beacon_interval;
237357fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2374ffb3cf30SAshok Nagarajan 	u32 basic_rates;
23758564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2376d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
23771224f583SDenis Kenzior 	bool control_port_over_nl80211;
237829cbe68cSJohannes Berg };
237929cbe68cSJohannes Berg 
238029cbe68cSJohannes Berg /**
23816e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
23826e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
23836e0bd6c3SRostislav Lisovy  *
23846e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
23856e0bd6c3SRostislav Lisovy  */
23866e0bd6c3SRostislav Lisovy struct ocb_setup {
23876e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
23886e0bd6c3SRostislav Lisovy };
23896e0bd6c3SRostislav Lisovy 
23906e0bd6c3SRostislav Lisovy /**
239131888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2392a3304b0aSJohannes Berg  * @ac: AC identifier
239331888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
239431888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
239531888487SJouni Malinen  *	1..32767]
239631888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
239731888487SJouni Malinen  *	1..32767]
239831888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
23999d2bb84dSShaul Triebitz  * @link_id: link_id or -1 for non-MLD
240031888487SJouni Malinen  */
240131888487SJouni Malinen struct ieee80211_txq_params {
2402a3304b0aSJohannes Berg 	enum nl80211_ac ac;
240331888487SJouni Malinen 	u16 txop;
240431888487SJouni Malinen 	u16 cwmin;
240531888487SJouni Malinen 	u16 cwmax;
240631888487SJouni Malinen 	u8 aifs;
24079d2bb84dSShaul Triebitz 	int link_id;
240831888487SJouni Malinen };
240931888487SJouni Malinen 
2410d70e9693SJohannes Berg /**
2411d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2412d70e9693SJohannes Berg  *
2413d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2414d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2415d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2416d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2417d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2418d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2419d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2420d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2421d70e9693SJohannes Berg  * in the wiphy structure.
2422d70e9693SJohannes Berg  *
2423d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2424d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2425d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2426d70e9693SJohannes Berg  *
2427d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2428d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2429d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2430d70e9693SJohannes Berg  * to userspace.
2431d70e9693SJohannes Berg  */
243272bdcf34SJouni Malinen 
2433704232c2SJohannes Berg /**
24342a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
24352a519311SJohannes Berg  * @ssid: the SSID
24362a519311SJohannes Berg  * @ssid_len: length of the ssid
24372a519311SJohannes Berg  */
24382a519311SJohannes Berg struct cfg80211_ssid {
24392a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
24402a519311SJohannes Berg 	u8 ssid_len;
24412a519311SJohannes Berg };
24422a519311SJohannes Berg 
24432a519311SJohannes Berg /**
24441d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
24451d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
24461d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
24471d76250bSAvraham Stern  *	information is not available, this field is left zero.
24481d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
24491d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
24501d76250bSAvraham Stern  *	userspace will be notified of that
24511d76250bSAvraham Stern  */
24521d76250bSAvraham Stern struct cfg80211_scan_info {
24531d76250bSAvraham Stern 	u64 scan_start_tsf;
24541d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
24551d76250bSAvraham Stern 	bool aborted;
24561d76250bSAvraham Stern };
24571d76250bSAvraham Stern 
24581d76250bSAvraham Stern /**
2459c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2460c8cb5b85STova Mussai  *
24612d8b08feSMauro Carvalho Chehab  * @short_ssid: short ssid to scan for
2462c8cb5b85STova Mussai  * @bssid: bssid to scan for
2463c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
2464c8cb5b85STova Mussai  *	 which the above info relvant to
2465c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
24662d8b08feSMauro Carvalho Chehab  * @short_ssid_valid: @short_ssid is valid and can be used
2467c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2468c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
2469c8cb5b85STova Mussai  */
2470c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2471c8cb5b85STova Mussai 	u32 short_ssid;
2472c8cb5b85STova Mussai 	u32 channel_idx;
2473c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2474c8cb5b85STova Mussai 	bool unsolicited_probe;
2475c8cb5b85STova Mussai 	bool short_ssid_valid;
2476c8cb5b85STova Mussai 	bool psc_no_listen;
2477c8cb5b85STova Mussai };
2478c8cb5b85STova Mussai 
2479c8cb5b85STova Mussai /**
24802a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
24812a519311SJohannes Berg  *
24822a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
24832a519311SJohannes Berg  * @n_ssids: number of SSIDs
24842a519311SJohannes Berg  * @channels: channels to scan on.
2485ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
2486dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
248770692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
248870692ad2SJouni Malinen  * @ie_len: length of ie in octets
24891d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
24901d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
24911d76250bSAvraham Stern  *	the actual dwell time may be shorter.
24921d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
24931d76250bSAvraham Stern  *	%duration field.
2494ed473771SSam Leffler  * @flags: bit field of flags controlling operation
249534850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
24962a519311SJohannes Berg  * @wiphy: the wiphy this was for
249715d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2498fd014284SJohannes Berg  * @wdev: the wireless device to scan for
24991d76250bSAvraham Stern  * @info: (internal) information about completed scan
25005fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2501e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2502ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2503ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2504ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2505ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2506c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2507c8cb5b85STova Mussai  *	true if this is the second scan request
2508c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2509c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2510818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
25112a519311SJohannes Berg  */
25122a519311SJohannes Berg struct cfg80211_scan_request {
25132a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
25142a519311SJohannes Berg 	int n_ssids;
25152a519311SJohannes Berg 	u32 n_channels;
2516dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2517de95a54bSJohannes Berg 	const u8 *ie;
251870692ad2SJouni Malinen 	size_t ie_len;
25191d76250bSAvraham Stern 	u16 duration;
25201d76250bSAvraham Stern 	bool duration_mandatory;
2521ed473771SSam Leffler 	u32 flags;
25222a519311SJohannes Berg 
252357fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
252434850ab2SJohannes Berg 
2525fd014284SJohannes Berg 	struct wireless_dev *wdev;
2526fd014284SJohannes Berg 
2527ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2528ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2529818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2530ad2b26abSJohannes Berg 
25312a519311SJohannes Berg 	/* internal */
25322a519311SJohannes Berg 	struct wiphy *wiphy;
253315d6030bSSam Leffler 	unsigned long scan_start;
25341d76250bSAvraham Stern 	struct cfg80211_scan_info info;
25351d76250bSAvraham Stern 	bool notified;
2536e9f935e3SRajkumar Manoharan 	bool no_cck;
2537c8cb5b85STova Mussai 	bool scan_6ghz;
2538c8cb5b85STova Mussai 	u32 n_6ghz_params;
2539c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
25405ba63533SJohannes Berg 
25415ba63533SJohannes Berg 	/* keep last */
2542396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
25432a519311SJohannes Berg };
25442a519311SJohannes Berg 
2545ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2546ad2b26abSJohannes Berg {
2547ad2b26abSJohannes Berg 	int i;
2548ad2b26abSJohannes Berg 
2549ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2550ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2551ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2552ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2553ad2b26abSJohannes Berg 	}
2554ad2b26abSJohannes Berg }
2555ad2b26abSJohannes Berg 
25562a519311SJohannes Berg /**
2557a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2558a1f1c21cSLuciano Coelho  *
25593007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
25603007e352SArend Van Spriel  *	or no match (RSSI only)
25613007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
25623007e352SArend Van Spriel  *	or no match (RSSI only)
2563ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
25641e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
25651e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
25661e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
25671e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
25681e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
25691e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
25701e1b11b6Svamsi krishna  *	corresponding matchset.
2571a1f1c21cSLuciano Coelho  */
2572a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2573a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
25743007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2575ea73cbceSJohannes Berg 	s32 rssi_thold;
25761e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2577a1f1c21cSLuciano Coelho };
2578a1f1c21cSLuciano Coelho 
2579a1f1c21cSLuciano Coelho /**
25803b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
25813b06d277SAvraham Stern  *
25823b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
25833b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
25843b06d277SAvraham Stern  *	infinite loop.
25853b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
25863b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
25873b06d277SAvraham Stern  */
25883b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
25893b06d277SAvraham Stern 	u32 interval;
25903b06d277SAvraham Stern 	u32 iterations;
25913b06d277SAvraham Stern };
25923b06d277SAvraham Stern 
25933b06d277SAvraham Stern /**
2594bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2595bf95ecdbSvamsi krishna  *
2596bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2597bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2598bf95ecdbSvamsi krishna  */
2599bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2600bf95ecdbSvamsi krishna 	enum nl80211_band band;
2601bf95ecdbSvamsi krishna 	s8 delta;
2602bf95ecdbSvamsi krishna };
2603bf95ecdbSvamsi krishna 
2604bf95ecdbSvamsi krishna /**
2605807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2606807f8a8cSLuciano Coelho  *
260796b08fd6SArend Van Spriel  * @reqid: identifies this request.
2608807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2609807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2610807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2611dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2612807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2613807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2614ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2615a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2616a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2617a1f1c21cSLuciano Coelho  *	(others are filtered out).
2618a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2619a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
26206406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2621807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2622807f8a8cSLuciano Coelho  * @dev: the interface
2623077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2624807f8a8cSLuciano Coelho  * @channels: channels to scan
2625ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2626ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2627ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2628ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2629ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2630ad2b26abSJohannes Berg  *	be taken from the @mac_addr
26313b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
26323b06d277SAvraham Stern  *	index must be executed first.
26333b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
263431a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
263593a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
263693a1e86cSJukka Rissanen  *	owned by a particular socket)
2637ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2638ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
26399c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
26409c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
26419c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
26429c748934SLuciano Coelho  *	supported.
2643bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2644bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2645bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2646bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2647bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2648bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2649bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2650bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2651bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2652bf95ecdbSvamsi krishna  *	comparisions.
2653807f8a8cSLuciano Coelho  */
2654807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
265596b08fd6SArend Van Spriel 	u64 reqid;
2656807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2657807f8a8cSLuciano Coelho 	int n_ssids;
2658807f8a8cSLuciano Coelho 	u32 n_channels;
2659dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2660807f8a8cSLuciano Coelho 	const u8 *ie;
2661807f8a8cSLuciano Coelho 	size_t ie_len;
2662ed473771SSam Leffler 	u32 flags;
2663a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2664a1f1c21cSLuciano Coelho 	int n_match_sets;
2665ea73cbceSJohannes Berg 	s32 min_rssi_thold;
26669c748934SLuciano Coelho 	u32 delay;
26673b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
26683b06d277SAvraham Stern 	int n_scan_plans;
2669807f8a8cSLuciano Coelho 
2670ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2671ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2672ad2b26abSJohannes Berg 
2673bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2674bf95ecdbSvamsi krishna 	s8 relative_rssi;
2675bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2676bf95ecdbSvamsi krishna 
2677807f8a8cSLuciano Coelho 	/* internal */
2678807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2679807f8a8cSLuciano Coelho 	struct net_device *dev;
268015d6030bSSam Leffler 	unsigned long scan_start;
2681b34939b9SArend Van Spriel 	bool report_results;
268231a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
268393a1e86cSJukka Rissanen 	u32 owner_nlportid;
2684ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2685ca986ad9SArend Van Spriel 	struct list_head list;
2686807f8a8cSLuciano Coelho 
2687807f8a8cSLuciano Coelho 	/* keep last */
2688396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2689807f8a8cSLuciano Coelho };
2690807f8a8cSLuciano Coelho 
2691807f8a8cSLuciano Coelho /**
26922a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
26932a519311SJohannes Berg  *
26942a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
26952a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
26962a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
26972a519311SJohannes Berg  */
26982a519311SJohannes Berg enum cfg80211_signal_type {
26992a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
27002a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
27012a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
27022a519311SJohannes Berg };
27032a519311SJohannes Berg 
27042a519311SJohannes Berg /**
27056e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
27066e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
27076e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
27086e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
27096e19bc4bSDmitry Shmidt  *	signal type
27106e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
27116e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
27126e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
27136e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
27146e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
27159285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
27161d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
27171d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
27181d76250bSAvraham Stern  *	by %parent_bssid.
27191d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
27201d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2721983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2722983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
27235db25290SBenjamin Berg  * @drv_data: Data to be passed through to @inform_bss
27246e19bc4bSDmitry Shmidt  */
27256e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
27266e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
27276e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
27286e19bc4bSDmitry Shmidt 	s32 signal;
27296e19bc4bSDmitry Shmidt 	u64 boottime_ns;
27301d76250bSAvraham Stern 	u64 parent_tsf;
27311d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2732983dafaaSSunil Dutt 	u8 chains;
2733983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
27345db25290SBenjamin Berg 
27355db25290SBenjamin Berg 	void *drv_data;
27366e19bc4bSDmitry Shmidt };
27376e19bc4bSDmitry Shmidt 
27386e19bc4bSDmitry Shmidt /**
27392aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
27408cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
27419caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
27429caf0364SJohannes Berg  * @len: length of the IEs
27430e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
27449caf0364SJohannes Berg  * @data: IE data
27459caf0364SJohannes Berg  */
27469caf0364SJohannes Berg struct cfg80211_bss_ies {
27478cef2c9dSJohannes Berg 	u64 tsf;
27489caf0364SJohannes Berg 	struct rcu_head rcu_head;
27499caf0364SJohannes Berg 	int len;
27500e227084SJohannes Berg 	bool from_beacon;
27519caf0364SJohannes Berg 	u8 data[];
27529caf0364SJohannes Berg };
27539caf0364SJohannes Berg 
27549caf0364SJohannes Berg /**
27552a519311SJohannes Berg  * struct cfg80211_bss - BSS description
27562a519311SJohannes Berg  *
27572a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
27582a519311SJohannes Berg  * for use in scan results and similar.
27592a519311SJohannes Berg  *
2760abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2761dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
27622a519311SJohannes Berg  * @bssid: BSSID of the BSS
27632a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
27642a519311SJohannes Berg  * @capability: the capability field in host byte order
276583c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
276683c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
276783c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
276883c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
276934a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2770776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2771776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2772776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
277334a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2774776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2775776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2776776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2777776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2778851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2779851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2780851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2781851ae31dSJohannes Berg  *	(multi-BSSID support)
278277965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2783983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2784983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
27850cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
27860cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
27872a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
27882a519311SJohannes Berg  */
27892a519311SJohannes Berg struct cfg80211_bss {
27902a519311SJohannes Berg 	struct ieee80211_channel *channel;
2791dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
27922a519311SJohannes Berg 
27939caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
27949caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
27959caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
27969caf0364SJohannes Berg 
2797776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
27987011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
27997011ba58SSara Sharon 	struct list_head nontrans_list;
28002a519311SJohannes Berg 
28012a519311SJohannes Berg 	s32 signal;
28022a519311SJohannes Berg 
28039caf0364SJohannes Berg 	u16 beacon_interval;
28049caf0364SJohannes Berg 	u16 capability;
28059caf0364SJohannes Berg 
28069caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2807983dafaaSSunil Dutt 	u8 chains;
2808983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
28099caf0364SJohannes Berg 
28100cd01efbSSara Sharon 	u8 bssid_index;
28110cd01efbSSara Sharon 	u8 max_bssid_indicator;
28120cd01efbSSara Sharon 
2813396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
28142a519311SJohannes Berg };
28152a519311SJohannes Berg 
28162a519311SJohannes Berg /**
281749a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2818517357c6SJohannes Berg  * @bss: the bss to search
281949a68e0dSJohannes Berg  * @id: the element ID
28209caf0364SJohannes Berg  *
28219caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
28229caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
28230ae997dcSYacine Belkadi  * Return: %NULL if not found.
2824517357c6SJohannes Berg  */
282549a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
282649a68e0dSJohannes Berg 
282749a68e0dSJohannes Berg /**
282849a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
282949a68e0dSJohannes Berg  * @bss: the bss to search
283049a68e0dSJohannes Berg  * @id: the element ID
283149a68e0dSJohannes Berg  *
283249a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
283349a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
283449a68e0dSJohannes Berg  * Return: %NULL if not found.
283549a68e0dSJohannes Berg  */
283649a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
283749a68e0dSJohannes Berg {
28387e367b06SJohannes Berg 	return (const void *)ieee80211_bss_get_elem(bss, id);
283949a68e0dSJohannes Berg }
2840517357c6SJohannes Berg 
2841517357c6SJohannes Berg 
2842517357c6SJohannes Berg /**
2843636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2844636a5d36SJouni Malinen  *
2845636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2846636a5d36SJouni Malinen  * authentication.
2847636a5d36SJouni Malinen  *
2848959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2849959867faSJohannes Berg  *	to it if it needs to keep it.
2850636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2851636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2852636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2853fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2854fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2855fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
285611b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
285711b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
285811b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
285911b6b5a4SJouni Malinen  *	transaction sequence number field.
286011b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2861d648c230SJohannes Berg  * @link_id: if >= 0, indicates authentication should be done as an MLD,
2862d648c230SJohannes Berg  *	the interface address is included as the MLD address and the
2863d648c230SJohannes Berg  *	necessary link (with the given link_id) will be created (and
2864d648c230SJohannes Berg  *	given an MLD address) by the driver
2865d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of authentication request with
2866d648c230SJohannes Berg  *	an AP MLD, valid iff @link_id >= 0
2867636a5d36SJouni Malinen  */
2868636a5d36SJouni Malinen struct cfg80211_auth_request {
286919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2870636a5d36SJouni Malinen 	const u8 *ie;
2871636a5d36SJouni Malinen 	size_t ie_len;
287219957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2873fffd0934SJohannes Berg 	const u8 *key;
287423cc6d8cSJohannes Berg 	u8 key_len;
287523cc6d8cSJohannes Berg 	s8 key_idx;
287611b6b5a4SJouni Malinen 	const u8 *auth_data;
287711b6b5a4SJouni Malinen 	size_t auth_data_len;
2878d648c230SJohannes Berg 	s8 link_id;
2879d648c230SJohannes Berg 	const u8 *ap_mld_addr;
2880d648c230SJohannes Berg };
2881d648c230SJohannes Berg 
2882d648c230SJohannes Berg /**
2883d648c230SJohannes Berg  * struct cfg80211_assoc_link - per-link information for MLO association
2884d648c230SJohannes Berg  * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
2885d648c230SJohannes Berg  *	if this is %NULL for a link, that link is not requested
2886d648c230SJohannes Berg  * @elems: extra elements for the per-STA profile for this link
2887d648c230SJohannes Berg  * @elems_len: length of the elements
28886cf963edSIlan Peer  * @disabled: If set this link should be included during association etc. but it
28896cf963edSIlan Peer  *	should not be used until enabled by the AP MLD.
2890d648c230SJohannes Berg  */
2891d648c230SJohannes Berg struct cfg80211_assoc_link {
2892d648c230SJohannes Berg 	struct cfg80211_bss *bss;
2893d648c230SJohannes Berg 	const u8 *elems;
2894d648c230SJohannes Berg 	size_t elems_len;
28956cf963edSIlan Peer 	bool disabled;
2896636a5d36SJouni Malinen };
2897636a5d36SJouni Malinen 
2898636a5d36SJouni Malinen /**
28997e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
29007e7c8926SBen Greear  *
29017e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2902ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2903bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
290440cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
290540cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
290640cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
290740cbfa90SSrinivas Dasari  *	request (connect callback).
2908b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
290936f84235SMuna Sinada  * @ASSOC_REQ_DISABLE_EHT:  Disable EHT
2910efbabc11SVeerendranath Jakkam  * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
2911efbabc11SVeerendranath Jakkam  *	Drivers shall disable MLO features for the current association if this
2912efbabc11SVeerendranath Jakkam  *	flag is not set.
29137e7c8926SBen Greear  */
29147e7c8926SBen Greear enum cfg80211_assoc_req_flags {
29157e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2916ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2917bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
291840cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
2919b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
292036f84235SMuna Sinada 	ASSOC_REQ_DISABLE_EHT			= BIT(5),
2921efbabc11SVeerendranath Jakkam 	CONNECT_REQ_MLO_SUPPORT			= BIT(6),
29227e7c8926SBen Greear };
29237e7c8926SBen Greear 
29247e7c8926SBen Greear /**
2925636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2926636a5d36SJouni Malinen  *
2927636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2928636a5d36SJouni Malinen  * (re)association.
2929959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2930959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2931959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2932959867faSJohannes Berg  *	association requests while already associating must be rejected.
2933d648c230SJohannes Berg  *	This also applies to the @links.bss parameter, which is used instead
2934d648c230SJohannes Berg  *	of this one (it is %NULL) for MLO associations.
2935636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2936636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2937dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2938b23aa676SSamuel Ortiz  * @crypto: crypto settings
293935eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
294035eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
294135eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
294235eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
294335eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
294435eb8f7bSJouni Malinen  *	frame.
29457e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
29467e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
29477e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
29487e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2949ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2950ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2951348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2952348bd456SJouni Malinen  *	%NULL if FILS is not used.
2953348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2954348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2955348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2956348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2957d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
2958d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
2959d648c230SJohannes Berg  * @links: per-link information for MLO connections
2960d648c230SJohannes Berg  * @link_id: >= 0 for MLO connections, where links are given, and indicates
2961d648c230SJohannes Berg  *	the link on which the association request should be sent
2962d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of MLO association request,
2963d648c230SJohannes Berg  *	valid iff @link_id >= 0
2964636a5d36SJouni Malinen  */
2965636a5d36SJouni Malinen struct cfg80211_assoc_request {
296619957bb3SJohannes Berg 	struct cfg80211_bss *bss;
29673e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2968636a5d36SJouni Malinen 	size_t ie_len;
2969b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
297019957bb3SJohannes Berg 	bool use_mfp;
29717e7c8926SBen Greear 	u32 flags;
29727e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
29737e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2974ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2975348bd456SJouni Malinen 	const u8 *fils_kek;
2976348bd456SJouni Malinen 	size_t fils_kek_len;
2977348bd456SJouni Malinen 	const u8 *fils_nonces;
2978d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2979d648c230SJohannes Berg 	struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
2980d648c230SJohannes Berg 	const u8 *ap_mld_addr;
2981d648c230SJohannes Berg 	s8 link_id;
2982636a5d36SJouni Malinen };
2983636a5d36SJouni Malinen 
2984636a5d36SJouni Malinen /**
2985636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2986636a5d36SJouni Malinen  *
2987636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2988636a5d36SJouni Malinen  * deauthentication.
2989636a5d36SJouni Malinen  *
29908f6e0dfcSJohannes Berg  * @bssid: the BSSID or AP MLD address to deauthenticate from
2991636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2992636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
299319957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2994077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2995077f897aSJohannes Berg  *	do not set a deauth frame
2996636a5d36SJouni Malinen  */
2997636a5d36SJouni Malinen struct cfg80211_deauth_request {
299895de817bSJohannes Berg 	const u8 *bssid;
2999636a5d36SJouni Malinen 	const u8 *ie;
3000636a5d36SJouni Malinen 	size_t ie_len;
300119957bb3SJohannes Berg 	u16 reason_code;
30026863255bSStanislaw Gruszka 	bool local_state_change;
3003636a5d36SJouni Malinen };
3004636a5d36SJouni Malinen 
3005636a5d36SJouni Malinen /**
3006636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
3007636a5d36SJouni Malinen  *
3008636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
300966f00449SMasahiro Yamada  * disassociation.
3010636a5d36SJouni Malinen  *
30118f6e0dfcSJohannes Berg  * @ap_addr: the BSSID or AP MLD address to disassociate from
3012636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
3013636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
301419957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
3015d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
3016d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
3017636a5d36SJouni Malinen  */
3018636a5d36SJouni Malinen struct cfg80211_disassoc_request {
30198f6e0dfcSJohannes Berg 	const u8 *ap_addr;
3020636a5d36SJouni Malinen 	const u8 *ie;
3021636a5d36SJouni Malinen 	size_t ie_len;
302219957bb3SJohannes Berg 	u16 reason_code;
3023d5cdfacbSJouni Malinen 	bool local_state_change;
3024636a5d36SJouni Malinen };
3025636a5d36SJouni Malinen 
3026636a5d36SJouni Malinen /**
302704a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
302804a773adSJohannes Berg  *
302904a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
303004a773adSJohannes Berg  * method.
303104a773adSJohannes Berg  *
303204a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
303304a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
303404a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
303504a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
3036683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
303704a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
303804a773adSJohannes Berg  *	IBSSs to join on other channels.
303904a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
304004a773adSJohannes Berg  * @ie_len: length of that
30418e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
3042fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
3043fffd0934SJohannes Berg  *	after joining
3044267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
3045267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
3046267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
3047267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
3048c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
3049c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
30505336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
30515336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
30525336fa88SSimon Wunderlich  *	to operate on DFS channels.
3053fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
3054dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
3055803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
3056803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
3057803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
30589ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
30599ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
30609ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
306104a773adSJohannes Berg  */
306204a773adSJohannes Berg struct cfg80211_ibss_params {
3063c1e5f471SJohannes Berg 	const u8 *ssid;
3064c1e5f471SJohannes Berg 	const u8 *bssid;
3065683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
3066c1e5f471SJohannes Berg 	const u8 *ie;
306704a773adSJohannes Berg 	u8 ssid_len, ie_len;
30688e30bc55SJohannes Berg 	u16 beacon_interval;
3069fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
307004a773adSJohannes Berg 	bool channel_fixed;
3071fffd0934SJohannes Berg 	bool privacy;
3072267335d6SAntonio Quartulli 	bool control_port;
3073c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
30745336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
307557fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
3076803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
3077803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
30789ae3b172STova Mussai 	struct key_params *wep_keys;
30799ae3b172STova Mussai 	int wep_tx_key;
308004a773adSJohannes Berg };
308104a773adSJohannes Berg 
308204a773adSJohannes Berg /**
308338de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
308438de03d2SArend van Spriel  *
308538de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
308638de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
308738de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
308838de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
308938de03d2SArend van Spriel  */
309038de03d2SArend van Spriel struct cfg80211_bss_selection {
309138de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
309238de03d2SArend van Spriel 	union {
309357fbcce3SJohannes Berg 		enum nl80211_band band_pref;
309438de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
309538de03d2SArend van Spriel 	} param;
309638de03d2SArend van Spriel };
309738de03d2SArend van Spriel 
309838de03d2SArend van Spriel /**
3099b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
3100b23aa676SSamuel Ortiz  *
3101b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
3102b23aa676SSamuel Ortiz  * authentication and association.
3103b23aa676SSamuel Ortiz  *
3104b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
3105b23aa676SSamuel Ortiz  *	on scan results)
31061df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
31071df4a510SJouni Malinen  *	%NULL if not specified
3108b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
3109b23aa676SSamuel Ortiz  *	results)
31101df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
31111df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
31121df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
31131df4a510SJouni Malinen  *	to use.
3114b23aa676SSamuel Ortiz  * @ssid: SSID
3115b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
3116b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
3117abe37c4bSJohannes Berg  * @ie: IEs for association request
3118abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
3119b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
3120cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
3121b23aa676SSamuel Ortiz  * @crypto: crypto settings
3122fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
3123fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
3124fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
31257e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
31264486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
31274486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
31287e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
31297e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
31307e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
3131ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
3132ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
313334d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
313434d50519SLior David  *	networks.
313538de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
313635eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
313735eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
313835eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
313935eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
314035eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
314135eb8f7bSJouni Malinen  *	frame.
3142a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
3143a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
3144a3caf744SVidyullatha Kanchanapally  *	data IE.
3145a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
3146a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
3147a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
3148a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
3149a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
3150a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
3151a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
3152a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
3153a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
3154a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
31553a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
31563a00df57SAvraham Stern  *	offload of 4-way handshake.
31572a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
31582a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
31592a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
3160b23aa676SSamuel Ortiz  */
3161b23aa676SSamuel Ortiz struct cfg80211_connect_params {
3162b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
31631df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
3164664834deSJouni Malinen 	const u8 *bssid;
31651df4a510SJouni Malinen 	const u8 *bssid_hint;
3166664834deSJouni Malinen 	const u8 *ssid;
3167b23aa676SSamuel Ortiz 	size_t ssid_len;
3168b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
31694b5800feSJohannes Berg 	const u8 *ie;
3170b23aa676SSamuel Ortiz 	size_t ie_len;
3171b23aa676SSamuel Ortiz 	bool privacy;
3172cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
3173b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
3174fffd0934SJohannes Berg 	const u8 *key;
3175fffd0934SJohannes Berg 	u8 key_len, key_idx;
31767e7c8926SBen Greear 	u32 flags;
31774486ea98SBala Shanmugam 	int bg_scan_period;
31787e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
31797e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3180ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
3181ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
318234d50519SLior David 	bool pbss;
318338de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
3184ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
3185a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
3186a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
3187a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
3188a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
3189a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
3190a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
3191a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
31923a00df57SAvraham Stern 	bool want_1x;
31932a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
3194b23aa676SSamuel Ortiz };
3195b23aa676SSamuel Ortiz 
3196b23aa676SSamuel Ortiz /**
3197088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
3198088e8df8Svamsi krishna  *
3199088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
3200088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
3201088e8df8Svamsi krishna  *
3202088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
32037f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
32047f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
32057f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
3206088e8df8Svamsi krishna  */
3207088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
3208088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
32097f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
32107f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
3211088e8df8Svamsi krishna };
3212088e8df8Svamsi krishna 
3213088e8df8Svamsi krishna /**
3214b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
3215abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
3216abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
3217abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
3218abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
3219abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
32203057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
322152539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
322252539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
322352539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
3224b9a5f8caSJouni Malinen  */
3225b9a5f8caSJouni Malinen enum wiphy_params_flags {
3226b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
3227b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
3228b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
3229b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
323081077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
32313057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
323252539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
323352539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
323452539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
3235b9a5f8caSJouni Malinen };
3236b9a5f8caSJouni Malinen 
323736647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
323836647055SToke Høiland-Jørgensen 
32393ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
32403ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
32413ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
32423ace10f5SKan Yan 
32433ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
32443ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
32453ace10f5SKan Yan 
324667fbb16bSSamuel Ortiz /**
324767fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
324867fbb16bSSamuel Ortiz  *
324967fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
325067fbb16bSSamuel Ortiz  * caching.
325167fbb16bSSamuel Ortiz  *
3252a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
3253a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
3254a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
3255a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
3256a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
3257a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
3258a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
3259a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
3260a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3261a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3262a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3263a3caf744SVidyullatha Kanchanapally  *	%NULL).
32647fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
32657fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
32667fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
32677fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
32687fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
32697fc82af8SVeerendranath Jakkam  *	used for it expires.
32707fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
32717fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
32727fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
32737fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
32747fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
327567fbb16bSSamuel Ortiz  */
327667fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3277c1e5f471SJohannes Berg 	const u8 *bssid;
3278c1e5f471SJohannes Berg 	const u8 *pmkid;
3279a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3280a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3281a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3282a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3283a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
32847fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
32857fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
328667fbb16bSSamuel Ortiz };
32879930380fSJohannes Berg 
32887643a2c3SJohannes Berg /**
328950ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3290ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3291ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3292ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3293ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3294bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3295ff1b6e69SJohannes Berg  *
3296ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3297ff1b6e69SJohannes Berg  * memory, free @mask only!
3298ff1b6e69SJohannes Berg  */
329950ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3300922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3301ff1b6e69SJohannes Berg 	int pattern_len;
3302bb92d199SAmitkumar Karwar 	int pkt_offset;
3303ff1b6e69SJohannes Berg };
3304ff1b6e69SJohannes Berg 
3305ff1b6e69SJohannes Berg /**
33062a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
33072a0e047eSJohannes Berg  *
33082a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
33092a0e047eSJohannes Berg  * @src: source IP address
33102a0e047eSJohannes Berg  * @dst: destination IP address
33112a0e047eSJohannes Berg  * @dst_mac: destination MAC address
33122a0e047eSJohannes Berg  * @src_port: source port
33132a0e047eSJohannes Berg  * @dst_port: destination port
33142a0e047eSJohannes Berg  * @payload_len: data payload length
33152a0e047eSJohannes Berg  * @payload: data payload buffer
33162a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
33172a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
33182a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
33192a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
33202a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
33212a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
33222a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
33232a0e047eSJohannes Berg  */
33242a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
33252a0e047eSJohannes Berg 	struct socket *sock;
33262a0e047eSJohannes Berg 	__be32 src, dst;
33272a0e047eSJohannes Berg 	u16 src_port, dst_port;
33282a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
33292a0e047eSJohannes Berg 	int payload_len;
33302a0e047eSJohannes Berg 	const u8 *payload;
33312a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
33322a0e047eSJohannes Berg 	u32 data_interval;
33332a0e047eSJohannes Berg 	u32 wake_len;
33342a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
33352a0e047eSJohannes Berg 	u32 tokens_size;
33362a0e047eSJohannes Berg 	/* must be last, variable member */
33372a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3338ff1b6e69SJohannes Berg };
3339ff1b6e69SJohannes Berg 
3340ff1b6e69SJohannes Berg /**
3341ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3342ff1b6e69SJohannes Berg  *
3343ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3344ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3345ff1b6e69SJohannes Berg  *	operating as normal during suspend
3346ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3347ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3348ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3349ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
335077dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
335177dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
335277dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
335377dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
33542a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
33552a0e047eSJohannes Berg  *	NULL if not configured.
33568cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3357ff1b6e69SJohannes Berg  */
3358ff1b6e69SJohannes Berg struct cfg80211_wowlan {
335977dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
336077dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
336177dbbb13SJohannes Berg 	     rfkill_release;
336250ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
33632a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3364ff1b6e69SJohannes Berg 	int n_patterns;
33658cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3366ff1b6e69SJohannes Berg };
3367ff1b6e69SJohannes Berg 
3368ff1b6e69SJohannes Berg /**
3369be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3370be29b99aSAmitkumar Karwar  *
3371be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3372be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3373be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3374be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3375be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3376be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3377be29b99aSAmitkumar Karwar  */
3378be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3379be29b99aSAmitkumar Karwar 	int delay;
3380be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3381be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3382be29b99aSAmitkumar Karwar 	int n_patterns;
3383be29b99aSAmitkumar Karwar };
3384be29b99aSAmitkumar Karwar 
3385be29b99aSAmitkumar Karwar /**
3386be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3387be29b99aSAmitkumar Karwar  *
3388be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3389be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3390be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3391be29b99aSAmitkumar Karwar  */
3392be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3393be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
3394be29b99aSAmitkumar Karwar 	int n_rules;
3395be29b99aSAmitkumar Karwar };
3396be29b99aSAmitkumar Karwar 
3397be29b99aSAmitkumar Karwar /**
33988cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
33998cd4d456SLuciano Coelho  *
34008cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
34018cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
34028cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
34038cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
34048cd4d456SLuciano Coelho  *	occurred (in MHz)
34058cd4d456SLuciano Coelho  */
34068cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
34078cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
34088cd4d456SLuciano Coelho 	int n_channels;
34098cd4d456SLuciano Coelho 	u32 channels[];
34108cd4d456SLuciano Coelho };
34118cd4d456SLuciano Coelho 
34128cd4d456SLuciano Coelho /**
34138cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
34148cd4d456SLuciano Coelho  *
34158cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
34168cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
34178cd4d456SLuciano Coelho  *	match information.
34188cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
34198cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
34208cd4d456SLuciano Coelho  */
34218cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
34228cd4d456SLuciano Coelho 	int n_matches;
34238cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
34248cd4d456SLuciano Coelho };
34258cd4d456SLuciano Coelho 
34268cd4d456SLuciano Coelho /**
3427cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3428cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3429cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3430cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3431cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3432cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3433cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3434cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3435cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3436cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3437cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3438cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3439cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3440cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3441cd8f7cb4SJohannes Berg  *	it is.
34422a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
34432a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
34442a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
34458cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3446cd8f7cb4SJohannes Berg  */
3447cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3448cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3449cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
34502a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
34512a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
3452cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3453cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3454cd8f7cb4SJohannes Berg 	const void *packet;
34558cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3456cd8f7cb4SJohannes Berg };
3457cd8f7cb4SJohannes Berg 
3458cd8f7cb4SJohannes Berg /**
3459e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3460093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3461093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
346278f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3463093a48d2SNathan Errera  * @kek_len: length of kek
34642d8b08feSMauro Carvalho Chehab  * @kck_len: length of kck
3465093a48d2SNathan Errera  * @akm: akm (oui, id)
3466e5497d76SJohannes Berg  */
3467e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
346878f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3469093a48d2SNathan Errera 	u32 akm;
3470093a48d2SNathan Errera 	u8 kek_len, kck_len;
3471e5497d76SJohannes Berg };
3472e5497d76SJohannes Berg 
3473e5497d76SJohannes Berg /**
3474355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3475355199e0SJouni Malinen  *
3476355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3477355199e0SJouni Malinen  *
3478355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3479355199e0SJouni Malinen  * @ie: Fast Transition IEs
3480355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3481355199e0SJouni Malinen  */
3482355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3483355199e0SJouni Malinen 	u16 md;
3484355199e0SJouni Malinen 	const u8 *ie;
3485355199e0SJouni Malinen 	size_t ie_len;
3486355199e0SJouni Malinen };
3487355199e0SJouni Malinen 
3488355199e0SJouni Malinen /**
3489b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3490b176e629SAndrei Otcheretianski  *
3491b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3492b176e629SAndrei Otcheretianski  *
3493b176e629SAndrei Otcheretianski  * @chan: channel to use
3494b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
3495b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3496b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3497b176e629SAndrei Otcheretianski  * @len: buffer length
3498b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3499b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
350034d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
350134d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
350295f498bbSJohannes Berg  * @link_id: for MLO, the link ID to transmit on, -1 if not given; note
350395f498bbSJohannes Berg  *	that the link ID isn't validated (much), it's in range but the
350495f498bbSJohannes Berg  *	link might not exist (or be used by the receiver STA)
3505b176e629SAndrei Otcheretianski  */
3506b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3507b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3508b176e629SAndrei Otcheretianski 	bool offchan;
3509b176e629SAndrei Otcheretianski 	unsigned int wait;
3510b176e629SAndrei Otcheretianski 	const u8 *buf;
3511b176e629SAndrei Otcheretianski 	size_t len;
3512b176e629SAndrei Otcheretianski 	bool no_cck;
3513b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
351434d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
351534d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
351695f498bbSJohannes Berg 	int link_id;
3517b176e629SAndrei Otcheretianski };
3518b176e629SAndrei Otcheretianski 
3519b176e629SAndrei Otcheretianski /**
3520fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3521fa9ffc74SKyeyoon Park  *
3522fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3523fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3524fa9ffc74SKyeyoon Park  */
3525fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3526fa9ffc74SKyeyoon Park 	u8 dscp;
3527fa9ffc74SKyeyoon Park 	u8 up;
3528fa9ffc74SKyeyoon Park };
3529fa9ffc74SKyeyoon Park 
3530fa9ffc74SKyeyoon Park /**
3531fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3532fa9ffc74SKyeyoon Park  *
3533fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3534fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3535fa9ffc74SKyeyoon Park  */
3536fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3537fa9ffc74SKyeyoon Park 	u8 low;
3538fa9ffc74SKyeyoon Park 	u8 high;
3539fa9ffc74SKyeyoon Park };
3540fa9ffc74SKyeyoon Park 
3541fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3542fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3543fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3544fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3545fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3546fa9ffc74SKyeyoon Park 
3547fa9ffc74SKyeyoon Park /**
3548fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3549fa9ffc74SKyeyoon Park  *
3550fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3551fa9ffc74SKyeyoon Park  *
3552fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3553fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3554fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3555fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3556fa9ffc74SKyeyoon Park  */
3557fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3558fa9ffc74SKyeyoon Park 	u8 num_des;
3559fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3560fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3561fa9ffc74SKyeyoon Park };
3562fa9ffc74SKyeyoon Park 
3563fa9ffc74SKyeyoon Park /**
3564cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3565cb3b7d87SAyala Beker  *
3566cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3567cb3b7d87SAyala Beker  *
3568cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
35698585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
35708585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
35718585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3572cb3b7d87SAyala Beker  */
3573cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3574cb3b7d87SAyala Beker 	u8 master_pref;
35758585989dSLuca Coelho 	u8 bands;
3576cb3b7d87SAyala Beker };
3577cb3b7d87SAyala Beker 
3578cb3b7d87SAyala Beker /**
3579a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3580a5a9dcf2SAyala Beker  * configuration
3581a5a9dcf2SAyala Beker  *
3582a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
35838585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3584a5a9dcf2SAyala Beker  */
3585a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3586a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
35878585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3588a5a9dcf2SAyala Beker };
3589a5a9dcf2SAyala Beker 
3590a5a9dcf2SAyala Beker /**
3591a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3592a442b761SAyala Beker  *
3593a442b761SAyala Beker  * @filter: the content of the filter
3594a442b761SAyala Beker  * @len: the length of the filter
3595a442b761SAyala Beker  */
3596a442b761SAyala Beker struct cfg80211_nan_func_filter {
3597a442b761SAyala Beker 	const u8 *filter;
3598a442b761SAyala Beker 	u8 len;
3599a442b761SAyala Beker };
3600a442b761SAyala Beker 
3601a442b761SAyala Beker /**
3602a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3603a442b761SAyala Beker  *
3604a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3605a442b761SAyala Beker  * @service_id: the service ID of the function
3606a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3607a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3608a442b761SAyala Beker  *	implementation specific.
3609a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3610a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3611a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3612a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3613a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3614a442b761SAyala Beker  * @ttl: time to live counter in DW.
3615a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3616a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3617a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3618a442b761SAyala Beker  * @srf_bf: Bloom Filter
3619a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3620a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3621a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3622a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3623a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3624a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3625a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3626a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3627a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3628a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3629a442b761SAyala Beker  */
3630a442b761SAyala Beker struct cfg80211_nan_func {
3631a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3632a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3633a442b761SAyala Beker 	u8 publish_type;
3634a442b761SAyala Beker 	bool close_range;
3635a442b761SAyala Beker 	bool publish_bcast;
3636a442b761SAyala Beker 	bool subscribe_active;
3637a442b761SAyala Beker 	u8 followup_id;
3638a442b761SAyala Beker 	u8 followup_reqid;
3639a442b761SAyala Beker 	struct mac_address followup_dest;
3640a442b761SAyala Beker 	u32 ttl;
3641a442b761SAyala Beker 	const u8 *serv_spec_info;
3642a442b761SAyala Beker 	u8 serv_spec_info_len;
3643a442b761SAyala Beker 	bool srf_include;
3644a442b761SAyala Beker 	const u8 *srf_bf;
3645a442b761SAyala Beker 	u8 srf_bf_len;
3646a442b761SAyala Beker 	u8 srf_bf_idx;
3647a442b761SAyala Beker 	struct mac_address *srf_macs;
3648a442b761SAyala Beker 	int srf_num_macs;
3649a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3650a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3651a442b761SAyala Beker 	u8 num_tx_filters;
3652a442b761SAyala Beker 	u8 num_rx_filters;
3653a442b761SAyala Beker 	u8 instance_id;
3654a442b761SAyala Beker 	u64 cookie;
3655a442b761SAyala Beker };
3656a442b761SAyala Beker 
3657a442b761SAyala Beker /**
36583a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
36593a00df57SAvraham Stern  *
36603a00df57SAvraham Stern  * @aa: authenticator address
36613a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
36623a00df57SAvraham Stern  * @pmk: the PMK material
36633a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
36643a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
36653a00df57SAvraham Stern  *	holds PMK-R0.
36663a00df57SAvraham Stern  */
36673a00df57SAvraham Stern struct cfg80211_pmk_conf {
36683a00df57SAvraham Stern 	const u8 *aa;
36693a00df57SAvraham Stern 	u8 pmk_len;
36703a00df57SAvraham Stern 	const u8 *pmk;
36713a00df57SAvraham Stern 	const u8 *pmk_r0_name;
36723a00df57SAvraham Stern };
36733a00df57SAvraham Stern 
36743a00df57SAvraham Stern /**
367540cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
367640cbfa90SSrinivas Dasari  *
367740cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
367840cbfa90SSrinivas Dasari  *
367940cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
368040cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
368140cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
368240cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
368340cbfa90SSrinivas Dasari  *	authentication response command interface.
368440cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
368540cbfa90SSrinivas Dasari  *	authentication response command interface.
368640cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
368740cbfa90SSrinivas Dasari  *	authentication request event interface.
368840cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
368940cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
369040cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
369140cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3692fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
36939a47c1efSVeerendranath Jakkam  * @mld_addr: MLD address of the peer. Used by the authentication request event
36949a47c1efSVeerendranath Jakkam  *	interface. Driver indicates this to enable MLO during the authentication
36959a47c1efSVeerendranath Jakkam  *	offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT
36969a47c1efSVeerendranath Jakkam  *	flag capability in NL80211_CMD_CONNECT to know whether the user space
36979a47c1efSVeerendranath Jakkam  *	supports enabling MLO during the authentication offload.
36989a47c1efSVeerendranath Jakkam  *	User space should use the address of the interface (on which the
36999a47c1efSVeerendranath Jakkam  *	authentication request event reported) as self MLD address. User space
37009a47c1efSVeerendranath Jakkam  *	and driver should use MLD addresses in RA, TA and BSSID fields of
37019a47c1efSVeerendranath Jakkam  *	authentication frames sent or received via cfg80211. The driver
37029a47c1efSVeerendranath Jakkam  *	translates the MLD addresses to/from link addresses based on the link
37039a47c1efSVeerendranath Jakkam  *	chosen for the authentication.
370440cbfa90SSrinivas Dasari  */
370540cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
370640cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
370740cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
370840cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
370940cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
371040cbfa90SSrinivas Dasari 	u16 status;
3711fe494370SSrinivas Dasari 	const u8 *pmkid;
37129a47c1efSVeerendranath Jakkam 	u8 mld_addr[ETH_ALEN] __aligned(2);
371340cbfa90SSrinivas Dasari };
371440cbfa90SSrinivas Dasari 
371540cbfa90SSrinivas Dasari /**
37163453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
371781e54d08SPradeep Kumar Chitrapu  *
371881e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
371981e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
372081e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
372181e54d08SPradeep Kumar Chitrapu  *	answered
372281e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
372381e54d08SPradeep Kumar Chitrapu  *	successfully answered
372481e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
372581e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
372681e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
372781e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
372881e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
372981e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
373081e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
373181e54d08SPradeep Kumar Chitrapu  *	the responder
373281e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
373381e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
373481e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
373581e54d08SPradeep Kumar Chitrapu  */
373681e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
373781e54d08SPradeep Kumar Chitrapu 	u32 filled;
373881e54d08SPradeep Kumar Chitrapu 	u32 success_num;
373981e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
374081e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
374181e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
374281e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
374381e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
374481e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
374581e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
374681e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
374781e54d08SPradeep Kumar Chitrapu };
374881e54d08SPradeep Kumar Chitrapu 
374981e54d08SPradeep Kumar Chitrapu /**
37509bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
37519bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
37529bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
37539bb7e0f2SJohannes Berg  *	reason than just "failure"
37549bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
37559bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
37569bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
37579bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
37589bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
37599bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
37609bb7e0f2SJohannes Berg  *	by the responder
37619bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
37629bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
37639bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
37649bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
37659bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
37669bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
37679bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
37689bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
37699bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
37709bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
37719bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
37729bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
37739bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
37749bb7e0f2SJohannes Berg  *	the square root of the variance)
37759bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
37769bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
37779bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
37789bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
37799bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
37809bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
37819bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
37829bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
37839bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
37849bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
37859bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
37869bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
37879bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
37889bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
37899bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
37909bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
37919bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
37929bb7e0f2SJohannes Berg  */
37939bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
37949bb7e0f2SJohannes Berg 	const u8 *lci;
37959bb7e0f2SJohannes Berg 	const u8 *civicloc;
37969bb7e0f2SJohannes Berg 	unsigned int lci_len;
37979bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
37989bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
37999bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
38009bb7e0f2SJohannes Berg 	s16 burst_index;
38019bb7e0f2SJohannes Berg 	u8 busy_retry_time;
38029bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
38039bb7e0f2SJohannes Berg 	u8 burst_duration;
38049bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
38059bb7e0f2SJohannes Berg 	s32 rssi_avg;
38069bb7e0f2SJohannes Berg 	s32 rssi_spread;
38079bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
38089bb7e0f2SJohannes Berg 	s64 rtt_avg;
38099bb7e0f2SJohannes Berg 	s64 rtt_variance;
38109bb7e0f2SJohannes Berg 	s64 rtt_spread;
38119bb7e0f2SJohannes Berg 	s64 dist_avg;
38129bb7e0f2SJohannes Berg 	s64 dist_variance;
38139bb7e0f2SJohannes Berg 	s64 dist_spread;
38149bb7e0f2SJohannes Berg 
38159bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
38169bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
38179bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
38189bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
38199bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
38209bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
38219bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
38229bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
38239bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
38249bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
38259bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
38269bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
38279bb7e0f2SJohannes Berg };
38289bb7e0f2SJohannes Berg 
38299bb7e0f2SJohannes Berg /**
38309bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
38319bb7e0f2SJohannes Berg  * @addr: address of the peer
38329bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
38339bb7e0f2SJohannes Berg  *	measurement was made)
38349bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
38359bb7e0f2SJohannes Berg  * @status: status of the measurement
38369bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
38379bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
38389bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
38399bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
38409bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
38419bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
38422d8b08feSMauro Carvalho Chehab  * @ftm: FTM result
38439bb7e0f2SJohannes Berg  */
38449bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
38459bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
38469bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
38479bb7e0f2SJohannes Berg 
38489bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
38499bb7e0f2SJohannes Berg 
38509bb7e0f2SJohannes Berg 	u8 final:1,
38519bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
38529bb7e0f2SJohannes Berg 
38539bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
38549bb7e0f2SJohannes Berg 
38559bb7e0f2SJohannes Berg 	union {
38569bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
38579bb7e0f2SJohannes Berg 	};
38589bb7e0f2SJohannes Berg };
38599bb7e0f2SJohannes Berg 
38609bb7e0f2SJohannes Berg /**
38619bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
38629bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
38639bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
38649bb7e0f2SJohannes Berg  * @burst_period: burst period to use
38659bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
38669bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
38679bb7e0f2SJohannes Berg  * @burst_duration: burst duration
38689bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
38699bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
38709bb7e0f2SJohannes Berg  * @request_lci: request LCI information
38719bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
3872efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
3873efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3874efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
3875efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
3876efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3877efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
387873807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
387973807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
3880dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
3881dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
3882dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
38839bb7e0f2SJohannes Berg  *
38849bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
38859bb7e0f2SJohannes Berg  */
38869bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
38879bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
38889bb7e0f2SJohannes Berg 	u16 burst_period;
38899bb7e0f2SJohannes Berg 	u8 requested:1,
38909bb7e0f2SJohannes Berg 	   asap:1,
38919bb7e0f2SJohannes Berg 	   request_lci:1,
3892efb5520dSAvraham Stern 	   request_civicloc:1,
3893efb5520dSAvraham Stern 	   trigger_based:1,
389473807523SAvraham Stern 	   non_trigger_based:1,
389573807523SAvraham Stern 	   lmr_feedback:1;
38969bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
38979bb7e0f2SJohannes Berg 	u8 burst_duration;
38989bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
38999bb7e0f2SJohannes Berg 	u8 ftmr_retries;
3900dd3e4fc7SAvraham Stern 	u8 bss_color;
39019bb7e0f2SJohannes Berg };
39029bb7e0f2SJohannes Berg 
39039bb7e0f2SJohannes Berg /**
39049bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
39059bb7e0f2SJohannes Berg  * @addr: MAC address
39069bb7e0f2SJohannes Berg  * @chandef: channel to use
39079bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
39089bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
39099bb7e0f2SJohannes Berg  */
39109bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
39119bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
39129bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
39139bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
39149bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
39159bb7e0f2SJohannes Berg };
39169bb7e0f2SJohannes Berg 
39179bb7e0f2SJohannes Berg /**
39189bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
39199bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
39209bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
39219bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
39229bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
39239bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
39249bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
39259bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
39269bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
39279bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
39289bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
39299bb7e0f2SJohannes Berg  *	zero it means there's no timeout
39309bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
39319bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
39329bb7e0f2SJohannes Berg  */
39339bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
39349bb7e0f2SJohannes Berg 	u64 cookie;
39359bb7e0f2SJohannes Berg 	void *drv_data;
39369bb7e0f2SJohannes Berg 	u32 n_peers;
39379bb7e0f2SJohannes Berg 	u32 nl_portid;
39389bb7e0f2SJohannes Berg 
39399bb7e0f2SJohannes Berg 	u32 timeout;
39409bb7e0f2SJohannes Berg 
39419bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
39429bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
39439bb7e0f2SJohannes Berg 
39449bb7e0f2SJohannes Berg 	struct list_head list;
39459bb7e0f2SJohannes Berg 
39469bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
39479bb7e0f2SJohannes Berg };
39489bb7e0f2SJohannes Berg 
39499bb7e0f2SJohannes Berg /**
3950cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3951cb74e977SSunil Dutt  *
3952cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3953cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3954cb74e977SSunil Dutt  *
3955cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3956cb74e977SSunil Dutt  *
3957cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3958cb74e977SSunil Dutt  *	has to be done.
3959cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3960cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3961cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3962cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3963cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3964cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3965cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3966cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
39678bb588d9SVeerendranath Jakkam  * @assoc_link_id: MLO link ID of the AP, with which (re)association requested
39688bb588d9SVeerendranath Jakkam  *	by peer. This will be filled by driver for both MLO and non-MLO station
39698bb588d9SVeerendranath Jakkam  *	connections when the AP affiliated with an MLD. For non-MLD AP mode, it
39708bb588d9SVeerendranath Jakkam  *	will be -1. Used only with OWE update event (driver to user space).
39718bb588d9SVeerendranath Jakkam  * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO
39728bb588d9SVeerendranath Jakkam  *	connection, it will be all zeros. This is applicable only when
39738bb588d9SVeerendranath Jakkam  *	@assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only
39748bb588d9SVeerendranath Jakkam  *	with OWE update event (driver to user space).
3975cb74e977SSunil Dutt  */
3976cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3977cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3978cb74e977SSunil Dutt 	u16 status;
3979cb74e977SSunil Dutt 	const u8 *ie;
3980cb74e977SSunil Dutt 	size_t ie_len;
39818bb588d9SVeerendranath Jakkam 	int assoc_link_id;
39828bb588d9SVeerendranath Jakkam 	u8 peer_mld_addr[ETH_ALEN] __aligned(2);
3983cb74e977SSunil Dutt };
3984cb74e977SSunil Dutt 
3985cb74e977SSunil Dutt /**
39866cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
39876cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
39886cd536feSJohannes Berg  *	for the entire device
39896cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
39906cd536feSJohannes Berg  *	for the given interface
39912d8b08feSMauro Carvalho Chehab  * @global_mcast_stypes: mcast RX is needed globally for these subtypes
39929dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
39939dba48a6SJohannes Berg  *	for these subtypes
39946cd536feSJohannes Berg  */
39956cd536feSJohannes Berg struct mgmt_frame_regs {
39966cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
39979dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
39986cd536feSJohannes Berg };
39996cd536feSJohannes Berg 
40006cd536feSJohannes Berg /**
4001704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
4002704232c2SJohannes Berg  *
4003704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
4004704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
4005704232c2SJohannes Berg  *
4006704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
4007704232c2SJohannes Berg  * on success or a negative error code.
4008704232c2SJohannes Berg  *
4009a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
4010a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
4011a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
4012a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
401343fb45cbSJohannes Berg  *
4014ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
4015ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
4016ff1b6e69SJohannes Berg  *	configured for the device.
40170378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
40186d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
40196d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
40206d52563fSJohannes Berg  *	the device.
40210378b3f1SJohannes Berg  *
402260719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
4023463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
402484efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
402598104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
402698104fdeSJohannes Berg  *	also set the address member in the wdev.
4027a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
4028704232c2SJohannes Berg  *
402984efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
4030a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
403155682965SJohannes Berg  *
403260719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
403360719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
4034a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
403555682965SJohannes Berg  *
4036f2a0290bSJohannes Berg  * @add_intf_link: Add a new MLO link to the given interface. Note that
4037f2a0290bSJohannes Berg  *	the wdev->link[] data structure has been updated, so the new link
4038f2a0290bSJohannes Berg  *	address is available.
4039f2a0290bSJohannes Berg  * @del_intf_link: Remove an MLO link from the given interface.
4040f2a0290bSJohannes Berg  *
404141ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
4042e7a7b84eSVeerendranath Jakkam  *	when adding a group key. @link_id will be -1 for non-MLO connection.
4043e7a7b84eSVeerendranath Jakkam  *	For MLO connection, @link_id will be >= 0 for group key and -1 for
4044e7a7b84eSVeerendranath Jakkam  *	pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.
404541ade00fSJohannes Berg  *
404641ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
404741ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
404841ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
4049e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
4050e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
4051e7a7b84eSVeerendranath Jakkam  *	@link_id will be -1 for non-MLO connection. For MLO connection,
4052e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr
4053e7a7b84eSVeerendranath Jakkam  *	will be peer's MLD address for MLO pairwise key.
405441ade00fSJohannes Berg  *
405541ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
4056e7a7b84eSVeerendranath Jakkam  *	and @key_index, return -ENOENT if the key doesn't exist. @link_id will
4057e7a7b84eSVeerendranath Jakkam  *	be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0
4058e7a7b84eSVeerendranath Jakkam  *	for group key and -1 for pairwise key, @mac_addr will be peer's MLD
4059e7a7b84eSVeerendranath Jakkam  *	address for MLO pairwise key.
406041ade00fSJohannes Berg  *
4061e7a7b84eSVeerendranath Jakkam  * @set_default_key: set the default key on an interface. @link_id will be >= 0
4062e7a7b84eSVeerendranath Jakkam  *	for MLO connection and -1 for non-MLO connection.
4063ed1b6cc7SJohannes Berg  *
4064e7a7b84eSVeerendranath Jakkam  * @set_default_mgmt_key: set the default management frame key on an interface.
4065e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
40661f7e9f46SJohannes Berg  *
4067e7a7b84eSVeerendranath Jakkam  * @set_default_beacon_key: set the default Beacon frame key on an interface.
4068e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
40693cfcf6acSJouni Malinen  *
4070e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
4071e5497d76SJohannes Berg  *
4072c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
4073c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
4074c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
4075c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
40765727ef1bSJohannes Berg  *
40775727ef1bSJohannes Berg  * @add_station: Add a new station.
407889c771e5SJouni Malinen  * @del_station: Remove a station
4079bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
4080bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
4081bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
408277ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
408377ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
4084abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
4085abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
4086abe37c4bSJohannes Berg  *
4087abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
4088abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
4089abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
4090abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
4091abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
409266be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
409366be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
4094f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
40958d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4096f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
40978d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
40982ec600d6SLuis Carlos Cobo  *
409924bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
410093da9cc1Scolin@cozybit.com  *
410124bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
410293da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
410393da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
410493da9cc1Scolin@cozybit.com  *
41059f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
410631888487SJouni Malinen  *
41075db25290SBenjamin Berg  * @inform_bss: Called by cfg80211 while being informed about new BSS data
41085db25290SBenjamin Berg  *	for every BSS found within the reported data or frame. This is called
41095db25290SBenjamin Berg  *	from within the cfg8011 inform_bss handlers while holding the bss_lock.
41105db25290SBenjamin Berg  *	The data parameter is passed through from drv_data inside
41115db25290SBenjamin Berg  *	struct cfg80211_inform_bss.
41125db25290SBenjamin Berg  *	The new IE data for the BSS is explicitly passed.
41135db25290SBenjamin Berg  *
411431888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
411572bdcf34SJouni Malinen  *
4116e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
4117e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
4118e8c9bd5bSJohannes Berg  *	join the mesh instead.
4119e8c9bd5bSJohannes Berg  *
4120e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
4121e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
4122e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
4123e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
41249aed3cc1SJouni Malinen  *
41252a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
41262a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
41272a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
41282a519311SJohannes Berg  *	the scan/scan_done bracket too.
412991d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
413091d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
4131636a5d36SJouni Malinen  *
4132636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
41338d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4134636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
41358d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4136636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
41378d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4138636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
41398d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
414004a773adSJohannes Berg  *
4141b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
4142bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
4143bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
4144bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
4145bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
4146bf1ecd21SJouni Malinen  *	was received.
4147bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
4148bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
4149bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
4150bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
4151bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
4152bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
4153bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
415435eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
4155bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
4156bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
4157bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
415829ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
4159088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
4160088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
4161088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
4162088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
4163088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
4164088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
4165088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
4166088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
41670711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
41680711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
41690711d638SIlan Peer  *      case connection was already established (invoked with the
41700711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
4171b23aa676SSamuel Ortiz  *
417204a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
417304a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
417404a773adSJohannes Berg  *	to a merge.
41758d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
417604a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
41778d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4178b9a5f8caSJouni Malinen  *
4179f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
4180f4e583c8SAntonio Quartulli  *	MESH mode)
4181f4e583c8SAntonio Quartulli  *
4182b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
4183b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
4184b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
4185b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
41867643a2c3SJohannes Berg  *
41871432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
4188c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
4189c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
4190c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
4191c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
41927643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
41931f87f7d3SJohannes Berg  *	return 0 if successful
41941f87f7d3SJohannes Berg  *
41951f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
41961f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
4197aff89a9bSJohannes Berg  *
419861fa713cSHolger Schurig  * @dump_survey: get site survey information.
419961fa713cSHolger Schurig  *
42009588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
42019588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
42029588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
42039588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
42049588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
42059588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
42069588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
42079588bbd5SJouni Malinen  *	the duration value.
4208f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
4209f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
4210f7ca38dfSJohannes Berg  *	frame on another channel
42119588bbd5SJouni Malinen  *
4212fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
421371063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
421471063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
421571063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
421671063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
421771063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
421871063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
421967fbb16bSSamuel Ortiz  *
4220abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
4221abe37c4bSJohannes Berg  *
422267fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
422367fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
422467fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
422567fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
422667fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
42279043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
42289043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
4229d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
4230e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
4231e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
4232e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
4233e86abc68SJohannes Berg  *	disabled.)
42344a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
42354a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
42364a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
42374a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
42384a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
423984f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
424084f10708SThomas Pedersen  *	thresholds.
4241807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
42423a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
42433a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
42443a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
42453a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
42463a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
42473a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
424867fbb16bSSamuel Ortiz  *
42496cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
42506cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
4251547025d5SBruno Randolf  *
4252547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
4253547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
4254547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
4255547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
4256547025d5SBruno Randolf  *
4257547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
42583677713bSJohn W. Linville  *
4259109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
4260109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
42617f6cf311SJohannes Berg  *
42627f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
42637f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
42641d9d9213SSimon Wunderlich  *
42651d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
4266d6199218SBen Greear  *
42675b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
42685b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
42695b7ccaf3SJohannes Berg  *	current monitoring channel.
427098104fdeSJohannes Berg  *
427198104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
427298104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
427377765eafSVasanthakumar Thiagarajan  *
427477765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
427577765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
427677765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
427777765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
427877765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
427977765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
428004f39047SSimon Wunderlich  *
428104f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
42828bf24293SJouni Malinen  *
428326ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
428426ec17a1SOrr Mazor  *	was finished on another phy.
428526ec17a1SOrr Mazor  *
42868bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
42878bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
42888bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
42895de17984SArend van Spriel  *
42905de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
42915de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
42925de17984SArend van Spriel  *	driver can take the most appropriate actions.
42935de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
42945de17984SArend van Spriel  *	reliability. This operation can not fail.
4295be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
429616ef1fe2SSimon Wunderlich  *
429797dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
429897dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
429997dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
430097dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
430197dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
430297dc94f1SMichal Kazior  *	as soon as possible.
4303fa9ffc74SKyeyoon Park  *
4304fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
4305e16821bcSJouni Malinen  *
4306e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
4307e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
4308e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
4309960d01acSJohannes Berg  *
4310960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4311960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4312960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4313960d01acSJohannes Berg  *	account.
4314960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4315960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4316960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4317960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4318960d01acSJohannes Berg  *	rejected)
4319960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
43206e0bd6c3SRostislav Lisovy  *
43216e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
43226e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
43236e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
43246e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
43251057d35eSArik Nemtsov  *
43261057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
43271057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
43281057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
43291057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
43301057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4331cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4332cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4333a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4334a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4335a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4336a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4337a442b761SAyala Beker  *	cfg80211_free_nan_func().
4338a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4339a442b761SAyala Beker  *	provided @nan_func.
4340a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4341a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4342a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4343a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4344ce0ce13aSMichael Braun  *
4345ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
43463a00df57SAvraham Stern  *
434752539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
434852539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
434952539ca8SToke Høiland-Jørgensen  *
43503a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
43513a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
43523a00df57SAvraham Stern  *	upon which the driver should clear it.
43533a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
43543a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
43553a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
435640cbfa90SSrinivas Dasari  *
435740cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
435840cbfa90SSrinivas Dasari  *     user space
43592576a9acSDenis Kenzior  *
43602576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
43612576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
436281e54d08SPradeep Kumar Chitrapu  *
436381e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
436481e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
43659bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
43669bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4367cb74e977SSunil Dutt  *
4368cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4369cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4370cb74e977SSunil Dutt  *	DH IE through this interface.
43715ab92e7fSRajkumar Manoharan  *
43725ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
43735ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
437477f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
437577f576deSTamizh chelvam  *	This callback may sleep.
43763710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
43773710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
437870b6ff35SJohannes Berg  *
437970b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
43800d2ab3aeSJohn Crispin  *
43810d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4382e306784aSSubrat Mishra  *
4383e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4384e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4385e306784aSSubrat Mishra  *	Response frame.
4386bc2dfc02SLorenzo Bianconi  *
4387a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4388bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4389bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4390a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4391bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4392bc2dfc02SLorenzo Bianconi  *	radar channel.
4393bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4394a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4395577e5b8cSShaul Triebitz  * @add_link_station: Add a link to a station.
4396577e5b8cSShaul Triebitz  * @mod_link_station: Modify a link of a station.
4397577e5b8cSShaul Triebitz  * @del_link_station: Remove a link of a station.
4398cbbaf2bbSAvraham Stern  *
4399cbbaf2bbSAvraham Stern  * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
4400704232c2SJohannes Berg  */
4401704232c2SJohannes Berg struct cfg80211_ops {
4402ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
44030378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
44046d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
44050378b3f1SJohannes Berg 
440684efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4407552bff0cSJohannes Berg 						  const char *name,
44086bab2e19STom Gundersen 						  unsigned char name_assign_type,
4409f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
44102ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
441184efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
441284efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4413e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4414e36d56b6SJohannes Berg 				       struct net_device *dev,
4415818a986eSJohannes Berg 				       enum nl80211_iftype type,
44162ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
441741ade00fSJohannes Berg 
4418f2a0290bSJohannes Berg 	int	(*add_intf_link)(struct wiphy *wiphy,
4419f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4420f2a0290bSJohannes Berg 				 unsigned int link_id);
4421f2a0290bSJohannes Berg 	void	(*del_intf_link)(struct wiphy *wiphy,
4422f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4423f2a0290bSJohannes Berg 				 unsigned int link_id);
4424f2a0290bSJohannes Berg 
442541ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4426e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4427e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr, struct key_params *params);
442841ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4429e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4430e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr, void *cookie,
443141ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
443241ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4433e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4434e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr);
443541ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
4436e7a7b84eSVeerendranath Jakkam 				   struct net_device *netdev, int link_id,
4437dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
44383cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
4439e7a7b84eSVeerendranath Jakkam 					struct net_device *netdev, int link_id,
44403cfcf6acSJouni Malinen 					u8 key_index);
444156be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
444256be393fSJouni Malinen 					  struct net_device *netdev,
4443e7a7b84eSVeerendranath Jakkam 					  int link_id,
444456be393fSJouni Malinen 					  u8 key_index);
4445ed1b6cc7SJohannes Berg 
44468860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
44478860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
44488860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
44498860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
44507b0a0e3cSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
44517b0a0e3cSJohannes Berg 			   unsigned int link_id);
44525727ef1bSJohannes Berg 
44535727ef1bSJohannes Berg 
44545727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
44553b3a0162SJohannes Berg 			       const u8 *mac,
44563b3a0162SJohannes Berg 			       struct station_parameters *params);
44575727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
445889c771e5SJouni Malinen 			       struct station_del_parameters *params);
44595727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
44603b3a0162SJohannes Berg 				  const u8 *mac,
44613b3a0162SJohannes Berg 				  struct station_parameters *params);
4462fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
44633b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
44642ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
44652ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
44662ec600d6SLuis Carlos Cobo 
44672ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
44683b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
44692ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
44703b3a0162SJohannes Berg 			       const u8 *dst);
44712ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
44723b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
44732ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
44743b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
44752ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
44762ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
44772ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
447866be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
447966be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
448066be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
448166be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
448266be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
448324bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
448493da9cc1Scolin@cozybit.com 				struct net_device *dev,
448593da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
448624bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
448729cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
448829cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
448929cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
449029cbe68cSJohannes Berg 			     const struct mesh_config *conf,
449129cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
449229cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
449329cbe68cSJohannes Berg 
44946e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
44956e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
44966e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
44976e0bd6c3SRostislav Lisovy 
44989f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
44999f1ba906SJouni Malinen 			      struct bss_parameters *params);
450031888487SJouni Malinen 
45015db25290SBenjamin Berg 	void	(*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,
45025db25290SBenjamin Berg 			      const struct cfg80211_bss_ies *ies, void *data);
45035db25290SBenjamin Berg 
4504f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
450531888487SJouni Malinen 				  struct ieee80211_txq_params *params);
450672bdcf34SJouni Malinen 
4507e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4508e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4509e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4510e8c9bd5bSJohannes Berg 
4511e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4512683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
45139aed3cc1SJouni Malinen 
4514fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
45152a519311SJohannes Berg 			struct cfg80211_scan_request *request);
451691d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4517636a5d36SJouni Malinen 
4518636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4519636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4520636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4521636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4522636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
452363c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4524636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
452563c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
452604a773adSJohannes Berg 
4527b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4528b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4529088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4530088e8df8Svamsi krishna 					 struct net_device *dev,
4531088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4532088e8df8Svamsi krishna 					 u32 changed);
4533b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4534b23aa676SSamuel Ortiz 			      u16 reason_code);
4535b23aa676SSamuel Ortiz 
453604a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
453704a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
453804a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4539b9a5f8caSJouni Malinen 
4540f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
454157fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4542f4e583c8SAntonio Quartulli 
4543b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
45447643a2c3SJohannes Berg 
4545c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4546fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4547c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4548c8442118SJohannes Berg 				int *dbm);
45491f87f7d3SJohannes Berg 
45501f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4551aff89a9bSJohannes Berg 
4552aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4553fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4554fc73f11fSDavid Spinadel 				void *data, int len);
455571063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
455671063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
455771063f0eSWey-Yi Guy 				 void *data, int len);
4558aff89a9bSJohannes Berg #endif
4559bc92afd9SJohannes Berg 
45609930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
45619930380fSJohannes Berg 				    struct net_device *dev,
45627b0a0e3cSJohannes Berg 				    unsigned int link_id,
45639930380fSJohannes Berg 				    const u8 *peer,
45649930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
45659930380fSJohannes Berg 
456661fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
456761fa713cSHolger Schurig 			int idx, struct survey_info *info);
456861fa713cSHolger Schurig 
456967fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
457067fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
457167fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
457267fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
457367fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
457467fbb16bSSamuel Ortiz 
45759588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
457671bbc994SJohannes Berg 				     struct wireless_dev *wdev,
45779588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
45789588bbd5SJouni Malinen 				     unsigned int duration,
45799588bbd5SJouni Malinen 				     u64 *cookie);
45809588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
458171bbc994SJohannes Berg 					    struct wireless_dev *wdev,
45829588bbd5SJouni Malinen 					    u64 cookie);
45839588bbd5SJouni Malinen 
458471bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4585b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4586b176e629SAndrei Otcheretianski 			   u64 *cookie);
4587f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
458871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4589f7ca38dfSJohannes Berg 				       u64 cookie);
4590026331c4SJouni Malinen 
4591bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4592bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4593d6dc1a38SJuuso Oikarinen 
4594d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4595d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4596d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4597271733cfSJohannes Berg 
45984a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
45994a4b8169SAndrew Zaborowski 					     struct net_device *dev,
46004a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
46014a4b8169SAndrew Zaborowski 
460284f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
460384f10708SThomas Pedersen 				      struct net_device *dev,
460484f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
460584f10708SThomas Pedersen 
46066cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
460771bbc994SJohannes Berg 						   struct wireless_dev *wdev,
46086cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4609afe0cbf8SBruno Randolf 
4610afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4611afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
46123677713bSJohn W. Linville 
4613807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4614807f8a8cSLuciano Coelho 				struct net_device *dev,
4615807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
46163a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
46173a3ecf1dSArend Van Spriel 				   u64 reqid);
4618e5497d76SJohannes Berg 
4619e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4620e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4621109086ceSArik Nemtsov 
4622109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4623c6112046SMukesh Sisodiya 			     const u8 *peer, int link_id,
4624c6112046SMukesh Sisodiya 			     u8 action_code, u8 dialog_token, u16 status_code,
4625c6112046SMukesh Sisodiya 			     u32 peer_capability, bool initiator,
4626c6112046SMukesh Sisodiya 			     const u8 *buf, size_t len);
4627109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
46283b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
46297f6cf311SJohannes Berg 
46307f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
46317f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4632e999882aSJohannes Berg 
46331d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
46341d9d9213SSimon Wunderlich 				  struct net_device *dev,
46351d9d9213SSimon Wunderlich 				  u16 noack_map);
46361d9d9213SSimon Wunderlich 
4637683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
46385b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
46397b0a0e3cSJohannes Berg 			       unsigned int link_id,
4640683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
464198104fdeSJohannes Berg 
464298104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
464398104fdeSJohannes Berg 				    struct wireless_dev *wdev);
464498104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
464598104fdeSJohannes Berg 				   struct wireless_dev *wdev);
464677765eafSVasanthakumar Thiagarajan 
464777765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
464877765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
464904f39047SSimon Wunderlich 
465004f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
465104f39047SSimon Wunderlich 					 struct net_device *dev,
465231559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
465331559f35SJanusz Dziedzic 					 u32 cac_time_ms);
465426ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
465526ec17a1SOrr Mazor 				struct net_device *dev);
4656355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4657355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
46585de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
46595de17984SArend van Spriel 				    struct wireless_dev *wdev,
46605de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
46615de17984SArend van Spriel 				    u16 duration);
46625de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
46635de17984SArend van Spriel 				   struct wireless_dev *wdev);
4664be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4665be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
466616ef1fe2SSimon Wunderlich 
466716ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
466816ef1fe2SSimon Wunderlich 				  struct net_device *dev,
466916ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4670e16821bcSJouni Malinen 
4671fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4672fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4673fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4674e16821bcSJouni Malinen 
4675e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
46767b0a0e3cSJohannes Berg 				    unsigned int link_id,
4677e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4678960d01acSJohannes Berg 
4679960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4680960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4681960d01acSJohannes Berg 			     u16 admitted_time);
4682960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4683960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
46841057d35eSArik Nemtsov 
46851057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
46861057d35eSArik Nemtsov 				       struct net_device *dev,
46871057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
46881057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
46891057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
46901057d35eSArik Nemtsov 					      struct net_device *dev,
46911057d35eSArik Nemtsov 					      const u8 *addr);
4692cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4693cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4694cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4695a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4696a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4697a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4698a442b761SAyala Beker 			       u64 cookie);
4699a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4700a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4701a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4702a5a9dcf2SAyala Beker 				   u32 changes);
4703ce0ce13aSMichael Braun 
4704ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4705ce0ce13aSMichael Braun 					    struct net_device *dev,
4706ce0ce13aSMichael Braun 					    const bool enabled);
47073a00df57SAvraham Stern 
470852539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
470952539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
471052539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
471152539ca8SToke Høiland-Jørgensen 
47123a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
47133a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
47143a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
47153a00df57SAvraham Stern 			   const u8 *aa);
471640cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
471740cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
47182576a9acSDenis Kenzior 
47192576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
47202576a9acSDenis Kenzior 				   struct net_device *dev,
47212576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
47228d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
472367207babSAndrei Otcheretianski 				   const bool noencrypt, int link_id,
4724dca9ca2dSMarkus Theil 				   u64 *cookie);
472581e54d08SPradeep Kumar Chitrapu 
472681e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
472781e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
472881e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
47299bb7e0f2SJohannes Berg 
47309bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
47319bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
47329bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
47339bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4734cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4735cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
47365ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
47375ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
473877f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
47393710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
474077f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
47413710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
47426bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
47436bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
47440d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
47450d2ab3aeSJohn Crispin 				struct net_device *dev,
47460d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4747e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4748e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4749a95bfb87SLorenzo Bianconi 	int	(*set_radar_background)(struct wiphy *wiphy,
4750bc2dfc02SLorenzo Bianconi 					struct cfg80211_chan_def *chandef);
4751577e5b8cSShaul Triebitz 	int	(*add_link_station)(struct wiphy *wiphy, struct net_device *dev,
4752577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4753577e5b8cSShaul Triebitz 	int	(*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,
4754577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4755577e5b8cSShaul Triebitz 	int	(*del_link_station)(struct wiphy *wiphy, struct net_device *dev,
4756577e5b8cSShaul Triebitz 				    struct link_station_del_parameters *params);
4757cbbaf2bbSAvraham Stern 	int	(*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,
4758cbbaf2bbSAvraham Stern 				    struct cfg80211_set_hw_timestamp *hwts);
4759704232c2SJohannes Berg };
4760704232c2SJohannes Berg 
4761d3236553SJohannes Berg /*
4762d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4763d3236553SJohannes Berg  * and registration/helper functions
4764d3236553SJohannes Berg  */
4765d3236553SJohannes Berg 
4766d3236553SJohannes Berg /**
47675be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
47685be83de5SJohannes Berg  *
4769c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4770c8cb5b85STova Mussai  *	 into two, first for legacy bands and second for UHB.
47715be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
47725be83de5SJohannes Berg  *	wiphy at all
47735be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
47745be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
47755be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
47765be83de5SJohannes Berg  *	reason to override the default
47779bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
477833d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
477933d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
47809bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4781c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4782c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4783c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4784e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
478515d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
478615d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4787f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4788f4b34b55SVivek Natarajan  *	firmware.
4789cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4790109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4791109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4792109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4793109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4794109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4795109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4796562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
47975e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
47985e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
47995e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
480087bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
480187bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
48027c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
48037c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
48042f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
480516ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
480616ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4807093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
48087b0a0e3cSJohannes Berg  * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
48097b0a0e3cSJohannes Berg  *	in order to not have them reachable in normal drivers, until we have
48107b0a0e3cSJohannes Berg  *	complete feature/interface combinations/etc. advertisement. No driver
48117b0a0e3cSJohannes Berg  *	should set this flag for now.
4812648fba79SShivani Baranwal  * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.
4813d99975c4SWen Gong  * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for
4814d99975c4SWen Gong  *	NL80211_REGDOM_SET_BY_DRIVER.
48155be83de5SJohannes Berg  */
48165be83de5SJohannes Berg enum wiphy_flags {
4817093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
48187b0a0e3cSJohannes Berg 	WIPHY_FLAG_SUPPORTS_MLO			= BIT(1),
4819c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
48205be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
48215be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
48229bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
48239bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4824c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4825309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
482615d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4827648fba79SShivani Baranwal 	WIPHY_FLAG_SUPPORTS_EXT_KCK_32          = BIT(11),
48288e8b41f9SJohannes Berg 	/* use hole at 12 */
4829f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4830cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4831109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4832109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4833562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
48345e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
483587bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
48367c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
48377c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
48382f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
483916ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4840d99975c4SWen Gong 	WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER	= BIT(24),
48417527a782SJohannes Berg };
48427527a782SJohannes Berg 
48437527a782SJohannes Berg /**
48447527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
48457527a782SJohannes Berg  * @max: maximum number of interfaces of these types
48467527a782SJohannes Berg  * @types: interface types (bits)
48477527a782SJohannes Berg  */
48487527a782SJohannes Berg struct ieee80211_iface_limit {
48497527a782SJohannes Berg 	u16 max;
48507527a782SJohannes Berg 	u16 types;
48517527a782SJohannes Berg };
48527527a782SJohannes Berg 
48537527a782SJohannes Berg /**
48547527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
48557527a782SJohannes Berg  *
4856b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4857b80edbc1SLuciano Coelho  * combinations it supports concurrently.
48587527a782SJohannes Berg  *
4859b80edbc1SLuciano Coelho  * Examples:
4860b80edbc1SLuciano Coelho  *
4861b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
48627527a782SJohannes Berg  *
4863819bf593SJohannes Berg  *    .. code-block:: c
4864819bf593SJohannes Berg  *
48657527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
48667527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
48674d371d6eSPhilipp Hortmann  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP), },
48687527a782SJohannes Berg  *	};
48697527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
48707527a782SJohannes Berg  *		.limits = limits1,
48717527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
48727527a782SJohannes Berg  *		.max_interfaces = 2,
48737527a782SJohannes Berg  *		.beacon_int_infra_match = true,
48747527a782SJohannes Berg  *	};
48757527a782SJohannes Berg  *
48767527a782SJohannes Berg  *
4877b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
48787527a782SJohannes Berg  *
4879819bf593SJohannes Berg  *    .. code-block:: c
4880819bf593SJohannes Berg  *
48817527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
48827527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
48837527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
48847527a782SJohannes Berg  *	};
48857527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
48867527a782SJohannes Berg  *		.limits = limits2,
48877527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
48887527a782SJohannes Berg  *		.max_interfaces = 8,
48897527a782SJohannes Berg  *		.num_different_channels = 1,
48907527a782SJohannes Berg  *	};
48917527a782SJohannes Berg  *
48927527a782SJohannes Berg  *
4893b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4894b80edbc1SLuciano Coelho  *
48957527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
48967527a782SJohannes Berg  *
4897819bf593SJohannes Berg  *    .. code-block:: c
4898819bf593SJohannes Berg  *
48997527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
49007527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
49017527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
49027527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
49037527a782SJohannes Berg  *	};
49047527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
49057527a782SJohannes Berg  *		.limits = limits3,
49067527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
49077527a782SJohannes Berg  *		.max_interfaces = 4,
49087527a782SJohannes Berg  *		.num_different_channels = 2,
49097527a782SJohannes Berg  *	};
4910819bf593SJohannes Berg  *
49117527a782SJohannes Berg  */
49127527a782SJohannes Berg struct ieee80211_iface_combination {
4913c6c94aeaSJohannes Berg 	/**
4914c6c94aeaSJohannes Berg 	 * @limits:
4915c6c94aeaSJohannes Berg 	 * limits for the given interface types
4916c6c94aeaSJohannes Berg 	 */
49177527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4918c6c94aeaSJohannes Berg 
4919c6c94aeaSJohannes Berg 	/**
4920c6c94aeaSJohannes Berg 	 * @num_different_channels:
4921c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4922c6c94aeaSJohannes Berg 	 */
49237527a782SJohannes Berg 	u32 num_different_channels;
4924c6c94aeaSJohannes Berg 
4925c6c94aeaSJohannes Berg 	/**
4926c6c94aeaSJohannes Berg 	 * @max_interfaces:
4927c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4928c6c94aeaSJohannes Berg 	 */
49297527a782SJohannes Berg 	u16 max_interfaces;
4930c6c94aeaSJohannes Berg 
4931c6c94aeaSJohannes Berg 	/**
4932c6c94aeaSJohannes Berg 	 * @n_limits:
4933c6c94aeaSJohannes Berg 	 * number of limitations
4934c6c94aeaSJohannes Berg 	 */
49357527a782SJohannes Berg 	u8 n_limits;
4936c6c94aeaSJohannes Berg 
4937c6c94aeaSJohannes Berg 	/**
4938c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4939c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4940c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4941c6c94aeaSJohannes Berg 	 */
49427527a782SJohannes Berg 	bool beacon_int_infra_match;
4943c6c94aeaSJohannes Berg 
4944c6c94aeaSJohannes Berg 	/**
4945c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4946c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4947c6c94aeaSJohannes Berg 	 */
494811c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4949c6c94aeaSJohannes Berg 
4950c6c94aeaSJohannes Berg 	/**
4951c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4952c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4953c6c94aeaSJohannes Berg 	 */
49548c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4955c6c94aeaSJohannes Berg 
4956c6c94aeaSJohannes Berg 	/**
4957c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4958c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4959c6c94aeaSJohannes Berg 	 *
4960c6c94aeaSJohannes Berg 	 * = 0
4961c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4962c6c94aeaSJohannes Berg 	 * > 0
4963c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4964c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4965c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4966c6c94aeaSJohannes Berg 	 */
49670c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
49685be83de5SJohannes Berg };
49695be83de5SJohannes Berg 
49702e161f78SJohannes Berg struct ieee80211_txrx_stypes {
49712e161f78SJohannes Berg 	u16 tx, rx;
49722e161f78SJohannes Berg };
49732e161f78SJohannes Berg 
49745be83de5SJohannes Berg /**
4975ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4976ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4977ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4978ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4979ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4980ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4981ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4982ff1b6e69SJohannes Berg  *	(see nl80211.h)
4983ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
498477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
498577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
498677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
498777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
498877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
49898cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4990ff1b6e69SJohannes Berg  */
4991ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4992ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4993ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4994ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
499577dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
499677dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
499777dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
499877dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
499977dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
50008cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
5001ff1b6e69SJohannes Berg };
5002ff1b6e69SJohannes Berg 
50032a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
50042a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
50052a0e047eSJohannes Berg 	u32 data_payload_max;
50062a0e047eSJohannes Berg 	u32 data_interval_max;
50072a0e047eSJohannes Berg 	u32 wake_payload_max;
50082a0e047eSJohannes Berg 	bool seq;
50092a0e047eSJohannes Berg };
50102a0e047eSJohannes Berg 
5011ff1b6e69SJohannes Berg /**
5012ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
5013ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
5014ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
5015ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
5016ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
5017ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
5018bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
50198cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
50208cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
50218cd4d456SLuciano Coelho  *	scheduled scans.
50228cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
50238cd4d456SLuciano Coelho  *	details.
50242a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
5025ff1b6e69SJohannes Berg  */
5026ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
5027ff1b6e69SJohannes Berg 	u32 flags;
5028ff1b6e69SJohannes Berg 	int n_patterns;
5029ff1b6e69SJohannes Berg 	int pattern_max_len;
5030ff1b6e69SJohannes Berg 	int pattern_min_len;
5031bb92d199SAmitkumar Karwar 	int max_pkt_offset;
50328cd4d456SLuciano Coelho 	int max_nd_match_sets;
50332a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
5034ff1b6e69SJohannes Berg };
5035ff1b6e69SJohannes Berg 
5036ff1b6e69SJohannes Berg /**
5037be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
5038be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
5039be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
5040be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
5041be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
5042be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
5043be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
5044be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
5045be29b99aSAmitkumar Karwar  */
5046be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
5047be29b99aSAmitkumar Karwar 	int n_rules;
5048be29b99aSAmitkumar Karwar 	int max_delay;
5049be29b99aSAmitkumar Karwar 	int n_patterns;
5050be29b99aSAmitkumar Karwar 	int pattern_max_len;
5051be29b99aSAmitkumar Karwar 	int pattern_min_len;
5052be29b99aSAmitkumar Karwar 	int max_pkt_offset;
5053be29b99aSAmitkumar Karwar };
5054be29b99aSAmitkumar Karwar 
5055be29b99aSAmitkumar Karwar /**
5056ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
5057ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
5058ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
5059ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
5060ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
5061ad7e718cSJohannes Berg  */
5062ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
5063ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
5064ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
5065ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
5066ad7e718cSJohannes Berg };
5067ad7e718cSJohannes Berg 
5068ad7e718cSJohannes Berg /**
5069466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
5070466b9936Stamizhr@codeaurora.org  *
5071466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
5072466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
5073466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
5074466b9936Stamizhr@codeaurora.org  *
5075466b9936Stamizhr@codeaurora.org  */
5076466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
5077466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
5078466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
5079466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
5080466b9936Stamizhr@codeaurora.org };
5081466b9936Stamizhr@codeaurora.org 
5082466b9936Stamizhr@codeaurora.org /**
5083466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
5084466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
50855e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
50865e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
5087466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
5088466b9936Stamizhr@codeaurora.org  */
5089466b9936Stamizhr@codeaurora.org 
5090466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
5091466b9936Stamizhr@codeaurora.org 	u32 changed;
50925e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
50935e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
5094466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
5095466b9936Stamizhr@codeaurora.org };
5096466b9936Stamizhr@codeaurora.org 
509791046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
5098901bb989SJohannes Berg 
5099466b9936Stamizhr@codeaurora.org /**
5100ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
5101ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
5102ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
5103ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
5104ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
5105ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
51067bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
51077bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
51087bdbe400SJohannes Berg  *	dumpit calls.
5109901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
5110901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
5111901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
5112901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
51137bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
51147bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
51157bdbe400SJohannes Berg  * are used with dump requests.
5116ad7e718cSJohannes Berg  */
5117ad7e718cSJohannes Berg struct wiphy_vendor_command {
5118ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
5119ad7e718cSJohannes Berg 	u32 flags;
5120ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
5121ad7e718cSJohannes Berg 		    const void *data, int data_len);
51227bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
51237bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
51247bdbe400SJohannes Berg 		      unsigned long *storage);
5125901bb989SJohannes Berg 	const struct nla_policy *policy;
5126901bb989SJohannes Berg 	unsigned int maxattr;
5127ad7e718cSJohannes Berg };
5128ad7e718cSJohannes Berg 
5129ad7e718cSJohannes Berg /**
5130019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
5131019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
5132019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
5133019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
5134019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
5135019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
5136019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
5137019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
5138019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
51394e9c3af3SJohannes Berg  * @eml_capabilities: EML capabilities (for MLO)
51404e9c3af3SJohannes Berg  * @mld_capa_and_ops: MLD capabilities and operations (for MLO)
5141019ae3a9SKanchanapally, Vidyullatha  */
5142019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
5143019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
5144019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
5145019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
5146019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
51474e9c3af3SJohannes Berg 	u16 eml_capabilities;
51484e9c3af3SJohannes Berg 	u16 mld_capa_and_ops;
5149019ae3a9SKanchanapally, Vidyullatha };
5150019ae3a9SKanchanapally, Vidyullatha 
5151019ae3a9SKanchanapally, Vidyullatha /**
51527464f665SJohannes Berg  * cfg80211_get_iftype_ext_capa - lookup interface type extended capability
51537464f665SJohannes Berg  * @wiphy: the wiphy to look up from
51547464f665SJohannes Berg  * @type: the interface type to look up
51557464f665SJohannes Berg  */
51567464f665SJohannes Berg const struct wiphy_iftype_ext_capab *
51577464f665SJohannes Berg cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
51587464f665SJohannes Berg 
51597464f665SJohannes Berg /**
51609bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
51619bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
51629bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
51639bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
51642d8b08feSMauro Carvalho Chehab  * @ftm: FTM measurement data
51659bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
51669bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
51679bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
51689bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
51699bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
51709bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
51719bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
51729bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
51739bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
51749bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
51759bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
51769bb7e0f2SJohannes Berg  *	not limited)
5177efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
5178efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
51799bb7e0f2SJohannes Berg  */
51809bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
51819bb7e0f2SJohannes Berg 	unsigned int max_peers;
51829bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
51839bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
51849bb7e0f2SJohannes Berg 
51859bb7e0f2SJohannes Berg 	struct {
51869bb7e0f2SJohannes Berg 		u32 preambles;
51879bb7e0f2SJohannes Berg 		u32 bandwidths;
51889bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
51899bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
51909bb7e0f2SJohannes Berg 		u8 supported:1,
51919bb7e0f2SJohannes Berg 		   asap:1,
51929bb7e0f2SJohannes Berg 		   non_asap:1,
51939bb7e0f2SJohannes Berg 		   request_lci:1,
5194efb5520dSAvraham Stern 		   request_civicloc:1,
5195efb5520dSAvraham Stern 		   trigger_based:1,
5196efb5520dSAvraham Stern 		   non_trigger_based:1;
51979bb7e0f2SJohannes Berg 	} ftm;
51989bb7e0f2SJohannes Berg };
51999bb7e0f2SJohannes Berg 
52009bb7e0f2SJohannes Berg /**
5201d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
5202d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
5203d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
5204d6039a34SVeerendranath Jakkam  *
5205d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
5206d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
5207d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5208d6039a34SVeerendranath Jakkam  */
5209d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
5210d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
5211d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
5212d6039a34SVeerendranath Jakkam 	int n_akm_suites;
5213d6039a34SVeerendranath Jakkam };
5214d6039a34SVeerendranath Jakkam 
5215cbbaf2bbSAvraham Stern #define CFG80211_HW_TIMESTAMP_ALL_PEERS	0xffff
5216cbbaf2bbSAvraham Stern 
5217d6039a34SVeerendranath Jakkam /**
52185be83de5SJohannes Berg  * struct wiphy - wireless hardware description
5219a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
52202784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
52212784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
52222784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
5223d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
5224d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
5225d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
5226d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
5227d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
5228d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
5229d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
5230d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
5231d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
5232d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
5233ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5234d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
5235d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
5236d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
5237d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
5238d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
5239d6039a34SVeerendranath Jakkam  *	suites are specified separately.
5240b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
5241b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
5242b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
5243b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
5244b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
5245abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
5246ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
5247ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
5248ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
52490fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
5250ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
5251ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
5252ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
5253ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
5254ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
5255ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
5256ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
5257ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
5258fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
5259fd235913SRandy Dunlap  *	unregister hardware
5260edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
5261edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
526215bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
526315bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
526415bc6dfbSJérôme Pouiller  *	(see below).
5265abe37c4bSJohannes Berg  * @wext: wireless extension handlers
5266abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
5267abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
5268abe37c4bSJohannes Berg  *	must be set by driver
52697527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
52707527a782SJohannes Berg  *	list single interface types.
52717527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
52727527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
52737527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
5274abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
5275a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
5276a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
52771f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
5278d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
5279d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
5280abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
5281abe37c4bSJohannes Berg  *	this variable determines its size
5282abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
5283abe37c4bSJohannes Berg  *	any given scan
5284ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
5285ca986ad9SArend Van Spriel  *	the device can run concurrently.
528693b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
528793b6aa69SLuciano Coelho  *	for in any given scheduled scan
5288a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
5289a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
5290a1f1c21cSLuciano Coelho  *	supported.
5291abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
5292abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
5293abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
52945a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
52955a865badSLuciano Coelho  *	scans
52963b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
52973b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
52983b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
52993b06d277SAvraham Stern  *	single scan plan supported by the device.
53003b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
53013b06d277SAvraham Stern  *	scan plan supported by the device.
5302abe37c4bSJohannes Berg  * @coverage_class: current coverage class
5303abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
5304abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
5305abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
5306abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
5307abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
5308abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
53092e161f78SJohannes Berg  *
53102e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
53112e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
53122e161f78SJohannes Berg  *	type
5313a7ffac95SBruno Randolf  *
53147f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
53157f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
53167f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
53177f531e03SBruno Randolf  *
53187f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
53197f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
53207f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
5321a293911dSJohannes Berg  *
532215f0ebc2SRandy Dunlap  * @probe_resp_offload:
532315f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
532415f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
532515f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
532615f0ebc2SRandy Dunlap  *
5327a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
5328a293911dSJohannes Berg  *	may request, if implemented.
5329ff1b6e69SJohannes Berg  *
5330ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
53316abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
53326abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
53336abb9cb9SJohannes Berg  *	to the suspend() operation instead.
5334562a7480SJohannes Berg  *
5335562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
53367e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
53377e7c8926SBen Greear  *	If null, then none can be over-ridden.
5338ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
5339ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
534077765eafSVasanthakumar Thiagarajan  *
534153873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
534253873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
534353873f13SJohannes Berg  *
534477765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
534577765eafSVasanthakumar Thiagarajan  *	supports for ACL.
5346a50df0c4SJohannes Berg  *
5347a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
5348a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
5349a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
5350a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
5351019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
5352019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
5353019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
5354a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
5355a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
5356019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
5357019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
5358019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
5359be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
5360ad7e718cSJohannes Berg  *
5361ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5362ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5363567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5364567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5365b43504cfSJouni Malinen  *
5366b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5367b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5368b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5369b43504cfSJouni Malinen  *	some cases, but may not always reach.
5370c2e4323bSLuciano Coelho  *
5371c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5372c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5373c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5374c2e4323bSLuciano Coelho  *	infinite.
537538de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
537638de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
537738de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5378a442b761SAyala Beker  *
53798585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
53808585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
53818585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
53828585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5383f3a7ca64SJohannes Berg  *
5384f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5385f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5386f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
53879bb7e0f2SJohannes Berg  *
5388a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5389a710d214SLothar Rubusch  *	wake_tx_queue
5390a710d214SLothar Rubusch  *
5391213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5392213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5393213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5394213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5395213ed579SSara Sharon  *
53969bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
53973710a8a6SJohannes Berg  *
53983710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
53993710a8a6SJohannes Berg  *	device has
54003710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
54013710a8a6SJohannes Berg  *	supported by the driver for each vif
54023710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
54033710a8a6SJohannes Berg  *	supported by the driver for each peer
54046a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
54056a21d16cSTamizh chelvam  *	long/short retry configuration
5406a710d214SLothar Rubusch  *
5407a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5408a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5409a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
541070b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5411358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5412dc1e3cb8SJohn Crispin  *
5413dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5414dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5415dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5416f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5417dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5418dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5419ecad3b0bSVeerendranath Jakkam  * @max_num_akm_suites: maximum number of AKM suites allowed for
5420ecad3b0bSVeerendranath Jakkam  *	configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
5421ecad3b0bSVeerendranath Jakkam  *	%NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by
5422ecad3b0bSVeerendranath Jakkam  *	driver. If set by driver minimum allowed value is
5423ecad3b0bSVeerendranath Jakkam  *	NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with
5424ecad3b0bSVeerendranath Jakkam  *	legacy userspace and maximum allowed value is
5425ecad3b0bSVeerendranath Jakkam  *	CFG80211_MAX_NUM_AKM_SUITES.
5426cbbaf2bbSAvraham Stern  *
5427cbbaf2bbSAvraham Stern  * @hw_timestamp_max_peers: maximum number of peers that the driver supports
5428cbbaf2bbSAvraham Stern  *	enabling HW timestamping for concurrently. Setting this field to a
5429cbbaf2bbSAvraham Stern  *	non-zero value indicates that the driver supports HW timestamping.
5430cbbaf2bbSAvraham Stern  *	A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver
5431cbbaf2bbSAvraham Stern  *	supports enabling HW timestamping for all peers (i.e. no need to
5432cbbaf2bbSAvraham Stern  *	specify a mac address).
5433d3236553SJohannes Berg  */
5434d3236553SJohannes Berg struct wiphy {
5435a05829a7SJohannes Berg 	struct mutex mtx;
5436a05829a7SJohannes Berg 
5437d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5438d3236553SJohannes Berg 
5439d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5440ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5441ef15aac6SJohannes Berg 
5442ef15aac6SJohannes Berg 	struct mac_address *addresses;
5443d3236553SJohannes Berg 
54442e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
54452e161f78SJohannes Berg 
54467527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
54477527a782SJohannes Berg 	int n_iface_combinations;
54487527a782SJohannes Berg 	u16 software_iftypes;
54497527a782SJohannes Berg 
54502e161f78SJohannes Berg 	u16 n_addresses;
54512e161f78SJohannes Berg 
5452d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5453d3236553SJohannes Berg 	u16 interface_modes;
5454d3236553SJohannes Berg 
545577765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
545677765eafSVasanthakumar Thiagarajan 
5457a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5458d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5459463d0183SJohannes Berg 
5460562a7480SJohannes Berg 	u32 ap_sme_capa;
5461562a7480SJohannes Berg 
5462d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5463d3236553SJohannes Berg 
5464d3236553SJohannes Berg 	int bss_priv_size;
5465d3236553SJohannes Berg 	u8 max_scan_ssids;
5466ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
546793b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5468a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5469d3236553SJohannes Berg 	u16 max_scan_ie_len;
54705a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
54713b06d277SAvraham Stern 	u32 max_sched_scan_plans;
54723b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
54733b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5474d3236553SJohannes Berg 
5475d3236553SJohannes Berg 	int n_cipher_suites;
5476d3236553SJohannes Berg 	const u32 *cipher_suites;
5477d3236553SJohannes Berg 
5478ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5479ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5480ab4dfa20SVeerendranath Jakkam 
5481d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5482d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5483d6039a34SVeerendranath Jakkam 
5484b9a5f8caSJouni Malinen 	u8 retry_short;
5485b9a5f8caSJouni Malinen 	u8 retry_long;
5486b9a5f8caSJouni Malinen 	u32 frag_threshold;
5487b9a5f8caSJouni Malinen 	u32 rts_threshold;
548881077e82SLukáš Turek 	u8 coverage_class;
5489b9a5f8caSJouni Malinen 
549081135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5491dfce95f5SKalle Valo 	u32 hw_version;
5492dfce95f5SKalle Valo 
5493dfb89c56SJohannes Berg #ifdef CONFIG_PM
5494964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
54956abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5496dfb89c56SJohannes Berg #endif
5497ff1b6e69SJohannes Berg 
5498a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5499a293911dSJohannes Berg 
550067fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
550167fbb16bSSamuel Ortiz 
55027f531e03SBruno Randolf 	u32 available_antennas_tx;
55037f531e03SBruno Randolf 	u32 available_antennas_rx;
5504a7ffac95SBruno Randolf 
550587bbbe22SArik Nemtsov 	u32 probe_resp_offload;
550687bbbe22SArik Nemtsov 
5507a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5508a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5509a50df0c4SJohannes Berg 
5510019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5511019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5512019ae3a9SKanchanapally, Vidyullatha 
5513cf5aa2f1SDavid Kilroy 	const void *privid;
5514d3236553SJohannes Berg 
551557fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5516d3236553SJohannes Berg 
55170c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5518d3236553SJohannes Berg 			     struct regulatory_request *request);
5519d3236553SJohannes Berg 
5520d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5521d3236553SJohannes Berg 
5522458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5523d3236553SJohannes Berg 
5524d3236553SJohannes Berg 	struct device dev;
5525d3236553SJohannes Berg 
5526ecb44335SStanislaw Gruszka 	bool registered;
5527ecb44335SStanislaw Gruszka 
5528d3236553SJohannes Berg 	struct dentry *debugfsdir;
5529d3236553SJohannes Berg 
55307e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5531ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
55327e7c8926SBen Greear 
553353873f13SJohannes Berg 	struct list_head wdev_list;
553453873f13SJohannes Berg 
55350c5c9fb5SEric W. Biederman 	possible_net_t _net;
5536463d0183SJohannes Berg 
55373d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
55383d23e349SJohannes Berg 	const struct iw_handler_def *wext;
55393d23e349SJohannes Berg #endif
55403d23e349SJohannes Berg 
5541be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5542be29b99aSAmitkumar Karwar 
5543ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5544567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5545567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5546ad7e718cSJohannes Berg 
5547b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5548b43504cfSJouni Malinen 
55499a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
55509a774c78SAndrei Otcheretianski 
555138de03d2SArend van Spriel 	u32 bss_select_support;
555238de03d2SArend van Spriel 
55538585989dSLuca Coelho 	u8 nan_supported_bands;
55548585989dSLuca Coelho 
555552539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
555652539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
555752539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
555852539ca8SToke Høiland-Jørgensen 
55591f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
55601f6e0baaSJohn Crispin 
5561213ed579SSara Sharon 	u8 support_mbssid:1,
5562213ed579SSara Sharon 	   support_only_he_mbssid:1;
5563213ed579SSara Sharon 
55649bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
55659bb7e0f2SJohannes Berg 
55663710a8a6SJohannes Berg 	struct {
55673710a8a6SJohannes Berg 		u64 peer, vif;
55686a21d16cSTamizh chelvam 		u8 max_retry;
55693710a8a6SJohannes Berg 	} tid_config_support;
55703710a8a6SJohannes Berg 
55716a21d16cSTamizh chelvam 	u8 max_data_retry_count;
55726a21d16cSTamizh chelvam 
55736bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
55746bdb68ceSCarl Huang 
5575358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5576358ae888SEmmanuel Grumbach 
5577dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5578dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5579ecad3b0bSVeerendranath Jakkam 	u16 max_num_akm_suites;
5580dc1e3cb8SJohn Crispin 
5581cbbaf2bbSAvraham Stern 	u16 hw_timestamp_max_peers;
5582cbbaf2bbSAvraham Stern 
5583396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5584d3236553SJohannes Berg };
5585d3236553SJohannes Berg 
5586463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5587463d0183SJohannes Berg {
5588c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5589463d0183SJohannes Berg }
5590463d0183SJohannes Berg 
5591463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5592463d0183SJohannes Berg {
5593c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5594463d0183SJohannes Berg }
5595463d0183SJohannes Berg 
5596d3236553SJohannes Berg /**
5597d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5598d3236553SJohannes Berg  *
5599d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
56000ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5601d3236553SJohannes Berg  */
5602d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5603d3236553SJohannes Berg {
5604d3236553SJohannes Berg 	BUG_ON(!wiphy);
5605d3236553SJohannes Berg 	return &wiphy->priv;
5606d3236553SJohannes Berg }
5607d3236553SJohannes Berg 
5608d3236553SJohannes Berg /**
5609f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5610f1f74825SDavid Kilroy  *
5611f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
56120ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5613f1f74825SDavid Kilroy  */
5614f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5615f1f74825SDavid Kilroy {
5616f1f74825SDavid Kilroy 	BUG_ON(!priv);
5617f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5618f1f74825SDavid Kilroy }
5619f1f74825SDavid Kilroy 
5620f1f74825SDavid Kilroy /**
5621d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5622d3236553SJohannes Berg  *
5623d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5624d3236553SJohannes Berg  * @dev: The device to parent it to
5625d3236553SJohannes Berg  */
5626d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5627d3236553SJohannes Berg {
5628d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5629d3236553SJohannes Berg }
5630d3236553SJohannes Berg 
5631d3236553SJohannes Berg /**
5632d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5633d3236553SJohannes Berg  *
5634d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
56350ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5636d3236553SJohannes Berg  */
5637d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5638d3236553SJohannes Berg {
5639d3236553SJohannes Berg 	return wiphy->dev.parent;
5640d3236553SJohannes Berg }
5641d3236553SJohannes Berg 
5642d3236553SJohannes Berg /**
5643d3236553SJohannes Berg  * wiphy_name - get wiphy name
5644d3236553SJohannes Berg  *
5645d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
56460ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5647d3236553SJohannes Berg  */
5648e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5649d3236553SJohannes Berg {
5650d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5651d3236553SJohannes Berg }
5652d3236553SJohannes Berg 
5653d3236553SJohannes Berg /**
56541998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
56551998d90aSBen Greear  *
56561998d90aSBen Greear  * @ops: The configuration operations for this device
56571998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
56581998d90aSBen Greear  * @requested_name: Request a particular name.
56591998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
56601998d90aSBen Greear  *
56611998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
56621998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
56631998d90aSBen Greear  *
56641998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
56651998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
56661998d90aSBen Greear  */
56671998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
56681998d90aSBen Greear 			   const char *requested_name);
56691998d90aSBen Greear 
56701998d90aSBen Greear /**
5671d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5672d3236553SJohannes Berg  *
5673d3236553SJohannes Berg  * @ops: The configuration operations for this device
5674d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5675d3236553SJohannes Berg  *
5676d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5677d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5678d3236553SJohannes Berg  *
56790ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
56800ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5681d3236553SJohannes Berg  */
56821998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
56831998d90aSBen Greear 				      int sizeof_priv)
56841998d90aSBen Greear {
56851998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
56861998d90aSBen Greear }
5687d3236553SJohannes Berg 
5688d3236553SJohannes Berg /**
5689d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5690d3236553SJohannes Berg  *
5691d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5692d3236553SJohannes Berg  *
56930ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5694d3236553SJohannes Berg  */
569510dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5696d3236553SJohannes Berg 
5697a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5698a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5699a05829a7SJohannes Berg 
5700a05829a7SJohannes Berg /**
5701a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5702a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5703a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5704a05829a7SJohannes Berg  *
5705a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5706a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5707a05829a7SJohannes Berg  */
5708a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5709a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5710a05829a7SJohannes Berg 
5711a05829a7SJohannes Berg /**
5712a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5713a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5714a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5715a05829a7SJohannes Berg  *
5716a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5717a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5718a05829a7SJohannes Berg  */
5719a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5720a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5721a05829a7SJohannes Berg 
5722a05829a7SJohannes Berg /**
5723a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5724a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
5725a05829a7SJohannes Berg  */
5726a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5727a05829a7SJohannes Berg 
5728d3236553SJohannes Berg /**
5729d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5730d3236553SJohannes Berg  *
5731d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5732d3236553SJohannes Berg  *
5733d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5734d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5735d3236553SJohannes Berg  * request that is being handled.
5736d3236553SJohannes Berg  */
573710dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5738d3236553SJohannes Berg 
5739d3236553SJohannes Berg /**
5740d3236553SJohannes Berg  * wiphy_free - free wiphy
5741d3236553SJohannes Berg  *
5742d3236553SJohannes Berg  * @wiphy: The wiphy to free
5743d3236553SJohannes Berg  */
574410dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5745d3236553SJohannes Berg 
5746fffd0934SJohannes Berg /* internal structs */
57476829c878SJohannes Berg struct cfg80211_conn;
574819957bb3SJohannes Berg struct cfg80211_internal_bss;
5749fffd0934SJohannes Berg struct cfg80211_cached_keys;
57504a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
575119957bb3SJohannes Berg 
5752d3236553SJohannes Berg /**
5753a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5754a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5755a05829a7SJohannes Berg  *
5756a3ee4dc8SJohannes Berg  * This is needed around registering and unregistering netdevs that
5757a3ee4dc8SJohannes Berg  * aren't created through cfg80211 calls, since that requires locking
5758a3ee4dc8SJohannes Berg  * in cfg80211 when the notifiers is called, but that cannot
5759a3ee4dc8SJohannes Berg  * differentiate which way it's called.
5760a3ee4dc8SJohannes Berg  *
5761a3ee4dc8SJohannes Berg  * It can also be used by drivers for their own purposes.
5762a05829a7SJohannes Berg  *
5763a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
5764a3ee4dc8SJohannes Berg  *
5765a3ee4dc8SJohannes Berg  * Note that this makes sure that no workers that have been queued
5766a3ee4dc8SJohannes Berg  * with wiphy_queue_work() are running.
5767a05829a7SJohannes Berg  */
5768a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
5769a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
5770a05829a7SJohannes Berg {
5771a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
5772a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
5773a05829a7SJohannes Berg }
5774a05829a7SJohannes Berg 
5775a05829a7SJohannes Berg /**
5776a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
5777a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
5778a05829a7SJohannes Berg  */
5779a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
5780a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
5781a05829a7SJohannes Berg {
5782a05829a7SJohannes Berg 	__release(&wiphy->mtx);
5783a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
5784a05829a7SJohannes Berg }
5785a05829a7SJohannes Berg 
5786a3ee4dc8SJohannes Berg struct wiphy_work;
5787a3ee4dc8SJohannes Berg typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);
5788a3ee4dc8SJohannes Berg 
5789a3ee4dc8SJohannes Berg struct wiphy_work {
5790a3ee4dc8SJohannes Berg 	struct list_head entry;
5791a3ee4dc8SJohannes Berg 	wiphy_work_func_t func;
5792a3ee4dc8SJohannes Berg };
5793a3ee4dc8SJohannes Berg 
5794a3ee4dc8SJohannes Berg static inline void wiphy_work_init(struct wiphy_work *work,
5795a3ee4dc8SJohannes Berg 				   wiphy_work_func_t func)
5796a3ee4dc8SJohannes Berg {
5797a3ee4dc8SJohannes Berg 	INIT_LIST_HEAD(&work->entry);
5798a3ee4dc8SJohannes Berg 	work->func = func;
5799a3ee4dc8SJohannes Berg }
5800a3ee4dc8SJohannes Berg 
5801a3ee4dc8SJohannes Berg /**
5802a3ee4dc8SJohannes Berg  * wiphy_work_queue - queue work for the wiphy
5803a3ee4dc8SJohannes Berg  * @wiphy: the wiphy to queue for
5804a3ee4dc8SJohannes Berg  * @work: the work item
5805a3ee4dc8SJohannes Berg  *
5806a3ee4dc8SJohannes Berg  * This is useful for work that must be done asynchronously, and work
5807a3ee4dc8SJohannes Berg  * queued here has the special property that the wiphy mutex will be
5808a3ee4dc8SJohannes Berg  * held as if wiphy_lock() was called, and that it cannot be running
5809a3ee4dc8SJohannes Berg  * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
5810a3ee4dc8SJohannes Berg  * use just cancel_work() instead of cancel_work_sync(), it requires
5811a3ee4dc8SJohannes Berg  * being in a section protected by wiphy_lock().
5812a3ee4dc8SJohannes Berg  */
5813a3ee4dc8SJohannes Berg void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);
5814a3ee4dc8SJohannes Berg 
5815a3ee4dc8SJohannes Berg /**
5816a3ee4dc8SJohannes Berg  * wiphy_work_cancel - cancel previously queued work
5817a3ee4dc8SJohannes Berg  * @wiphy: the wiphy, for debug purposes
5818a3ee4dc8SJohannes Berg  * @work: the work to cancel
5819a3ee4dc8SJohannes Berg  *
5820a3ee4dc8SJohannes Berg  * Cancel the work *without* waiting for it, this assumes being
5821a3ee4dc8SJohannes Berg  * called under the wiphy mutex acquired by wiphy_lock().
5822a3ee4dc8SJohannes Berg  */
5823a3ee4dc8SJohannes Berg void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);
5824a3ee4dc8SJohannes Berg 
5825a3ee4dc8SJohannes Berg struct wiphy_delayed_work {
5826a3ee4dc8SJohannes Berg 	struct wiphy_work work;
5827a3ee4dc8SJohannes Berg 	struct wiphy *wiphy;
5828a3ee4dc8SJohannes Berg 	struct timer_list timer;
5829a3ee4dc8SJohannes Berg };
5830a3ee4dc8SJohannes Berg 
5831a3ee4dc8SJohannes Berg void wiphy_delayed_work_timer(struct timer_list *t);
5832a3ee4dc8SJohannes Berg 
5833a3ee4dc8SJohannes Berg static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,
5834a3ee4dc8SJohannes Berg 					   wiphy_work_func_t func)
5835a3ee4dc8SJohannes Berg {
5836a3ee4dc8SJohannes Berg 	timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);
5837a3ee4dc8SJohannes Berg 	wiphy_work_init(&dwork->work, func);
5838a3ee4dc8SJohannes Berg }
5839a3ee4dc8SJohannes Berg 
5840a3ee4dc8SJohannes Berg /**
5841a3ee4dc8SJohannes Berg  * wiphy_delayed_work_queue - queue delayed work for the wiphy
5842a3ee4dc8SJohannes Berg  * @wiphy: the wiphy to queue for
5843a3ee4dc8SJohannes Berg  * @dwork: the delayable worker
5844a3ee4dc8SJohannes Berg  * @delay: number of jiffies to wait before queueing
5845a3ee4dc8SJohannes Berg  *
5846a3ee4dc8SJohannes Berg  * This is useful for work that must be done asynchronously, and work
5847a3ee4dc8SJohannes Berg  * queued here has the special property that the wiphy mutex will be
5848a3ee4dc8SJohannes Berg  * held as if wiphy_lock() was called, and that it cannot be running
5849a3ee4dc8SJohannes Berg  * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
5850a3ee4dc8SJohannes Berg  * use just cancel_work() instead of cancel_work_sync(), it requires
5851a3ee4dc8SJohannes Berg  * being in a section protected by wiphy_lock().
5852a3ee4dc8SJohannes Berg  */
5853a3ee4dc8SJohannes Berg void wiphy_delayed_work_queue(struct wiphy *wiphy,
5854a3ee4dc8SJohannes Berg 			      struct wiphy_delayed_work *dwork,
5855a3ee4dc8SJohannes Berg 			      unsigned long delay);
5856a3ee4dc8SJohannes Berg 
5857a3ee4dc8SJohannes Berg /**
5858a3ee4dc8SJohannes Berg  * wiphy_delayed_work_cancel - cancel previously queued delayed work
5859a3ee4dc8SJohannes Berg  * @wiphy: the wiphy, for debug purposes
5860a3ee4dc8SJohannes Berg  * @dwork: the delayed work to cancel
5861a3ee4dc8SJohannes Berg  *
5862a3ee4dc8SJohannes Berg  * Cancel the work *without* waiting for it, this assumes being
5863a3ee4dc8SJohannes Berg  * called under the wiphy mutex acquired by wiphy_lock().
5864a3ee4dc8SJohannes Berg  */
5865a3ee4dc8SJohannes Berg void wiphy_delayed_work_cancel(struct wiphy *wiphy,
5866a3ee4dc8SJohannes Berg 			       struct wiphy_delayed_work *dwork);
5867a3ee4dc8SJohannes Berg 
5868a05829a7SJohannes Berg /**
586989a54e48SJohannes Berg  * struct wireless_dev - wireless device state
5870d3236553SJohannes Berg  *
587189a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
587289a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
587389a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
587489a54e48SJohannes Berg  * It need not be registered then as netdev registration will
5875a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
5876a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
5877a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
5878a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
587989a54e48SJohannes Berg  *
588089a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
588189a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
588289a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
588389a54e48SJohannes Berg  * allocated outside of callback operations that return it.
5884d3236553SJohannes Berg  *
5885d3236553SJohannes Berg  * @wiphy: pointer to hardware description
5886d3236553SJohannes Berg  * @iftype: interface type
58872fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
588840c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
588940c575d1SJohannes Berg  *	for the notifier
5890d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
589189a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
589289a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
589389a54e48SJohannes Berg  *	wireless device if it has no netdev
58942d8b08feSMauro Carvalho Chehab  * @u: union containing data specific to @iftype
58957b0a0e3cSJohannes Berg  * @connected: indicates if connected or not (STA mode)
5896d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
5897d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
58989874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
58999874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
59009874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
59019874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
59029874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
59039874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
59049874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
59059874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
59069874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
59079874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
59089874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
59099bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
59109bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
59119bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
59129bc383deSJohannes Berg  *	by cfg80211 on change_interface
59132e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
591479ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
591579ea1e12SJohannes Berg  *	need to propagate the update to the driver
59168d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
59178d61ffa5SJohannes Berg  *	and some API functions require it held
591856d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
591956d1893dSJohannes Berg  *	beacons, 0 when not valid
592098104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
592173c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
592273c7da3dSArend Van Spriel  *	the P2P Device.
592304f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
592404f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
592531559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
5926780b40dfSJohannes Berg  * @ps: powersave mode is enabled
5927780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
5928780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
5929780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
5930780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
5931780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
593234d50519SLior David  * @conn_bss_type: connecting/connected BSS type
5933bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
5934bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
5935bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5936780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
5937780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
593878f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5939ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
59404a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
59419bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
59429bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
59439bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
59444d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
59454d797fceSJouni Malinen  *	unprotected beacon report
59462d8b08feSMauro Carvalho Chehab  * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
59472d8b08feSMauro Carvalho Chehab  *	@ap and @client for each link
59482d8b08feSMauro Carvalho Chehab  * @valid_links: bitmap describing what elements of @links are valid
5949d3236553SJohannes Berg  */
5950d3236553SJohannes Berg struct wireless_dev {
5951d3236553SJohannes Berg 	struct wiphy *wiphy;
5952d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5953d3236553SJohannes Berg 
5954667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5955d3236553SJohannes Berg 	struct list_head list;
5956d3236553SJohannes Berg 	struct net_device *netdev;
5957d3236553SJohannes Berg 
595889a54e48SJohannes Berg 	u32 identifier;
595989a54e48SJohannes Berg 
59602e161f78SJohannes Berg 	struct list_head mgmt_registrations;
596179ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
5962026331c4SJouni Malinen 
5963667503ddSJohannes Berg 	struct mutex mtx;
5964667503ddSJohannes Berg 
596540c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
596698104fdeSJohannes Berg 
596798104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
59689bc383deSJohannes Berg 
5969b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
59706829c878SJohannes Berg 	struct cfg80211_conn *conn;
5971fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
597234d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5973bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5974bd2522b1SAndrzej Zaborowski 
5975bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5976bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5977d3236553SJohannes Berg 
5978667503ddSJohannes Berg 	struct list_head event_list;
5979667503ddSJohannes Berg 	spinlock_t event_lock;
5980667503ddSJohannes Berg 
59817b0a0e3cSJohannes Berg 	u8 connected:1;
5982f4489ebeSMichal Kazior 
5983ffb9eb3dSKalle Valo 	bool ps;
5984ffb9eb3dSKalle Valo 	int ps_timeout;
5985ffb9eb3dSKalle Valo 
598615e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
598728946da7SJohannes Berg 
5988ab81007aSJohannes Berg 	u32 owner_nlportid;
5989ab81007aSJohannes Berg 	bool nl_owner_dead;
5990ab81007aSJohannes Berg 
59917b0a0e3cSJohannes Berg 	/* FIXME: need to rework radar detection for MLO */
599204f39047SSimon Wunderlich 	bool cac_started;
599304f39047SSimon Wunderlich 	unsigned long cac_start_time;
599431559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
599504f39047SSimon Wunderlich 
59963d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5997d3236553SJohannes Berg 	/* wext data */
5998cbe8fa9cSJohannes Berg 	struct {
5999cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
6000f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
6001fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
6002c1e5f471SJohannes Berg 		const u8 *ie;
6003f2129354SJohannes Berg 		size_t ie_len;
60049874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
60059874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
6006f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
600708645126SJohannes Berg 		s8 default_key, default_mgmt_key;
6008ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
6009cbe8fa9cSJohannes Berg 	} wext;
6010d3236553SJohannes Berg #endif
60114a4b8169SAndrew Zaborowski 
60124a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
60139bb7e0f2SJohannes Berg 
60149bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
60159bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
60169bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
60174d797fceSJouni Malinen 
60184d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
60197b0a0e3cSJohannes Berg 
60207b0a0e3cSJohannes Berg 	union {
60217b0a0e3cSJohannes Berg 		struct {
60227b0a0e3cSJohannes Berg 			u8 connected_addr[ETH_ALEN] __aligned(2);
60237b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
60247b0a0e3cSJohannes Berg 			u8 ssid_len;
60257b0a0e3cSJohannes Berg 		} client;
60267b0a0e3cSJohannes Berg 		struct {
60277b0a0e3cSJohannes Berg 			int beacon_interval;
60287b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
60297b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
60307b0a0e3cSJohannes Berg 			u8 id[IEEE80211_MAX_SSID_LEN];
60317b0a0e3cSJohannes Berg 			u8 id_len, id_up_len;
60327b0a0e3cSJohannes Berg 		} mesh;
60337b0a0e3cSJohannes Berg 		struct {
60347b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
60357b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
60367b0a0e3cSJohannes Berg 			u8 ssid_len;
60377b0a0e3cSJohannes Berg 		} ap;
60387b0a0e3cSJohannes Berg 		struct {
60397b0a0e3cSJohannes Berg 			struct cfg80211_internal_bss *current_bss;
60407b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
60417b0a0e3cSJohannes Berg 			int beacon_interval;
60427b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
60437b0a0e3cSJohannes Berg 			u8 ssid_len;
60447b0a0e3cSJohannes Berg 		} ibss;
60457b0a0e3cSJohannes Berg 		struct {
60467b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
60477b0a0e3cSJohannes Berg 		} ocb;
60487b0a0e3cSJohannes Berg 	} u;
60497b0a0e3cSJohannes Berg 
60507b0a0e3cSJohannes Berg 	struct {
60517b0a0e3cSJohannes Berg 		u8 addr[ETH_ALEN] __aligned(2);
60527b0a0e3cSJohannes Berg 		union {
60537b0a0e3cSJohannes Berg 			struct {
60547b0a0e3cSJohannes Berg 				unsigned int beacon_interval;
60557b0a0e3cSJohannes Berg 				struct cfg80211_chan_def chandef;
60567b0a0e3cSJohannes Berg 			} ap;
60577b0a0e3cSJohannes Berg 			struct {
60587b0a0e3cSJohannes Berg 				struct cfg80211_internal_bss *current_bss;
60597b0a0e3cSJohannes Berg 			} client;
60607b0a0e3cSJohannes Berg 		};
60617b0a0e3cSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
60627b0a0e3cSJohannes Berg 	u16 valid_links;
6063d3236553SJohannes Berg };
6064d3236553SJohannes Berg 
606510de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
606698104fdeSJohannes Berg {
606798104fdeSJohannes Berg 	if (wdev->netdev)
606898104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
606998104fdeSJohannes Berg 	return wdev->address;
607098104fdeSJohannes Berg }
607198104fdeSJohannes Berg 
607273c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
607373c7da3dSArend Van Spriel {
607473c7da3dSArend Van Spriel 	if (wdev->netdev)
607573c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
607673c7da3dSArend Van Spriel 	return wdev->is_running;
607773c7da3dSArend Van Spriel }
607873c7da3dSArend Van Spriel 
6079d3236553SJohannes Berg /**
6080d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
6081d3236553SJohannes Berg  *
6082d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
60830ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
6084d3236553SJohannes Berg  */
6085d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
6086d3236553SJohannes Berg {
6087d3236553SJohannes Berg 	BUG_ON(!wdev);
6088d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
6089d3236553SJohannes Berg }
6090d3236553SJohannes Berg 
6091d70e9693SJohannes Berg /**
60927b0a0e3cSJohannes Berg  * wdev_chandef - return chandef pointer from wireless_dev
60937b0a0e3cSJohannes Berg  * @wdev: the wdev
60947b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO
60957b0a0e3cSJohannes Berg  *
60967b0a0e3cSJohannes Berg  * Return: The chandef depending on the mode, or %NULL.
60977b0a0e3cSJohannes Berg  */
60987b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
60997b0a0e3cSJohannes Berg 				       unsigned int link_id);
61007b0a0e3cSJohannes Berg 
61017b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
61027b0a0e3cSJohannes Berg 					unsigned int link_id)
61037b0a0e3cSJohannes Berg {
61047b0a0e3cSJohannes Berg 	WARN_ON(link_id && !wdev->valid_links);
61057b0a0e3cSJohannes Berg 	WARN_ON(wdev->valid_links &&
61067b0a0e3cSJohannes Berg 		!(wdev->valid_links & BIT(link_id)));
61077b0a0e3cSJohannes Berg }
61087b0a0e3cSJohannes Berg 
6109efbabc11SVeerendranath Jakkam #define for_each_valid_link(link_info, link_id)			\
61107b0a0e3cSJohannes Berg 	for (link_id = 0;					\
6111efbabc11SVeerendranath Jakkam 	     link_id < ((link_info)->valid_links ?		\
6112efbabc11SVeerendranath Jakkam 			ARRAY_SIZE((link_info)->links) : 1);	\
61137b0a0e3cSJohannes Berg 	     link_id++)						\
6114efbabc11SVeerendranath Jakkam 		if (!(link_info)->valid_links ||		\
6115efbabc11SVeerendranath Jakkam 		    ((link_info)->valid_links & BIT(link_id)))
61167b0a0e3cSJohannes Berg 
61177b0a0e3cSJohannes Berg /**
6118d70e9693SJohannes Berg  * DOC: Utility functions
6119d70e9693SJohannes Berg  *
6120d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
6121d3236553SJohannes Berg  */
6122d3236553SJohannes Berg 
6123d3236553SJohannes Berg /**
6124934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
6125934f4c7dSThomas Pedersen  *
6126934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
6127934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
6128934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
6129934f4c7dSThomas Pedersen  */
6130934f4c7dSThomas Pedersen static inline bool
6131934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
6132934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
6133934f4c7dSThomas Pedersen {
6134934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
6135934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
6136934f4c7dSThomas Pedersen }
6137934f4c7dSThomas Pedersen 
6138934f4c7dSThomas Pedersen /**
6139934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
6140934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
6141934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
6142934f4c7dSThomas Pedersen  */
6143934f4c7dSThomas Pedersen static inline u32
6144934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
6145934f4c7dSThomas Pedersen {
6146934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
6147934f4c7dSThomas Pedersen }
6148934f4c7dSThomas Pedersen 
6149934f4c7dSThomas Pedersen /**
615011b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
615111b34737SThomas Pedersen  *
615211b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
615311b34737SThomas Pedersen  * @chan: channel
615411b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
615511b34737SThomas Pedersen  */
615611b34737SThomas Pedersen enum nl80211_chan_width
615711b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
615811b34737SThomas Pedersen 
615911b34737SThomas Pedersen /**
6160934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
6161934f4c7dSThomas Pedersen  * @chan: channel number
6162934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
6163934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
6164934f4c7dSThomas Pedersen  */
6165934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
6166934f4c7dSThomas Pedersen 
6167934f4c7dSThomas Pedersen /**
6168d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
6169abe37c4bSJohannes Berg  * @chan: channel number
617059eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
61710ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
6172d3236553SJohannes Berg  */
6173934f4c7dSThomas Pedersen static inline int
6174934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
6175934f4c7dSThomas Pedersen {
6176934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
6177934f4c7dSThomas Pedersen }
6178934f4c7dSThomas Pedersen 
6179934f4c7dSThomas Pedersen /**
6180934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
6181934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
6182934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
6183934f4c7dSThomas Pedersen  */
6184934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
6185d3236553SJohannes Berg 
6186d3236553SJohannes Berg /**
6187d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
6188934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
61890ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
6190d3236553SJohannes Berg  */
6191934f4c7dSThomas Pedersen static inline int
6192934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
6193934f4c7dSThomas Pedersen {
6194934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
6195934f4c7dSThomas Pedersen }
6196934f4c7dSThomas Pedersen 
6197934f4c7dSThomas Pedersen /**
6198934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
6199934f4c7dSThomas Pedersen  * frequency
6200934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
6201934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
6202934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
6203934f4c7dSThomas Pedersen  */
6204934f4c7dSThomas Pedersen struct ieee80211_channel *
6205934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
6206d3236553SJohannes Berg 
6207d3236553SJohannes Berg /**
6208d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
6209543b921bSArend Van Spriel  *
6210abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
6211934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
62120ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
6213d3236553SJohannes Berg  */
6214934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
6215934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
6216934f4c7dSThomas Pedersen {
6217934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
6218934f4c7dSThomas Pedersen }
6219d3236553SJohannes Berg 
6220d3236553SJohannes Berg /**
6221afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
6222afbc9c9eSJohannes Berg  * @chan: control channel to check
6223afbc9c9eSJohannes Berg  *
6224afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
6225afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
6226afbc9c9eSJohannes Berg  */
6227afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
6228afbc9c9eSJohannes Berg {
6229afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
6230afbc9c9eSJohannes Berg 		return false;
6231afbc9c9eSJohannes Berg 
6232afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
6233afbc9c9eSJohannes Berg }
6234afbc9c9eSJohannes Berg 
6235afbc9c9eSJohannes Berg /**
6236d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
6237d3236553SJohannes Berg  *
6238d3236553SJohannes Berg  * @sband: the band to look for rates in
6239d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
6240d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
6241d3236553SJohannes Berg  *
62420ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
62430ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
62440ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
62450ae997dcSYacine Belkadi  * rates in the band's bitrate table.
6246d3236553SJohannes Berg  */
6247623b988fSJoe Perches const struct ieee80211_rate *
6248d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
6249d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
6250d3236553SJohannes Berg 
6251b422c6cdSAshok Nagarajan /**
6252b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
6253b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
625474608acaSSimon Wunderlich  * @scan_width: width of the control channel
6255b422c6cdSAshok Nagarajan  *
6256b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
6257b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
6258b422c6cdSAshok Nagarajan  */
625974608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
626074608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
6261b422c6cdSAshok Nagarajan 
6262d3236553SJohannes Berg /*
6263d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
6264d3236553SJohannes Berg  *
6265d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
626666d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
6267d3236553SJohannes Berg  */
6268d3236553SJohannes Berg 
626933e5a2f7SJohannes Berg struct radiotap_align_size {
627033e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
627133e5a2f7SJohannes Berg };
627233e5a2f7SJohannes Berg 
627333e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
627433e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
627533e5a2f7SJohannes Berg 	int n_bits;
627633e5a2f7SJohannes Berg 	uint32_t oui;
627733e5a2f7SJohannes Berg 	uint8_t subns;
627833e5a2f7SJohannes Berg };
627933e5a2f7SJohannes Berg 
628033e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
628133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
628233e5a2f7SJohannes Berg 	int n_ns;
628333e5a2f7SJohannes Berg };
628433e5a2f7SJohannes Berg 
6285d3236553SJohannes Berg /**
6286d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
628733e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
628833e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
628933e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
629033e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
629133e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
629233e5a2f7SJohannes Berg  *	the beginning of the actual data portion
629333e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
629433e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
629533e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
629633e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
629733e5a2f7SJohannes Berg  *	radiotap namespace or not
629833e5a2f7SJohannes Berg  *
629933e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
630033e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
630133e5a2f7SJohannes Berg  * @_arg_index: next argument index
630233e5a2f7SJohannes Berg  * @_arg: next argument pointer
630333e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
630433e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
630533e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
630633e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
630733e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
630833e5a2f7SJohannes Berg  *	next bitmap word
630933e5a2f7SJohannes Berg  *
631033e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
631133e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
6312d3236553SJohannes Berg  */
6313d3236553SJohannes Berg 
6314d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
631533e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
631633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
631733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
6318d3236553SJohannes Berg 
631933e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
632067272440SJohannes Berg 	__le32 *_next_bitmap;
632133e5a2f7SJohannes Berg 
632233e5a2f7SJohannes Berg 	unsigned char *this_arg;
632333e5a2f7SJohannes Berg 	int this_arg_index;
632433e5a2f7SJohannes Berg 	int this_arg_size;
632533e5a2f7SJohannes Berg 
632633e5a2f7SJohannes Berg 	int is_radiotap_ns;
632733e5a2f7SJohannes Berg 
632833e5a2f7SJohannes Berg 	int _max_length;
632933e5a2f7SJohannes Berg 	int _arg_index;
633033e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
633133e5a2f7SJohannes Berg 	int _reset_on_ext;
6332d3236553SJohannes Berg };
6333d3236553SJohannes Berg 
633410dd9b7cSJoe Perches int
633510dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
6336d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
633710dd9b7cSJoe Perches 				 int max_length,
633810dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
6339d3236553SJohannes Berg 
634010dd9b7cSJoe Perches int
634110dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
6342d3236553SJohannes Berg 
634333e5a2f7SJohannes Berg 
6344e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
6345e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
6346e31a16d6SZhu Yi 
6347e31a16d6SZhu Yi /**
6348e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
6349e31a16d6SZhu Yi  *
6350e31a16d6SZhu Yi  * @skb: the frame
63510ae997dcSYacine Belkadi  *
63520ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
63530ae997dcSYacine Belkadi  * returns the 802.11 header length.
63540ae997dcSYacine Belkadi  *
63550ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
63560ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
63570ae997dcSYacine Belkadi  * 802.11 header.
6358e31a16d6SZhu Yi  */
6359e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
6360e31a16d6SZhu Yi 
6361e31a16d6SZhu Yi /**
6362e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
6363e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
63640ae997dcSYacine Belkadi  * Return: The header length in bytes.
6365e31a16d6SZhu Yi  */
6366633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
6367e31a16d6SZhu Yi 
6368e31a16d6SZhu Yi /**
63699b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
63709b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
63719b395bc3SJohannes Berg  *	(first byte) will be accessed
63720ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
63739b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
63749b395bc3SJohannes Berg  */
63759b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
63769b395bc3SJohannes Berg 
63779b395bc3SJohannes Berg /**
6378d70e9693SJohannes Berg  * DOC: Data path helpers
6379d70e9693SJohannes Berg  *
6380d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
6381d70e9693SJohannes Berg  * functions that help implement the data path for devices
6382d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
6383d70e9693SJohannes Berg  */
6384d70e9693SJohannes Berg 
6385d70e9693SJohannes Berg /**
63867f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
63877f6990c8SJohannes Berg  * @skb: the 802.11 data frame
63887f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
63897f6990c8SJohannes Berg  *	of it being pushed into the SKB
63907f6990c8SJohannes Berg  * @addr: the device MAC address
63917f6990c8SJohannes Berg  * @iftype: the virtual interface type
639224bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
63932d8b08feSMauro Carvalho Chehab  * @is_amsdu: true if the 802.11 header is A-MSDU
63947f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
63957f6990c8SJohannes Berg  */
63967f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
639724bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
6398a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
63997f6990c8SJohannes Berg 
64007f6990c8SJohannes Berg /**
6401e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
6402e31a16d6SZhu Yi  * @skb: the 802.11 data frame
6403e31a16d6SZhu Yi  * @addr: the device MAC address
6404e31a16d6SZhu Yi  * @iftype: the virtual interface type
64050ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
6406e31a16d6SZhu Yi  */
64077f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
64087f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
64097f6990c8SJohannes Berg {
6410a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
64117f6990c8SJohannes Berg }
6412e31a16d6SZhu Yi 
6413e31a16d6SZhu Yi /**
64146e4c0d04SFelix Fietkau  * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid
64156e4c0d04SFelix Fietkau  *
64166e4c0d04SFelix Fietkau  * This is used to detect non-standard A-MSDU frames, e.g. the ones generated
64176e4c0d04SFelix Fietkau  * by ath10k and ath11k, where the subframe length includes the length of the
64186e4c0d04SFelix Fietkau  * mesh control field.
64196e4c0d04SFelix Fietkau  *
64206e4c0d04SFelix Fietkau  * @skb: The input A-MSDU frame without any headers.
6421fe4a6d2dSFelix Fietkau  * @mesh_hdr: the type of mesh header to test
6422fe4a6d2dSFelix Fietkau  *	0: non-mesh A-MSDU length field
6423fe4a6d2dSFelix Fietkau  *	1: big-endian mesh A-MSDU length field
6424fe4a6d2dSFelix Fietkau  *	2: little-endian mesh A-MSDU length field
64256e4c0d04SFelix Fietkau  * Returns: true if subframe header lengths are valid for the @mesh_hdr mode
64266e4c0d04SFelix Fietkau  */
6427fe4a6d2dSFelix Fietkau bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);
64286e4c0d04SFelix Fietkau 
64296e4c0d04SFelix Fietkau /**
6430eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
6431eaf85ca7SZhu Yi  *
64327f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
64337f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
64347f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
6435eaf85ca7SZhu Yi  *
64367f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
6437eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
6438085a6c10SRandy Dunlap  *	initialized by the caller.
6439eaf85ca7SZhu Yi  * @addr: The device MAC address.
6440eaf85ca7SZhu Yi  * @iftype: The device interface type.
6441eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
64428b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
64438b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
6444fe4a6d2dSFelix Fietkau  * @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu
6445eaf85ca7SZhu Yi  */
6446eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
6447eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
64488b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
6449986e43b1SFelix Fietkau 			      const u8 *check_da, const u8 *check_sa,
6450fe4a6d2dSFelix Fietkau 			      u8 mesh_control);
6451986e43b1SFelix Fietkau 
6452986e43b1SFelix Fietkau /**
6453986e43b1SFelix Fietkau  * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol
6454986e43b1SFelix Fietkau  *
6455986e43b1SFelix Fietkau  * Check for RFC1042 or bridge tunnel header and fetch the encapsulated
6456986e43b1SFelix Fietkau  * protocol.
6457986e43b1SFelix Fietkau  *
6458986e43b1SFelix Fietkau  * @hdr: pointer to the MSDU payload
6459986e43b1SFelix Fietkau  * @proto: destination pointer to store the protocol
6460986e43b1SFelix Fietkau  * Return: true if encapsulation was found
6461986e43b1SFelix Fietkau  */
6462986e43b1SFelix Fietkau bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);
6463986e43b1SFelix Fietkau 
6464986e43b1SFelix Fietkau /**
6465986e43b1SFelix Fietkau  * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames
6466986e43b1SFelix Fietkau  *
6467986e43b1SFelix Fietkau  * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part
6468986e43b1SFelix Fietkau  * of the MSDU data. Also move any source/destination addresses from the mesh
6469986e43b1SFelix Fietkau  * header to the ethernet header (if present).
6470986e43b1SFelix Fietkau  *
6471986e43b1SFelix Fietkau  * @skb: The 802.3 frame with embedded mesh header
6472986e43b1SFelix Fietkau  */
6473986e43b1SFelix Fietkau int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);
6474eaf85ca7SZhu Yi 
6475eaf85ca7SZhu Yi /**
6476e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
6477e31a16d6SZhu Yi  * @skb: the data frame
6478fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
64790ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
6480e31a16d6SZhu Yi  */
6481fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
6482fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
6483e31a16d6SZhu Yi 
6484c21dbf92SJohannes Berg /**
648549a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
648649a68e0dSJohannes Berg  *
648749a68e0dSJohannes Berg  * @eid: element ID
648849a68e0dSJohannes Berg  * @ies: data consisting of IEs
648949a68e0dSJohannes Berg  * @len: length of data
649049a68e0dSJohannes Berg  * @match: byte array to match
649149a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
649249a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
649349a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
649449a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
649549a68e0dSJohannes Berg  *	the data portion instead.
649649a68e0dSJohannes Berg  *
649749a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
649849a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
649949a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
650049a68e0dSJohannes Berg  * requested element struct.
650149a68e0dSJohannes Berg  *
650249a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
650349a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
650449a68e0dSJohannes Berg  * byte array to match.
650549a68e0dSJohannes Berg  */
650649a68e0dSJohannes Berg const struct element *
650749a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
650849a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
650949a68e0dSJohannes Berg 			 unsigned int match_offset);
651049a68e0dSJohannes Berg 
651149a68e0dSJohannes Berg /**
6512fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
6513fbd05e4aSLuca Coelho  *
6514fbd05e4aSLuca Coelho  * @eid: element ID
6515fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
6516fbd05e4aSLuca Coelho  * @len: length of data
6517fbd05e4aSLuca Coelho  * @match: byte array to match
6518fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
6519fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
6520fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
6521fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
6522fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
6523fbd05e4aSLuca Coelho  *	the second byte is the IE length.
6524fbd05e4aSLuca Coelho  *
6525fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
6526fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
6527fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
6528fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
6529fbd05e4aSLuca Coelho  * element ID.
6530fbd05e4aSLuca Coelho  *
6531fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
6532fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
6533fbd05e4aSLuca Coelho  * byte array to match.
6534fbd05e4aSLuca Coelho  */
653549a68e0dSJohannes Berg static inline const u8 *
653649a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
653749a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
653849a68e0dSJohannes Berg 		       unsigned int match_offset)
653949a68e0dSJohannes Berg {
654049a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
654149a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
654249a68e0dSJohannes Berg 	 */
654349a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
654449a68e0dSJohannes Berg 		    (!match_len && match_offset)))
654549a68e0dSJohannes Berg 		return NULL;
654649a68e0dSJohannes Berg 
65477e367b06SJohannes Berg 	return (const void *)cfg80211_find_elem_match(eid, ies, len,
654849a68e0dSJohannes Berg 						      match, match_len,
654949a68e0dSJohannes Berg 						      match_offset ?
655049a68e0dSJohannes Berg 							match_offset - 2 : 0);
655149a68e0dSJohannes Berg }
655249a68e0dSJohannes Berg 
655349a68e0dSJohannes Berg /**
655449a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
655549a68e0dSJohannes Berg  *
655649a68e0dSJohannes Berg  * @eid: element ID
655749a68e0dSJohannes Berg  * @ies: data consisting of IEs
655849a68e0dSJohannes Berg  * @len: length of data
655949a68e0dSJohannes Berg  *
656049a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
656149a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
656249a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
656349a68e0dSJohannes Berg  * requested element struct.
656449a68e0dSJohannes Berg  *
656549a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
656649a68e0dSJohannes Berg  * having to fit into the given data.
656749a68e0dSJohannes Berg  */
656849a68e0dSJohannes Berg static inline const struct element *
656949a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
657049a68e0dSJohannes Berg {
657149a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
657249a68e0dSJohannes Berg }
6573fbd05e4aSLuca Coelho 
6574fbd05e4aSLuca Coelho /**
6575c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6576c21dbf92SJohannes Berg  *
6577c21dbf92SJohannes Berg  * @eid: element ID
6578c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6579c21dbf92SJohannes Berg  * @len: length of data
6580c21dbf92SJohannes Berg  *
65810ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
65820ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
65830ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
65840ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
65850ae997dcSYacine Belkadi  *
65860ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
65870ae997dcSYacine Belkadi  * having to fit into the given data.
6588c21dbf92SJohannes Berg  */
6589fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6590fbd05e4aSLuca Coelho {
6591fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6592fbd05e4aSLuca Coelho }
6593c21dbf92SJohannes Berg 
6594d70e9693SJohannes Berg /**
659549a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
659649a68e0dSJohannes Berg  *
659749a68e0dSJohannes Berg  * @ext_eid: element ID Extension
659849a68e0dSJohannes Berg  * @ies: data consisting of IEs
659949a68e0dSJohannes Berg  * @len: length of data
660049a68e0dSJohannes Berg  *
660149a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
660249a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
660349a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
660449a68e0dSJohannes Berg  * requested element struct.
660549a68e0dSJohannes Berg  *
660649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
660749a68e0dSJohannes Berg  * having to fit into the given data.
660849a68e0dSJohannes Berg  */
660949a68e0dSJohannes Berg static inline const struct element *
661049a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
661149a68e0dSJohannes Berg {
661249a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
661349a68e0dSJohannes Berg 					&ext_eid, 1, 0);
661449a68e0dSJohannes Berg }
661549a68e0dSJohannes Berg 
661649a68e0dSJohannes Berg /**
66173f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
66183f817fe7SJouni Malinen  *
66193f817fe7SJouni Malinen  * @ext_eid: element ID Extension
66203f817fe7SJouni Malinen  * @ies: data consisting of IEs
66213f817fe7SJouni Malinen  * @len: length of data
66223f817fe7SJouni Malinen  *
66233f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
66243f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
66253f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
66263f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
66273f817fe7SJouni Malinen  *
66283f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
66293f817fe7SJouni Malinen  * having to fit into the given data.
66303f817fe7SJouni Malinen  */
66313f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
66323f817fe7SJouni Malinen {
66333f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
66343f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
66353f817fe7SJouni Malinen }
66363f817fe7SJouni Malinen 
66373f817fe7SJouni Malinen /**
663849a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
663949a68e0dSJohannes Berg  *
664049a68e0dSJohannes Berg  * @oui: vendor OUI
664149a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
664249a68e0dSJohannes Berg  * @ies: data consisting of IEs
664349a68e0dSJohannes Berg  * @len: length of data
664449a68e0dSJohannes Berg  *
664549a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
664649a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
664749a68e0dSJohannes Berg  * return the element structure for the requested element.
664849a68e0dSJohannes Berg  *
664949a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
665049a68e0dSJohannes Berg  * the given data.
665149a68e0dSJohannes Berg  */
665249a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
665349a68e0dSJohannes Berg 						const u8 *ies,
665449a68e0dSJohannes Berg 						unsigned int len);
665549a68e0dSJohannes Berg 
665649a68e0dSJohannes Berg /**
66570c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
66580c28ec58SEliad Peller  *
66590c28ec58SEliad Peller  * @oui: vendor OUI
66609e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
66610c28ec58SEliad Peller  * @ies: data consisting of IEs
66620c28ec58SEliad Peller  * @len: length of data
66630c28ec58SEliad Peller  *
66640ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
66650ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
66660ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
66670ae997dcSYacine Belkadi  * element ID.
66680ae997dcSYacine Belkadi  *
66690ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
66700ae997dcSYacine Belkadi  * the given data.
66710c28ec58SEliad Peller  */
667249a68e0dSJohannes Berg static inline const u8 *
667349a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
667449a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
667549a68e0dSJohannes Berg {
66767e367b06SJohannes Berg 	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
667749a68e0dSJohannes Berg }
66780c28ec58SEliad Peller 
66790c28ec58SEliad Peller /**
6680f837a653SBenjamin Berg  * cfg80211_defragment_element - Defrag the given element data into a buffer
6681f837a653SBenjamin Berg  *
6682f837a653SBenjamin Berg  * @elem: the element to defragment
6683f837a653SBenjamin Berg  * @ies: elements where @elem is contained
6684f837a653SBenjamin Berg  * @ieslen: length of @ies
6685f837a653SBenjamin Berg  * @data: buffer to store element data
6686f837a653SBenjamin Berg  * @data_len: length of @data
6687f837a653SBenjamin Berg  * @frag_id: the element ID of fragments
6688f837a653SBenjamin Berg  *
6689f837a653SBenjamin Berg  * Return: length of @data, or -EINVAL on error
6690f837a653SBenjamin Berg  *
6691f837a653SBenjamin Berg  * Copy out all data from an element that may be fragmented into @data, while
6692f837a653SBenjamin Berg  * skipping all headers.
6693f837a653SBenjamin Berg  *
6694f837a653SBenjamin Berg  * The function uses memmove() internally. It is acceptable to defragment an
6695f837a653SBenjamin Berg  * element in-place.
6696f837a653SBenjamin Berg  */
6697f837a653SBenjamin Berg ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,
6698f837a653SBenjamin Berg 				    size_t ieslen, u8 *data, size_t data_len,
6699f837a653SBenjamin Berg 				    u8 frag_id);
6700f837a653SBenjamin Berg 
6701f837a653SBenjamin Berg /**
670230ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
670330ca1aa5SDedy Lansky  *
670430ca1aa5SDedy Lansky  * @dev: network device
670530ca1aa5SDedy Lansky  * @addr: STA MAC address
670630ca1aa5SDedy Lansky  *
670730ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
670830ca1aa5SDedy Lansky  * devices upon STA association.
670930ca1aa5SDedy Lansky  */
671030ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
671130ca1aa5SDedy Lansky 
671230ca1aa5SDedy Lansky /**
6713d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
6714d70e9693SJohannes Berg  *
6715d70e9693SJohannes Berg  * TODO
6716d3236553SJohannes Berg  */
6717d3236553SJohannes Berg 
6718d3236553SJohannes Berg /**
6719d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
6720d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
6721d3236553SJohannes Berg  *	conflicts)
6722d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6723d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
6724d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
6725d3236553SJohannes Berg  *	alpha2.
6726d3236553SJohannes Berg  *
6727d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
6728d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
6729d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6730d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
6731d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6732d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
6733d3236553SJohannes Berg  *
6734d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
6735d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
6736d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
6737d3236553SJohannes Berg  *
6738d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
6739d3236553SJohannes Berg  * an -ENOMEM.
67400ae997dcSYacine Belkadi  *
67410ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
6742d3236553SJohannes Berg  */
674310dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6744d3236553SJohannes Berg 
6745d3236553SJohannes Berg /**
6746b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6747b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
6748b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
6749b0d7aa59SJonathan Doron  *
6750b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
6751b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6752b0d7aa59SJonathan Doron  * information.
6753b0d7aa59SJonathan Doron  *
6754b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
6755b0d7aa59SJonathan Doron  */
6756b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6757b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
6758b0d7aa59SJonathan Doron 
6759b0d7aa59SJonathan Doron /**
6760a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
67612c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
67622c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
67632c3e861cSArik Nemtsov  *
6764a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
6765a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
6766a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
67672c3e861cSArik Nemtsov  *
67682c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
67692c3e861cSArik Nemtsov  */
6770a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
67712c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
67722c3e861cSArik Nemtsov 
67732c3e861cSArik Nemtsov /**
6774d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6775d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
6776d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
6777d3236553SJohannes Berg  *
6778d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
6779d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
6780d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
6781d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
6782d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
6783d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
6784222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
6785ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6786222ea581SLuis R. Rodriguez  * that called this helper.
6787d3236553SJohannes Berg  */
678810dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6789d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
6790d3236553SJohannes Berg 
6791d3236553SJohannes Berg /**
6792d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
6793d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
6794d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
6795d3236553SJohannes Berg  *
6796d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
6797d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
6798d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
6799d3236553SJohannes Berg  * and processed already.
6800d3236553SJohannes Berg  *
68010ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
68020ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
68030ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
68040ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
68050ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
68060ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
68070ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
6808d3236553SJohannes Berg  */
6809361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6810361c9c8bSJohannes Berg 					       u32 center_freq);
6811d3236553SJohannes Berg 
6812034c6d6eSLuis R. Rodriguez /**
6813034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
6814034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
6815034c6d6eSLuis R. Rodriguez  *
6816034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
6817034c6d6eSLuis R. Rodriguez  * proper string representation.
6818034c6d6eSLuis R. Rodriguez  */
6819034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6820034c6d6eSLuis R. Rodriguez 
682119d3577eSHaim Dreyfuss /**
6822dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6823dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
6824dc0c18edSAaron Komisar  *
6825dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
6826dc0c18edSAaron Komisar  */
6827dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6828dc0c18edSAaron Komisar 
6829dc0c18edSAaron Komisar /**
683019d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
683119d3577eSHaim Dreyfuss  *
683219d3577eSHaim Dreyfuss  */
683319d3577eSHaim Dreyfuss 
683419d3577eSHaim Dreyfuss /**
683519d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
683619d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
683719d3577eSHaim Dreyfuss  *
683819d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
683919d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
684019d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
684119d3577eSHaim Dreyfuss  *
684219d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
684319d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
684419d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
684519d3577eSHaim Dreyfuss  *
684619d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
684719d3577eSHaim Dreyfuss  * an -ENODATA.
684819d3577eSHaim Dreyfuss  *
684919d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
685019d3577eSHaim Dreyfuss  */
685138cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
685238cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
685319d3577eSHaim Dreyfuss 
6854d3236553SJohannes Berg /*
6855d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
6856d3236553SJohannes Berg  * functions and BSS handling helpers
6857d3236553SJohannes Berg  */
6858d3236553SJohannes Berg 
68592a519311SJohannes Berg /**
68602a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
68612a519311SJohannes Berg  *
68622a519311SJohannes Berg  * @request: the corresponding scan request
68631d76250bSAvraham Stern  * @info: information about the completed scan
68642a519311SJohannes Berg  */
68651d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
68661d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
68672a519311SJohannes Berg 
68682a519311SJohannes Berg /**
6869807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
6870807f8a8cSLuciano Coelho  *
6871807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
6872b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6873807f8a8cSLuciano Coelho  */
6874b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6875807f8a8cSLuciano Coelho 
6876807f8a8cSLuciano Coelho /**
6877807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6878807f8a8cSLuciano Coelho  *
6879807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
6880b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6881807f8a8cSLuciano Coelho  *
6882807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
6883807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
6884807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
6885807f8a8cSLuciano Coelho  */
6886b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6887807f8a8cSLuciano Coelho 
6888807f8a8cSLuciano Coelho /**
6889a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6890792e6aa7SEliad Peller  *
6891792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
6892b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6893792e6aa7SEliad Peller  *
6894792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
6895792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
6896792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
6897a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
6898792e6aa7SEliad Peller  */
6899a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6900792e6aa7SEliad Peller 
6901792e6aa7SEliad Peller /**
69026e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
69032a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
69046e19bc4bSDmitry Shmidt  * @data: the BSS metadata
6905abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
6906abe37c4bSJohannes Berg  * @len: length of the management frame
69072a519311SJohannes Berg  * @gfp: context flags
69082a519311SJohannes Berg  *
69092a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
69102a519311SJohannes Berg  * the BSS should be updated/added.
6911ef100682SJohannes Berg  *
69120ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
69130ae997dcSYacine Belkadi  * Or %NULL on error.
69142a519311SJohannes Berg  */
6915ef100682SJohannes Berg struct cfg80211_bss * __must_check
69166e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
69176e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
69186e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
69196e19bc4bSDmitry Shmidt 			       gfp_t gfp);
69206e19bc4bSDmitry Shmidt 
69216e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6922dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
69233afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
6924dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
6925dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
69266e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
69276e19bc4bSDmitry Shmidt {
69286e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
69296e19bc4bSDmitry Shmidt 		.chan = rx_channel,
69306e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
69316e19bc4bSDmitry Shmidt 		.signal = signal,
69326e19bc4bSDmitry Shmidt 	};
69336e19bc4bSDmitry Shmidt 
69346e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
69356e19bc4bSDmitry Shmidt }
6936dcd6eac1SSimon Wunderlich 
6937dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
69382a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
69393afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
69402a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
6941dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
6942dcd6eac1SSimon Wunderlich {
69436e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
69446e19bc4bSDmitry Shmidt 		.chan = rx_channel,
69456e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
69466e19bc4bSDmitry Shmidt 		.signal = signal,
69476e19bc4bSDmitry Shmidt 	};
69486e19bc4bSDmitry Shmidt 
69496e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6950dcd6eac1SSimon Wunderlich }
69512a519311SJohannes Berg 
6952abe37c4bSJohannes Berg /**
69537ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
69547ece9c37SSara Sharon  * @bssid: transmitter BSSID
69557ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
69567ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
69575d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
69587ece9c37SSara Sharon  */
69597ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
69605d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
69617ece9c37SSara Sharon {
69625d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
69635d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
69645d4071abSJohannes Berg 	u64 new_bssid_u64;
69657ece9c37SSara Sharon 
69665d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
69677ece9c37SSara Sharon 
69685d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
69697ece9c37SSara Sharon 
69705d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
69717ece9c37SSara Sharon }
69727ece9c37SSara Sharon 
69737ece9c37SSara Sharon /**
6974f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
6975f7dacfb1SSara Sharon  * @element: element to check
6976f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
6977f7dacfb1SSara Sharon  */
6978f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
6979f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
6980f7dacfb1SSara Sharon 
6981f7dacfb1SSara Sharon /**
6982fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6983fe806e49SSara Sharon  * @ie: ies
6984fe806e49SSara Sharon  * @ielen: length of IEs
6985fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
6986fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
6987fe806e49SSara Sharon  * @merged_ie: location of the merged profile
6988fe806e49SSara Sharon  * @max_copy_len: max merged profile length
6989fe806e49SSara Sharon  */
6990fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6991fe806e49SSara Sharon 			      const struct element *mbssid_elem,
6992fe806e49SSara Sharon 			      const struct element *sub_elem,
69935809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
6994fe806e49SSara Sharon 
6995fe806e49SSara Sharon /**
69965bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
69975bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
69985bc8c1f2SJohannes Berg  *	from a beacon or probe response
69995bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
70005bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
70015bc8c1f2SJohannes Berg  */
70025bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
70035bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
70045bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
70055bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
70065bc8c1f2SJohannes Berg };
70075bc8c1f2SJohannes Berg 
70085bc8c1f2SJohannes Berg /**
70097f599aecSAyala Beker  * cfg80211_get_ies_channel_number - returns the channel number from ies
70107f599aecSAyala Beker  * @ie: IEs
70117f599aecSAyala Beker  * @ielen: length of IEs
70127f599aecSAyala Beker  * @band: enum nl80211_band of the channel
70137f599aecSAyala Beker  *
70147f599aecSAyala Beker  * Returns the channel number, or -1 if none could be determined.
70157f599aecSAyala Beker  */
70167f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
70176ff9efcfSMordechay Goodstein 				    enum nl80211_band band);
70187f599aecSAyala Beker 
70197f599aecSAyala Beker /**
70206e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
7021abe37c4bSJohannes Berg  *
7022abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
70236e19bc4bSDmitry Shmidt  * @data: the BSS metadata
70245bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
7025abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
70267b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
7027abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
7028abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
7029abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
7030abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
7031abe37c4bSJohannes Berg  * @gfp: context flags
7032abe37c4bSJohannes Berg  *
7033abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
7034abe37c4bSJohannes Berg  * the BSS should be updated/added.
7035ef100682SJohannes Berg  *
70360ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
70370ae997dcSYacine Belkadi  * Or %NULL on error.
7038abe37c4bSJohannes Berg  */
7039ef100682SJohannes Berg struct cfg80211_bss * __must_check
70406e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
70416e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
70426e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
70436e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
70446e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
70456e19bc4bSDmitry Shmidt 			 gfp_t gfp);
70466e19bc4bSDmitry Shmidt 
70476e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
7048dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
70493afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
7050dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
70515bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
7052dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
7053dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
70546e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
70556e19bc4bSDmitry Shmidt {
70566e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
70576e19bc4bSDmitry Shmidt 		.chan = rx_channel,
70586e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
70596e19bc4bSDmitry Shmidt 		.signal = signal,
70606e19bc4bSDmitry Shmidt 	};
70616e19bc4bSDmitry Shmidt 
70626e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
70636e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
70646e19bc4bSDmitry Shmidt 					gfp);
70656e19bc4bSDmitry Shmidt }
7066dcd6eac1SSimon Wunderlich 
7067dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
706806aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
70693afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
70705bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
70717b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
70727b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
7073dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
7074dcd6eac1SSimon Wunderlich {
70756e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
70766e19bc4bSDmitry Shmidt 		.chan = rx_channel,
70776e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
70786e19bc4bSDmitry Shmidt 		.signal = signal,
70796e19bc4bSDmitry Shmidt 	};
70806e19bc4bSDmitry Shmidt 
70816e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
70826e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
7083dcd6eac1SSimon Wunderlich 					gfp);
7084dcd6eac1SSimon Wunderlich }
708506aa7afaSJussi Kivilinna 
708627548677SJohannes Berg /**
708727548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
708827548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
708927548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
709027548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
709127548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
709227548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
709327548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
709427548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
709527548677SJohannes Berg  */
70962a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
70972a519311SJohannes Berg 				      struct ieee80211_channel *channel,
70982a519311SJohannes Berg 				      const u8 *bssid,
709979420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
71006eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
710127548677SJohannes Berg 				      enum ieee80211_privacy privacy);
710279420f09SJohannes Berg static inline struct cfg80211_bss *
710379420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
710479420f09SJohannes Berg 		  struct ieee80211_channel *channel,
710579420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
710679420f09SJohannes Berg {
710779420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
71086eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
71096eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
711079420f09SJohannes Berg }
711179420f09SJohannes Berg 
71124c0c0b75SJohannes Berg /**
71134c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
71145b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
71154c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
71164c0c0b75SJohannes Berg  *
71174c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
71184c0c0b75SJohannes Berg  */
71195b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
71204c0c0b75SJohannes Berg 
71214c0c0b75SJohannes Berg /**
71224c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
71235b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
71244c0c0b75SJohannes Berg  * @bss: the BSS struct
71254c0c0b75SJohannes Berg  *
71264c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
71274c0c0b75SJohannes Berg  */
71285b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
7129d3236553SJohannes Berg 
7130d491af19SJohannes Berg /**
7131d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
7132d491af19SJohannes Berg  * @wiphy: the wiphy
7133d491af19SJohannes Berg  * @bss: the bss to remove
7134d491af19SJohannes Berg  *
7135d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
7136d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
7137d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
7138d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
7139d491af19SJohannes Berg  */
7140d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
7141fee52678SJohannes Berg 
71424770c8f9SIlan Peer /**
71434770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
71444770c8f9SIlan Peer  *
71454770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
71464770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
71474770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
71484770c8f9SIlan Peer  *
71494770c8f9SIlan Peer  * @wiphy: the wiphy
71504770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
71514770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
71524770c8f9SIlan Peer  * @iter: the iterator function to call
71534770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
71544770c8f9SIlan Peer  */
71554770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
71564770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
71574770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
71584770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
71594770c8f9SIlan Peer 				    void *data),
71604770c8f9SIlan Peer 		       void *iter_data);
71614770c8f9SIlan Peer 
7162dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
7163dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
7164dcd6eac1SSimon Wunderlich {
7165dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
7166dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
7167dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
7168dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
7169dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
7170dcd6eac1SSimon Wunderlich 	default:
7171dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
7172dcd6eac1SSimon Wunderlich 	}
7173dcd6eac1SSimon Wunderlich }
7174dcd6eac1SSimon Wunderlich 
71756039f6d2SJouni Malinen /**
71766ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
71776039f6d2SJouni Malinen  * @dev: network device
71786039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
71796039f6d2SJouni Malinen  * @len: length of the frame data
71806039f6d2SJouni Malinen  *
71816ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
71826ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
71836ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
71846ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
71856ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
71866ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
71876ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
71886ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
71896ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
71906ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
71916ff57cf8SJohannes Berg  *
71926ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
71936039f6d2SJouni Malinen  */
71946ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
71956039f6d2SJouni Malinen 
71966039f6d2SJouni Malinen /**
71976ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
71981965c853SJouni Malinen  * @dev: network device
71991965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
7200cb0b4bebSJohannes Berg  *
72018d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
72028d61ffa5SJohannes Berg  * mutex.
72031965c853SJouni Malinen  */
72046ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
72051965c853SJouni Malinen 
72061965c853SJouni Malinen /**
7207cd47c0f5SJohannes Berg  * struct cfg80211_rx_assoc_resp - association response data
72086ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
7209cd47c0f5SJohannes Berg  *	moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
72104d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
72116039f6d2SJouni Malinen  * @len: length of the frame data
7212f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
7213f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
72144d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
72154d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
72165cd212cbSJohannes Berg  * @ap_mld_addr: AP MLD address (in case of MLO)
72175cd212cbSJohannes Berg  * @links: per-link information indexed by link ID, use links[0] for
72185cd212cbSJohannes Berg  *	non-MLO connections
721953ad07e9SJohannes Berg  * @links.status: Set this (along with a BSS pointer) for links that
722053ad07e9SJohannes Berg  *	were rejected by the AP.
7221cd47c0f5SJohannes Berg  */
7222cd47c0f5SJohannes Berg struct cfg80211_rx_assoc_resp {
7223cd47c0f5SJohannes Berg 	const u8 *buf;
7224cd47c0f5SJohannes Berg 	size_t len;
7225cd47c0f5SJohannes Berg 	const u8 *req_ies;
7226cd47c0f5SJohannes Berg 	size_t req_ies_len;
7227cd47c0f5SJohannes Berg 	int uapsd_queues;
72285cd212cbSJohannes Berg 	const u8 *ap_mld_addr;
72295cd212cbSJohannes Berg 	struct {
72305cd212cbSJohannes Berg 		const u8 *addr;
72315cd212cbSJohannes Berg 		struct cfg80211_bss *bss;
723253ad07e9SJohannes Berg 		u16 status;
72335cd212cbSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
7234cd47c0f5SJohannes Berg };
7235cd47c0f5SJohannes Berg 
7236cd47c0f5SJohannes Berg /**
7237cd47c0f5SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
7238cd47c0f5SJohannes Berg  * @dev: network device
7239cd47c0f5SJohannes Berg  * @data: association response data, &struct cfg80211_rx_assoc_resp
72406039f6d2SJouni Malinen  *
72416ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
72426ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
72436ff57cf8SJohannes Berg  *
72446ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
72456039f6d2SJouni Malinen  */
72466ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
7247cd47c0f5SJohannes Berg 			    struct cfg80211_rx_assoc_resp *data);
72486039f6d2SJouni Malinen 
72496039f6d2SJouni Malinen /**
7250f662d2f4SJohannes Berg  * struct cfg80211_assoc_failure - association failure data
7251f662d2f4SJohannes Berg  * @ap_mld_addr: AP MLD address, or %NULL
7252f662d2f4SJohannes Berg  * @bss: list of BSSes, must use entry 0 for non-MLO connections
7253f662d2f4SJohannes Berg  *	(@ap_mld_addr is %NULL)
7254f662d2f4SJohannes Berg  * @timeout: indicates the association failed due to timeout, otherwise
7255f662d2f4SJohannes Berg  *	the association was abandoned for a reason reported through some
7256f662d2f4SJohannes Berg  *	other API (e.g. deauth RX)
72571965c853SJouni Malinen  */
7258f662d2f4SJohannes Berg struct cfg80211_assoc_failure {
7259f662d2f4SJohannes Berg 	const u8 *ap_mld_addr;
7260f662d2f4SJohannes Berg 	struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];
7261f662d2f4SJohannes Berg 	bool timeout;
7262f662d2f4SJohannes Berg };
72631965c853SJouni Malinen 
72641965c853SJouni Malinen /**
7265f662d2f4SJohannes Berg  * cfg80211_assoc_failure - notification of association failure
7266e6f462dfSJohannes Berg  * @dev: network device
7267f662d2f4SJohannes Berg  * @data: data describing the association failure
7268e6f462dfSJohannes Berg  *
7269e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
7270e6f462dfSJohannes Berg  */
7271f662d2f4SJohannes Berg void cfg80211_assoc_failure(struct net_device *dev,
7272f662d2f4SJohannes Berg 			    struct cfg80211_assoc_failure *data);
7273e6f462dfSJohannes Berg 
7274e6f462dfSJohannes Berg /**
72756ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
72766039f6d2SJouni Malinen  * @dev: network device
72776ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
72786039f6d2SJouni Malinen  * @len: length of the frame data
72793bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
72806039f6d2SJouni Malinen  *
72816039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
728253b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
72838d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
72848d61ffa5SJohannes Berg  * corresponding wdev's mutex.
72856039f6d2SJouni Malinen  */
72863bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
72873bb02143SJohannes Berg 			   bool reconnect);
7288ce470613SHolger Schurig 
7289ce470613SHolger Schurig /**
72906ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
7291cf4e594eSJouni Malinen  * @dev: network device
72924d797fceSJouni Malinen  * @buf: received management frame (header + body)
7293cf4e594eSJouni Malinen  * @len: length of the frame data
7294cf4e594eSJouni Malinen  *
72956ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
72966ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
72974d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
72984d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
72994d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
73004d797fceSJouni Malinen  *
73014d797fceSJouni Malinen  * This function may sleep.
7302cf4e594eSJouni Malinen  */
73036ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
73046ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
7305cf4e594eSJouni Malinen 
7306cf4e594eSJouni Malinen /**
7307a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
7308a3b8b056SJouni Malinen  * @dev: network device
7309a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
7310a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
7311a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
7312a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
7313e6d6e342SJohannes Berg  * @gfp: allocation flags
7314a3b8b056SJouni Malinen  *
7315a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
7316a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
7317a3b8b056SJouni Malinen  * primitive.
7318a3b8b056SJouni Malinen  */
7319a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
7320a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
7321e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
7322a3b8b056SJouni Malinen 
732304a773adSJohannes Berg /**
732404a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
732504a773adSJohannes Berg  *
732604a773adSJohannes Berg  * @dev: network device
732704a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
7328fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
732904a773adSJohannes Berg  * @gfp: allocation flags
733004a773adSJohannes Berg  *
733104a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
733204a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
733304a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
733404a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
733504a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
733604a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
733704a773adSJohannes Berg  */
7338fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
7339fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
734004a773adSJohannes Berg 
73411f87f7d3SJohannes Berg /**
7342b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
7343b1e8eb11SMauro Carvalho Chehab  * 					candidate
7344c93b5e71SJavier Cardona  *
7345c93b5e71SJavier Cardona  * @dev: network device
7346c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
7347c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
73485ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
73492d8b08feSMauro Carvalho Chehab  * @sig_dbm: signal level in dBm
7350c93b5e71SJavier Cardona  * @gfp: allocation flags
7351c93b5e71SJavier Cardona  *
7352c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
7353c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
7354c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
7355c93b5e71SJavier Cardona  */
7356c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
7357ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
7358ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
7359c93b5e71SJavier Cardona 
7360c93b5e71SJavier Cardona /**
7361d70e9693SJohannes Berg  * DOC: RFkill integration
7362d70e9693SJohannes Berg  *
7363d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
7364d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
7365d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
7366d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
7367d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
7368d70e9693SJohannes Berg  *
7369d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
7370d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
7371d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
7372d70e9693SJohannes Berg  */
7373d70e9693SJohannes Berg 
7374d70e9693SJohannes Berg /**
7375810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
73761f87f7d3SJohannes Berg  * @wiphy: the wiphy
73771f87f7d3SJohannes Berg  * @blocked: block status
73786f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
73791f87f7d3SJohannes Berg  */
73806f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
73816f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
73826f779a66SEmmanuel Grumbach 
73836f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
73846f779a66SEmmanuel Grumbach {
73856f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
73866f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
73876f779a66SEmmanuel Grumbach }
73881f87f7d3SJohannes Berg 
73891f87f7d3SJohannes Berg /**
73901f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
73911f87f7d3SJohannes Berg  * @wiphy: the wiphy
73921f87f7d3SJohannes Berg  */
73931f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
73941f87f7d3SJohannes Berg 
73951f87f7d3SJohannes Berg /**
73961f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
73971f87f7d3SJohannes Berg  * @wiphy: the wiphy
73981f87f7d3SJohannes Berg  */
7399358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
7400358ae888SEmmanuel Grumbach {
7401358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
7402358ae888SEmmanuel Grumbach }
74031f87f7d3SJohannes Berg 
7404ad7e718cSJohannes Berg /**
7405ad7e718cSJohannes Berg  * DOC: Vendor commands
7406ad7e718cSJohannes Berg  *
7407ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
7408ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
7409ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
7410ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
7411ad7e718cSJohannes Berg  * the configuration mechanism.
7412ad7e718cSJohannes Berg  *
7413ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
7414ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
7415ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
7416ad7e718cSJohannes Berg  *
7417ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
7418ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
7419ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
7420ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
7421ad7e718cSJohannes Berg  * managers etc. need.
7422ad7e718cSJohannes Berg  */
7423ad7e718cSJohannes Berg 
7424ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
7425ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
7426ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
7427ad7e718cSJohannes Berg 					   int approxlen);
7428ad7e718cSJohannes Berg 
7429567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
74306c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
7431567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
7432567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
743355c1fdf0SJohannes Berg 					   unsigned int portid,
7434567ffc35SJohannes Berg 					   int vendor_event_idx,
7435567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
7436567ffc35SJohannes Berg 
7437567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
7438567ffc35SJohannes Berg 
7439ad7e718cSJohannes Berg /**
7440ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
7441ad7e718cSJohannes Berg  * @wiphy: the wiphy
7442ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7443ad7e718cSJohannes Berg  *	be put into the skb
7444ad7e718cSJohannes Berg  *
7445ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7446ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
7447ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
7448ad7e718cSJohannes Berg  *
7449ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
7450ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
7451ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
7452ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
7453ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
7454ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
7455ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
7456ad7e718cSJohannes Berg  *
7457ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
7458ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
7459ad7e718cSJohannes Berg  *
7460ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7461ad7e718cSJohannes Berg  */
7462ad7e718cSJohannes Berg static inline struct sk_buff *
7463ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7464ad7e718cSJohannes Berg {
7465ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
7466ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
7467ad7e718cSJohannes Berg }
7468ad7e718cSJohannes Berg 
7469ad7e718cSJohannes Berg /**
7470ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
7471ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
7472ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
7473ad7e718cSJohannes Berg  *
7474ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
7475ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
7476ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
7477ad7e718cSJohannes Berg  * skb regardless of the return value.
7478ad7e718cSJohannes Berg  *
7479ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
7480ad7e718cSJohannes Berg  */
7481ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
7482ad7e718cSJohannes Berg 
7483567ffc35SJohannes Berg /**
74845d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
748555c1fdf0SJohannes Berg  * @wiphy: the wiphy
748655c1fdf0SJohannes Berg  *
748755c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
748855c1fdf0SJohannes Berg  * Valid to call only there.
748955c1fdf0SJohannes Berg  */
749055c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
749155c1fdf0SJohannes Berg 
749255c1fdf0SJohannes Berg /**
7493567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
7494567ffc35SJohannes Berg  * @wiphy: the wiphy
74956c09e791SAhmad Kholaif  * @wdev: the wireless device
7496567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
7497567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7498567ffc35SJohannes Berg  *	be put into the skb
7499567ffc35SJohannes Berg  * @gfp: allocation flags
7500567ffc35SJohannes Berg  *
7501567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7502567ffc35SJohannes Berg  * vendor-specific multicast group.
7503567ffc35SJohannes Berg  *
75046c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
75056c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
75066c09e791SAhmad Kholaif  * attribute.
75076c09e791SAhmad Kholaif  *
7508567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
7509567ffc35SJohannes Berg  * skb to send the event.
7510567ffc35SJohannes Berg  *
7511567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7512567ffc35SJohannes Berg  */
7513567ffc35SJohannes Berg static inline struct sk_buff *
75146c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
75156c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
7516567ffc35SJohannes Berg {
75176c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
7518567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
751955c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
752055c1fdf0SJohannes Berg }
752155c1fdf0SJohannes Berg 
752255c1fdf0SJohannes Berg /**
752355c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
752455c1fdf0SJohannes Berg  * @wiphy: the wiphy
752555c1fdf0SJohannes Berg  * @wdev: the wireless device
752655c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
752755c1fdf0SJohannes Berg  * @portid: port ID of the receiver
752855c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
752955c1fdf0SJohannes Berg  *	be put into the skb
753055c1fdf0SJohannes Berg  * @gfp: allocation flags
753155c1fdf0SJohannes Berg  *
753255c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
753355c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
753455c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
753555c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
753655c1fdf0SJohannes Berg  *
753755c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
753855c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
753955c1fdf0SJohannes Berg  * attribute.
754055c1fdf0SJohannes Berg  *
754155c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
754255c1fdf0SJohannes Berg  * skb to send the event.
754355c1fdf0SJohannes Berg  *
754455c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
754555c1fdf0SJohannes Berg  */
754655c1fdf0SJohannes Berg static inline struct sk_buff *
754755c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
754855c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
754955c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
755055c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
755155c1fdf0SJohannes Berg {
755255c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
755355c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
755455c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
7555567ffc35SJohannes Berg }
7556567ffc35SJohannes Berg 
7557567ffc35SJohannes Berg /**
7558567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
7559567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
7560567ffc35SJohannes Berg  * @gfp: allocation flags
7561567ffc35SJohannes Berg  *
7562567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
7563567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
7564567ffc35SJohannes Berg  */
7565567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
7566567ffc35SJohannes Berg {
7567567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7568567ffc35SJohannes Berg }
7569567ffc35SJohannes Berg 
7570aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
7571aff89a9bSJohannes Berg /**
7572d70e9693SJohannes Berg  * DOC: Test mode
7573d70e9693SJohannes Berg  *
7574d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
7575d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
7576d70e9693SJohannes Berg  * factory programming.
7577d70e9693SJohannes Berg  *
7578d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
7579d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
7580d70e9693SJohannes Berg  */
7581d70e9693SJohannes Berg 
7582d70e9693SJohannes Berg /**
7583aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
7584aff89a9bSJohannes Berg  * @wiphy: the wiphy
7585aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7586aff89a9bSJohannes Berg  *	be put into the skb
7587aff89a9bSJohannes Berg  *
7588aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7589aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
7590aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
7591aff89a9bSJohannes Berg  *
75920ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
75930ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
75940ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
75950ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
75960ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
75970ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
75980ae997dcSYacine Belkadi  * must not modify the skb in any other way.
7599aff89a9bSJohannes Berg  *
7600aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
7601aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
76020ae997dcSYacine Belkadi  *
76030ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7604aff89a9bSJohannes Berg  */
7605ad7e718cSJohannes Berg static inline struct sk_buff *
7606ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7607ad7e718cSJohannes Berg {
7608ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
7609ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
7610ad7e718cSJohannes Berg }
7611aff89a9bSJohannes Berg 
7612aff89a9bSJohannes Berg /**
7613aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7614aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7615aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7616aff89a9bSJohannes Berg  *
76170ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
76180ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
76190ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
76200ae997dcSYacine Belkadi  * regardless of the return value.
76210ae997dcSYacine Belkadi  *
76220ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7623aff89a9bSJohannes Berg  */
7624ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7625ad7e718cSJohannes Berg {
7626ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7627ad7e718cSJohannes Berg }
7628aff89a9bSJohannes Berg 
7629aff89a9bSJohannes Berg /**
7630aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7631aff89a9bSJohannes Berg  * @wiphy: the wiphy
7632aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7633aff89a9bSJohannes Berg  *	be put into the skb
7634aff89a9bSJohannes Berg  * @gfp: allocation flags
7635aff89a9bSJohannes Berg  *
7636aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7637aff89a9bSJohannes Berg  * testmode multicast group.
7638aff89a9bSJohannes Berg  *
76390ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
76400ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
76410ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
76420ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
76430ae997dcSYacine Belkadi  * in any other way.
7644aff89a9bSJohannes Berg  *
7645aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7646aff89a9bSJohannes Berg  * skb to send the event.
76470ae997dcSYacine Belkadi  *
76480ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7649aff89a9bSJohannes Berg  */
7650567ffc35SJohannes Berg static inline struct sk_buff *
7651567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7652567ffc35SJohannes Berg {
76536c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
765455c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7655567ffc35SJohannes Berg 					  approxlen, gfp);
7656567ffc35SJohannes Berg }
7657aff89a9bSJohannes Berg 
7658aff89a9bSJohannes Berg /**
7659aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7660aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7661aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7662aff89a9bSJohannes Berg  * @gfp: allocation flags
7663aff89a9bSJohannes Berg  *
7664aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7665aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7666aff89a9bSJohannes Berg  * consumes it.
7667aff89a9bSJohannes Berg  */
7668567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7669567ffc35SJohannes Berg {
7670567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7671567ffc35SJohannes Berg }
7672aff89a9bSJohannes Berg 
7673aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
767471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
7675aff89a9bSJohannes Berg #else
7676aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
767771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
7678aff89a9bSJohannes Berg #endif
7679aff89a9bSJohannes Berg 
7680b23aa676SSamuel Ortiz /**
768176804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
768276804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
768376804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
768476804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
768576804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
768676804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
768776804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
768876804d28SArend Van Spriel  *	status for a FILS connection.
768976804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
769076804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
769176804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
769276804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
769376804d28SArend Van Spriel  */
769476804d28SArend Van Spriel struct cfg80211_fils_resp_params {
769576804d28SArend Van Spriel 	const u8 *kek;
769676804d28SArend Van Spriel 	size_t kek_len;
769776804d28SArend Van Spriel 	bool update_erp_next_seq_num;
769876804d28SArend Van Spriel 	u16 erp_next_seq_num;
769976804d28SArend Van Spriel 	const u8 *pmk;
770076804d28SArend Van Spriel 	size_t pmk_len;
770176804d28SArend Van Spriel 	const u8 *pmkid;
770276804d28SArend Van Spriel };
770376804d28SArend Van Spriel 
770476804d28SArend Van Spriel /**
77055349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
77065349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
77075349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
77085349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
77095349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
77105349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
77115349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
77125349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
77135349a0f7SVidyullatha Kanchanapally  *	case.
77145349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
77155349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
77165349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
77175349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
771876804d28SArend Van Spriel  * @fils: FILS connection response parameters.
77195349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
77205349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
77215349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
77225349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
77235349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
77245349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
7725efbabc11SVeerendranath Jakkam  * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
7726efbabc11SVeerendranath Jakkam  *	zero.
7727efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
7728efbabc11SVeerendranath Jakkam  * @links : For MLO connection, contains link info for the valid links indicated
7729efbabc11SVeerendranath Jakkam  *	using @valid_links. For non-MLO connection, links[0] contains the
7730efbabc11SVeerendranath Jakkam  *	connected AP info.
7731efbabc11SVeerendranath Jakkam  * @links.addr: For MLO connection, MAC address of the STA link. Otherwise
7732efbabc11SVeerendranath Jakkam  *	%NULL.
7733efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
7734efbabc11SVeerendranath Jakkam  *	connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
7735efbabc11SVeerendranath Jakkam  * @links.bss: For MLO connection, entry of bss to which STA link is connected.
7736efbabc11SVeerendranath Jakkam  *	For non-MLO connection, links[0].bss points to entry of bss to which STA
7737efbabc11SVeerendranath Jakkam  *	is connected. It can be obtained through cfg80211_get_bss() (may be
7738efbabc11SVeerendranath Jakkam  *	%NULL). It is recommended to store the bss from the connect_request and
7739efbabc11SVeerendranath Jakkam  *	hold a reference to it and return through this param to avoid a warning
7740efbabc11SVeerendranath Jakkam  *	if the bss is expired during the connection, esp. for those drivers
7741efbabc11SVeerendranath Jakkam  *	implementing connect op. Only one parameter among @bssid and @bss needs
7742efbabc11SVeerendranath Jakkam  *	to be specified.
774353ad07e9SJohannes Berg  * @links.status: per-link status code, to report a status code that's not
774453ad07e9SJohannes Berg  *	%WLAN_STATUS_SUCCESS for a given link, it must also be in the
774553ad07e9SJohannes Berg  *	@valid_links bitmap and may have a BSS pointer (which is then released)
77465349a0f7SVidyullatha Kanchanapally  */
77475349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
77485349a0f7SVidyullatha Kanchanapally 	int status;
77495349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
77505349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
77515349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
77525349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
775376804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
77545349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
7755efbabc11SVeerendranath Jakkam 
7756efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
7757efbabc11SVeerendranath Jakkam 	u16 valid_links;
7758efbabc11SVeerendranath Jakkam 	struct {
7759efbabc11SVeerendranath Jakkam 		const u8 *addr;
7760efbabc11SVeerendranath Jakkam 		const u8 *bssid;
7761efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
776253ad07e9SJohannes Berg 		u16 status;
7763efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
77645349a0f7SVidyullatha Kanchanapally };
77655349a0f7SVidyullatha Kanchanapally 
77665349a0f7SVidyullatha Kanchanapally /**
77675349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
77685349a0f7SVidyullatha Kanchanapally  *
77695349a0f7SVidyullatha Kanchanapally  * @dev: network device
77705349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
77715349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
77725349a0f7SVidyullatha Kanchanapally  *
77735349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
77745349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
77755349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
77765349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
77775349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
77785349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
77795349a0f7SVidyullatha Kanchanapally  */
77805349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
77815349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
77825349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
77835349a0f7SVidyullatha Kanchanapally 
77845349a0f7SVidyullatha Kanchanapally /**
7785e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
7786e7054989SKanchanapally, Vidyullatha  *
7787e7054989SKanchanapally, Vidyullatha  * @dev: network device
7788e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
7789a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
7790a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7791a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7792a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7793a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7794a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
7795e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
7796e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
7797e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
7798e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
7799c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7800e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7801c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
7802c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
7803c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
7804c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
7805c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
7806c88215d7SJouni Malinen  *	case.
7807e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
78083093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
78093093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
78103093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
78113093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
78123093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
78133093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
7814e7054989SKanchanapally, Vidyullatha  *
7815c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7816c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7817c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
78185349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
78195349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
78205349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7821e7054989SKanchanapally, Vidyullatha  */
78225349a0f7SVidyullatha Kanchanapally static inline void
78235349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7824e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
7825e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
78263093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
78275349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
78285349a0f7SVidyullatha Kanchanapally {
78295349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
78305349a0f7SVidyullatha Kanchanapally 
78315349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
78325349a0f7SVidyullatha Kanchanapally 	params.status = status;
7833efbabc11SVeerendranath Jakkam 	params.links[0].bssid = bssid;
7834efbabc11SVeerendranath Jakkam 	params.links[0].bss = bss;
78355349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
78365349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
78375349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
78385349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
78395349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
78405349a0f7SVidyullatha Kanchanapally 
78415349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
78425349a0f7SVidyullatha Kanchanapally }
7843e7054989SKanchanapally, Vidyullatha 
7844e7054989SKanchanapally, Vidyullatha /**
7845b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
7846b23aa676SSamuel Ortiz  *
7847b23aa676SSamuel Ortiz  * @dev: network device
7848b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
7849b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
7850b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
7851b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
7852b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
7853c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7854b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7855b23aa676SSamuel Ortiz  *	the real status code for failures.
7856b23aa676SSamuel Ortiz  * @gfp: allocation flags
7857b23aa676SSamuel Ortiz  *
7858c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7859c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7860c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
78615349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
78625349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7863b23aa676SSamuel Ortiz  */
7864e7054989SKanchanapally, Vidyullatha static inline void
7865e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7866b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
7867b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
7868e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
7869e7054989SKanchanapally, Vidyullatha {
7870e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
78713093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
78723093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
7873e7054989SKanchanapally, Vidyullatha }
7874b23aa676SSamuel Ortiz 
7875b23aa676SSamuel Ortiz /**
7876bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7877bf1ecd21SJouni Malinen  *
7878bf1ecd21SJouni Malinen  * @dev: network device
7879bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
7880bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
7881bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
7882bf1ecd21SJouni Malinen  * @gfp: allocation flags
78833093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
7884bf1ecd21SJouni Malinen  *
7885bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
7886bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
7887bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
7888bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
78895349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
78905349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
78915349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7892bf1ecd21SJouni Malinen  */
7893bf1ecd21SJouni Malinen static inline void
7894bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
78953093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
78963093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
7897bf1ecd21SJouni Malinen {
7898bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
78993093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
7900bf1ecd21SJouni Malinen }
7901bf1ecd21SJouni Malinen 
7902bf1ecd21SJouni Malinen /**
790329ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
790429ce6ecbSAvraham Stern  *
790529ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
790629ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
790729ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
790829ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
7909e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
7910efbabc11SVeerendranath Jakkam  * @valid_links: For MLO roaming, BIT mask of the new valid links is set.
7911efbabc11SVeerendranath Jakkam  *	Otherwise zero.
7912efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
7913efbabc11SVeerendranath Jakkam  * @links : For MLO roaming, contains new link info for the valid links set in
7914efbabc11SVeerendranath Jakkam  *	@valid_links. For non-MLO roaming, links[0] contains the new AP info.
7915efbabc11SVeerendranath Jakkam  * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
7916efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
7917efbabc11SVeerendranath Jakkam  *	roaming, links[0].bssid points to the BSSID of the new AP. May be
7918efbabc11SVeerendranath Jakkam  *	%NULL if %links.bss is set.
7919efbabc11SVeerendranath Jakkam  * @links.channel: the channel of the new AP.
7920efbabc11SVeerendranath Jakkam  * @links.bss: For MLO roaming, entry of new bss to which STA link got
7921efbabc11SVeerendranath Jakkam  *	roamed. For non-MLO roaming, links[0].bss points to entry of bss to
7922efbabc11SVeerendranath Jakkam  *	which STA got roamed (may be %NULL if %links.bssid is set)
792329ce6ecbSAvraham Stern  */
792429ce6ecbSAvraham Stern struct cfg80211_roam_info {
792529ce6ecbSAvraham Stern 	const u8 *req_ie;
792629ce6ecbSAvraham Stern 	size_t req_ie_len;
792729ce6ecbSAvraham Stern 	const u8 *resp_ie;
792829ce6ecbSAvraham Stern 	size_t resp_ie_len;
7929e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
7930efbabc11SVeerendranath Jakkam 
7931efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
7932efbabc11SVeerendranath Jakkam 	u16 valid_links;
7933efbabc11SVeerendranath Jakkam 	struct {
7934efbabc11SVeerendranath Jakkam 		const u8 *addr;
7935efbabc11SVeerendranath Jakkam 		const u8 *bssid;
7936efbabc11SVeerendranath Jakkam 		struct ieee80211_channel *channel;
7937efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
7938efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
793929ce6ecbSAvraham Stern };
794029ce6ecbSAvraham Stern 
794129ce6ecbSAvraham Stern /**
7942b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
7943b23aa676SSamuel Ortiz  *
7944b23aa676SSamuel Ortiz  * @dev: network device
794529ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
7946b23aa676SSamuel Ortiz  * @gfp: allocation flags
7947b23aa676SSamuel Ortiz  *
794829ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
794929ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
795029ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
795129ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
795229ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
795329ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
795429ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7955adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
795629ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7957e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
7958adbde344SVasanthakumar Thiagarajan  */
795929ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
796029ce6ecbSAvraham Stern 		     gfp_t gfp);
7961adbde344SVasanthakumar Thiagarajan 
7962adbde344SVasanthakumar Thiagarajan /**
7963503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
7964503c1fb9SAvraham Stern  *
7965503c1fb9SAvraham Stern  * @dev: network device
7966503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
79670ff57171SVinayak Yadawad  * @td_bitmap: transition disable policy
79680ff57171SVinayak Yadawad  * @td_bitmap_len: Length of transition disable policy
7969503c1fb9SAvraham Stern  * @gfp: allocation flags
7970503c1fb9SAvraham Stern  *
7971503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
7972503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
7973503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
7974503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
7975503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7976503c1fb9SAvraham Stern  * indicate the 802.11 association.
7977503c1fb9SAvraham Stern  */
7978503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
79790ff57171SVinayak Yadawad 			      const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);
7980503c1fb9SAvraham Stern 
7981503c1fb9SAvraham Stern /**
7982b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
7983b23aa676SSamuel Ortiz  *
7984b23aa676SSamuel Ortiz  * @dev: network device
7985b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7986b23aa676SSamuel Ortiz  * @ie_len: length of IEs
7987b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
798880279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
7989b23aa676SSamuel Ortiz  * @gfp: allocation flags
7990b23aa676SSamuel Ortiz  *
7991b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
7992b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
7993b23aa676SSamuel Ortiz  */
7994b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
799580279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
799680279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
7997b23aa676SSamuel Ortiz 
79989588bbd5SJouni Malinen /**
79999588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
800071bbc994SJohannes Berg  * @wdev: wireless device
80019588bbd5SJouni Malinen  * @cookie: the request cookie
80029588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
80039588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
80049588bbd5SJouni Malinen  *	channel
80059588bbd5SJouni Malinen  * @gfp: allocation flags
80069588bbd5SJouni Malinen  */
800771bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
80089588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
80099588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
80109588bbd5SJouni Malinen 
80119588bbd5SJouni Malinen /**
80129588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
801371bbc994SJohannes Berg  * @wdev: wireless device
80149588bbd5SJouni Malinen  * @cookie: the request cookie
80159588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
80169588bbd5SJouni Malinen  * @gfp: allocation flags
80179588bbd5SJouni Malinen  */
801871bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
80199588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
80209588bbd5SJouni Malinen 					gfp_t gfp);
8021b23aa676SSamuel Ortiz 
80228689c051SArend van Spriel /**
80231c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
80241c38c7f2SJames Prestwood  * @wdev: wireless device
80251c38c7f2SJames Prestwood  * @cookie: the requested cookie
80261c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
80271c38c7f2SJames Prestwood  * @gfp: allocation flags
80281c38c7f2SJames Prestwood  */
80291c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
80301c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
80311c38c7f2SJames Prestwood 
80321c38c7f2SJames Prestwood /**
80338689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
80348689c051SArend van Spriel  *
80358689c051SArend van Spriel  * @sinfo: the station information
80368689c051SArend van Spriel  * @gfp: allocation flags
80378689c051SArend van Spriel  */
80388689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
803998b62183SJohannes Berg 
804098b62183SJohannes Berg /**
80417ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
80427ea3e110SJohannes Berg  * @sinfo: the station information
80437ea3e110SJohannes Berg  *
80447ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
80457ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
80467ea3e110SJohannes Berg  * the stack.)
80477ea3e110SJohannes Berg  */
80487ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
80497ea3e110SJohannes Berg {
80507ea3e110SJohannes Berg 	kfree(sinfo->pertid);
80517ea3e110SJohannes Berg }
80527ea3e110SJohannes Berg 
80537ea3e110SJohannes Berg /**
805498b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
805598b62183SJohannes Berg  *
805698b62183SJohannes Berg  * @dev: the netdev
805798b62183SJohannes Berg  * @mac_addr: the station's address
805898b62183SJohannes Berg  * @sinfo: the station information
805998b62183SJohannes Berg  * @gfp: allocation flags
806098b62183SJohannes Berg  */
806198b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
806298b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
806398b62183SJohannes Berg 
8064026331c4SJouni Malinen /**
8065cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
8066cf5ead82SJohannes Berg  * @dev: the netdev
8067bfc55167SVeerendranath Jakkam  * @mac_addr: the station's address. For MLD station, MLD address is used.
8068cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
8069cf5ead82SJohannes Berg  * @gfp: allocation flags
8070cf5ead82SJohannes Berg  */
8071cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
8072cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
8073cf5ead82SJohannes Berg 
8074cf5ead82SJohannes Berg /**
8075ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
8076ec15e68bSJouni Malinen  *
8077ec15e68bSJouni Malinen  * @dev: the netdev
8078bfc55167SVeerendranath Jakkam  * @mac_addr: the station's address. For MLD station, MLD address is used.
8079ec15e68bSJouni Malinen  * @gfp: allocation flags
8080ec15e68bSJouni Malinen  */
8081cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
8082cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
8083cf5ead82SJohannes Berg {
8084cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
8085cf5ead82SJohannes Berg }
8086ec15e68bSJouni Malinen 
8087ec15e68bSJouni Malinen /**
8088ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
8089ed44a951SPandiyarajan Pitchaimuthu  *
8090ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
8091ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
8092ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
8093ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
8094ed44a951SPandiyarajan Pitchaimuthu  *
8095ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
8096ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
8097ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
8098ed44a951SPandiyarajan Pitchaimuthu  *
8099ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
8100ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
8101ed44a951SPandiyarajan Pitchaimuthu  */
8102ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
8103ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
8104ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
8105ed44a951SPandiyarajan Pitchaimuthu 
8106ed44a951SPandiyarajan Pitchaimuthu /**
810700b3d840SAvraham Stern  * struct cfg80211_rx_info - received management frame info
810800b3d840SAvraham Stern  *
810900b3d840SAvraham Stern  * @freq: Frequency on which the frame was received in kHz
811000b3d840SAvraham Stern  * @sig_dbm: signal strength in dBm, or 0 if unknown
81116074c9e5SJohannes Berg  * @have_link_id: indicates the frame was received on a link of
81126074c9e5SJohannes Berg  *	an MLD, i.e. the @link_id field is valid
81136074c9e5SJohannes Berg  * @link_id: the ID of the link the frame was received	on
811400b3d840SAvraham Stern  * @buf: Management frame (header + body)
811500b3d840SAvraham Stern  * @len: length of the frame data
811600b3d840SAvraham Stern  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
81171ff715ffSAvraham Stern  * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
81181ff715ffSAvraham Stern  * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
811900b3d840SAvraham Stern  */
812000b3d840SAvraham Stern struct cfg80211_rx_info {
812100b3d840SAvraham Stern 	int freq;
812200b3d840SAvraham Stern 	int sig_dbm;
81236074c9e5SJohannes Berg 	bool have_link_id;
81246074c9e5SJohannes Berg 	u8 link_id;
812500b3d840SAvraham Stern 	const u8 *buf;
812600b3d840SAvraham Stern 	size_t len;
812700b3d840SAvraham Stern 	u32 flags;
81281ff715ffSAvraham Stern 	u64 rx_tstamp;
81291ff715ffSAvraham Stern 	u64 ack_tstamp;
813000b3d840SAvraham Stern };
813100b3d840SAvraham Stern 
813200b3d840SAvraham Stern /**
813300b3d840SAvraham Stern  * cfg80211_rx_mgmt_ext - management frame notification with extended info
813400b3d840SAvraham Stern  * @wdev: wireless device receiving the frame
813500b3d840SAvraham Stern  * @info: RX info as defined in struct cfg80211_rx_info
813600b3d840SAvraham Stern  *
813700b3d840SAvraham Stern  * This function is called whenever an Action frame is received for a station
813800b3d840SAvraham Stern  * mode interface, but is not processed in kernel.
813900b3d840SAvraham Stern  *
814000b3d840SAvraham Stern  * Return: %true if a user space application has registered for this frame.
814100b3d840SAvraham Stern  * For action frames, that makes it responsible for rejecting unrecognized
814200b3d840SAvraham Stern  * action frames; %false otherwise, in which case for action frames the
814300b3d840SAvraham Stern  * driver is responsible for rejecting the frame.
814400b3d840SAvraham Stern  */
814500b3d840SAvraham Stern bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,
814600b3d840SAvraham Stern 			  struct cfg80211_rx_info *info);
814700b3d840SAvraham Stern 
814800b3d840SAvraham Stern /**
8149e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
8150e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
8151e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
8152e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8153e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
8154e76fede8SThomas Pedersen  * @len: length of the frame data
8155e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
8156e76fede8SThomas Pedersen  *
8157e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
8158e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
8159e76fede8SThomas Pedersen  *
8160e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
8161e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
8162e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
8163e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
8164e76fede8SThomas Pedersen  */
816500b3d840SAvraham Stern static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,
816600b3d840SAvraham Stern 					int sig_dbm, const u8 *buf, size_t len,
816700b3d840SAvraham Stern 					u32 flags)
816800b3d840SAvraham Stern {
816900b3d840SAvraham Stern 	struct cfg80211_rx_info info = {
817000b3d840SAvraham Stern 		.freq = freq,
817100b3d840SAvraham Stern 		.sig_dbm = sig_dbm,
817200b3d840SAvraham Stern 		.buf = buf,
817300b3d840SAvraham Stern 		.len = len,
817400b3d840SAvraham Stern 		.flags = flags
817500b3d840SAvraham Stern 	};
817600b3d840SAvraham Stern 
817700b3d840SAvraham Stern 	return cfg80211_rx_mgmt_ext(wdev, &info);
817800b3d840SAvraham Stern }
8179e76fede8SThomas Pedersen 
8180e76fede8SThomas Pedersen /**
81812e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
818271bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
8183026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
81846c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
81852e161f78SJohannes Berg  * @buf: Management frame (header + body)
8186026331c4SJouni Malinen  * @len: length of the frame data
818719504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
81882e161f78SJohannes Berg  *
81890ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
81900ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
81910ae997dcSYacine Belkadi  *
81920ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
81932e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
81942e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
81952e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
8196026331c4SJouni Malinen  */
8197e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
8198e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
8199e76fede8SThomas Pedersen 				    u32 flags)
8200e76fede8SThomas Pedersen {
820100b3d840SAvraham Stern 	struct cfg80211_rx_info info = {
820200b3d840SAvraham Stern 		.freq = MHZ_TO_KHZ(freq),
820300b3d840SAvraham Stern 		.sig_dbm = sig_dbm,
820400b3d840SAvraham Stern 		.buf = buf,
820500b3d840SAvraham Stern 		.len = len,
820600b3d840SAvraham Stern 		.flags = flags
820700b3d840SAvraham Stern 	};
820800b3d840SAvraham Stern 
820900b3d840SAvraham Stern 	return cfg80211_rx_mgmt_ext(wdev, &info);
8210e76fede8SThomas Pedersen }
8211026331c4SJouni Malinen 
8212026331c4SJouni Malinen /**
8213ea7d50c9SAvraham Stern  * struct cfg80211_tx_status - TX status for management frame information
8214ea7d50c9SAvraham Stern  *
8215ea7d50c9SAvraham Stern  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
8216ea7d50c9SAvraham Stern  * @tx_tstamp: hardware TX timestamp in nanoseconds
8217ea7d50c9SAvraham Stern  * @ack_tstamp: hardware ack RX timestamp in nanoseconds
8218ea7d50c9SAvraham Stern  * @buf: Management frame (header + body)
8219ea7d50c9SAvraham Stern  * @len: length of the frame data
8220ea7d50c9SAvraham Stern  * @ack: Whether frame was acknowledged
8221ea7d50c9SAvraham Stern  */
8222ea7d50c9SAvraham Stern struct cfg80211_tx_status {
8223ea7d50c9SAvraham Stern 	u64 cookie;
8224ea7d50c9SAvraham Stern 	u64 tx_tstamp;
8225ea7d50c9SAvraham Stern 	u64 ack_tstamp;
8226ea7d50c9SAvraham Stern 	const u8 *buf;
8227ea7d50c9SAvraham Stern 	size_t len;
8228ea7d50c9SAvraham Stern 	bool ack;
8229ea7d50c9SAvraham Stern };
8230ea7d50c9SAvraham Stern 
8231ea7d50c9SAvraham Stern /**
8232ea7d50c9SAvraham Stern  * cfg80211_mgmt_tx_status_ext - TX status notification with extended info
8233ea7d50c9SAvraham Stern  * @wdev: wireless device receiving the frame
8234ea7d50c9SAvraham Stern  * @status: TX status data
8235ea7d50c9SAvraham Stern  * @gfp: context flags
8236ea7d50c9SAvraham Stern  *
8237ea7d50c9SAvraham Stern  * This function is called whenever a management frame was requested to be
8238ea7d50c9SAvraham Stern  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
8239ea7d50c9SAvraham Stern  * transmission attempt with extended info.
8240ea7d50c9SAvraham Stern  */
8241ea7d50c9SAvraham Stern void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,
8242ea7d50c9SAvraham Stern 				 struct cfg80211_tx_status *status, gfp_t gfp);
8243ea7d50c9SAvraham Stern 
8244ea7d50c9SAvraham Stern /**
82452e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
824671bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
82472e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
82482e161f78SJohannes Berg  * @buf: Management frame (header + body)
8249026331c4SJouni Malinen  * @len: length of the frame data
8250026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
8251026331c4SJouni Malinen  * @gfp: context flags
8252026331c4SJouni Malinen  *
82532e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
82542e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
8255026331c4SJouni Malinen  * transmission attempt.
8256026331c4SJouni Malinen  */
8257ea7d50c9SAvraham Stern static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,
8258ea7d50c9SAvraham Stern 					   u64 cookie, const u8 *buf,
8259ea7d50c9SAvraham Stern 					   size_t len, bool ack, gfp_t gfp)
8260ea7d50c9SAvraham Stern {
8261ea7d50c9SAvraham Stern 	struct cfg80211_tx_status status = {
8262ea7d50c9SAvraham Stern 		.cookie = cookie,
8263ea7d50c9SAvraham Stern 		.buf = buf,
8264ea7d50c9SAvraham Stern 		.len = len,
8265ea7d50c9SAvraham Stern 		.ack = ack
8266ea7d50c9SAvraham Stern 	};
8267ea7d50c9SAvraham Stern 
8268ea7d50c9SAvraham Stern 	cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);
8269ea7d50c9SAvraham Stern }
8270026331c4SJouni Malinen 
8271dca9ca2dSMarkus Theil /**
8272dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
8273dca9ca2dSMarkus Theil  *                                   port frames
8274dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
8275dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
8276dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
8277dca9ca2dSMarkus Theil  * @len: length of the frame data
8278dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
8279dca9ca2dSMarkus Theil  * @gfp: context flags
8280dca9ca2dSMarkus Theil  *
8281dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
8282dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
8283dca9ca2dSMarkus Theil  * the transmission attempt.
8284dca9ca2dSMarkus Theil  */
8285dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
8286dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
8287dca9ca2dSMarkus Theil 				     gfp_t gfp);
8288d6dc1a38SJuuso Oikarinen 
8289d6dc1a38SJuuso Oikarinen /**
82906a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
82916a671a50SDenis Kenzior  * @dev: The device the frame matched to
8292a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
8293a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
8294a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
8295a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
8296a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
82976a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
82984c532321SJohannes Berg  * @link_id: the link the frame was received on, -1 if not applicable or unknown
82996a671a50SDenis Kenzior  *
83006a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
83016a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
83026a671a50SDenis Kenzior  * control port frames over nl80211.
83036a671a50SDenis Kenzior  *
83046a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
83056a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
83066a671a50SDenis Kenzior  *
83076a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
83086a671a50SDenis Kenzior  */
83094c532321SJohannes Berg bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
83104c532321SJohannes Berg 			      bool unencrypted, int link_id);
83116a671a50SDenis Kenzior 
83126a671a50SDenis Kenzior /**
8313d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
8314d6dc1a38SJuuso Oikarinen  * @dev: network device
8315d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
8316bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
8317d6dc1a38SJuuso Oikarinen  * @gfp: context flags
8318d6dc1a38SJuuso Oikarinen  *
8319d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
8320d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
8321d6dc1a38SJuuso Oikarinen  */
8322d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
8323d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
8324bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
8325d6dc1a38SJuuso Oikarinen 
8326c063dbf5SJohannes Berg /**
8327c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
8328c063dbf5SJohannes Berg  * @dev: network device
8329c063dbf5SJohannes Berg  * @peer: peer's MAC address
8330c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
8331c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
8332c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
8333c063dbf5SJohannes Berg  * @gfp: context flags
8334c063dbf5SJohannes Berg  */
8335c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
8336c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
8337c063dbf5SJohannes Berg 
8338e5497d76SJohannes Berg /**
833984f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
834084f10708SThomas Pedersen  * @dev: network device
834184f10708SThomas Pedersen  * @peer: peer's MAC address
834284f10708SThomas Pedersen  * @num_packets: how many packets were lost
834384f10708SThomas Pedersen  * @rate: % of packets which failed transmission
834484f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
834584f10708SThomas Pedersen  * @gfp: context flags
834684f10708SThomas Pedersen  *
834784f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
834884f10708SThomas Pedersen  * given interval is exceeded.
834984f10708SThomas Pedersen  */
835084f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
835184f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
835284f10708SThomas Pedersen 
835384f10708SThomas Pedersen /**
835498f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
835598f03342SJohannes Berg  * @dev: network device
835698f03342SJohannes Berg  * @gfp: context flags
835798f03342SJohannes Berg  *
835898f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
835998f03342SJohannes Berg  */
836098f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
836198f03342SJohannes Berg 
836298f03342SJohannes Berg /**
8363c47240cbSLorenzo Bianconi  * __cfg80211_radar_event - radar detection event
83645b97f49dSJohannes Berg  * @wiphy: the wiphy
83655b97f49dSJohannes Berg  * @chandef: chandef for the current channel
8366c47240cbSLorenzo Bianconi  * @offchan: the radar has been detected on the offchannel chain
83675b97f49dSJohannes Berg  * @gfp: context flags
83685b97f49dSJohannes Berg  *
83695b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
83705b97f49dSJohannes Berg  */
8371c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy,
8372c47240cbSLorenzo Bianconi 			    struct cfg80211_chan_def *chandef,
8373c47240cbSLorenzo Bianconi 			    bool offchan, gfp_t gfp);
8374c47240cbSLorenzo Bianconi 
8375c47240cbSLorenzo Bianconi static inline void
8376c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy,
8377c47240cbSLorenzo Bianconi 		     struct cfg80211_chan_def *chandef,
8378c47240cbSLorenzo Bianconi 		     gfp_t gfp)
8379c47240cbSLorenzo Bianconi {
8380c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, false, gfp);
8381c47240cbSLorenzo Bianconi }
8382c47240cbSLorenzo Bianconi 
8383c47240cbSLorenzo Bianconi static inline void
8384a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy,
8385c47240cbSLorenzo Bianconi 				struct cfg80211_chan_def *chandef,
8386c47240cbSLorenzo Bianconi 				gfp_t gfp)
8387c47240cbSLorenzo Bianconi {
8388c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, true, gfp);
8389c47240cbSLorenzo Bianconi }
83905b97f49dSJohannes Berg 
83915b97f49dSJohannes Berg /**
8392466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
8393466b9936Stamizhr@codeaurora.org  * @dev: network device
8394466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
8395466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
8396466b9936Stamizhr@codeaurora.org  * @gfp: context flags
8397466b9936Stamizhr@codeaurora.org  *
8398466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
8399466b9936Stamizhr@codeaurora.org  * frame.
8400466b9936Stamizhr@codeaurora.org  */
8401466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
8402466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
8403466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
8404466b9936Stamizhr@codeaurora.org 
8405466b9936Stamizhr@codeaurora.org /**
84065b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
84075b97f49dSJohannes Berg  * @netdev: network device
84085b97f49dSJohannes Berg  * @chandef: chandef for the current channel
84095b97f49dSJohannes Berg  * @event: type of event
84105b97f49dSJohannes Berg  * @gfp: context flags
84115b97f49dSJohannes Berg  *
84125b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
84135b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
84145b97f49dSJohannes Berg  * also by full-MAC drivers.
84155b97f49dSJohannes Berg  */
84165b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
84175b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
84185b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
84195b97f49dSJohannes Berg 
8420bc2dfc02SLorenzo Bianconi /**
8421a95bfb87SLorenzo Bianconi  * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
8422bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
8423bc2dfc02SLorenzo Bianconi  *
84241507b153SLorenzo Bianconi  * This function is called by the driver when a Channel Availability Check
84251507b153SLorenzo Bianconi  * (CAC) is aborted by a offchannel dedicated chain.
8426bc2dfc02SLorenzo Bianconi  */
8427a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy);
84285b97f49dSJohannes Berg 
84295b97f49dSJohannes Berg /**
8430e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
8431e5497d76SJohannes Berg  * @dev: network device
8432e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
8433e5497d76SJohannes Berg  * @replay_ctr: new replay counter
8434af71ff85SJohannes Berg  * @gfp: allocation flags
8435e5497d76SJohannes Berg  */
8436e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
8437e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
8438e5497d76SJohannes Berg 
8439c9df56b4SJouni Malinen /**
8440c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
8441c9df56b4SJouni Malinen  * @dev: network device
8442c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
8443c9df56b4SJouni Malinen  * @bssid: BSSID of AP
8444c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
8445c9df56b4SJouni Malinen  * @gfp: allocation flags
8446c9df56b4SJouni Malinen  */
8447c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
8448c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
8449c9df56b4SJouni Malinen 
845028946da7SJohannes Berg /**
845128946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
845228946da7SJohannes Berg  * @dev: The device the frame matched to
845328946da7SJohannes Berg  * @addr: the transmitter address
845428946da7SJohannes Berg  * @gfp: context flags
845528946da7SJohannes Berg  *
845628946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
845728946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
845828946da7SJohannes Berg  * sender.
84590ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
846028946da7SJohannes Berg  * for a reason other than not having a subscription.)
846128946da7SJohannes Berg  */
846228946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
846328946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
846428946da7SJohannes Berg 
84657f6cf311SJohannes Berg /**
8466b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
8467b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
8468b92ab5d8SJohannes Berg  * @addr: the transmitter address
8469b92ab5d8SJohannes Berg  * @gfp: context flags
8470b92ab5d8SJohannes Berg  *
8471b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
8472b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
8473b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
8474b92ab5d8SJohannes Berg  * station to avoid event flooding.
84750ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
8476b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
8477b92ab5d8SJohannes Berg  */
8478b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
8479b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
8480b92ab5d8SJohannes Berg 
8481b92ab5d8SJohannes Berg /**
84827f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
84837f6cf311SJohannes Berg  * @dev: the device the probe was sent on
84847f6cf311SJohannes Berg  * @addr: the address of the peer
84857f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
84867f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
8487c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
8488c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
84897f6cf311SJohannes Berg  * @gfp: allocation flags
84907f6cf311SJohannes Berg  */
84917f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
8492c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
8493c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
84947f6cf311SJohannes Berg 
84955e760230SJohannes Berg /**
8496e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
8497e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
8498e76fede8SThomas Pedersen  * @frame: the frame
8499e76fede8SThomas Pedersen  * @len: length of the frame
8500e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
8501e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8502e76fede8SThomas Pedersen  *
8503e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
8504e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
8505e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
8506e76fede8SThomas Pedersen  */
8507e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
8508e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
8509e76fede8SThomas Pedersen 
8510e76fede8SThomas Pedersen /**
85115e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
85125e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
85135e760230SJohannes Berg  * @frame: the frame
85145e760230SJohannes Berg  * @len: length of the frame
85155e760230SJohannes Berg  * @freq: frequency the frame was received on
85166c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
85175e760230SJohannes Berg  *
85185e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
85195e760230SJohannes Berg  * received. It is not useful to call this when there is no
85205e760230SJohannes Berg  * netdev that is in AP/GO mode.
85215e760230SJohannes Berg  */
8522e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
85235e760230SJohannes Berg 					       const u8 *frame, size_t len,
8524e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
8525e76fede8SThomas Pedersen {
8526e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
8527e76fede8SThomas Pedersen 					sig_dbm);
8528e76fede8SThomas Pedersen }
85295e760230SJohannes Berg 
8530d58e7e37SJohannes Berg /**
8531683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
853254858ee5SAlexander Simon  * @wiphy: the wiphy
8533683b6d3bSJohannes Berg  * @chandef: the channel definition
8534174e0cd2SIlan Peer  * @iftype: interface type
8535d58e7e37SJohannes Berg  *
85360ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
85370ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
853854858ee5SAlexander Simon  */
8539683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
8540174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
8541174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
854254858ee5SAlexander Simon 
8543923b352fSArik Nemtsov /**
8544923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
8545923b352fSArik Nemtsov  * @wiphy: the wiphy
8546923b352fSArik Nemtsov  * @chandef: the channel definition
8547923b352fSArik Nemtsov  * @iftype: interface type
8548923b352fSArik Nemtsov  *
8549923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
8550923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
8551923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
8552923b352fSArik Nemtsov  * more permissive conditions.
8553923b352fSArik Nemtsov  *
8554a05829a7SJohannes Berg  * Requires the wiphy mutex to be held.
8555923b352fSArik Nemtsov  */
8556923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
8557923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
8558923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
8559923b352fSArik Nemtsov 
85608097e149SThomas Pedersen /*
85615314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
85625314526bSThomas Pedersen  * @dev: the device which switched channels
8563683b6d3bSJohannes Berg  * @chandef: the new channel definition
85647b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO, must be 0 for non-MLO
8565b345f063SAloka Dixit  * @punct_bitmap: the new puncturing bitmap
85665314526bSThomas Pedersen  *
8567e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
8568e487eaebSSimon Wunderlich  * driver context!
85695314526bSThomas Pedersen  */
8570683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
85717b0a0e3cSJohannes Berg 			       struct cfg80211_chan_def *chandef,
8572b345f063SAloka Dixit 			       unsigned int link_id, u16 punct_bitmap);
85735314526bSThomas Pedersen 
8574f8d7552eSLuciano Coelho /*
8575f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
8576f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
8577f8d7552eSLuciano Coelho  * @chandef: the future channel definition
8578b8c9024eSVeerendranath Jakkam  * @link_id: the link ID for MLO, must be 0 for non-MLO
8579f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
8580669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
8581b345f063SAloka Dixit  * @punct_bitmap: the future puncturing bitmap
8582f8d7552eSLuciano Coelho  *
8583f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
8584f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
8585f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
8586f8d7552eSLuciano Coelho  */
8587f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
8588f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
8589b8c9024eSVeerendranath Jakkam 				       unsigned int link_id, u8 count,
8590b345f063SAloka Dixit 				       bool quiet, u16 punct_bitmap);
8591f8d7552eSLuciano Coelho 
85921ce3e82bSJohannes Berg /**
85931ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
85941ce3e82bSJohannes Berg  *
85951ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
85961ce3e82bSJohannes Berg  * @band: band pointer to fill
85971ce3e82bSJohannes Berg  *
85981ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
85991ce3e82bSJohannes Berg  */
86001ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
860157fbcce3SJohannes Berg 				       enum nl80211_band *band);
86021ce3e82bSJohannes Berg 
8603a38700ddSArik Nemtsov /**
8604a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
8605a38700ddSArik Nemtsov  *
8606a38700ddSArik Nemtsov  * @chandef: the chandef to convert
8607a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
8608a38700ddSArik Nemtsov  *
8609a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
8610a38700ddSArik Nemtsov  */
8611a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
8612a38700ddSArik Nemtsov 					  u8 *op_class);
8613a38700ddSArik Nemtsov 
8614934f4c7dSThomas Pedersen /**
8615934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
8616934f4c7dSThomas Pedersen  *
8617934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
8618934f4c7dSThomas Pedersen  *
8619934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
8620934f4c7dSThomas Pedersen  */
8621934f4c7dSThomas Pedersen static inline u32
8622934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
8623934f4c7dSThomas Pedersen {
8624934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
8625934f4c7dSThomas Pedersen }
8626934f4c7dSThomas Pedersen 
86275314526bSThomas Pedersen /*
86283475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
86293475b094SJouni Malinen  * @dev: the device on which the operation is requested
86303475b094SJouni Malinen  * @peer: the MAC address of the peer device
86313475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
86323475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
86333475b094SJouni Malinen  * @reason_code: the reason code for teardown request
86343475b094SJouni Malinen  * @gfp: allocation flags
86353475b094SJouni Malinen  *
86363475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
86373475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
86383475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
86393475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
86403475b094SJouni Malinen  * based on traffic and signal strength for a peer).
86413475b094SJouni Malinen  */
86423475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
86433475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
86443475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
86453475b094SJouni Malinen 
86463475b094SJouni Malinen /*
86478097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
86488097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
86498097e149SThomas Pedersen  *
86508097e149SThomas Pedersen  * return 0 if MCS index >= 32
86518097e149SThomas Pedersen  */
86528eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
86538097e149SThomas Pedersen 
865498104fdeSJohannes Berg /**
865598104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
865698104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
865798104fdeSJohannes Berg  *
86582fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
86592fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
86602fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
86612fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
86622fe8ef10SJohannes Berg  * is unbound from the driver.
866398104fdeSJohannes Berg  *
8664a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
866598104fdeSJohannes Berg  */
866698104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
866798104fdeSJohannes Berg 
86680ee45355SJohannes Berg /**
86692fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
86702fe8ef10SJohannes Berg  * @dev: the netdev to register
86712fe8ef10SJohannes Berg  *
86722fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
86732fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
86742fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
86752fe8ef10SJohannes Berg  * instead as well.
8676a05829a7SJohannes Berg  *
8677a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
86782fe8ef10SJohannes Berg  */
86792fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
86802fe8ef10SJohannes Berg 
86812fe8ef10SJohannes Berg /**
86822fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
86832fe8ef10SJohannes Berg  * @dev: the netdev to register
86842fe8ef10SJohannes Berg  *
86852fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
86862fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
86872fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
86882fe8ef10SJohannes Berg  * usable instead as well.
8689a05829a7SJohannes Berg  *
8690a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
86912fe8ef10SJohannes Berg  */
86922fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
86932fe8ef10SJohannes Berg {
8694c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211)
86952fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
8696c304eddcSJakub Kicinski #endif
86972fe8ef10SJohannes Berg }
86982fe8ef10SJohannes Berg 
86992fe8ef10SJohannes Berg /**
8700b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
8701355199e0SJouni Malinen  * @ies: FT IEs
8702355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
8703355199e0SJouni Malinen  * @target_ap: target AP's MAC address
8704355199e0SJouni Malinen  * @ric_ies: RIC IE
8705355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
8706355199e0SJouni Malinen  */
8707355199e0SJouni Malinen struct cfg80211_ft_event_params {
8708355199e0SJouni Malinen 	const u8 *ies;
8709355199e0SJouni Malinen 	size_t ies_len;
8710355199e0SJouni Malinen 	const u8 *target_ap;
8711355199e0SJouni Malinen 	const u8 *ric_ies;
8712355199e0SJouni Malinen 	size_t ric_ies_len;
8713355199e0SJouni Malinen };
8714355199e0SJouni Malinen 
8715355199e0SJouni Malinen /**
8716355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
8717355199e0SJouni Malinen  * @netdev: network device
8718355199e0SJouni Malinen  * @ft_event: IE information
8719355199e0SJouni Malinen  */
8720355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
8721355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
8722355199e0SJouni Malinen 
8723355199e0SJouni Malinen /**
87240ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
87250ee45355SJohannes Berg  * @ies: the input IE buffer
87260ee45355SJohannes Berg  * @len: the input length
87270ee45355SJohannes Berg  * @attr: the attribute ID to find
87280ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
87290ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
87300ee45355SJohannes Berg  * @bufsize: size of the output buffer
87310ee45355SJohannes Berg  *
87320ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
87330ee45355SJohannes Berg  * copies its contents to the given buffer.
87340ee45355SJohannes Berg  *
87350ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
87360ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
87370ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
87380ee45355SJohannes Berg  */
8739c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
8740c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
8741c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
87420ee45355SJohannes Berg 
8743cd8f7cb4SJohannes Berg /**
874429464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
874529464cccSJohannes Berg  * @ies: the IE buffer
874629464cccSJohannes Berg  * @ielen: the length of the IE buffer
874729464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
87482512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
87492512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
875029464cccSJohannes Berg  * @n_ids: the size of the element ID array
875129464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
875229464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
875329464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
875429464cccSJohannes Berg  *
875529464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
875629464cccSJohannes Berg  * variable to point to the location where the buffer should be
875729464cccSJohannes Berg  * split.
875829464cccSJohannes Berg  *
875929464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
876029464cccSJohannes Berg  * has to be guaranteed by the caller!
876129464cccSJohannes Berg  *
876229464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
876329464cccSJohannes Berg  * correctly, if not the result of using this function will not
876429464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
876529464cccSJohannes Berg  *
876629464cccSJohannes Berg  * The function returns the offset where the next part of the
876729464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
876829464cccSJohannes Berg  * of the buffer should be used.
876929464cccSJohannes Berg  */
877029464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
877129464cccSJohannes Berg 			      const u8 *ids, int n_ids,
877229464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
877329464cccSJohannes Berg 			      size_t offset);
877429464cccSJohannes Berg 
877529464cccSJohannes Berg /**
877629464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
877729464cccSJohannes Berg  * @ies: the IE buffer
877829464cccSJohannes Berg  * @ielen: the length of the IE buffer
877929464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
87802512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
87812512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
878229464cccSJohannes Berg  * @n_ids: the size of the element ID array
878329464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
878429464cccSJohannes Berg  *
878529464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
878629464cccSJohannes Berg  * variable to point to the location where the buffer should be
878729464cccSJohannes Berg  * split.
878829464cccSJohannes Berg  *
878929464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
879029464cccSJohannes Berg  * has to be guaranteed by the caller!
879129464cccSJohannes Berg  *
879229464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
879329464cccSJohannes Berg  * correctly, if not the result of using this function will not
879429464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
879529464cccSJohannes Berg  *
879629464cccSJohannes Berg  * The function returns the offset where the next part of the
879729464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
879829464cccSJohannes Berg  * of the buffer should be used.
879929464cccSJohannes Berg  */
88000483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
88010483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
88020483eeacSJohannes Berg {
88030483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
88040483eeacSJohannes Berg }
880529464cccSJohannes Berg 
880629464cccSJohannes Berg /**
8807cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
8808cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
8809cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
8810cd8f7cb4SJohannes Berg  * @gfp: allocation flags
8811cd8f7cb4SJohannes Berg  *
8812cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
8813cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
8814cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
8815cd8f7cb4SJohannes Berg  * else caused the wakeup.
8816cd8f7cb4SJohannes Berg  */
8817cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
8818cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
8819cd8f7cb4SJohannes Berg 				   gfp_t gfp);
8820cd8f7cb4SJohannes Berg 
88215de17984SArend van Spriel /**
88225de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
88235de17984SArend van Spriel  *
88245de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
882503f831a6SRobert P. J. Day  * @gfp: allocation flags
88265de17984SArend van Spriel  *
88275de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
88285de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
88295de17984SArend van Spriel  * by .crit_proto_start() has expired.
88305de17984SArend van Spriel  */
88315de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
88325de17984SArend van Spriel 
8833bdfbec2dSIlan Peer /**
8834bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
8835bdfbec2dSIlan Peer  * @wiphy: the wiphy
8836bdfbec2dSIlan Peer  *
8837bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
8838bdfbec2dSIlan Peer  */
8839bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
8840bdfbec2dSIlan Peer 
8841cb2d956dSLuciano Coelho /**
8842cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
8843cb2d956dSLuciano Coelho  *
8844cb2d956dSLuciano Coelho  * @wiphy: the wiphy
8845e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
8846cb2d956dSLuciano Coelho  *
8847cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
8848cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
8849cb2d956dSLuciano Coelho  * the interface combinations.
8850cb2d956dSLuciano Coelho  */
8851cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
8852e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
8853cb2d956dSLuciano Coelho 
885465a124ddSMichal Kazior /**
885565a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
885665a124ddSMichal Kazior  *
885765a124ddSMichal Kazior  * @wiphy: the wiphy
8858e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
885965a124ddSMichal Kazior  * @iter: function to call for each matching combination
886065a124ddSMichal Kazior  * @data: pointer to pass to iter function
886165a124ddSMichal Kazior  *
886265a124ddSMichal Kazior  * This function can be called by the driver to check what possible
886365a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
886465a124ddSMichal Kazior  * purposes.
886565a124ddSMichal Kazior  */
886665a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
8867e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
886865a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
886965a124ddSMichal Kazior 					    void *data),
887065a124ddSMichal Kazior 			       void *data);
887165a124ddSMichal Kazior 
8872f04c2203SMichal Kazior /*
8873f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
8874f04c2203SMichal Kazior  *
8875f04c2203SMichal Kazior  * @wiphy: the wiphy
8876f04c2203SMichal Kazior  * @wdev: wireless device
8877f04c2203SMichal Kazior  * @gfp: context flags
8878f04c2203SMichal Kazior  *
8879f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
8880f04c2203SMichal Kazior  * disconnected.
8881f04c2203SMichal Kazior  *
8882f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
8883f04c2203SMichal Kazior  */
8884f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
8885f04c2203SMichal Kazior 			 gfp_t gfp);
8886f04c2203SMichal Kazior 
8887f6837ba8SJohannes Berg /**
8888f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
8889f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
8890f6837ba8SJohannes Berg  *
8891f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
8892f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
8893f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
8894f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
8895f6837ba8SJohannes Berg  *
8896f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
8897f6837ba8SJohannes Berg  * the driver while the function is running.
8898f6837ba8SJohannes Berg  */
8899f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
8900f6837ba8SJohannes Berg 
8901d75bb06bSGautam Kumar Shukla /**
8902d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
8903d75bb06bSGautam Kumar Shukla  *
8904d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8905d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8906d75bb06bSGautam Kumar Shukla  *
8907d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8908d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8909d75bb06bSGautam Kumar Shukla  */
8910d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
8911d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
8912d75bb06bSGautam Kumar Shukla {
8913d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
8914d75bb06bSGautam Kumar Shukla 
8915d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
8916d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
8917d75bb06bSGautam Kumar Shukla }
8918d75bb06bSGautam Kumar Shukla 
8919d75bb06bSGautam Kumar Shukla /**
8920d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
8921d75bb06bSGautam Kumar Shukla  *
8922d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8923d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8924d75bb06bSGautam Kumar Shukla  *
8925d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8926d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8927d75bb06bSGautam Kumar Shukla  */
8928d75bb06bSGautam Kumar Shukla static inline bool
8929d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
8930d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
8931d75bb06bSGautam Kumar Shukla {
8932d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
8933d75bb06bSGautam Kumar Shukla 
8934d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
8935d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
8936d75bb06bSGautam Kumar Shukla }
8937b7ffbd7eSJohannes Berg 
8938a442b761SAyala Beker /**
8939a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
8940a442b761SAyala Beker  * @f: NAN function that should be freed
8941a442b761SAyala Beker  *
8942a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
8943a442b761SAyala Beker  */
8944a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8945a442b761SAyala Beker 
894650bcd31dSAyala Beker /**
894750bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
894850bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
894950bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
895050bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
895150bcd31dSAyala Beker  *	 result.
895250bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
895350bcd31dSAyala Beker  * @inst_id: the local instance id
895450bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
895550bcd31dSAyala Beker  * @addr: the MAC address of the peer
895650bcd31dSAyala Beker  * @info_len: the length of the &info
895750bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
895850bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
895950bcd31dSAyala Beker  */
896050bcd31dSAyala Beker struct cfg80211_nan_match_params {
896150bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
896250bcd31dSAyala Beker 	u8 inst_id;
896350bcd31dSAyala Beker 	u8 peer_inst_id;
896450bcd31dSAyala Beker 	const u8 *addr;
896550bcd31dSAyala Beker 	u8 info_len;
896650bcd31dSAyala Beker 	const u8 *info;
896750bcd31dSAyala Beker 	u64 cookie;
896850bcd31dSAyala Beker };
896950bcd31dSAyala Beker 
897050bcd31dSAyala Beker /**
897150bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
897250bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
897350bcd31dSAyala Beker  * @match: match notification parameters
897450bcd31dSAyala Beker  * @gfp: allocation flags
897550bcd31dSAyala Beker  *
897650bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
897750bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
897850bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
897950bcd31dSAyala Beker  */
898050bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
898150bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
898250bcd31dSAyala Beker 
8983368e5a7bSAyala Beker /**
8984368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
8985368e5a7bSAyala Beker  *
8986368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
8987368e5a7bSAyala Beker  * @inst_id: the local instance id
8988368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8989368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
8990368e5a7bSAyala Beker  * @gfp: allocation flags
8991368e5a7bSAyala Beker  *
8992368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
8993368e5a7bSAyala Beker  */
8994368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8995368e5a7bSAyala Beker 				  u8 inst_id,
8996368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
8997368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
8998368e5a7bSAyala Beker 
8999b7ffbd7eSJohannes Berg /* ethtool helper */
9000b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
9001b7ffbd7eSJohannes Berg 
900240cbfa90SSrinivas Dasari /**
900340cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
900440cbfa90SSrinivas Dasari  * @netdev: network device
900540cbfa90SSrinivas Dasari  * @params: External authentication parameters
900640cbfa90SSrinivas Dasari  * @gfp: allocation flags
900740cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
900840cbfa90SSrinivas Dasari  */
900940cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
901040cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
901140cbfa90SSrinivas Dasari 				   gfp_t gfp);
901240cbfa90SSrinivas Dasari 
90139bb7e0f2SJohannes Berg /**
90149bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
90159bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
90169bb7e0f2SJohannes Berg  * @req: the original measurement request
90179bb7e0f2SJohannes Berg  * @result: the result data
90189bb7e0f2SJohannes Berg  * @gfp: allocation flags
90199bb7e0f2SJohannes Berg  */
90209bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
90219bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
90229bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
90239bb7e0f2SJohannes Berg 			  gfp_t gfp);
90249bb7e0f2SJohannes Berg 
90259bb7e0f2SJohannes Berg /**
90269bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
90279bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
90289bb7e0f2SJohannes Berg  * @req: the original measurement request
90299bb7e0f2SJohannes Berg  * @gfp: allocation flags
90309bb7e0f2SJohannes Berg  *
90319bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
90329bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
90339bb7e0f2SJohannes Berg  */
90349bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
90359bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
90369bb7e0f2SJohannes Berg 			    gfp_t gfp);
90379bb7e0f2SJohannes Berg 
9038e6f40511SManikanta Pubbisetty /**
9039e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
9040e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
9041e6f40511SManikanta Pubbisetty  * @iftype: interface type
9042e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
9043e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
9044e6f40511SManikanta Pubbisetty  *
9045e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
9046e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
9047e6f40511SManikanta Pubbisetty  * check_swif is '1'.
9048e6f40511SManikanta Pubbisetty  */
9049e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
9050e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
9051e6f40511SManikanta Pubbisetty 
9052e6f40511SManikanta Pubbisetty 
9053a083ee8aSIlan Peer /**
9054a083ee8aSIlan Peer  * cfg80211_assoc_comeback - notification of association that was
9055a083ee8aSIlan Peer  * temporarly rejected with a comeback
9056a083ee8aSIlan Peer  * @netdev: network device
9057e69dac88SJohannes Berg  * @ap_addr: AP (MLD) address that rejected the assocation
9058a083ee8aSIlan Peer  * @timeout: timeout interval value TUs.
9059a083ee8aSIlan Peer  *
9060a083ee8aSIlan Peer  * this function may sleep. the caller must hold the corresponding wdev's mutex.
9061a083ee8aSIlan Peer  */
9062a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev,
9063e69dac88SJohannes Berg 			     const u8 *ap_addr, u32 timeout);
9064a083ee8aSIlan Peer 
9065e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
9066e1db74fcSJoe Perches 
9067e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
9068e1db74fcSJoe Perches 
9069e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
90709c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
9071e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
90729c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
9073e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
90749c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
9075e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
90769c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
9077e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
90789c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
9079e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
90809c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
9081e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
90829c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
9083e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
90849c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
9085761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
9086761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
9087073730d7SJoe Perches 
9088a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
9089a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
9090a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
9091a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
9092a58d7525SStanislaw Gruszka 
90939c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
9094e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
90959c376639SJoe Perches 
9096e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
90979c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
9098e1db74fcSJoe Perches 
9099e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
9100e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
9101e1db74fcSJoe Perches #else
9102e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
9103e1db74fcSJoe Perches ({									\
9104e1db74fcSJoe Perches 	if (0)								\
9105e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
9106e1db74fcSJoe Perches 	0;								\
9107e1db74fcSJoe Perches })
9108e1db74fcSJoe Perches #endif
9109e1db74fcSJoe Perches 
9110e1db74fcSJoe Perches /*
9111e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
9112e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
9113e1db74fcSJoe Perches  * file/line information and a backtrace.
9114e1db74fcSJoe Perches  */
9115e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
9116e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
9117e1db74fcSJoe Perches 
9118cb74e977SSunil Dutt /**
9119cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
9120cb74e977SSunil Dutt  * @netdev: network device
9121cb74e977SSunil Dutt  * @owe_info: peer's owe info
9122cb74e977SSunil Dutt  * @gfp: allocation flags
9123cb74e977SSunil Dutt  */
9124cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
9125cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
9126cb74e977SSunil Dutt 				    gfp_t gfp);
9127cb74e977SSunil Dutt 
91282f1805eaSEmmanuel Grumbach /**
91292f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
91302f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
91312f1805eaSEmmanuel Grumbach  */
91322f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
91332f1805eaSEmmanuel Grumbach 
91340d2ab3aeSJohn Crispin /**
91350d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
91360d2ab3aeSJohn Crispin  * @dev: network device
91370d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
91380d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
91390d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
91400d2ab3aeSJohn Crispin  */
9141935ef47bSLorenzo Bianconi int cfg80211_bss_color_notify(struct net_device *dev,
91420d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
91430d2ab3aeSJohn Crispin 			      u64 color_bitmap);
91440d2ab3aeSJohn Crispin 
91450d2ab3aeSJohn Crispin /**
91460d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
91470d2ab3aeSJohn Crispin  * @dev: network device
91480d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
91490d2ab3aeSJohn Crispin  */
91500d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
9151935ef47bSLorenzo Bianconi 						       u64 color_bitmap)
91520d2ab3aeSJohn Crispin {
9153935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,
91540d2ab3aeSJohn Crispin 					 0, color_bitmap);
91550d2ab3aeSJohn Crispin }
91560d2ab3aeSJohn Crispin 
91570d2ab3aeSJohn Crispin /**
91580d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
91590d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
91600d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
91610d2ab3aeSJohn Crispin  *
91620d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
91630d2ab3aeSJohn Crispin  */
91640d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
91650d2ab3aeSJohn Crispin 						       u8 count)
91660d2ab3aeSJohn Crispin {
9167935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,
91680d2ab3aeSJohn Crispin 					 count, 0);
91690d2ab3aeSJohn Crispin }
91700d2ab3aeSJohn Crispin 
91710d2ab3aeSJohn Crispin /**
91720d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
91730d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
91740d2ab3aeSJohn Crispin  *
91750d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
91760d2ab3aeSJohn Crispin  */
91770d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
91780d2ab3aeSJohn Crispin {
9179935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,
91800d2ab3aeSJohn Crispin 					 0, 0);
91810d2ab3aeSJohn Crispin }
91820d2ab3aeSJohn Crispin 
91830d2ab3aeSJohn Crispin /**
91840d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
91850d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
91860d2ab3aeSJohn Crispin  *
91870d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
91880d2ab3aeSJohn Crispin  */
91890d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev)
91900d2ab3aeSJohn Crispin {
9191935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev,
91920d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
91930d2ab3aeSJohn Crispin 					 0, 0);
91940d2ab3aeSJohn Crispin }
91950d2ab3aeSJohn Crispin 
9196b25413feSAloka Dixit /**
9197b25413feSAloka Dixit  * cfg80211_valid_disable_subchannel_bitmap - validate puncturing bitmap
9198b25413feSAloka Dixit  * @bitmap: bitmap to be validated
9199b25413feSAloka Dixit  * @chandef: channel definition
9200b25413feSAloka Dixit  *
9201b25413feSAloka Dixit  * Validate the puncturing bitmap.
9202b25413feSAloka Dixit  *
9203b25413feSAloka Dixit  * Return: %true if the bitmap is valid. %false otherwise.
9204b25413feSAloka Dixit  */
9205b25413feSAloka Dixit bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
9206b25413feSAloka Dixit 					      const struct cfg80211_chan_def *chandef);
9207b25413feSAloka Dixit 
9208*065563b2SVeerendranath Jakkam /**
9209*065563b2SVeerendranath Jakkam  * cfg80211_links_removed - Notify about removed STA MLD setup links.
9210*065563b2SVeerendranath Jakkam  * @dev: network device.
9211*065563b2SVeerendranath Jakkam  * @link_mask: BIT mask of removed STA MLD setup link IDs.
9212*065563b2SVeerendranath Jakkam  *
9213*065563b2SVeerendranath Jakkam  * Inform cfg80211 and the userspace about removed STA MLD setup links due to
9214*065563b2SVeerendranath Jakkam  * AP MLD removing the corresponding affiliated APs with Multi-Link
9215*065563b2SVeerendranath Jakkam  * reconfiguration. Note that it's not valid to remove all links, in this
9216*065563b2SVeerendranath Jakkam  * case disconnect instead.
9217*065563b2SVeerendranath Jakkam  * Also note that the wdev mutex must be held.
9218*065563b2SVeerendranath Jakkam  */
9219*065563b2SVeerendranath Jakkam void cfg80211_links_removed(struct net_device *dev, u16 link_mask);
9220*065563b2SVeerendranath Jakkam 
9221704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
9222