xref: /linux/include/net/cfg80211.h (revision bc2dfc02836b1133d1bf4d22aa13d48ac98eabef)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2704232c2SJohannes Berg #ifndef __NET_CFG80211_H
3704232c2SJohannes Berg #define __NET_CFG80211_H
4d3236553SJohannes Berg /*
5d3236553SJohannes Berg  * 802.11 device and configuration interface
6d3236553SJohannes Berg  *
7026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
82740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
98585989dSLuca Coelho  * Copyright 2015-2017	Intel Deutschland GmbH
10dd3e4fc7SAvraham Stern  * Copyright (C) 2018-2021 Intel Corporation
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13cc69837fSJakub Kicinski #include <linux/ethtool.h>
146f779a66SEmmanuel Grumbach #include <uapi/linux/rfkill.h>
15d3236553SJohannes Berg #include <linux/netdevice.h>
16d3236553SJohannes Berg #include <linux/debugfs.h>
17d3236553SJohannes Berg #include <linux/list.h>
18187f1882SPaul Gortmaker #include <linux/bug.h>
19704232c2SJohannes Berg #include <linux/netlink.h>
20704232c2SJohannes Berg #include <linux/skbuff.h>
2155682965SJohannes Berg #include <linux/nl80211.h>
222a519311SJohannes Berg #include <linux/if_ether.h>
232a519311SJohannes Berg #include <linux/ieee80211.h>
242a0e047eSJohannes Berg #include <linux/net.h>
25358ae888SEmmanuel Grumbach #include <linux/rfkill.h>
26d3236553SJohannes Berg #include <net/regulatory.h>
27d3236553SJohannes Berg 
28d70e9693SJohannes Berg /**
29d70e9693SJohannes Berg  * DOC: Introduction
30d70e9693SJohannes Berg  *
31d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
33d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
35d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
36d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
37d70e9693SJohannes Berg  *
38d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
39d70e9693SJohannes Berg  * use restrictions.
40d70e9693SJohannes Berg  */
41d70e9693SJohannes Berg 
42d70e9693SJohannes Berg 
43d70e9693SJohannes Berg /**
44d70e9693SJohannes Berg  * DOC: Device registration
45d70e9693SJohannes Berg  *
46d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
47d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
48d70e9693SJohannes Berg  * described below.
49d70e9693SJohannes Berg  *
50d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
51d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
52d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
53d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
54d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
56d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
57d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
58d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
59d70e9693SJohannes Berg  *
60d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
61d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
62d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
63d70e9693SJohannes Berg  */
64d70e9693SJohannes Berg 
659f5e8f6eSJohannes Berg struct wiphy;
669f5e8f6eSJohannes Berg 
67704232c2SJohannes Berg /*
68d3236553SJohannes Berg  * wireless hardware capability structures
69d3236553SJohannes Berg  */
70d3236553SJohannes Berg 
71d3236553SJohannes Berg /**
72d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
73d3236553SJohannes Berg  *
74d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
75d3236553SJohannes Berg  *
76d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
778fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
788fe02e16SLuis R. Rodriguez  *	sending probe requests or beaconing.
79d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
80689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
81d3236553SJohannes Berg  *	is not permitted.
82689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
83d3236553SJohannes Berg  *	is not permitted.
8403f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
85c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
86c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
87c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
88c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
89c7a6ee27SJohannes Berg  *	restrictions.
90c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
91c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
92c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
93c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
94c7a6ee27SJohannes Berg  *	restrictions.
95570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9606f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
97ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
98ea077c1cSRostislav Lisovy  *	on this channel.
99ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
100ea077c1cSRostislav Lisovy  *	on this channel.
1011e61d82cSHaim Dreyfuss  * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
102d65a9770SThomas Pedersen  * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
103d65a9770SThomas Pedersen  *	on this channel.
104d65a9770SThomas Pedersen  * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
105d65a9770SThomas Pedersen  *	on this channel.
106d65a9770SThomas Pedersen  * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
107d65a9770SThomas Pedersen  *	on this channel.
108d65a9770SThomas Pedersen  * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
109d65a9770SThomas Pedersen  *	on this channel.
110d65a9770SThomas Pedersen  * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
111d65a9770SThomas Pedersen  *	on this channel.
112570dbde1SDavid Spinadel  *
113d3236553SJohannes Berg  */
114d3236553SJohannes Berg enum ieee80211_channel_flags {
115d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1168fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1178fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
118d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
119689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
120689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12103f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
122c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
123c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
124570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
12506f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
126ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
127ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
1281e61d82cSHaim Dreyfuss 	IEEE80211_CHAN_NO_HE		= 1<<13,
129d65a9770SThomas Pedersen 	IEEE80211_CHAN_1MHZ		= 1<<14,
130d65a9770SThomas Pedersen 	IEEE80211_CHAN_2MHZ		= 1<<15,
131d65a9770SThomas Pedersen 	IEEE80211_CHAN_4MHZ		= 1<<16,
132d65a9770SThomas Pedersen 	IEEE80211_CHAN_8MHZ		= 1<<17,
133d65a9770SThomas Pedersen 	IEEE80211_CHAN_16MHZ		= 1<<18,
134d3236553SJohannes Berg };
135d3236553SJohannes Berg 
136038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
137689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
138038659e7SLuis R. Rodriguez 
13904f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
14004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
14104f39047SSimon Wunderlich 
142d3236553SJohannes Berg /**
143d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
144d3236553SJohannes Berg  *
145d3236553SJohannes Berg  * This structure describes a single channel for use
146d3236553SJohannes Berg  * with cfg80211.
147d3236553SJohannes Berg  *
148d3236553SJohannes Berg  * @center_freq: center frequency in MHz
149934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
150d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
151d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
152d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
153d3236553SJohannes Berg  *	code to support devices with additional restrictions
154d3236553SJohannes Berg  * @band: band this channel belongs to.
155d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
156d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
157eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
158d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
159d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
16077c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
161d3236553SJohannes Berg  * @orig_mag: internal use
162d3236553SJohannes Berg  * @orig_mpwr: internal use
16304f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
16404f39047SSimon Wunderlich  *	on this channel.
16504f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
166089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
167d3236553SJohannes Berg  */
168d3236553SJohannes Berg struct ieee80211_channel {
16957fbcce3SJohannes Berg 	enum nl80211_band band;
1709cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
171934f4c7dSThomas Pedersen 	u16 freq_offset;
172d3236553SJohannes Berg 	u16 hw_value;
173d3236553SJohannes Berg 	u32 flags;
174d3236553SJohannes Berg 	int max_antenna_gain;
175d3236553SJohannes Berg 	int max_power;
176eccc068eSHong Wu 	int max_reg_power;
177d3236553SJohannes Berg 	bool beacon_found;
178d3236553SJohannes Berg 	u32 orig_flags;
179d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
18004f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
18104f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
182089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
183d3236553SJohannes Berg };
184d3236553SJohannes Berg 
185d3236553SJohannes Berg /**
186d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
187d3236553SJohannes Berg  *
188d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
189d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
190d3236553SJohannes Berg  * different bands/PHY modes.
191d3236553SJohannes Berg  *
192d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
193d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
194d3236553SJohannes Berg  *	with CCK rates.
195d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
196d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
197d3236553SJohannes Berg  *	core code when registering the wiphy.
198d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
199d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
200d3236553SJohannes Berg  *	core code when registering the wiphy.
201d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
202d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
203d3236553SJohannes Berg  *	core code when registering the wiphy.
204d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
20530e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
20630e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
207d3236553SJohannes Berg  */
208d3236553SJohannes Berg enum ieee80211_rate_flags {
209d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
210d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
211d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
212d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
213d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
21430e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
21530e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
216d3236553SJohannes Berg };
217d3236553SJohannes Berg 
218d3236553SJohannes Berg /**
2196eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2206eb18137SDedy Lansky  *
2216eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2226eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2236eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2246eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2256eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2266eb18137SDedy Lansky  */
2276eb18137SDedy Lansky enum ieee80211_bss_type {
2286eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2296eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2306eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2316eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2326eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2336eb18137SDedy Lansky };
2346eb18137SDedy Lansky 
2356eb18137SDedy Lansky /**
2366eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2376eb18137SDedy Lansky  *
2386eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2396eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2406eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2416eb18137SDedy Lansky  */
2426eb18137SDedy Lansky enum ieee80211_privacy {
2436eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2446eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2456eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2466eb18137SDedy Lansky };
2476eb18137SDedy Lansky 
2486eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2496eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2506eb18137SDedy Lansky 
2516eb18137SDedy Lansky /**
252d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
253d3236553SJohannes Berg  *
254d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
255d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
256d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
257d3236553SJohannes Berg  * passed around.
258d3236553SJohannes Berg  *
259d3236553SJohannes Berg  * @flags: rate-specific flags
260d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
261d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
262d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
263d3236553SJohannes Berg  *	short preamble is used
264d3236553SJohannes Berg  */
265d3236553SJohannes Berg struct ieee80211_rate {
266d3236553SJohannes Berg 	u32 flags;
267d3236553SJohannes Berg 	u16 bitrate;
268d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
269d3236553SJohannes Berg };
270d3236553SJohannes Berg 
271d3236553SJohannes Berg /**
272796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
273796e90f4SJohn Crispin  *
274796e90f4SJohn Crispin  * @enable: is the feature enabled.
275f5bec330SRajkumar Manoharan  * @sr_ctrl: The SR Control field of SRP element.
276f5bec330SRajkumar Manoharan  * @non_srg_max_offset: non-SRG maximum tx power offset
277796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
278796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
279f5bec330SRajkumar Manoharan  * @bss_color_bitmap: bitmap that indicates the BSS color values used by
280f5bec330SRajkumar Manoharan  *	members of the SRG
281f5bec330SRajkumar Manoharan  * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
282f5bec330SRajkumar Manoharan  *	used by members of the SRG
283796e90f4SJohn Crispin  */
284796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
285796e90f4SJohn Crispin 	bool enable;
286f5bec330SRajkumar Manoharan 	u8 sr_ctrl;
287f5bec330SRajkumar Manoharan 	u8 non_srg_max_offset;
288796e90f4SJohn Crispin 	u8 min_offset;
289796e90f4SJohn Crispin 	u8 max_offset;
290f5bec330SRajkumar Manoharan 	u8 bss_color_bitmap[8];
291f5bec330SRajkumar Manoharan 	u8 partial_bssid_bitmap[8];
292796e90f4SJohn Crispin };
293796e90f4SJohn Crispin 
294796e90f4SJohn Crispin /**
2955c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
2965c5e52d1SJohn Crispin  *
2975c5e52d1SJohn Crispin  * @color: the current color.
29875e6b594SJohannes Berg  * @enabled: HE BSS color is used
2995c5e52d1SJohn Crispin  * @partial: define the AID equation.
3005c5e52d1SJohn Crispin  */
3015c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
3025c5e52d1SJohn Crispin 	u8 color;
30375e6b594SJohannes Berg 	bool enabled;
3045c5e52d1SJohn Crispin 	bool partial;
3055c5e52d1SJohn Crispin };
3065c5e52d1SJohn Crispin 
3075c5e52d1SJohn Crispin /**
308d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
309d3236553SJohannes Berg  *
310d3236553SJohannes Berg  * This structure describes most essential parameters needed
311d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
312d3236553SJohannes Berg  *
313d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
314d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
315d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
316d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
317d3236553SJohannes Berg  * @mcs: Supported MCS rates
318d3236553SJohannes Berg  */
319d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
320d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
321d3236553SJohannes Berg 	bool ht_supported;
322d3236553SJohannes Berg 	u8 ampdu_factor;
323d3236553SJohannes Berg 	u8 ampdu_density;
324d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
325d3236553SJohannes Berg };
326d3236553SJohannes Berg 
327d3236553SJohannes Berg /**
328bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
329bf0c111eSMahesh Palivela  *
330bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
331bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
332bf0c111eSMahesh Palivela  *
333bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
334bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
335bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
336bf0c111eSMahesh Palivela  */
337bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
338bf0c111eSMahesh Palivela 	bool vht_supported;
339bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
340bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
341bf0c111eSMahesh Palivela };
342bf0c111eSMahesh Palivela 
343c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
344c4cbaf79SLuca Coelho 
345c4cbaf79SLuca Coelho /**
346c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
347c4cbaf79SLuca Coelho  *
348c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
349c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
350c4cbaf79SLuca Coelho  *
351c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
352c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
353c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
354c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
355c4cbaf79SLuca Coelho  */
356c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
357c4cbaf79SLuca Coelho 	bool has_he;
358c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
359c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
360c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
361c4cbaf79SLuca Coelho };
362c4cbaf79SLuca Coelho 
363c4cbaf79SLuca Coelho /**
3645d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
365c4cbaf79SLuca Coelho  *
366c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
367c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
368c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
369c4cbaf79SLuca Coelho  *
370c4cbaf79SLuca Coelho  * @types_mask: interface types mask
371c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
37222395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
37322395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
374f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
375f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
376f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
377c4cbaf79SLuca Coelho  */
378c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
379c4cbaf79SLuca Coelho 	u16 types_mask;
380c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
38122395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
382f4f86505SJohannes Berg 	struct {
383f4f86505SJohannes Berg 		const u8 *data;
384f4f86505SJohannes Berg 		unsigned int len;
385f4f86505SJohannes Berg 	} vendor_elems;
386c4cbaf79SLuca Coelho };
387c4cbaf79SLuca Coelho 
388bf0c111eSMahesh Palivela /**
3892a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
3902a38075cSAlexei Avshalom Lazar  *
3912a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
3922a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
3932a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
3942a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
3952a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
3962a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
3972a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
3982a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
3992a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4002a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4012a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4022a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4032a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4042a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4052a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4062a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4072a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4082a38075cSAlexei Avshalom Lazar  */
4092a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4102a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4112a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4122a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4132a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4142a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4152a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
4162a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
4172a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
4182a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
4192a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
4202a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
4212a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4222a38075cSAlexei Avshalom Lazar };
4232a38075cSAlexei Avshalom Lazar 
4242a38075cSAlexei Avshalom Lazar /**
4252a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4262a38075cSAlexei Avshalom Lazar  *
4272a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4282a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4292a38075cSAlexei Avshalom Lazar  *
4302a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4312a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4322a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4332a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4342a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4352a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4362a38075cSAlexei Avshalom Lazar  */
4372a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4382a38075cSAlexei Avshalom Lazar 	u8 channels;
4392a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4402a38075cSAlexei Avshalom Lazar };
4412a38075cSAlexei Avshalom Lazar 
4422a38075cSAlexei Avshalom Lazar /**
443df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
444df78a0c0SThomas Pedersen  *
445df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
446df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
447df78a0c0SThomas Pedersen  *
448df78a0c0SThomas Pedersen  * @s1g_supported: is STA an S1G STA
449df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
450df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
451df78a0c0SThomas Pedersen  */
452df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
453df78a0c0SThomas Pedersen 	bool s1g;
454df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
455df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
456df78a0c0SThomas Pedersen };
457df78a0c0SThomas Pedersen 
458df78a0c0SThomas Pedersen /**
459d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
460d3236553SJohannes Berg  *
461d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
462d3236553SJohannes Berg  * is able to operate in.
463d3236553SJohannes Berg  *
464085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
465d3236553SJohannes Berg  *	in this band.
466d3236553SJohannes Berg  * @band: the band this structure represents
467d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
468d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
469d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
470d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
471d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
472abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
473c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
4748a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
4752a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
4769ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
477c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
478c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
479c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
480c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
481c4cbaf79SLuca Coelho  *	iftype_data).
482d3236553SJohannes Berg  */
483d3236553SJohannes Berg struct ieee80211_supported_band {
484d3236553SJohannes Berg 	struct ieee80211_channel *channels;
485d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
48657fbcce3SJohannes Berg 	enum nl80211_band band;
487d3236553SJohannes Berg 	int n_channels;
488d3236553SJohannes Berg 	int n_bitrates;
489d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
490bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
491df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
4922a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
493c4cbaf79SLuca Coelho 	u16 n_iftype_data;
494c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
495d3236553SJohannes Berg };
496d3236553SJohannes Berg 
497e691ac2fSRafał Miłecki /**
498c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
499c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
500c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
501c4cbaf79SLuca Coelho  *
502c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
503c4cbaf79SLuca Coelho  */
504c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
505c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
506c4cbaf79SLuca Coelho 				u8 iftype)
507c4cbaf79SLuca Coelho {
508c4cbaf79SLuca Coelho 	int i;
509c4cbaf79SLuca Coelho 
510c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
511c4cbaf79SLuca Coelho 		return NULL;
512c4cbaf79SLuca Coelho 
513c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
514c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
515c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
516c4cbaf79SLuca Coelho 
517c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
518c4cbaf79SLuca Coelho 			return data;
519c4cbaf79SLuca Coelho 	}
520c4cbaf79SLuca Coelho 
521c4cbaf79SLuca Coelho 	return NULL;
522c4cbaf79SLuca Coelho }
523c4cbaf79SLuca Coelho 
524c4cbaf79SLuca Coelho /**
525d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
526d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
527d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
528d7edf40cSJohn Crispin  *
529d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
530d7edf40cSJohn Crispin  */
531d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
532d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
533d7edf40cSJohn Crispin 			    u8 iftype)
534d7edf40cSJohn Crispin {
535d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
536d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
537d7edf40cSJohn Crispin 
538d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
539d7edf40cSJohn Crispin 		return &data->he_cap;
540d7edf40cSJohn Crispin 
541d7edf40cSJohn Crispin 	return NULL;
542d7edf40cSJohn Crispin }
543d7edf40cSJohn Crispin 
544d7edf40cSJohn Crispin /**
5452ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
5462ad2274cSIlan Peer  * @sband: the sband to search for the STA on
5472ad2274cSIlan Peer  * @iftype: the iftype to search for
5482ad2274cSIlan Peer  *
5492ad2274cSIlan Peer  * Return: the 6GHz capabilities
5502ad2274cSIlan Peer  */
5512ad2274cSIlan Peer static inline __le16
5522ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
5532ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
5542ad2274cSIlan Peer {
5552ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
5562ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
5572ad2274cSIlan Peer 
5582ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
5592ad2274cSIlan Peer 		return 0;
5602ad2274cSIlan Peer 
5612ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
5622ad2274cSIlan Peer }
5632ad2274cSIlan Peer 
5642ad2274cSIlan Peer /**
565e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
566e691ac2fSRafał Miłecki  *
567e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
568e691ac2fSRafał Miłecki  *
569e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
570e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
571e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
572e691ac2fSRafał Miłecki  *
573e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
574e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
575e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
576e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
577e691ac2fSRafał Miłecki  * without affecting other devices.
578e691ac2fSRafał Miłecki  *
579e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
580e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
581e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
582e691ac2fSRafał Miłecki  */
583e691ac2fSRafał Miłecki #ifdef CONFIG_OF
584e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
585e691ac2fSRafał Miłecki #else /* CONFIG_OF */
586e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
587e691ac2fSRafał Miłecki {
588e691ac2fSRafał Miłecki }
589e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
590e691ac2fSRafał Miłecki 
591e691ac2fSRafał Miłecki 
592d3236553SJohannes Berg /*
593d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
594704232c2SJohannes Berg  */
595704232c2SJohannes Berg 
5962ec600d6SLuis Carlos Cobo /**
597d70e9693SJohannes Berg  * DOC: Actions and configuration
598d70e9693SJohannes Berg  *
599d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
600d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
601d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
602d70e9693SJohannes Berg  * operations use are described separately.
603d70e9693SJohannes Berg  *
604d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
605d70e9693SJohannes Berg  * information via some functions that drivers need to call.
606d70e9693SJohannes Berg  *
607d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
608d70e9693SJohannes Berg  * in a separate chapter.
609d70e9693SJohannes Berg  */
610d70e9693SJohannes Berg 
611c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
612c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
613c6e6a0c8SAviya Erenfeld 
614d70e9693SJohannes Berg /**
6152ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
616818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
617818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
6188b787643SFelix Fietkau  * @use_4addr: use 4-address frames
619e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
620e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
621e8f479b1SBen Greear  *	determine the address as needed.
622e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
623e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
624e8f479b1SBen Greear  **	only p2p devices with specified MAC.
625b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
626b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
627b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
628b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
6292ec600d6SLuis Carlos Cobo  */
6302ec600d6SLuis Carlos Cobo struct vif_params {
631818a986eSJohannes Berg 	u32 flags;
6328b787643SFelix Fietkau 	int use_4addr;
6331c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
634b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
635b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
6362ec600d6SLuis Carlos Cobo };
6372ec600d6SLuis Carlos Cobo 
63841ade00fSJohannes Berg /**
63941ade00fSJohannes Berg  * struct key_params - key information
64041ade00fSJohannes Berg  *
64141ade00fSJohannes Berg  * Information about a key
64241ade00fSJohannes Berg  *
64341ade00fSJohannes Berg  * @key: key material
64441ade00fSJohannes Berg  * @key_len: length of key material
64541ade00fSJohannes Berg  * @cipher: cipher suite selector
64641ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
64741ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
64841ade00fSJohannes Berg  *	length given by @seq_len.
649abe37c4bSJohannes Berg  * @seq_len: length of @seq.
65014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
6516cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
65241ade00fSJohannes Berg  */
65341ade00fSJohannes Berg struct key_params {
654c1e5f471SJohannes Berg 	const u8 *key;
655c1e5f471SJohannes Berg 	const u8 *seq;
65641ade00fSJohannes Berg 	int key_len;
65741ade00fSJohannes Berg 	int seq_len;
65814f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
65941ade00fSJohannes Berg 	u32 cipher;
6606cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
66141ade00fSJohannes Berg };
66241ade00fSJohannes Berg 
663ed1b6cc7SJohannes Berg /**
664683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
665683b6d3bSJohannes Berg  * @chan: the (control) channel
6663d9d1d66SJohannes Berg  * @width: channel width
6673d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
6683d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
6693d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
6702a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
6712a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
6722a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
6732a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
674934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
675683b6d3bSJohannes Berg  */
676683b6d3bSJohannes Berg struct cfg80211_chan_def {
677683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
6783d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
6793d9d1d66SJohannes Berg 	u32 center_freq1;
6803d9d1d66SJohannes Berg 	u32 center_freq2;
6812a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
682934f4c7dSThomas Pedersen 	u16 freq1_offset;
683683b6d3bSJohannes Berg };
684683b6d3bSJohannes Berg 
6859a5f6488STamizh Chelvam /*
6869a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
6879a5f6488STamizh Chelvam  */
6889a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
6899a5f6488STamizh Chelvam 	struct {
6909a5f6488STamizh Chelvam 		u32 legacy;
6919a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
6929a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
693eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
6949a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
695eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
696eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
6979a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
6989a5f6488STamizh Chelvam };
6999a5f6488STamizh Chelvam 
7009a5f6488STamizh Chelvam 
70177f576deSTamizh chelvam /**
7023710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
70377f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
70477f576deSTamizh chelvam  *	of the peer.
7053710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
7063710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
7073710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
70877f576deSTamizh chelvam  * @noack: noack configuration value for the TID
7096a21d16cSTamizh chelvam  * @retry_long: retry count value
7106a21d16cSTamizh chelvam  * @retry_short: retry count value
71133462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
71204f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
71333462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
7149a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
7159a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
71677f576deSTamizh chelvam  */
7173710a8a6SJohannes Berg struct cfg80211_tid_cfg {
71877f576deSTamizh chelvam 	bool config_override;
7193710a8a6SJohannes Berg 	u8 tids;
7202d5d9b7fSSergey Matyukevich 	u64 mask;
72177f576deSTamizh chelvam 	enum nl80211_tid_config noack;
7226a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
723ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
72404f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
72533462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
7269a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
7279a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
72877f576deSTamizh chelvam };
72977f576deSTamizh chelvam 
73077f576deSTamizh chelvam /**
7313710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
73277f576deSTamizh chelvam  * @peer: Station's MAC address
73377f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
73477f576deSTamizh chelvam  * @tid_conf: Configuration change info
73577f576deSTamizh chelvam  */
7363710a8a6SJohannes Berg struct cfg80211_tid_config {
73777f576deSTamizh chelvam 	const u8 *peer;
73877f576deSTamizh chelvam 	u32 n_tid_conf;
7393710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
74077f576deSTamizh chelvam };
74177f576deSTamizh chelvam 
7423d9d1d66SJohannes Berg /**
743e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
744e306784aSSubrat Mishra  * @macaddr: STA MAC address
745e306784aSSubrat Mishra  * @kek: FILS KEK
746e306784aSSubrat Mishra  * @kek_len: FILS KEK length
747e306784aSSubrat Mishra  * @snonce: STA Nonce
748e306784aSSubrat Mishra  * @anonce: AP Nonce
749e306784aSSubrat Mishra  */
750e306784aSSubrat Mishra struct cfg80211_fils_aad {
751e306784aSSubrat Mishra 	const u8 *macaddr;
752e306784aSSubrat Mishra 	const u8 *kek;
753e306784aSSubrat Mishra 	u8 kek_len;
754e306784aSSubrat Mishra 	const u8 *snonce;
755e306784aSSubrat Mishra 	const u8 *anonce;
756e306784aSSubrat Mishra };
757e306784aSSubrat Mishra 
758e306784aSSubrat Mishra /**
7593d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
7603d9d1d66SJohannes Berg  * @chandef: the channel definition
7613d9d1d66SJohannes Berg  *
7620ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
7633d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
7643d9d1d66SJohannes Berg  */
765683b6d3bSJohannes Berg static inline enum nl80211_channel_type
766683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
767683b6d3bSJohannes Berg {
7683d9d1d66SJohannes Berg 	switch (chandef->width) {
7693d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
7703d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
7713d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
7723d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
7733d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
7743d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
7753d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
7763d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
7773d9d1d66SJohannes Berg 	default:
7783d9d1d66SJohannes Berg 		WARN_ON(1);
7793d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
780683b6d3bSJohannes Berg 	}
7813d9d1d66SJohannes Berg }
7823d9d1d66SJohannes Berg 
7833d9d1d66SJohannes Berg /**
7843d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
7853d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
7863d9d1d66SJohannes Berg  * @channel: the control channel
7873d9d1d66SJohannes Berg  * @chantype: the channel type
7883d9d1d66SJohannes Berg  *
7893d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
7903d9d1d66SJohannes Berg  */
7913d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
7923d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
7933d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
7943d9d1d66SJohannes Berg 
7953d9d1d66SJohannes Berg /**
7963d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
7973d9d1d66SJohannes Berg  * @chandef1: first channel definition
7983d9d1d66SJohannes Berg  * @chandef2: second channel definition
7993d9d1d66SJohannes Berg  *
8000ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
8013d9d1d66SJohannes Berg  * identical, %false otherwise.
8023d9d1d66SJohannes Berg  */
8033d9d1d66SJohannes Berg static inline bool
8043d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
8053d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
8063d9d1d66SJohannes Berg {
8073d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
8083d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
8093d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
810934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
8113d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
8123d9d1d66SJohannes Berg }
8133d9d1d66SJohannes Berg 
8143d9d1d66SJohannes Berg /**
8152a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
8162a38075cSAlexei Avshalom Lazar  *
8172a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
8182a38075cSAlexei Avshalom Lazar  *
8192a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
8202a38075cSAlexei Avshalom Lazar  */
8212a38075cSAlexei Avshalom Lazar static inline bool
8222a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
8232a38075cSAlexei Avshalom Lazar {
8242a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
8252a38075cSAlexei Avshalom Lazar }
8262a38075cSAlexei Avshalom Lazar 
8272a38075cSAlexei Avshalom Lazar /**
8283d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
8293d9d1d66SJohannes Berg  * @chandef1: first channel definition
8303d9d1d66SJohannes Berg  * @chandef2: second channel definition
8313d9d1d66SJohannes Berg  *
8320ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
8333d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
8343d9d1d66SJohannes Berg  */
8353d9d1d66SJohannes Berg const struct cfg80211_chan_def *
8363d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
8373d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
838683b6d3bSJohannes Berg 
839683b6d3bSJohannes Berg /**
8409f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
8419f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
8420ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
8439f5e8f6eSJohannes Berg  */
8449f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
8459f5e8f6eSJohannes Berg 
8469f5e8f6eSJohannes Berg /**
8479f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
8489f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
8499f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
8500ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
8510ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
8529f5e8f6eSJohannes Berg  */
8539f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
8549f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
8559f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
8569f5e8f6eSJohannes Berg 
8579f5e8f6eSJohannes Berg /**
858774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
859774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
860774f0734SSimon Wunderlich  * @chandef: the channel definition to check
8612beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
8622beb6dabSLuciano Coelho  * Returns:
8632beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
864774f0734SSimon Wunderlich  */
865774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
8662beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
867c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
868774f0734SSimon Wunderlich 
869774f0734SSimon Wunderlich /**
87030e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
87130e74732SSimon Wunderlich  *
87230e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
87330e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
87430e74732SSimon Wunderlich  *
87530e74732SSimon Wunderlich  * @chandef: channel definition for the channel
87630e74732SSimon Wunderlich  *
87730e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
87830e74732SSimon Wunderlich  */
87930e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
88030e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
88130e74732SSimon Wunderlich {
88230e74732SSimon Wunderlich 	switch (chandef->width) {
88330e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
88430e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
88530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
88630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
88730e74732SSimon Wunderlich 	default:
88830e74732SSimon Wunderlich 		break;
88930e74732SSimon Wunderlich 	}
89030e74732SSimon Wunderlich 	return 0;
89130e74732SSimon Wunderlich }
89230e74732SSimon Wunderlich 
89330e74732SSimon Wunderlich /**
8940430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
8950430c883SSimon Wunderlich  *
8960430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
8970430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
8980430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
8990430c883SSimon Wunderlich  *
9000430c883SSimon Wunderlich  * @chandef: channel definition for the channel
9010430c883SSimon Wunderlich  *
9020430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
9030430c883SSimon Wunderlich  */
9040430c883SSimon Wunderlich static inline int
9050430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
9060430c883SSimon Wunderlich {
9070430c883SSimon Wunderlich 	switch (chandef->width) {
9080430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
9090430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
9100430c883SSimon Wunderlich 			   chandef->chan->max_power);
9110430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
9120430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
9130430c883SSimon Wunderlich 			   chandef->chan->max_power);
9140430c883SSimon Wunderlich 	default:
9150430c883SSimon Wunderlich 		break;
9160430c883SSimon Wunderlich 	}
9170430c883SSimon Wunderlich 	return chandef->chan->max_power;
9180430c883SSimon Wunderlich }
9190430c883SSimon Wunderlich 
9200430c883SSimon Wunderlich /**
921be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
922be989891SJohannes Berg  * @wiphy: the wiphy to check for
923be989891SJohannes Berg  * @band_mask: which bands to check on
924be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
925be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
926be989891SJohannes Berg  */
927be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
928be989891SJohannes Berg 				  unsigned long band_mask,
929be989891SJohannes Berg 				  u32 prohibited_flags);
930be989891SJohannes Berg 
931be989891SJohannes Berg /**
93261fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
93361fa713cSHolger Schurig  *
934abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
93517e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
9364ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
9374ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
9384ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
9394ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
9404ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
941052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
942c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
943abe37c4bSJohannes Berg  *
94461fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
94561fa713cSHolger Schurig  * it has filled in during the get_survey().
94661fa713cSHolger Schurig  */
94761fa713cSHolger Schurig enum survey_info_flags {
9484ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
9494ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
9504ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
9514ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
9524ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
9534ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
9544ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
955052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
956c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
95761fa713cSHolger Schurig };
95861fa713cSHolger Schurig 
95961fa713cSHolger Schurig /**
96061fa713cSHolger Schurig  * struct survey_info - channel survey response
96161fa713cSHolger Schurig  *
96211f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
96311f78ac3SJohannes Berg  *	record to report global statistics
96461fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
96561fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
96661fa713cSHolger Schurig  *	optional
9674ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
9684ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
9694ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
9704ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
9714ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
972052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
973c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
97461fa713cSHolger Schurig  *
975abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
976abe37c4bSJohannes Berg  *
97761fa713cSHolger Schurig  * This structure can later be expanded with things like
97861fa713cSHolger Schurig  * channel duty cycle etc.
97961fa713cSHolger Schurig  */
98061fa713cSHolger Schurig struct survey_info {
98161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
9824ed20bebSJohannes Berg 	u64 time;
9834ed20bebSJohannes Berg 	u64 time_busy;
9844ed20bebSJohannes Berg 	u64 time_ext_busy;
9854ed20bebSJohannes Berg 	u64 time_rx;
9864ed20bebSJohannes Berg 	u64 time_tx;
987052536abSJohannes Berg 	u64 time_scan;
988c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
98961fa713cSHolger Schurig 	u32 filled;
99061fa713cSHolger Schurig 	s8 noise;
99161fa713cSHolger Schurig };
99261fa713cSHolger Schurig 
993b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
994b8676221SDavid Spinadel 
99561fa713cSHolger Schurig /**
9965fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
9975fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
9985fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
9995fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
10005fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
10015fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
10025fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
10035fb628e9SJouni Malinen  * @akm_suites: AKM suites
10045fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
10055fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
10065fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
10075fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
10085fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
10095fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
10105fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
10115fb628e9SJouni Malinen  *	protocol frames.
101264bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
101364bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1014a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1015a710d214SLothar Rubusch  *	port for mac80211
1016b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
1017b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
1018b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
101991b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
102026f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
102126f7044eSChung-Hsien Hsu  *	offload)
102226f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1023da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1024da1e9dd3SJohannes Berg  *
1025da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1026da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1027da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1028da1e9dd3SJohannes Berg  *	  such a scenario.
1029da1e9dd3SJohannes Berg  *
1030da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1031da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1032da1e9dd3SJohannes Berg  *
1033da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1034da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1035da1e9dd3SJohannes Berg  *
1036da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1037da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
10385fb628e9SJouni Malinen  */
10395fb628e9SJouni Malinen struct cfg80211_crypto_settings {
10405fb628e9SJouni Malinen 	u32 wpa_versions;
10415fb628e9SJouni Malinen 	u32 cipher_group;
10425fb628e9SJouni Malinen 	int n_ciphers_pairwise;
10435fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
10445fb628e9SJouni Malinen 	int n_akm_suites;
10455fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
10465fb628e9SJouni Malinen 	bool control_port;
10475fb628e9SJouni Malinen 	__be16 control_port_ethertype;
10485fb628e9SJouni Malinen 	bool control_port_no_encrypt;
104964bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
10507f3f96ceSMarkus Theil 	bool control_port_no_preauth;
1051b8676221SDavid Spinadel 	struct key_params *wep_keys;
1052b8676221SDavid Spinadel 	int wep_tx_key;
105391b5ab62SEliad Peller 	const u8 *psk;
105426f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
105526f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
10569f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
10575fb628e9SJouni Malinen };
10585fb628e9SJouni Malinen 
10595fb628e9SJouni Malinen /**
1060dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1061dc1e3cb8SJohn Crispin  *
1062dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1063dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1064dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1065dc1e3cb8SJohn Crispin  */
1066dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1067dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1068dc1e3cb8SJohn Crispin 	u8 index;
1069dc1e3cb8SJohn Crispin 	bool ema;
1070dc1e3cb8SJohn Crispin };
1071dc1e3cb8SJohn Crispin 
1072dc1e3cb8SJohn Crispin /**
1073dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1074dc1e3cb8SJohn Crispin  *
1075dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1076dc1e3cb8SJohn Crispin  *
1077dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1078dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1079dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1080dc1e3cb8SJohn Crispin  */
1081dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1082dc1e3cb8SJohn Crispin 	u8 cnt;
1083dc1e3cb8SJohn Crispin 	struct {
1084dc1e3cb8SJohn Crispin 		const u8 *data;
1085dc1e3cb8SJohn Crispin 		size_t len;
1086dc1e3cb8SJohn Crispin 	} elem[];
1087dc1e3cb8SJohn Crispin };
1088dc1e3cb8SJohn Crispin 
1089dc1e3cb8SJohn Crispin /**
10908860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
1091ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1092ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1093ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1094ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1095ed1b6cc7SJohannes Berg  * @head_len: length of @head
1096ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
10979946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
10989946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
10999946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
11009946ecfbSJouni Malinen  *	frames or %NULL
11019946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
11029946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
11039946ecfbSJouni Malinen  *	Response frames or %NULL
11049946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
110500f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
110600f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1107dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
110881e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
110981e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
111030db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
111130db641eSJohannes Berg  *	(measurement type 8)
111230db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
111330db641eSJohannes Berg  *	Token (measurement type 11)
111481e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
111581e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
1116ed1b6cc7SJohannes Berg  */
11178860020eSJohannes Berg struct cfg80211_beacon_data {
11188860020eSJohannes Berg 	const u8 *head, *tail;
11198860020eSJohannes Berg 	const u8 *beacon_ies;
11208860020eSJohannes Berg 	const u8 *proberesp_ies;
11218860020eSJohannes Berg 	const u8 *assocresp_ies;
11228860020eSJohannes Berg 	const u8 *probe_resp;
112381e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
112481e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1125dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
112681e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
11278860020eSJohannes Berg 
11288860020eSJohannes Berg 	size_t head_len, tail_len;
11298860020eSJohannes Berg 	size_t beacon_ies_len;
11308860020eSJohannes Berg 	size_t proberesp_ies_len;
11318860020eSJohannes Berg 	size_t assocresp_ies_len;
11328860020eSJohannes Berg 	size_t probe_resp_len;
113381e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
113481e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
11358860020eSJohannes Berg };
11368860020eSJohannes Berg 
11376d45a74bSVasanthakumar Thiagarajan struct mac_address {
11386d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
11396d45a74bSVasanthakumar Thiagarajan };
11406d45a74bSVasanthakumar Thiagarajan 
11418860020eSJohannes Berg /**
114277765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
114377765eafSVasanthakumar Thiagarajan  *
114477765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1145077f897aSJohannes Berg  *	entry specified by mac_addr
114677765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
114777765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
114877765eafSVasanthakumar Thiagarajan  */
114977765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
115077765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
115177765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
115277765eafSVasanthakumar Thiagarajan 
115377765eafSVasanthakumar Thiagarajan 	/* Keep it last */
115477765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
115577765eafSVasanthakumar Thiagarajan };
115677765eafSVasanthakumar Thiagarajan 
11578860020eSJohannes Berg /**
1158291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1159291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1160291c49deSAloka Dixit  *
1161291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1162291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1163291c49deSAloka Dixit  * @tmpl_len: Template length
1164291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1165291c49deSAloka Dixit  *	frame headers.
1166291c49deSAloka Dixit  */
1167291c49deSAloka Dixit struct cfg80211_fils_discovery {
1168291c49deSAloka Dixit 	u32 min_interval;
1169291c49deSAloka Dixit 	u32 max_interval;
1170291c49deSAloka Dixit 	size_t tmpl_len;
1171291c49deSAloka Dixit 	const u8 *tmpl;
1172291c49deSAloka Dixit };
1173291c49deSAloka Dixit 
1174291c49deSAloka Dixit /**
11757443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
11767443dcd1SAloka Dixit  *	response parameters in 6GHz.
11777443dcd1SAloka Dixit  *
11787443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
11797443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
11807443dcd1SAloka Dixit  *	scanning
11817443dcd1SAloka Dixit  * @tmpl_len: Template length
11827443dcd1SAloka Dixit  * @tmpl: Template data for probe response
11837443dcd1SAloka Dixit  */
11847443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
11857443dcd1SAloka Dixit 	u32 interval;
11867443dcd1SAloka Dixit 	size_t tmpl_len;
11877443dcd1SAloka Dixit 	const u8 *tmpl;
11887443dcd1SAloka Dixit };
11897443dcd1SAloka Dixit 
11907443dcd1SAloka Dixit /**
1191fe494370SSrinivas Dasari  * enum cfg80211_ap_settings_flags - AP settings flags
1192fe494370SSrinivas Dasari  *
1193fe494370SSrinivas Dasari  * Used by cfg80211_ap_settings
1194fe494370SSrinivas Dasari  *
1195fe494370SSrinivas Dasari  * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1196fe494370SSrinivas Dasari  */
1197fe494370SSrinivas Dasari enum cfg80211_ap_settings_flags {
1198fe494370SSrinivas Dasari 	AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1199fe494370SSrinivas Dasari };
1200fe494370SSrinivas Dasari 
1201fe494370SSrinivas Dasari /**
12028860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
12038860020eSJohannes Berg  *
12048860020eSJohannes Berg  * Used to configure an AP interface.
12058860020eSJohannes Berg  *
1206683b6d3bSJohannes Berg  * @chandef: defines the channel to use
12078860020eSJohannes Berg  * @beacon: beacon data
12088860020eSJohannes Berg  * @beacon_interval: beacon interval
12098860020eSJohannes Berg  * @dtim_period: DTIM period
12108860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
12118860020eSJohannes Berg  *	user space)
12128860020eSJohannes Berg  * @ssid_len: length of @ssid
12138860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
12148860020eSJohannes Berg  * @crypto: crypto settings
12158860020eSJohannes Berg  * @privacy: the BSS uses privacy
12168860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
121718998c38SEliad Peller  * @smps_mode: SMPS mode
12181b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
121953cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
122053cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
122177765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
122277765eafSVasanthakumar Thiagarajan  *	MAC address based access control
122334d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
122434d50519SLior David  *	networks.
12258564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
122666cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
122766cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1228244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
122966cd794eSJohannes Berg  * @ht_required: stations must support HT
123066cd794eSJohannes Berg  * @vht_required: stations must support VHT
1231a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
12322a392596SIlan Peer  * @he_required: stations must support HE
1233d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
1234fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1235796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
12365c5e52d1SJohn Crispin  * @he_bss_color: BSS Color settings
12377e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1238291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
12397443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1240dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
12418860020eSJohannes Berg  */
12428860020eSJohannes Berg struct cfg80211_ap_settings {
1243683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1244aa430da4SJohannes Berg 
12458860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
12468860020eSJohannes Berg 
12478860020eSJohannes Berg 	int beacon_interval, dtim_period;
124832e9de84SJouni Malinen 	const u8 *ssid;
124932e9de84SJouni Malinen 	size_t ssid_len;
125032e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
12515fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
12525fb628e9SJouni Malinen 	bool privacy;
12535fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
125418998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
12551b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
125653cabad7SJohannes Berg 	u8 p2p_ctwindow;
125753cabad7SJohannes Berg 	bool p2p_opp_ps;
125877765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
125934d50519SLior David 	bool pbss;
1260a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
126166cd794eSJohannes Berg 
126266cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
126366cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1264244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
12657e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
1266d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1267a0de1ca3SJohn Crispin 	bool twt_responder;
1268fe494370SSrinivas Dasari 	u32 flags;
1269796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
12705c5e52d1SJohn Crispin 	struct cfg80211_he_bss_color he_bss_color;
1271291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
12727443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1273dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1274ed1b6cc7SJohannes Berg };
1275ed1b6cc7SJohannes Berg 
12765727ef1bSJohannes Berg /**
127716ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
127816ef1fe2SSimon Wunderlich  *
127916ef1fe2SSimon Wunderlich  * Used for channel switch
128016ef1fe2SSimon Wunderlich  *
128116ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
128216ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
12839a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
12849a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
12859a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
12869a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
128716ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
128816ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
128916ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
129016ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
129116ef1fe2SSimon Wunderlich  */
129216ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
129316ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
129416ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
12959a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
12969a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
12979a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
12989a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
129916ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
130016ef1fe2SSimon Wunderlich 	bool radar_required;
130116ef1fe2SSimon Wunderlich 	bool block_tx;
130216ef1fe2SSimon Wunderlich 	u8 count;
130316ef1fe2SSimon Wunderlich };
130416ef1fe2SSimon Wunderlich 
130516ef1fe2SSimon Wunderlich /**
13060d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
13070d2ab3aeSJohn Crispin  *
13080d2ab3aeSJohn Crispin  * Used for bss color change
13090d2ab3aeSJohn Crispin  *
13100d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
13110d2ab3aeSJohn Crispin  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
13120d2ab3aeSJohn Crispin  * @counter_offsets_presp: offsets of the counters within the probe response
13130d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
13140d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
13150d2ab3aeSJohn Crispin  * @color: the color used after the change
13160d2ab3aeSJohn Crispin  */
13170d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
13180d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
13190d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
13200d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
13210d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
13220d2ab3aeSJohn Crispin 	u8 count;
13230d2ab3aeSJohn Crispin 	u8 color;
13240d2ab3aeSJohn Crispin };
13250d2ab3aeSJohn Crispin 
13260d2ab3aeSJohn Crispin /**
1327e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1328e227300cSPurushottam Kushwaha  *
1329e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1330e227300cSPurushottam Kushwaha  *
1331e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1332e227300cSPurushottam Kushwaha  *	to use for verification
1333e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1334e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1335e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1336e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1337e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1338e227300cSPurushottam Kushwaha  *	nl80211_iftype.
13394c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
13404c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
13414c8dea63SJohannes Berg  *	the verification
1342e227300cSPurushottam Kushwaha  */
1343e227300cSPurushottam Kushwaha struct iface_combination_params {
1344e227300cSPurushottam Kushwaha 	int num_different_channels;
1345e227300cSPurushottam Kushwaha 	u8 radar_detect;
1346e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
13474c8dea63SJohannes Berg 	u32 new_beacon_int;
1348e227300cSPurushottam Kushwaha };
1349e227300cSPurushottam Kushwaha 
1350e227300cSPurushottam Kushwaha /**
13513b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
13523b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
13539d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1354f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
13553b9ce80cSJohannes Berg  *
13563b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
13573b9ce80cSJohannes Berg  * for those that don't these flags will are used.
13583b9ce80cSJohannes Berg  */
13593b9ce80cSJohannes Berg enum station_parameters_apply_mask {
13603b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
13619d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1362f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1363e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1364e96d1cd2SAshok Raj Nagarajan };
1365e96d1cd2SAshok Raj Nagarajan 
1366e96d1cd2SAshok Raj Nagarajan /**
1367e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1368e96d1cd2SAshok Raj Nagarajan  *
1369e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1370e96d1cd2SAshok Raj Nagarajan  *
1371e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1372e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1373e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1374e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1375e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1376e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1377e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1378e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1379e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1380e96d1cd2SAshok Raj Nagarajan  */
1381e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1382e96d1cd2SAshok Raj Nagarajan 	s16 power;
1383e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
13843b9ce80cSJohannes Berg };
13853b9ce80cSJohannes Berg 
13863b9ce80cSJohannes Berg /**
13875727ef1bSJohannes Berg  * struct station_parameters - station parameters
13885727ef1bSJohannes Berg  *
13895727ef1bSJohannes Berg  * Used to change and create a new station.
13905727ef1bSJohannes Berg  *
13915727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
13925727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
13935727ef1bSJohannes Berg  *	(or NULL for no change)
13945727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1395eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1396819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1397eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1398819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
13995727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
14005727ef1bSJohannes Berg  * @aid: AID or zero for no change
140114f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
14027d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1403abe37c4bSJohannes Berg  * @plink_action: plink action to take
14049c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1405abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1406f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1407910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1408910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1409910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1410910868dbSEliad Peller  *	QoS info field (but already shifted down)
1411c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1412c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1413c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
14143b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
14153b1c5a53SMarco Porsch  *	to unknown)
14169d62a986SJouni Malinen  * @capability: station capability
14179d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
14189d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1419c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1420c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1421c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1422c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
142360f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
142460f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
142517b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1426c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1427c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
142836647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1429a710d214SLothar Rubusch  * @txpwr: transmit power for an associated station
143043e64bf3SRajkumar Manoharan  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
14315727ef1bSJohannes Berg  */
14325727ef1bSJohannes Berg struct station_parameters {
14332c1aabf3SJohannes Berg 	const u8 *supported_rates;
14345727ef1bSJohannes Berg 	struct net_device *vlan;
1435eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
14363b9ce80cSJohannes Berg 	u32 sta_modify_mask;
14375727ef1bSJohannes Berg 	int listen_interval;
14385727ef1bSJohannes Berg 	u16 aid;
143914f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
14407d27a0baSMasashi Honma 	u16 peer_aid;
14415727ef1bSJohannes Berg 	u8 supported_rates_len;
14422ec600d6SLuis Carlos Cobo 	u8 plink_action;
14439c3990aaSJavier Cardona 	u8 plink_state;
14442c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
14452c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1446c75786c9SEliad Peller 	u8 uapsd_queues;
1447c75786c9SEliad Peller 	u8 max_sp;
14483b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
14499d62a986SJouni Malinen 	u16 capability;
14502c1aabf3SJohannes Berg 	const u8 *ext_capab;
14519d62a986SJouni Malinen 	u8 ext_capab_len;
1452c01fc9adSSunil Dutt 	const u8 *supported_channels;
1453c01fc9adSSunil Dutt 	u8 supported_channels_len;
1454c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1455c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
145660f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
145760f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
145817b94247SAyala Beker 	int support_p2p_ps;
1459c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1460c4cbaf79SLuca Coelho 	u8 he_capa_len;
146136647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1462e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
146343e64bf3SRajkumar Manoharan 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
14645727ef1bSJohannes Berg };
14655727ef1bSJohannes Berg 
1466fd5b74dcSJohannes Berg /**
146789c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
146889c771e5SJouni Malinen  *
146989c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
147089c771e5SJouni Malinen  *
147189c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
147298856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
147398856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
147498856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
147589c771e5SJouni Malinen  */
147689c771e5SJouni Malinen struct station_del_parameters {
147789c771e5SJouni Malinen 	const u8 *mac;
147898856866SJouni Malinen 	u8 subtype;
147998856866SJouni Malinen 	u16 reason_code;
148089c771e5SJouni Malinen };
148189c771e5SJouni Malinen 
148289c771e5SJouni Malinen /**
148377ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
148477ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
148547edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
148647edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
148777ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
148877ee7c89SJohannes Berg  *	the AP MLME in the device
148977ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
149077ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
149177ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
149277ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
149377ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
149477ee7c89SJohannes Berg  *	supported/used)
149577ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
149677ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1497eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1498eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
149977ee7c89SJohannes Berg  */
150077ee7c89SJohannes Berg enum cfg80211_station_type {
150177ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
150247edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
150377ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
150477ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
150577ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
150677ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
150777ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1508eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1509eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
151077ee7c89SJohannes Berg };
151177ee7c89SJohannes Berg 
151277ee7c89SJohannes Berg /**
151377ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
151477ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
151577ee7c89SJohannes Berg  * @params: the new parameters for a station
151677ee7c89SJohannes Berg  * @statype: the type of station being modified
151777ee7c89SJohannes Berg  *
151877ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
151977ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
152077ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
152177ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
152277ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
152377ee7c89SJohannes Berg  */
152477ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
152577ee7c89SJohannes Berg 				  struct station_parameters *params,
152677ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
152777ee7c89SJohannes Berg 
152877ee7c89SJohannes Berg /**
1529b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1530420e7fabSHenning Rogge  *
1531420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1532420e7fabSHenning Rogge  * type for 802.11n transmissions.
1533420e7fabSHenning Rogge  *
1534db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1535db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1536420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
15372a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1538c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
15392a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1540d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1541420e7fabSHenning Rogge  */
1542420e7fabSHenning Rogge enum rate_info_flags {
1543db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1544db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1545b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
15462a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1547c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
15482a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1549d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1550b51f3beeSJohannes Berg };
1551b51f3beeSJohannes Berg 
1552b51f3beeSJohannes Berg /**
1553b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1554b51f3beeSJohannes Berg  *
1555b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1556b51f3beeSJohannes Berg  *
1557b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1558b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1559b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1560b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1561b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1562b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1563c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1564b51f3beeSJohannes Berg  */
1565b51f3beeSJohannes Berg enum rate_info_bw {
1566842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1567b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1568b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1569b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1570b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1571b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1572c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1573420e7fabSHenning Rogge };
1574420e7fabSHenning Rogge 
1575420e7fabSHenning Rogge /**
1576420e7fabSHenning Rogge  * struct rate_info - bitrate information
1577420e7fabSHenning Rogge  *
1578420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1579420e7fabSHenning Rogge  *
1580420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1581c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1582420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1583c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1584b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1585c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1586c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1587c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1588c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
15892a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1590420e7fabSHenning Rogge  */
1591420e7fabSHenning Rogge struct rate_info {
1592420e7fabSHenning Rogge 	u8 flags;
1593420e7fabSHenning Rogge 	u8 mcs;
1594420e7fabSHenning Rogge 	u16 legacy;
1595db9c64cfSJohannes Berg 	u8 nss;
1596b51f3beeSJohannes Berg 	u8 bw;
1597c4cbaf79SLuca Coelho 	u8 he_gi;
1598c4cbaf79SLuca Coelho 	u8 he_dcm;
1599c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
16002a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1601fd5b74dcSJohannes Berg };
1602fd5b74dcSJohannes Berg 
1603fd5b74dcSJohannes Berg /**
1604b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1605f4263c98SPaul Stewart  *
1606f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1607f4263c98SPaul Stewart  * type for 802.11n transmissions.
1608f4263c98SPaul Stewart  *
1609f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1610f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1611f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1612f4263c98SPaul Stewart  */
1613f4263c98SPaul Stewart enum bss_param_flags {
1614f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1615f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1616f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1617f4263c98SPaul Stewart };
1618f4263c98SPaul Stewart 
1619f4263c98SPaul Stewart /**
1620f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1621f4263c98SPaul Stewart  *
1622f4263c98SPaul Stewart  * Information about the currently associated BSS
1623f4263c98SPaul Stewart  *
1624f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1625f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1626f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1627f4263c98SPaul Stewart  */
1628f4263c98SPaul Stewart struct sta_bss_parameters {
1629f4263c98SPaul Stewart 	u8 flags;
1630f4263c98SPaul Stewart 	u8 dtim_period;
1631f4263c98SPaul Stewart 	u16 beacon_interval;
1632f4263c98SPaul Stewart };
1633f4263c98SPaul Stewart 
16346de39808SJohannes Berg /**
163552539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
163652539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
163752539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
163852539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
163952539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
164052539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
164152539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
164252539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
164352539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
164452539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
164552539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
164652539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
164752539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
164852539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
164952539ca8SToke Høiland-Jørgensen  */
165052539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
165152539ca8SToke Høiland-Jørgensen 	u32 filled;
165252539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
165352539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
165452539ca8SToke Høiland-Jørgensen 	u32 flows;
165552539ca8SToke Høiland-Jørgensen 	u32 drops;
165652539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
165752539ca8SToke Høiland-Jørgensen 	u32 overlimit;
165852539ca8SToke Høiland-Jørgensen 	u32 overmemory;
165952539ca8SToke Høiland-Jørgensen 	u32 collisions;
166052539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
166152539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
166252539ca8SToke Høiland-Jørgensen 	u32 max_flows;
166352539ca8SToke Høiland-Jørgensen };
166452539ca8SToke Høiland-Jørgensen 
166552539ca8SToke Høiland-Jørgensen /**
16666de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
16676de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
16686de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
16696de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
16706de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
16716de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
16726de39808SJohannes Berg  *	transmitted MSDUs
16736de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
167452539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
16756de39808SJohannes Berg  */
16766de39808SJohannes Berg struct cfg80211_tid_stats {
16776de39808SJohannes Berg 	u32 filled;
16786de39808SJohannes Berg 	u64 rx_msdu;
16796de39808SJohannes Berg 	u64 tx_msdu;
16806de39808SJohannes Berg 	u64 tx_msdu_retries;
16816de39808SJohannes Berg 	u64 tx_msdu_failed;
168252539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
16836de39808SJohannes Berg };
16846de39808SJohannes Berg 
1685119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1686119363c7SFelix Fietkau 
1687f4263c98SPaul Stewart /**
16882ec600d6SLuis Carlos Cobo  * struct station_info - station information
1689fd5b74dcSJohannes Berg  *
16902ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1691fd5b74dcSJohannes Berg  *
1692319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1693319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1694ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1695fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
16966c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
16978d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
16988d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
16992ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
17002ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
17012ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
170273c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
170373c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
170473c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
170573c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1706119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1707119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1708119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1709858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1710858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
17118d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
17128d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
17138d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
17148d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
17155a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
17161ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1717f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1718f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1719f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1720f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
172150d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
172250d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
172350d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
172450d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
172550d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1726c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1727a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1728d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
17293b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
17303b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
17313b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1732867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1733867d849fSAntonio Quartulli  *	towards this station.
1734a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1735a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1736a76b1942SJohannes Berg  *	from this peer
1737dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1738739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
173936647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
174036647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
17416de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
17426de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
17438689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1744c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
174581d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
174681d5439dSBalaji Pothunoori  *	been sent.
17470d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
17480d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
17490d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
17500d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1751ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
17521303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
1753fd5b74dcSJohannes Berg  */
17542ec600d6SLuis Carlos Cobo struct station_info {
1755739960f1SMohammed Shafi Shajakhan 	u64 filled;
1756ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1757fd5b74dcSJohannes Berg 	u32 inactive_time;
17586c7a0033SBen Greear 	u64 assoc_at;
175942745e03SVladimir Kondratiev 	u64 rx_bytes;
176042745e03SVladimir Kondratiev 	u64 tx_bytes;
17612ec600d6SLuis Carlos Cobo 	u16 llid;
17622ec600d6SLuis Carlos Cobo 	u16 plid;
17632ec600d6SLuis Carlos Cobo 	u8 plink_state;
1764420e7fabSHenning Rogge 	s8 signal;
1765541a45a1SBruno Randolf 	s8 signal_avg;
1766119363c7SFelix Fietkau 
1767119363c7SFelix Fietkau 	u8 chains;
1768119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1769119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1770119363c7SFelix Fietkau 
1771420e7fabSHenning Rogge 	struct rate_info txrate;
1772c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
177398c8a60aSJouni Malinen 	u32 rx_packets;
177498c8a60aSJouni Malinen 	u32 tx_packets;
1775b206b4efSBruno Randolf 	u32 tx_retries;
1776b206b4efSBruno Randolf 	u32 tx_failed;
17775a5c731aSBen Greear 	u32 rx_dropped_misc;
1778f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1779bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1780f5ea9120SJohannes Berg 
1781f5ea9120SJohannes Berg 	int generation;
178250d3dfb7SJouni Malinen 
178350d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
178450d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1785f612cedfSJouni Malinen 
1786a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1787d299a1f2SJavier Cardona 	s64 t_offset;
17883b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
17893b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
17903b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1791a85e1d55SPaul Stewart 
1792867d849fSAntonio Quartulli 	u32 expected_throughput;
1793a76b1942SJohannes Berg 
179436647055SToke Høiland-Jørgensen 	u64 tx_duration;
1795739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
179636647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1797a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1798dbdaee7aSBob Copeland 	u8 connected_to_gate;
1799dbdaee7aSBob Copeland 
18008689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1801c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
180281d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
18030d4e14a3SAnkita Bajaj 
180436647055SToke Høiland-Jørgensen 	u16 airtime_weight;
180536647055SToke Høiland-Jørgensen 
18060d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
18070d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1808ab60633cSNarayanraddi Masti 
1809ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
18101303a51cSMarkus Theil 
18111303a51cSMarkus Theil 	u8 connected_to_as;
1812fd5b74dcSJohannes Berg };
1813fd5b74dcSJohannes Berg 
18146bdb68ceSCarl Huang /**
18156bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
18166bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
18176bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
18186bdb68ceSCarl Huang  */
18196bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
18206bdb68ceSCarl Huang 	s32 power;
18216bdb68ceSCarl Huang 	u32 freq_range_index;
18226bdb68ceSCarl Huang };
18236bdb68ceSCarl Huang 
18246bdb68ceSCarl Huang /**
18256bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
18266bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
18276bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
18286bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
18296bdb68ceSCarl Huang  */
18306bdb68ceSCarl Huang struct cfg80211_sar_specs {
18316bdb68ceSCarl Huang 	enum nl80211_sar_type type;
18326bdb68ceSCarl Huang 	u32 num_sub_specs;
18336bdb68ceSCarl Huang 	struct cfg80211_sar_sub_specs sub_specs[];
18346bdb68ceSCarl Huang };
18356bdb68ceSCarl Huang 
18366bdb68ceSCarl Huang 
18376bdb68ceSCarl Huang /**
1838c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
18396bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
18406bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
18416bdb68ceSCarl Huang  */
18426bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
18436bdb68ceSCarl Huang 	u32 start_freq;
18446bdb68ceSCarl Huang 	u32 end_freq;
18456bdb68ceSCarl Huang };
18466bdb68ceSCarl Huang 
18476bdb68ceSCarl Huang /**
18486bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
18496bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
18506bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
18516bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
18526bdb68ceSCarl Huang  *
18536bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
18546bdb68ceSCarl Huang  * range to small ones and then append them.
18556bdb68ceSCarl Huang  */
18566bdb68ceSCarl Huang struct cfg80211_sar_capa {
18576bdb68ceSCarl Huang 	enum nl80211_sar_type type;
18586bdb68ceSCarl Huang 	u32 num_freq_ranges;
18596bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
18606bdb68ceSCarl Huang };
18616bdb68ceSCarl Huang 
186261aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
186366f7ac50SMichael Wu /**
18647406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
18657406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
18667406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
18677406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
18687406353dSAntonio Quartulli  *
18697406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
18707406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
18717406353dSAntonio Quartulli  * considered undefined.
18727406353dSAntonio Quartulli  */
18737406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
18747406353dSAntonio Quartulli 			 struct station_info *sinfo);
187561aaa0e8SLinus Lüssing #else
187661aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
187761aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
187861aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
187961aaa0e8SLinus Lüssing {
188061aaa0e8SLinus Lüssing 	return -ENOENT;
188161aaa0e8SLinus Lüssing }
188261aaa0e8SLinus Lüssing #endif
18837406353dSAntonio Quartulli 
18847406353dSAntonio Quartulli /**
188566f7ac50SMichael Wu  * enum monitor_flags - monitor flags
188666f7ac50SMichael Wu  *
188766f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
188866f7ac50SMichael Wu  * according to the nl80211 flags.
188966f7ac50SMichael Wu  *
1890818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
189166f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
189266f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
189366f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
189466f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
189566f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1896e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
189766f7ac50SMichael Wu  */
189866f7ac50SMichael Wu enum monitor_flags {
1899818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
190066f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
190166f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
190266f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
190366f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
190466f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1905e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
190666f7ac50SMichael Wu };
190766f7ac50SMichael Wu 
19082ec600d6SLuis Carlos Cobo /**
19092ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
19102ec600d6SLuis Carlos Cobo  *
19112ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
19122ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
19132ec600d6SLuis Carlos Cobo  *
1914abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1915abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1916abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1917abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1918abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1919abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1920abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
1921cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
19229874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
19232ec600d6SLuis Carlos Cobo  */
19242ec600d6SLuis Carlos Cobo enum mpath_info_flags {
19252ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1926d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
19272ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
19282ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
19292ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
19302ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
19312ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
1932540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
1933540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
19342ec600d6SLuis Carlos Cobo };
19352ec600d6SLuis Carlos Cobo 
19362ec600d6SLuis Carlos Cobo /**
19372ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
19382ec600d6SLuis Carlos Cobo  *
19392ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
19402ec600d6SLuis Carlos Cobo  *
19412ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
19422ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1943d19b3bf6SRui Paulo  * @sn: target sequence number
19442ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
19452ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
19462ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
19472ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
19482ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1949f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1950f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1951f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1952f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
1953cc241636SJulan Hsu  * @hop_count: hops to destination
1954540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
19552ec600d6SLuis Carlos Cobo  */
19562ec600d6SLuis Carlos Cobo struct mpath_info {
19572ec600d6SLuis Carlos Cobo 	u32 filled;
19582ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1959d19b3bf6SRui Paulo 	u32 sn;
19602ec600d6SLuis Carlos Cobo 	u32 metric;
19612ec600d6SLuis Carlos Cobo 	u32 exptime;
19622ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
19632ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
19642ec600d6SLuis Carlos Cobo 	u8 flags;
1965cc241636SJulan Hsu 	u8 hop_count;
1966540bbcb9SJulan Hsu 	u32 path_change_count;
1967f5ea9120SJohannes Berg 
1968f5ea9120SJohannes Berg 	int generation;
19692ec600d6SLuis Carlos Cobo };
19702ec600d6SLuis Carlos Cobo 
19719f1ba906SJouni Malinen /**
19729f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
19739f1ba906SJouni Malinen  *
19749f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
19759f1ba906SJouni Malinen  *
19769f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
19779f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
19789f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
19799f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
19809f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
19819f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
198290c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
198390c97a04SJouni Malinen  *	(or NULL for no change)
198490c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1985fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
19869d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
198750b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
198850b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
198953cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
199053cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
19919f1ba906SJouni Malinen  */
19929f1ba906SJouni Malinen struct bss_parameters {
19939f1ba906SJouni Malinen 	int use_cts_prot;
19949f1ba906SJouni Malinen 	int use_short_preamble;
19959f1ba906SJouni Malinen 	int use_short_slot_time;
1996c1e5f471SJohannes Berg 	const u8 *basic_rates;
199790c97a04SJouni Malinen 	u8 basic_rates_len;
1998fd8aaaf3SFelix Fietkau 	int ap_isolate;
199950b12f59SHelmut Schaa 	int ht_opmode;
200053cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
20019f1ba906SJouni Malinen };
20022ec600d6SLuis Carlos Cobo 
20033ddd53f3SChun-Yeow Yeoh /**
200429cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
200529cbe68cSJohannes Berg  *
200629cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
20073ddd53f3SChun-Yeow Yeoh  *
20083ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
20093ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
20103ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
20113ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
20123ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
20133ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
20143ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
20153ddd53f3SChun-Yeow Yeoh  *	mesh interface
20163ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
20173ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
20183ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
20193ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
20203ddd53f3SChun-Yeow Yeoh  *	elements
20213ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
20223ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
20233ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
20243ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
20253ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
20263ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
20273ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
20283ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
20293ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
20303ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
20313ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
20323ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
20333ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
20343ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
20353ddd53f3SChun-Yeow Yeoh  *	element
20363ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
20373ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
20383ddd53f3SChun-Yeow Yeoh  *	element
20393ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
20403ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
20413ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
20423ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
20433ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
20443ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
20453ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
20463ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
20473ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
20483ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
20493ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
20503ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
20513ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
20523ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
20533ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
20543ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2055ac1073a6SChun-Yeow Yeoh  *
2056ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2057ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2058ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2059ac1073a6SChun-Yeow Yeoh  *
2060ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2061ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2062728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2063728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2064728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
20653b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
20663b1c5a53SMarco Porsch  *	setting for new peer links.
20673b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
20683b1c5a53SMarco Porsch  *	after transmitting its beacon.
20698e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
20708e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
20718e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
207201d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
207301d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
207401d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
207501d66fbdSBob Copeland  *      in the mesh path table
2076e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2077e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2078e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2079e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2080e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
208129cbe68cSJohannes Berg  */
208293da9cc1Scolin@cozybit.com struct mesh_config {
208393da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
208493da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
208593da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
208693da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
208793da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
208893da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
208945904f21SJavier Cardona 	u8 element_ttl;
209093da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2091d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
209293da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
209393da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
209493da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
209593da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
209693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2097dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
209893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
209963c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
210001d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2101184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
21020507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
210316dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
210494f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
210555335137SAshok Nagarajan 	s32 rssi_threshold;
210670c33eaaSAshok Nagarajan 	u16 ht_opmode;
2107ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2108ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2109728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
21103b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
21113b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
21128e7c0538SColleen Twitty 	u32 plink_timeout;
2113e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
211493da9cc1Scolin@cozybit.com };
211593da9cc1Scolin@cozybit.com 
211631888487SJouni Malinen /**
211729cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2118683b6d3bSJohannes Berg  * @chandef: defines the channel to use
211929cbe68cSJohannes Berg  * @mesh_id: the mesh ID
212029cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2121d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2122c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2123c80d545dSJavier Cardona  * @path_metric: which metric to use
21246e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2125581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2126581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2127b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2128b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2129bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
21309bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
21319bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
21324bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2133ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
21348564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2135d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2136d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2137d37d49c2SBenjamin Berg  *	to operate on DFS channels.
21381224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
21391224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
214029cbe68cSJohannes Berg  *
214129cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
214229cbe68cSJohannes Berg  */
214329cbe68cSJohannes Berg struct mesh_setup {
2144683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
214529cbe68cSJohannes Berg 	const u8 *mesh_id;
214629cbe68cSJohannes Berg 	u8 mesh_id_len;
2147d299a1f2SJavier Cardona 	u8 sync_method;
2148c80d545dSJavier Cardona 	u8 path_sel_proto;
2149c80d545dSJavier Cardona 	u8 path_metric;
21506e16d90bSColleen Twitty 	u8 auth_id;
2151581a8b0fSJavier Cardona 	const u8 *ie;
2152581a8b0fSJavier Cardona 	u8 ie_len;
2153b130e5ceSJavier Cardona 	bool is_authenticated;
215415d5dda6SJavier Cardona 	bool is_secure;
2155bb2798d4SThomas Pedersen 	bool user_mpm;
21569bdbf04dSMarco Porsch 	u8 dtim_period;
21579bdbf04dSMarco Porsch 	u16 beacon_interval;
215857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2159ffb3cf30SAshok Nagarajan 	u32 basic_rates;
21608564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2161d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
21621224f583SDenis Kenzior 	bool control_port_over_nl80211;
216329cbe68cSJohannes Berg };
216429cbe68cSJohannes Berg 
216529cbe68cSJohannes Berg /**
21666e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
21676e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
21686e0bd6c3SRostislav Lisovy  *
21696e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
21706e0bd6c3SRostislav Lisovy  */
21716e0bd6c3SRostislav Lisovy struct ocb_setup {
21726e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
21736e0bd6c3SRostislav Lisovy };
21746e0bd6c3SRostislav Lisovy 
21756e0bd6c3SRostislav Lisovy /**
217631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2177a3304b0aSJohannes Berg  * @ac: AC identifier
217831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
217931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
218031888487SJouni Malinen  *	1..32767]
218131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
218231888487SJouni Malinen  *	1..32767]
218331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
218431888487SJouni Malinen  */
218531888487SJouni Malinen struct ieee80211_txq_params {
2186a3304b0aSJohannes Berg 	enum nl80211_ac ac;
218731888487SJouni Malinen 	u16 txop;
218831888487SJouni Malinen 	u16 cwmin;
218931888487SJouni Malinen 	u16 cwmax;
219031888487SJouni Malinen 	u8 aifs;
219131888487SJouni Malinen };
219231888487SJouni Malinen 
2193d70e9693SJohannes Berg /**
2194d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2195d70e9693SJohannes Berg  *
2196d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2197d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2198d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2199d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2200d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2201d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2202d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2203d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2204d70e9693SJohannes Berg  * in the wiphy structure.
2205d70e9693SJohannes Berg  *
2206d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2207d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2208d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2209d70e9693SJohannes Berg  *
2210d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2211d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2212d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2213d70e9693SJohannes Berg  * to userspace.
2214d70e9693SJohannes Berg  */
221572bdcf34SJouni Malinen 
2216704232c2SJohannes Berg /**
22172a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
22182a519311SJohannes Berg  * @ssid: the SSID
22192a519311SJohannes Berg  * @ssid_len: length of the ssid
22202a519311SJohannes Berg  */
22212a519311SJohannes Berg struct cfg80211_ssid {
22222a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
22232a519311SJohannes Berg 	u8 ssid_len;
22242a519311SJohannes Berg };
22252a519311SJohannes Berg 
22262a519311SJohannes Berg /**
22271d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
22281d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
22291d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
22301d76250bSAvraham Stern  *	information is not available, this field is left zero.
22311d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
22321d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
22331d76250bSAvraham Stern  *	userspace will be notified of that
22341d76250bSAvraham Stern  */
22351d76250bSAvraham Stern struct cfg80211_scan_info {
22361d76250bSAvraham Stern 	u64 scan_start_tsf;
22371d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
22381d76250bSAvraham Stern 	bool aborted;
22391d76250bSAvraham Stern };
22401d76250bSAvraham Stern 
22411d76250bSAvraham Stern /**
2242c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2243c8cb5b85STova Mussai  *
2244c8cb5b85STova Mussai  * @short_bssid: short ssid to scan for
2245c8cb5b85STova Mussai  * @bssid: bssid to scan for
2246c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
2247c8cb5b85STova Mussai  *	 which the above info relvant to
2248c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2249c8cb5b85STova Mussai  * @short_ssid_valid: short_ssid is valid and can be used
2250c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2251c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
2252c8cb5b85STova Mussai  */
2253c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2254c8cb5b85STova Mussai 	u32 short_ssid;
2255c8cb5b85STova Mussai 	u32 channel_idx;
2256c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2257c8cb5b85STova Mussai 	bool unsolicited_probe;
2258c8cb5b85STova Mussai 	bool short_ssid_valid;
2259c8cb5b85STova Mussai 	bool psc_no_listen;
2260c8cb5b85STova Mussai };
2261c8cb5b85STova Mussai 
2262c8cb5b85STova Mussai /**
22632a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
22642a519311SJohannes Berg  *
22652a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
22662a519311SJohannes Berg  * @n_ssids: number of SSIDs
22672a519311SJohannes Berg  * @channels: channels to scan on.
2268ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
2269dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
227070692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
227170692ad2SJouni Malinen  * @ie_len: length of ie in octets
22721d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
22731d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
22741d76250bSAvraham Stern  *	the actual dwell time may be shorter.
22751d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
22761d76250bSAvraham Stern  *	%duration field.
2277ed473771SSam Leffler  * @flags: bit field of flags controlling operation
227834850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
22792a519311SJohannes Berg  * @wiphy: the wiphy this was for
228015d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2281fd014284SJohannes Berg  * @wdev: the wireless device to scan for
22821d76250bSAvraham Stern  * @info: (internal) information about completed scan
22835fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2284e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2285ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2286ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2287ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2288ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2289c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2290c8cb5b85STova Mussai  *	true if this is the second scan request
2291c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2292c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2293818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
22942a519311SJohannes Berg  */
22952a519311SJohannes Berg struct cfg80211_scan_request {
22962a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
22972a519311SJohannes Berg 	int n_ssids;
22982a519311SJohannes Berg 	u32 n_channels;
2299dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2300de95a54bSJohannes Berg 	const u8 *ie;
230170692ad2SJouni Malinen 	size_t ie_len;
23021d76250bSAvraham Stern 	u16 duration;
23031d76250bSAvraham Stern 	bool duration_mandatory;
2304ed473771SSam Leffler 	u32 flags;
23052a519311SJohannes Berg 
230657fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
230734850ab2SJohannes Berg 
2308fd014284SJohannes Berg 	struct wireless_dev *wdev;
2309fd014284SJohannes Berg 
2310ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2311ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2312818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2313ad2b26abSJohannes Berg 
23142a519311SJohannes Berg 	/* internal */
23152a519311SJohannes Berg 	struct wiphy *wiphy;
231615d6030bSSam Leffler 	unsigned long scan_start;
23171d76250bSAvraham Stern 	struct cfg80211_scan_info info;
23181d76250bSAvraham Stern 	bool notified;
2319e9f935e3SRajkumar Manoharan 	bool no_cck;
2320c8cb5b85STova Mussai 	bool scan_6ghz;
2321c8cb5b85STova Mussai 	u32 n_6ghz_params;
2322c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
23235ba63533SJohannes Berg 
23245ba63533SJohannes Berg 	/* keep last */
2325396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
23262a519311SJohannes Berg };
23272a519311SJohannes Berg 
2328ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2329ad2b26abSJohannes Berg {
2330ad2b26abSJohannes Berg 	int i;
2331ad2b26abSJohannes Berg 
2332ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2333ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2334ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2335ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2336ad2b26abSJohannes Berg 	}
2337ad2b26abSJohannes Berg }
2338ad2b26abSJohannes Berg 
23392a519311SJohannes Berg /**
2340a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2341a1f1c21cSLuciano Coelho  *
23423007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
23433007e352SArend Van Spriel  *	or no match (RSSI only)
23443007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
23453007e352SArend Van Spriel  *	or no match (RSSI only)
2346ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
23471e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
23481e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
23491e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
23501e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
23511e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
23521e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
23531e1b11b6Svamsi krishna  *	corresponding matchset.
2354a1f1c21cSLuciano Coelho  */
2355a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2356a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
23573007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2358ea73cbceSJohannes Berg 	s32 rssi_thold;
23591e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2360a1f1c21cSLuciano Coelho };
2361a1f1c21cSLuciano Coelho 
2362a1f1c21cSLuciano Coelho /**
23633b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
23643b06d277SAvraham Stern  *
23653b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
23663b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
23673b06d277SAvraham Stern  *	infinite loop.
23683b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
23693b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
23703b06d277SAvraham Stern  */
23713b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
23723b06d277SAvraham Stern 	u32 interval;
23733b06d277SAvraham Stern 	u32 iterations;
23743b06d277SAvraham Stern };
23753b06d277SAvraham Stern 
23763b06d277SAvraham Stern /**
2377bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2378bf95ecdbSvamsi krishna  *
2379bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2380bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2381bf95ecdbSvamsi krishna  */
2382bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2383bf95ecdbSvamsi krishna 	enum nl80211_band band;
2384bf95ecdbSvamsi krishna 	s8 delta;
2385bf95ecdbSvamsi krishna };
2386bf95ecdbSvamsi krishna 
2387bf95ecdbSvamsi krishna /**
2388807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2389807f8a8cSLuciano Coelho  *
239096b08fd6SArend Van Spriel  * @reqid: identifies this request.
2391807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2392807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2393807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2394dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2395807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2396807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2397ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2398a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2399a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2400a1f1c21cSLuciano Coelho  *	(others are filtered out).
2401a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2402a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
24036406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2404807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2405807f8a8cSLuciano Coelho  * @dev: the interface
2406077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2407807f8a8cSLuciano Coelho  * @channels: channels to scan
2408ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2409ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2410ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2411ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2412ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2413ad2b26abSJohannes Berg  *	be taken from the @mac_addr
24143b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
24153b06d277SAvraham Stern  *	index must be executed first.
24163b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
241731a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
241893a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
241993a1e86cSJukka Rissanen  *	owned by a particular socket)
2420ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2421ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
24229c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
24239c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
24249c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
24259c748934SLuciano Coelho  *	supported.
2426bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2427bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2428bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2429bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2430bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2431bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2432bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2433bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2434bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2435bf95ecdbSvamsi krishna  *	comparisions.
2436807f8a8cSLuciano Coelho  */
2437807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
243896b08fd6SArend Van Spriel 	u64 reqid;
2439807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2440807f8a8cSLuciano Coelho 	int n_ssids;
2441807f8a8cSLuciano Coelho 	u32 n_channels;
2442dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2443807f8a8cSLuciano Coelho 	const u8 *ie;
2444807f8a8cSLuciano Coelho 	size_t ie_len;
2445ed473771SSam Leffler 	u32 flags;
2446a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2447a1f1c21cSLuciano Coelho 	int n_match_sets;
2448ea73cbceSJohannes Berg 	s32 min_rssi_thold;
24499c748934SLuciano Coelho 	u32 delay;
24503b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
24513b06d277SAvraham Stern 	int n_scan_plans;
2452807f8a8cSLuciano Coelho 
2453ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2454ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2455ad2b26abSJohannes Berg 
2456bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2457bf95ecdbSvamsi krishna 	s8 relative_rssi;
2458bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2459bf95ecdbSvamsi krishna 
2460807f8a8cSLuciano Coelho 	/* internal */
2461807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2462807f8a8cSLuciano Coelho 	struct net_device *dev;
246315d6030bSSam Leffler 	unsigned long scan_start;
2464b34939b9SArend Van Spriel 	bool report_results;
246531a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
246693a1e86cSJukka Rissanen 	u32 owner_nlportid;
2467ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2468ca986ad9SArend Van Spriel 	struct list_head list;
2469807f8a8cSLuciano Coelho 
2470807f8a8cSLuciano Coelho 	/* keep last */
2471396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2472807f8a8cSLuciano Coelho };
2473807f8a8cSLuciano Coelho 
2474807f8a8cSLuciano Coelho /**
24752a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
24762a519311SJohannes Berg  *
24772a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
24782a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
24792a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
24802a519311SJohannes Berg  */
24812a519311SJohannes Berg enum cfg80211_signal_type {
24822a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
24832a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
24842a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
24852a519311SJohannes Berg };
24862a519311SJohannes Berg 
24872a519311SJohannes Berg /**
24886e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
24896e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
24906e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
24916e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
24926e19bc4bSDmitry Shmidt  *	signal type
24936e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
24946e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
24956e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
24966e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
24976e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
24989285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
24991d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
25001d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
25011d76250bSAvraham Stern  *	by %parent_bssid.
25021d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
25031d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2504983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2505983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
25066e19bc4bSDmitry Shmidt  */
25076e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
25086e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
25096e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
25106e19bc4bSDmitry Shmidt 	s32 signal;
25116e19bc4bSDmitry Shmidt 	u64 boottime_ns;
25121d76250bSAvraham Stern 	u64 parent_tsf;
25131d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2514983dafaaSSunil Dutt 	u8 chains;
2515983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
25166e19bc4bSDmitry Shmidt };
25176e19bc4bSDmitry Shmidt 
25186e19bc4bSDmitry Shmidt /**
25192aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
25208cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
25219caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
25229caf0364SJohannes Berg  * @len: length of the IEs
25230e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
25249caf0364SJohannes Berg  * @data: IE data
25259caf0364SJohannes Berg  */
25269caf0364SJohannes Berg struct cfg80211_bss_ies {
25278cef2c9dSJohannes Berg 	u64 tsf;
25289caf0364SJohannes Berg 	struct rcu_head rcu_head;
25299caf0364SJohannes Berg 	int len;
25300e227084SJohannes Berg 	bool from_beacon;
25319caf0364SJohannes Berg 	u8 data[];
25329caf0364SJohannes Berg };
25339caf0364SJohannes Berg 
25349caf0364SJohannes Berg /**
25352a519311SJohannes Berg  * struct cfg80211_bss - BSS description
25362a519311SJohannes Berg  *
25372a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
25382a519311SJohannes Berg  * for use in scan results and similar.
25392a519311SJohannes Berg  *
2540abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2541dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
25422a519311SJohannes Berg  * @bssid: BSSID of the BSS
25432a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
25442a519311SJohannes Berg  * @capability: the capability field in host byte order
254583c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
254683c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
254783c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
254883c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
254934a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2550776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2551776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2552776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
255334a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2554776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2555776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2556776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2557776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2558851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2559851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2560851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2561851ae31dSJohannes Berg  *	(multi-BSSID support)
256277965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2563983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2564983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
25650cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
25660cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
25672a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
25682a519311SJohannes Berg  */
25692a519311SJohannes Berg struct cfg80211_bss {
25702a519311SJohannes Berg 	struct ieee80211_channel *channel;
2571dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
25722a519311SJohannes Berg 
25739caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
25749caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
25759caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
25769caf0364SJohannes Berg 
2577776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
25787011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
25797011ba58SSara Sharon 	struct list_head nontrans_list;
25802a519311SJohannes Berg 
25812a519311SJohannes Berg 	s32 signal;
25822a519311SJohannes Berg 
25839caf0364SJohannes Berg 	u16 beacon_interval;
25849caf0364SJohannes Berg 	u16 capability;
25859caf0364SJohannes Berg 
25869caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2587983dafaaSSunil Dutt 	u8 chains;
2588983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
25899caf0364SJohannes Berg 
25900cd01efbSSara Sharon 	u8 bssid_index;
25910cd01efbSSara Sharon 	u8 max_bssid_indicator;
25920cd01efbSSara Sharon 
2593396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
25942a519311SJohannes Berg };
25952a519311SJohannes Berg 
25962a519311SJohannes Berg /**
259749a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2598517357c6SJohannes Berg  * @bss: the bss to search
259949a68e0dSJohannes Berg  * @id: the element ID
26009caf0364SJohannes Berg  *
26019caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
26029caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
26030ae997dcSYacine Belkadi  * Return: %NULL if not found.
2604517357c6SJohannes Berg  */
260549a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
260649a68e0dSJohannes Berg 
260749a68e0dSJohannes Berg /**
260849a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
260949a68e0dSJohannes Berg  * @bss: the bss to search
261049a68e0dSJohannes Berg  * @id: the element ID
261149a68e0dSJohannes Berg  *
261249a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
261349a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
261449a68e0dSJohannes Berg  * Return: %NULL if not found.
261549a68e0dSJohannes Berg  */
261649a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
261749a68e0dSJohannes Berg {
261849a68e0dSJohannes Berg 	return (void *)ieee80211_bss_get_elem(bss, id);
261949a68e0dSJohannes Berg }
2620517357c6SJohannes Berg 
2621517357c6SJohannes Berg 
2622517357c6SJohannes Berg /**
2623636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2624636a5d36SJouni Malinen  *
2625636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2626636a5d36SJouni Malinen  * authentication.
2627636a5d36SJouni Malinen  *
2628959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2629959867faSJohannes Berg  *	to it if it needs to keep it.
2630636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2631636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2632636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2633fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2634fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2635fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
263611b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
263711b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
263811b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
263911b6b5a4SJouni Malinen  *	transaction sequence number field.
264011b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2641636a5d36SJouni Malinen  */
2642636a5d36SJouni Malinen struct cfg80211_auth_request {
264319957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2644636a5d36SJouni Malinen 	const u8 *ie;
2645636a5d36SJouni Malinen 	size_t ie_len;
264619957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2647fffd0934SJohannes Berg 	const u8 *key;
2648fffd0934SJohannes Berg 	u8 key_len, key_idx;
264911b6b5a4SJouni Malinen 	const u8 *auth_data;
265011b6b5a4SJouni Malinen 	size_t auth_data_len;
2651636a5d36SJouni Malinen };
2652636a5d36SJouni Malinen 
2653636a5d36SJouni Malinen /**
26547e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
26557e7c8926SBen Greear  *
26567e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2657ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2658bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
265940cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
266040cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
266140cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
266240cbfa90SSrinivas Dasari  *	request (connect callback).
2663b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
26647e7c8926SBen Greear  */
26657e7c8926SBen Greear enum cfg80211_assoc_req_flags {
26667e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2667ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2668bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
266940cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
2670b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
26717e7c8926SBen Greear };
26727e7c8926SBen Greear 
26737e7c8926SBen Greear /**
2674636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2675636a5d36SJouni Malinen  *
2676636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2677636a5d36SJouni Malinen  * (re)association.
2678959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2679959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2680959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2681959867faSJohannes Berg  *	association requests while already associating must be rejected.
2682636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2683636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2684dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2685b23aa676SSamuel Ortiz  * @crypto: crypto settings
268635eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
268735eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
268835eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
268935eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
269035eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
269135eb8f7bSJouni Malinen  *	frame.
26927e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
26937e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
26947e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
26957e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2696ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2697ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2698348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2699348bd456SJouni Malinen  *	%NULL if FILS is not used.
2700348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2701348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2702348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2703348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2704d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
2705d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
2706636a5d36SJouni Malinen  */
2707636a5d36SJouni Malinen struct cfg80211_assoc_request {
270819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
27093e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2710636a5d36SJouni Malinen 	size_t ie_len;
2711b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
271219957bb3SJohannes Berg 	bool use_mfp;
27137e7c8926SBen Greear 	u32 flags;
27147e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
27157e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2716ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2717348bd456SJouni Malinen 	const u8 *fils_kek;
2718348bd456SJouni Malinen 	size_t fils_kek_len;
2719348bd456SJouni Malinen 	const u8 *fils_nonces;
2720d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2721636a5d36SJouni Malinen };
2722636a5d36SJouni Malinen 
2723636a5d36SJouni Malinen /**
2724636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2725636a5d36SJouni Malinen  *
2726636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2727636a5d36SJouni Malinen  * deauthentication.
2728636a5d36SJouni Malinen  *
272995de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2730636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2731636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
273219957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2733077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2734077f897aSJohannes Berg  *	do not set a deauth frame
2735636a5d36SJouni Malinen  */
2736636a5d36SJouni Malinen struct cfg80211_deauth_request {
273795de817bSJohannes Berg 	const u8 *bssid;
2738636a5d36SJouni Malinen 	const u8 *ie;
2739636a5d36SJouni Malinen 	size_t ie_len;
274019957bb3SJohannes Berg 	u16 reason_code;
27416863255bSStanislaw Gruszka 	bool local_state_change;
2742636a5d36SJouni Malinen };
2743636a5d36SJouni Malinen 
2744636a5d36SJouni Malinen /**
2745636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2746636a5d36SJouni Malinen  *
2747636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
274866f00449SMasahiro Yamada  * disassociation.
2749636a5d36SJouni Malinen  *
275019957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2751636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2752636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
275319957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2754d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2755d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2756636a5d36SJouni Malinen  */
2757636a5d36SJouni Malinen struct cfg80211_disassoc_request {
275819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2759636a5d36SJouni Malinen 	const u8 *ie;
2760636a5d36SJouni Malinen 	size_t ie_len;
276119957bb3SJohannes Berg 	u16 reason_code;
2762d5cdfacbSJouni Malinen 	bool local_state_change;
2763636a5d36SJouni Malinen };
2764636a5d36SJouni Malinen 
2765636a5d36SJouni Malinen /**
276604a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
276704a773adSJohannes Berg  *
276804a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
276904a773adSJohannes Berg  * method.
277004a773adSJohannes Berg  *
277104a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
277204a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
277304a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
277404a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2775683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
277604a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
277704a773adSJohannes Berg  *	IBSSs to join on other channels.
277804a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
277904a773adSJohannes Berg  * @ie_len: length of that
27808e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2781fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2782fffd0934SJohannes Berg  *	after joining
2783267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2784267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2785267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2786267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2787c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2788c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
27895336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
27905336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
27915336fa88SSimon Wunderlich  *	to operate on DFS channels.
2792fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2793dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2794803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2795803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2796803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
27979ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
27989ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
27999ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
280004a773adSJohannes Berg  */
280104a773adSJohannes Berg struct cfg80211_ibss_params {
2802c1e5f471SJohannes Berg 	const u8 *ssid;
2803c1e5f471SJohannes Berg 	const u8 *bssid;
2804683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2805c1e5f471SJohannes Berg 	const u8 *ie;
280604a773adSJohannes Berg 	u8 ssid_len, ie_len;
28078e30bc55SJohannes Berg 	u16 beacon_interval;
2808fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
280904a773adSJohannes Berg 	bool channel_fixed;
2810fffd0934SJohannes Berg 	bool privacy;
2811267335d6SAntonio Quartulli 	bool control_port;
2812c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
28135336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
281457fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2815803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2816803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
28179ae3b172STova Mussai 	struct key_params *wep_keys;
28189ae3b172STova Mussai 	int wep_tx_key;
281904a773adSJohannes Berg };
282004a773adSJohannes Berg 
282104a773adSJohannes Berg /**
282238de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
282338de03d2SArend van Spriel  *
282438de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
282538de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
282638de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
282738de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
282838de03d2SArend van Spriel  */
282938de03d2SArend van Spriel struct cfg80211_bss_selection {
283038de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
283138de03d2SArend van Spriel 	union {
283257fbcce3SJohannes Berg 		enum nl80211_band band_pref;
283338de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
283438de03d2SArend van Spriel 	} param;
283538de03d2SArend van Spriel };
283638de03d2SArend van Spriel 
283738de03d2SArend van Spriel /**
2838b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2839b23aa676SSamuel Ortiz  *
2840b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2841b23aa676SSamuel Ortiz  * authentication and association.
2842b23aa676SSamuel Ortiz  *
2843b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2844b23aa676SSamuel Ortiz  *	on scan results)
28451df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
28461df4a510SJouni Malinen  *	%NULL if not specified
2847b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2848b23aa676SSamuel Ortiz  *	results)
28491df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
28501df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
28511df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
28521df4a510SJouni Malinen  *	to use.
2853b23aa676SSamuel Ortiz  * @ssid: SSID
2854b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2855b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2856abe37c4bSJohannes Berg  * @ie: IEs for association request
2857abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2858b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2859cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2860b23aa676SSamuel Ortiz  * @crypto: crypto settings
2861fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2862fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2863fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
28647e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
28654486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
28664486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
28677e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
28687e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
28697e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2870ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2871ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
287234d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
287334d50519SLior David  *	networks.
287438de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
287535eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
287635eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
287735eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
287835eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
287935eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
288035eb8f7bSJouni Malinen  *	frame.
2881a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2882a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2883a3caf744SVidyullatha Kanchanapally  *	data IE.
2884a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2885a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2886a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2887a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2888a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2889a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2890a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2891a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2892a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2893a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
28943a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
28953a00df57SAvraham Stern  *	offload of 4-way handshake.
28962a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
28972a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
28982a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
2899b23aa676SSamuel Ortiz  */
2900b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2901b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
29021df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2903664834deSJouni Malinen 	const u8 *bssid;
29041df4a510SJouni Malinen 	const u8 *bssid_hint;
2905664834deSJouni Malinen 	const u8 *ssid;
2906b23aa676SSamuel Ortiz 	size_t ssid_len;
2907b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
29084b5800feSJohannes Berg 	const u8 *ie;
2909b23aa676SSamuel Ortiz 	size_t ie_len;
2910b23aa676SSamuel Ortiz 	bool privacy;
2911cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2912b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2913fffd0934SJohannes Berg 	const u8 *key;
2914fffd0934SJohannes Berg 	u8 key_len, key_idx;
29157e7c8926SBen Greear 	u32 flags;
29164486ea98SBala Shanmugam 	int bg_scan_period;
29177e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
29187e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2919ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2920ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
292134d50519SLior David 	bool pbss;
292238de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2923ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2924a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2925a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
2926a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
2927a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
2928a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
2929a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
2930a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
29313a00df57SAvraham Stern 	bool want_1x;
29322a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
2933b23aa676SSamuel Ortiz };
2934b23aa676SSamuel Ortiz 
2935b23aa676SSamuel Ortiz /**
2936088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
2937088e8df8Svamsi krishna  *
2938088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
2939088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
2940088e8df8Svamsi krishna  *
2941088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
29427f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
29437f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
29447f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2945088e8df8Svamsi krishna  */
2946088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
2947088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
29487f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
29497f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
2950088e8df8Svamsi krishna };
2951088e8df8Svamsi krishna 
2952088e8df8Svamsi krishna /**
2953b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
2954abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2955abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2956abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2957abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2958abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
29593057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
296052539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
296152539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
296252539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2963b9a5f8caSJouni Malinen  */
2964b9a5f8caSJouni Malinen enum wiphy_params_flags {
2965b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
2966b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
2967b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
2968b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
296981077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
29703057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
297152539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
297252539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
297352539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
2974b9a5f8caSJouni Malinen };
2975b9a5f8caSJouni Malinen 
297636647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
297736647055SToke Høiland-Jørgensen 
29783ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
29793ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
29803ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
29813ace10f5SKan Yan 
29823ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
29833ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
29843ace10f5SKan Yan 
298567fbb16bSSamuel Ortiz /**
298667fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
298767fbb16bSSamuel Ortiz  *
298867fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
298967fbb16bSSamuel Ortiz  * caching.
299067fbb16bSSamuel Ortiz  *
2991a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
2992a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
2993a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2994a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
2995a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2996a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
2997a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2998a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
2999a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3000a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3001a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3002a3caf744SVidyullatha Kanchanapally  *	%NULL).
30037fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
30047fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
30057fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
30067fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
30077fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
30087fc82af8SVeerendranath Jakkam  *	used for it expires.
30097fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
30107fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
30117fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
30127fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
30137fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
301467fbb16bSSamuel Ortiz  */
301567fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3016c1e5f471SJohannes Berg 	const u8 *bssid;
3017c1e5f471SJohannes Berg 	const u8 *pmkid;
3018a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3019a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3020a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3021a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3022a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
30237fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
30247fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
302567fbb16bSSamuel Ortiz };
30269930380fSJohannes Berg 
30277643a2c3SJohannes Berg /**
302850ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3029ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3030ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3031ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3032ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3033bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3034ff1b6e69SJohannes Berg  *
3035ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3036ff1b6e69SJohannes Berg  * memory, free @mask only!
3037ff1b6e69SJohannes Berg  */
303850ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3039922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3040ff1b6e69SJohannes Berg 	int pattern_len;
3041bb92d199SAmitkumar Karwar 	int pkt_offset;
3042ff1b6e69SJohannes Berg };
3043ff1b6e69SJohannes Berg 
3044ff1b6e69SJohannes Berg /**
30452a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
30462a0e047eSJohannes Berg  *
30472a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
30482a0e047eSJohannes Berg  * @src: source IP address
30492a0e047eSJohannes Berg  * @dst: destination IP address
30502a0e047eSJohannes Berg  * @dst_mac: destination MAC address
30512a0e047eSJohannes Berg  * @src_port: source port
30522a0e047eSJohannes Berg  * @dst_port: destination port
30532a0e047eSJohannes Berg  * @payload_len: data payload length
30542a0e047eSJohannes Berg  * @payload: data payload buffer
30552a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
30562a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
30572a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
30582a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
30592a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
30602a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
30612a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
30622a0e047eSJohannes Berg  */
30632a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
30642a0e047eSJohannes Berg 	struct socket *sock;
30652a0e047eSJohannes Berg 	__be32 src, dst;
30662a0e047eSJohannes Berg 	u16 src_port, dst_port;
30672a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
30682a0e047eSJohannes Berg 	int payload_len;
30692a0e047eSJohannes Berg 	const u8 *payload;
30702a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
30712a0e047eSJohannes Berg 	u32 data_interval;
30722a0e047eSJohannes Berg 	u32 wake_len;
30732a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
30742a0e047eSJohannes Berg 	u32 tokens_size;
30752a0e047eSJohannes Berg 	/* must be last, variable member */
30762a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3077ff1b6e69SJohannes Berg };
3078ff1b6e69SJohannes Berg 
3079ff1b6e69SJohannes Berg /**
3080ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3081ff1b6e69SJohannes Berg  *
3082ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3083ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3084ff1b6e69SJohannes Berg  *	operating as normal during suspend
3085ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3086ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3087ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3088ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
308977dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
309077dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
309177dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
309277dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
30932a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
30942a0e047eSJohannes Berg  *	NULL if not configured.
30958cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3096ff1b6e69SJohannes Berg  */
3097ff1b6e69SJohannes Berg struct cfg80211_wowlan {
309877dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
309977dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
310077dbbb13SJohannes Berg 	     rfkill_release;
310150ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
31022a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3103ff1b6e69SJohannes Berg 	int n_patterns;
31048cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3105ff1b6e69SJohannes Berg };
3106ff1b6e69SJohannes Berg 
3107ff1b6e69SJohannes Berg /**
3108be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3109be29b99aSAmitkumar Karwar  *
3110be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3111be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3112be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3113be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3114be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3115be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3116be29b99aSAmitkumar Karwar  */
3117be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3118be29b99aSAmitkumar Karwar 	int delay;
3119be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3120be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3121be29b99aSAmitkumar Karwar 	int n_patterns;
3122be29b99aSAmitkumar Karwar };
3123be29b99aSAmitkumar Karwar 
3124be29b99aSAmitkumar Karwar /**
3125be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3126be29b99aSAmitkumar Karwar  *
3127be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3128be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3129be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3130be29b99aSAmitkumar Karwar  */
3131be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3132be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
3133be29b99aSAmitkumar Karwar 	int n_rules;
3134be29b99aSAmitkumar Karwar };
3135be29b99aSAmitkumar Karwar 
3136be29b99aSAmitkumar Karwar /**
31378cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
31388cd4d456SLuciano Coelho  *
31398cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
31408cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
31418cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
31428cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
31438cd4d456SLuciano Coelho  *	occurred (in MHz)
31448cd4d456SLuciano Coelho  */
31458cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
31468cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
31478cd4d456SLuciano Coelho 	int n_channels;
31488cd4d456SLuciano Coelho 	u32 channels[];
31498cd4d456SLuciano Coelho };
31508cd4d456SLuciano Coelho 
31518cd4d456SLuciano Coelho /**
31528cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
31538cd4d456SLuciano Coelho  *
31548cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
31558cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
31568cd4d456SLuciano Coelho  *	match information.
31578cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
31588cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
31598cd4d456SLuciano Coelho  */
31608cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
31618cd4d456SLuciano Coelho 	int n_matches;
31628cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
31638cd4d456SLuciano Coelho };
31648cd4d456SLuciano Coelho 
31658cd4d456SLuciano Coelho /**
3166cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3167cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3168cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3169cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3170cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3171cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3172cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3173cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3174cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3175cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3176cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3177cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3178cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3179cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3180cd8f7cb4SJohannes Berg  *	it is.
31812a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
31822a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
31832a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
31848cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3185cd8f7cb4SJohannes Berg  */
3186cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3187cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3188cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
31892a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
31902a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
3191cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3192cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3193cd8f7cb4SJohannes Berg 	const void *packet;
31948cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3195cd8f7cb4SJohannes Berg };
3196cd8f7cb4SJohannes Berg 
3197cd8f7cb4SJohannes Berg /**
3198e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3199093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3200093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
320178f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3202093a48d2SNathan Errera  * @kek_len: length of kek
3203093a48d2SNathan Errera  * @kck_len length of kck
3204093a48d2SNathan Errera  * @akm: akm (oui, id)
3205e5497d76SJohannes Berg  */
3206e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
320778f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3208093a48d2SNathan Errera 	u32 akm;
3209093a48d2SNathan Errera 	u8 kek_len, kck_len;
3210e5497d76SJohannes Berg };
3211e5497d76SJohannes Berg 
3212e5497d76SJohannes Berg /**
3213355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3214355199e0SJouni Malinen  *
3215355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3216355199e0SJouni Malinen  *
3217355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3218355199e0SJouni Malinen  * @ie: Fast Transition IEs
3219355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3220355199e0SJouni Malinen  */
3221355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3222355199e0SJouni Malinen 	u16 md;
3223355199e0SJouni Malinen 	const u8 *ie;
3224355199e0SJouni Malinen 	size_t ie_len;
3225355199e0SJouni Malinen };
3226355199e0SJouni Malinen 
3227355199e0SJouni Malinen /**
3228b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3229b176e629SAndrei Otcheretianski  *
3230b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3231b176e629SAndrei Otcheretianski  *
3232b176e629SAndrei Otcheretianski  * @chan: channel to use
3233b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
3234b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3235b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3236b176e629SAndrei Otcheretianski  * @len: buffer length
3237b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3238b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
323934d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
324034d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
3241b176e629SAndrei Otcheretianski  */
3242b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3243b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3244b176e629SAndrei Otcheretianski 	bool offchan;
3245b176e629SAndrei Otcheretianski 	unsigned int wait;
3246b176e629SAndrei Otcheretianski 	const u8 *buf;
3247b176e629SAndrei Otcheretianski 	size_t len;
3248b176e629SAndrei Otcheretianski 	bool no_cck;
3249b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
325034d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
325134d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
3252b176e629SAndrei Otcheretianski };
3253b176e629SAndrei Otcheretianski 
3254b176e629SAndrei Otcheretianski /**
3255fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3256fa9ffc74SKyeyoon Park  *
3257fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3258fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3259fa9ffc74SKyeyoon Park  */
3260fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3261fa9ffc74SKyeyoon Park 	u8 dscp;
3262fa9ffc74SKyeyoon Park 	u8 up;
3263fa9ffc74SKyeyoon Park };
3264fa9ffc74SKyeyoon Park 
3265fa9ffc74SKyeyoon Park /**
3266fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3267fa9ffc74SKyeyoon Park  *
3268fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3269fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3270fa9ffc74SKyeyoon Park  */
3271fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3272fa9ffc74SKyeyoon Park 	u8 low;
3273fa9ffc74SKyeyoon Park 	u8 high;
3274fa9ffc74SKyeyoon Park };
3275fa9ffc74SKyeyoon Park 
3276fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3277fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3278fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3279fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3280fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3281fa9ffc74SKyeyoon Park 
3282fa9ffc74SKyeyoon Park /**
3283fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3284fa9ffc74SKyeyoon Park  *
3285fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3286fa9ffc74SKyeyoon Park  *
3287fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3288fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3289fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3290fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3291fa9ffc74SKyeyoon Park  */
3292fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3293fa9ffc74SKyeyoon Park 	u8 num_des;
3294fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3295fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3296fa9ffc74SKyeyoon Park };
3297fa9ffc74SKyeyoon Park 
3298fa9ffc74SKyeyoon Park /**
3299cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3300cb3b7d87SAyala Beker  *
3301cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3302cb3b7d87SAyala Beker  *
3303cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
33048585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
33058585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
33068585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3307cb3b7d87SAyala Beker  */
3308cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3309cb3b7d87SAyala Beker 	u8 master_pref;
33108585989dSLuca Coelho 	u8 bands;
3311cb3b7d87SAyala Beker };
3312cb3b7d87SAyala Beker 
3313cb3b7d87SAyala Beker /**
3314a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3315a5a9dcf2SAyala Beker  * configuration
3316a5a9dcf2SAyala Beker  *
3317a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
33188585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3319a5a9dcf2SAyala Beker  */
3320a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3321a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
33228585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3323a5a9dcf2SAyala Beker };
3324a5a9dcf2SAyala Beker 
3325a5a9dcf2SAyala Beker /**
3326a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3327a442b761SAyala Beker  *
3328a442b761SAyala Beker  * @filter: the content of the filter
3329a442b761SAyala Beker  * @len: the length of the filter
3330a442b761SAyala Beker  */
3331a442b761SAyala Beker struct cfg80211_nan_func_filter {
3332a442b761SAyala Beker 	const u8 *filter;
3333a442b761SAyala Beker 	u8 len;
3334a442b761SAyala Beker };
3335a442b761SAyala Beker 
3336a442b761SAyala Beker /**
3337a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3338a442b761SAyala Beker  *
3339a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3340a442b761SAyala Beker  * @service_id: the service ID of the function
3341a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3342a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3343a442b761SAyala Beker  *	implementation specific.
3344a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3345a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3346a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3347a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3348a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3349a442b761SAyala Beker  * @ttl: time to live counter in DW.
3350a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3351a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3352a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3353a442b761SAyala Beker  * @srf_bf: Bloom Filter
3354a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3355a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3356a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3357a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3358a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3359a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3360a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3361a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3362a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3363a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3364a442b761SAyala Beker  */
3365a442b761SAyala Beker struct cfg80211_nan_func {
3366a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3367a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3368a442b761SAyala Beker 	u8 publish_type;
3369a442b761SAyala Beker 	bool close_range;
3370a442b761SAyala Beker 	bool publish_bcast;
3371a442b761SAyala Beker 	bool subscribe_active;
3372a442b761SAyala Beker 	u8 followup_id;
3373a442b761SAyala Beker 	u8 followup_reqid;
3374a442b761SAyala Beker 	struct mac_address followup_dest;
3375a442b761SAyala Beker 	u32 ttl;
3376a442b761SAyala Beker 	const u8 *serv_spec_info;
3377a442b761SAyala Beker 	u8 serv_spec_info_len;
3378a442b761SAyala Beker 	bool srf_include;
3379a442b761SAyala Beker 	const u8 *srf_bf;
3380a442b761SAyala Beker 	u8 srf_bf_len;
3381a442b761SAyala Beker 	u8 srf_bf_idx;
3382a442b761SAyala Beker 	struct mac_address *srf_macs;
3383a442b761SAyala Beker 	int srf_num_macs;
3384a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3385a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3386a442b761SAyala Beker 	u8 num_tx_filters;
3387a442b761SAyala Beker 	u8 num_rx_filters;
3388a442b761SAyala Beker 	u8 instance_id;
3389a442b761SAyala Beker 	u64 cookie;
3390a442b761SAyala Beker };
3391a442b761SAyala Beker 
3392a442b761SAyala Beker /**
33933a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
33943a00df57SAvraham Stern  *
33953a00df57SAvraham Stern  * @aa: authenticator address
33963a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
33973a00df57SAvraham Stern  * @pmk: the PMK material
33983a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
33993a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
34003a00df57SAvraham Stern  *	holds PMK-R0.
34013a00df57SAvraham Stern  */
34023a00df57SAvraham Stern struct cfg80211_pmk_conf {
34033a00df57SAvraham Stern 	const u8 *aa;
34043a00df57SAvraham Stern 	u8 pmk_len;
34053a00df57SAvraham Stern 	const u8 *pmk;
34063a00df57SAvraham Stern 	const u8 *pmk_r0_name;
34073a00df57SAvraham Stern };
34083a00df57SAvraham Stern 
34093a00df57SAvraham Stern /**
341040cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
341140cbfa90SSrinivas Dasari  *
341240cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
341340cbfa90SSrinivas Dasari  *
341440cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
341540cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
341640cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
341740cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
341840cbfa90SSrinivas Dasari  *	authentication response command interface.
341940cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
342040cbfa90SSrinivas Dasari  *	authentication response command interface.
342140cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
342240cbfa90SSrinivas Dasari  *	authentication request event interface.
342340cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
342440cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
342540cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
342640cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3427fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
342840cbfa90SSrinivas Dasari  */
342940cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
343040cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
343140cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
343240cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
343340cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
343440cbfa90SSrinivas Dasari 	u16 status;
3435fe494370SSrinivas Dasari 	const u8 *pmkid;
343640cbfa90SSrinivas Dasari };
343740cbfa90SSrinivas Dasari 
343840cbfa90SSrinivas Dasari /**
34393453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
344081e54d08SPradeep Kumar Chitrapu  *
344181e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
344281e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
344381e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
344481e54d08SPradeep Kumar Chitrapu  *	answered
344581e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
344681e54d08SPradeep Kumar Chitrapu  *	successfully answered
344781e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
344881e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
344981e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
345081e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
345181e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
345281e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
345381e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
345481e54d08SPradeep Kumar Chitrapu  *	the responder
345581e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
345681e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
345781e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
345881e54d08SPradeep Kumar Chitrapu  */
345981e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
346081e54d08SPradeep Kumar Chitrapu 	u32 filled;
346181e54d08SPradeep Kumar Chitrapu 	u32 success_num;
346281e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
346381e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
346481e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
346581e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
346681e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
346781e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
346881e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
346981e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
347081e54d08SPradeep Kumar Chitrapu };
347181e54d08SPradeep Kumar Chitrapu 
347281e54d08SPradeep Kumar Chitrapu /**
34739bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
34749bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
34759bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
34769bb7e0f2SJohannes Berg  *	reason than just "failure"
34779bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
34789bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
34799bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
34809bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
34819bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
34829bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
34839bb7e0f2SJohannes Berg  *	by the responder
34849bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
34859bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
34869bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
34879bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
34889bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
34899bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
34909bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
34919bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
34929bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
34939bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
34949bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
34959bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
34969bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
34979bb7e0f2SJohannes Berg  *	the square root of the variance)
34989bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
34999bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
35009bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
35019bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
35029bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
35039bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
35049bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
35059bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
35069bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
35079bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
35089bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
35099bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
35109bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
35119bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
35129bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
35139bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
35149bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
35159bb7e0f2SJohannes Berg  */
35169bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
35179bb7e0f2SJohannes Berg 	const u8 *lci;
35189bb7e0f2SJohannes Berg 	const u8 *civicloc;
35199bb7e0f2SJohannes Berg 	unsigned int lci_len;
35209bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
35219bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
35229bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
35239bb7e0f2SJohannes Berg 	s16 burst_index;
35249bb7e0f2SJohannes Berg 	u8 busy_retry_time;
35259bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
35269bb7e0f2SJohannes Berg 	u8 burst_duration;
35279bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
35289bb7e0f2SJohannes Berg 	s32 rssi_avg;
35299bb7e0f2SJohannes Berg 	s32 rssi_spread;
35309bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
35319bb7e0f2SJohannes Berg 	s64 rtt_avg;
35329bb7e0f2SJohannes Berg 	s64 rtt_variance;
35339bb7e0f2SJohannes Berg 	s64 rtt_spread;
35349bb7e0f2SJohannes Berg 	s64 dist_avg;
35359bb7e0f2SJohannes Berg 	s64 dist_variance;
35369bb7e0f2SJohannes Berg 	s64 dist_spread;
35379bb7e0f2SJohannes Berg 
35389bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
35399bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
35409bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
35419bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
35429bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
35439bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
35449bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
35459bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
35469bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
35479bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
35489bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
35499bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
35509bb7e0f2SJohannes Berg };
35519bb7e0f2SJohannes Berg 
35529bb7e0f2SJohannes Berg /**
35539bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
35549bb7e0f2SJohannes Berg  * @addr: address of the peer
35559bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
35569bb7e0f2SJohannes Berg  *	measurement was made)
35579bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
35589bb7e0f2SJohannes Berg  * @status: status of the measurement
35599bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
35609bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
35619bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
35629bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
35639bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
35649bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
35659bb7e0f2SJohannes Berg  */
35669bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
35679bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
35689bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
35699bb7e0f2SJohannes Berg 
35709bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
35719bb7e0f2SJohannes Berg 
35729bb7e0f2SJohannes Berg 	u8 final:1,
35739bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
35749bb7e0f2SJohannes Berg 
35759bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
35769bb7e0f2SJohannes Berg 
35779bb7e0f2SJohannes Berg 	union {
35789bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
35799bb7e0f2SJohannes Berg 	};
35809bb7e0f2SJohannes Berg };
35819bb7e0f2SJohannes Berg 
35829bb7e0f2SJohannes Berg /**
35839bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
35849bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
35859bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
35869bb7e0f2SJohannes Berg  * @burst_period: burst period to use
35879bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
35889bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
35899bb7e0f2SJohannes Berg  * @burst_duration: burst duration
35909bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
35919bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
35929bb7e0f2SJohannes Berg  * @request_lci: request LCI information
35939bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
3594efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
3595efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3596efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
3597efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
3598efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3599efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
360073807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
360173807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
3602dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
3603dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
3604dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
36059bb7e0f2SJohannes Berg  *
36069bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
36079bb7e0f2SJohannes Berg  */
36089bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
36099bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
36109bb7e0f2SJohannes Berg 	u16 burst_period;
36119bb7e0f2SJohannes Berg 	u8 requested:1,
36129bb7e0f2SJohannes Berg 	   asap:1,
36139bb7e0f2SJohannes Berg 	   request_lci:1,
3614efb5520dSAvraham Stern 	   request_civicloc:1,
3615efb5520dSAvraham Stern 	   trigger_based:1,
361673807523SAvraham Stern 	   non_trigger_based:1,
361773807523SAvraham Stern 	   lmr_feedback:1;
36189bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
36199bb7e0f2SJohannes Berg 	u8 burst_duration;
36209bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
36219bb7e0f2SJohannes Berg 	u8 ftmr_retries;
3622dd3e4fc7SAvraham Stern 	u8 bss_color;
36239bb7e0f2SJohannes Berg };
36249bb7e0f2SJohannes Berg 
36259bb7e0f2SJohannes Berg /**
36269bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
36279bb7e0f2SJohannes Berg  * @addr: MAC address
36289bb7e0f2SJohannes Berg  * @chandef: channel to use
36299bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
36309bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
36319bb7e0f2SJohannes Berg  */
36329bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
36339bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
36349bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
36359bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
36369bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
36379bb7e0f2SJohannes Berg };
36389bb7e0f2SJohannes Berg 
36399bb7e0f2SJohannes Berg /**
36409bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
36419bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
36429bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
36439bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
36449bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
36459bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
36469bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
36479bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
36489bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
36499bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
36509bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
36519bb7e0f2SJohannes Berg  *	zero it means there's no timeout
36529bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
36539bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
36549bb7e0f2SJohannes Berg  */
36559bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
36569bb7e0f2SJohannes Berg 	u64 cookie;
36579bb7e0f2SJohannes Berg 	void *drv_data;
36589bb7e0f2SJohannes Berg 	u32 n_peers;
36599bb7e0f2SJohannes Berg 	u32 nl_portid;
36609bb7e0f2SJohannes Berg 
36619bb7e0f2SJohannes Berg 	u32 timeout;
36629bb7e0f2SJohannes Berg 
36639bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
36649bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
36659bb7e0f2SJohannes Berg 
36669bb7e0f2SJohannes Berg 	struct list_head list;
36679bb7e0f2SJohannes Berg 
36689bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
36699bb7e0f2SJohannes Berg };
36709bb7e0f2SJohannes Berg 
36719bb7e0f2SJohannes Berg /**
3672cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3673cb74e977SSunil Dutt  *
3674cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3675cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3676cb74e977SSunil Dutt  *
3677cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3678cb74e977SSunil Dutt  *
3679cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3680cb74e977SSunil Dutt  *	has to be done.
3681cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3682cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3683cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3684cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3685cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3686cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3687cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3688cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3689cb74e977SSunil Dutt  */
3690cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3691cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3692cb74e977SSunil Dutt 	u16 status;
3693cb74e977SSunil Dutt 	const u8 *ie;
3694cb74e977SSunil Dutt 	size_t ie_len;
3695cb74e977SSunil Dutt };
3696cb74e977SSunil Dutt 
3697cb74e977SSunil Dutt /**
36986cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
36996cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
37006cd536feSJohannes Berg  *	for the entire device
37016cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
37026cd536feSJohannes Berg  *	for the given interface
37039dba48a6SJohannes Berg  * @global_mcast_rx: mcast RX is needed globally for these subtypes
37049dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
37059dba48a6SJohannes Berg  *	for these subtypes
37066cd536feSJohannes Berg  */
37076cd536feSJohannes Berg struct mgmt_frame_regs {
37086cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
37099dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
37106cd536feSJohannes Berg };
37116cd536feSJohannes Berg 
37126cd536feSJohannes Berg /**
3713704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3714704232c2SJohannes Berg  *
3715704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3716704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3717704232c2SJohannes Berg  *
3718704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3719704232c2SJohannes Berg  * on success or a negative error code.
3720704232c2SJohannes Berg  *
3721a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
3722a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
3723a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
3724a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
372543fb45cbSJohannes Berg  *
3726ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3727ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3728ff1b6e69SJohannes Berg  *	configured for the device.
37290378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
37306d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
37316d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
37326d52563fSJohannes Berg  *	the device.
37330378b3f1SJohannes Berg  *
373460719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3735463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
373684efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
373798104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
373898104fdeSJohannes Berg  *	also set the address member in the wdev.
3739a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
3740704232c2SJohannes Berg  *
374184efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
3742a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
374355682965SJohannes Berg  *
374460719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
374560719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
3746a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
374755682965SJohannes Berg  *
374841ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
374941ade00fSJohannes Berg  *	when adding a group key.
375041ade00fSJohannes Berg  *
375141ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
375241ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
375341ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3754e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3755e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
375641ade00fSJohannes Berg  *
375741ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3758e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
375941ade00fSJohannes Berg  *
376041ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3761ed1b6cc7SJohannes Berg  *
37623cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
37631f7e9f46SJohannes Berg  *
376456be393fSJouni Malinen  * @set_default_beacon_key: set the default Beacon frame key on an interface
37653cfcf6acSJouni Malinen  *
3766e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3767e5497d76SJohannes Berg  *
3768c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3769c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3770c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3771c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
37725727ef1bSJohannes Berg  *
37735727ef1bSJohannes Berg  * @add_station: Add a new station.
377489c771e5SJouni Malinen  * @del_station: Remove a station
3775bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3776bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3777bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
377877ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
377977ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3780abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3781abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3782abe37c4bSJohannes Berg  *
3783abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3784abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3785abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3786abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3787abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
378866be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
378966be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3790f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
37918d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3792f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
37938d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
37942ec600d6SLuis Carlos Cobo  *
379524bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
379693da9cc1Scolin@cozybit.com  *
379724bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
379893da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
379993da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
380093da9cc1Scolin@cozybit.com  *
38019f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
380231888487SJouni Malinen  *
380331888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
380472bdcf34SJouni Malinen  *
3805e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3806e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3807e8c9bd5bSJohannes Berg  *	join the mesh instead.
3808e8c9bd5bSJohannes Berg  *
3809e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3810e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3811e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3812e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
38139aed3cc1SJouni Malinen  *
38142a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
38152a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
38162a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
38172a519311SJohannes Berg  *	the scan/scan_done bracket too.
381891d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
381991d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3820636a5d36SJouni Malinen  *
3821636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
38228d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3823636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
38248d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3825636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
38268d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3827636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
38288d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
382904a773adSJohannes Berg  *
3830b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3831bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3832bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3833bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3834bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3835bf1ecd21SJouni Malinen  *	was received.
3836bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3837bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3838bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3839bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3840bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3841bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3842bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
384335eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3844bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3845bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3846bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
384729ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3848088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3849088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3850088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3851088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3852088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3853088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3854088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3855088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
38560711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
38570711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
38580711d638SIlan Peer  *      case connection was already established (invoked with the
38590711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3860b23aa676SSamuel Ortiz  *
386104a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
386204a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
386304a773adSJohannes Berg  *	to a merge.
38648d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
386504a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
38668d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3867b9a5f8caSJouni Malinen  *
3868f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3869f4e583c8SAntonio Quartulli  *	MESH mode)
3870f4e583c8SAntonio Quartulli  *
3871b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3872b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3873b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3874b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
38757643a2c3SJohannes Berg  *
38761432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3877c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3878c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3879c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3880c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
38817643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
38821f87f7d3SJohannes Berg  *	return 0 if successful
38831f87f7d3SJohannes Berg  *
38841f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
38851f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3886aff89a9bSJohannes Berg  *
388761fa713cSHolger Schurig  * @dump_survey: get site survey information.
388861fa713cSHolger Schurig  *
38899588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
38909588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
38919588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
38929588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
38939588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
38949588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
38959588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
38969588bbd5SJouni Malinen  *	the duration value.
3897f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3898f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3899f7ca38dfSJohannes Berg  *	frame on another channel
39009588bbd5SJouni Malinen  *
3901fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
390271063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
390371063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
390471063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
390571063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
390671063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
390771063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
390867fbb16bSSamuel Ortiz  *
3909abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3910abe37c4bSJohannes Berg  *
391167fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
391267fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
391367fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
391467fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
391567fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
39169043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
39179043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3918d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3919e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3920e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3921e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3922e86abc68SJohannes Berg  *	disabled.)
39234a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
39244a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
39254a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
39264a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
39274a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
392884f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
392984f10708SThomas Pedersen  *	thresholds.
3930807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
39313a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
39323a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
39333a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
39343a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
39353a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
39363a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
393767fbb16bSSamuel Ortiz  *
39386cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
39396cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
3940547025d5SBruno Randolf  *
3941547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3942547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3943547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
3944547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3945547025d5SBruno Randolf  *
3946547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
39473677713bSJohn W. Linville  *
3948109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
3949109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
39507f6cf311SJohannes Berg  *
39517f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
39527f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
39531d9d9213SSimon Wunderlich  *
39541d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
3955d6199218SBen Greear  *
39565b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
39575b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
39585b7ccaf3SJohannes Berg  *	current monitoring channel.
395998104fdeSJohannes Berg  *
396098104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
396198104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
396277765eafSVasanthakumar Thiagarajan  *
396377765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
396477765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
396577765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
396677765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
396777765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
396877765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
396904f39047SSimon Wunderlich  *
397004f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
39718bf24293SJouni Malinen  *
397226ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
397326ec17a1SOrr Mazor  *	was finished on another phy.
397426ec17a1SOrr Mazor  *
39758bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
39768bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
39778bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
39785de17984SArend van Spriel  *
39795de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
39805de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
39815de17984SArend van Spriel  *	driver can take the most appropriate actions.
39825de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
39835de17984SArend van Spriel  *	reliability. This operation can not fail.
3984be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
398516ef1fe2SSimon Wunderlich  *
398697dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
398797dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
398897dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
398997dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
399097dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
399197dc94f1SMichal Kazior  *	as soon as possible.
3992fa9ffc74SKyeyoon Park  *
3993fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
3994e16821bcSJouni Malinen  *
3995e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3996e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3997e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
3998960d01acSJohannes Berg  *
3999960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4000960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4001960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4002960d01acSJohannes Berg  *	account.
4003960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4004960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4005960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4006960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4007960d01acSJohannes Berg  *	rejected)
4008960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
40096e0bd6c3SRostislav Lisovy  *
40106e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
40116e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
40126e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
40136e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
40141057d35eSArik Nemtsov  *
40151057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
40161057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
40171057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
40181057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
40191057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4020cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4021cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4022a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4023a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4024a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4025a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4026a442b761SAyala Beker  *	cfg80211_free_nan_func().
4027a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4028a442b761SAyala Beker  *	provided @nan_func.
4029a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4030a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4031a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4032a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4033ce0ce13aSMichael Braun  *
4034ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
40353a00df57SAvraham Stern  *
403652539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
403752539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
403852539ca8SToke Høiland-Jørgensen  *
40393a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
40403a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
40413a00df57SAvraham Stern  *	upon which the driver should clear it.
40423a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
40433a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
40443a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
404540cbfa90SSrinivas Dasari  *
404640cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
404740cbfa90SSrinivas Dasari  *     user space
40482576a9acSDenis Kenzior  *
40492576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
40502576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
405181e54d08SPradeep Kumar Chitrapu  *
405281e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
405381e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
40549bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
40559bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4056cb74e977SSunil Dutt  *
4057cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4058cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4059cb74e977SSunil Dutt  *	DH IE through this interface.
40605ab92e7fSRajkumar Manoharan  *
40615ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
40625ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
406377f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
406477f576deSTamizh chelvam  *	This callback may sleep.
40653710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
40663710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
406770b6ff35SJohannes Berg  *
406870b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
40690d2ab3aeSJohn Crispin  *
40700d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4071e306784aSSubrat Mishra  *
4072e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4073e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4074e306784aSSubrat Mishra  *	Response frame.
4075*bc2dfc02SLorenzo Bianconi  *
4076*bc2dfc02SLorenzo Bianconi  * @set_radar_offchan: Configure dedicated offchannel chain available for
4077*bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4078*bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4079*bc2dfc02SLorenzo Bianconi  *	Offchannel radar/CAC detection allows to avoid the CAC downtime
4080*bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4081*bc2dfc02SLorenzo Bianconi  *	radar channel.
4082*bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4083*bc2dfc02SLorenzo Bianconi  *	disable offchannel CAC/radar detection.
4084704232c2SJohannes Berg  */
4085704232c2SJohannes Berg struct cfg80211_ops {
4086ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
40870378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
40886d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
40890378b3f1SJohannes Berg 
409084efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4091552bff0cSJohannes Berg 						  const char *name,
40926bab2e19STom Gundersen 						  unsigned char name_assign_type,
4093f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
40942ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
409584efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
409684efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4097e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4098e36d56b6SJohannes Berg 				       struct net_device *dev,
4099818a986eSJohannes Berg 				       enum nl80211_iftype type,
41002ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
410141ade00fSJohannes Berg 
410241ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4103e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
410441ade00fSJohannes Berg 			   struct key_params *params);
410541ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4106e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
4107e31b8213SJohannes Berg 			   void *cookie,
410841ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
410941ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4110e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
411141ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
411241ade00fSJohannes Berg 				   struct net_device *netdev,
4113dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
41143cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
41153cfcf6acSJouni Malinen 					struct net_device *netdev,
41163cfcf6acSJouni Malinen 					u8 key_index);
411756be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
411856be393fSJouni Malinen 					  struct net_device *netdev,
411956be393fSJouni Malinen 					  u8 key_index);
4120ed1b6cc7SJohannes Berg 
41218860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
41228860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
41238860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
41248860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
41258860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
41265727ef1bSJohannes Berg 
41275727ef1bSJohannes Berg 
41285727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
41293b3a0162SJohannes Berg 			       const u8 *mac,
41303b3a0162SJohannes Berg 			       struct station_parameters *params);
41315727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
413289c771e5SJouni Malinen 			       struct station_del_parameters *params);
41335727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
41343b3a0162SJohannes Berg 				  const u8 *mac,
41353b3a0162SJohannes Berg 				  struct station_parameters *params);
4136fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
41373b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
41382ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
41392ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
41402ec600d6SLuis Carlos Cobo 
41412ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
41423b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
41432ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
41443b3a0162SJohannes Berg 			       const u8 *dst);
41452ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
41463b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
41472ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
41483b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
41492ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
41502ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
41512ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
415266be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
415366be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
415466be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
415566be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
415666be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
415724bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
415893da9cc1Scolin@cozybit.com 				struct net_device *dev,
415993da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
416024bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
416129cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
416229cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
416329cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
416429cbe68cSJohannes Berg 			     const struct mesh_config *conf,
416529cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
416629cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
416729cbe68cSJohannes Berg 
41686e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
41696e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
41706e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
41716e0bd6c3SRostislav Lisovy 
41729f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
41739f1ba906SJouni Malinen 			      struct bss_parameters *params);
417431888487SJouni Malinen 
4175f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
417631888487SJouni Malinen 				  struct ieee80211_txq_params *params);
417772bdcf34SJouni Malinen 
4178e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4179e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4180e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4181e8c9bd5bSJohannes Berg 
4182e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4183683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
41849aed3cc1SJouni Malinen 
4185fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
41862a519311SJohannes Berg 			struct cfg80211_scan_request *request);
418791d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4188636a5d36SJouni Malinen 
4189636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4190636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4191636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4192636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4193636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
419463c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4195636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
419663c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
419704a773adSJohannes Berg 
4198b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4199b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4200088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4201088e8df8Svamsi krishna 					 struct net_device *dev,
4202088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4203088e8df8Svamsi krishna 					 u32 changed);
4204b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4205b23aa676SSamuel Ortiz 			      u16 reason_code);
4206b23aa676SSamuel Ortiz 
420704a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
420804a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
420904a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4210b9a5f8caSJouni Malinen 
4211f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
421257fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4213f4e583c8SAntonio Quartulli 
4214b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
42157643a2c3SJohannes Berg 
4216c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4217fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4218c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4219c8442118SJohannes Berg 				int *dbm);
42201f87f7d3SJohannes Berg 
42211f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4222aff89a9bSJohannes Berg 
4223aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4224fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4225fc73f11fSDavid Spinadel 				void *data, int len);
422671063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
422771063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
422871063f0eSWey-Yi Guy 				 void *data, int len);
4229aff89a9bSJohannes Berg #endif
4230bc92afd9SJohannes Berg 
42319930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
42329930380fSJohannes Berg 				    struct net_device *dev,
42339930380fSJohannes Berg 				    const u8 *peer,
42349930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
42359930380fSJohannes Berg 
423661fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
423761fa713cSHolger Schurig 			int idx, struct survey_info *info);
423861fa713cSHolger Schurig 
423967fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
424067fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
424167fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
424267fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
424367fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
424467fbb16bSSamuel Ortiz 
42459588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
424671bbc994SJohannes Berg 				     struct wireless_dev *wdev,
42479588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
42489588bbd5SJouni Malinen 				     unsigned int duration,
42499588bbd5SJouni Malinen 				     u64 *cookie);
42509588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
425171bbc994SJohannes Berg 					    struct wireless_dev *wdev,
42529588bbd5SJouni Malinen 					    u64 cookie);
42539588bbd5SJouni Malinen 
425471bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4255b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4256b176e629SAndrei Otcheretianski 			   u64 *cookie);
4257f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
425871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4259f7ca38dfSJohannes Berg 				       u64 cookie);
4260026331c4SJouni Malinen 
4261bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4262bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4263d6dc1a38SJuuso Oikarinen 
4264d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4265d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4266d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4267271733cfSJohannes Berg 
42684a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
42694a4b8169SAndrew Zaborowski 					     struct net_device *dev,
42704a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
42714a4b8169SAndrew Zaborowski 
427284f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
427384f10708SThomas Pedersen 				      struct net_device *dev,
427484f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
427584f10708SThomas Pedersen 
42766cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
427771bbc994SJohannes Berg 						   struct wireless_dev *wdev,
42786cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4279afe0cbf8SBruno Randolf 
4280afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4281afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
42823677713bSJohn W. Linville 
4283807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4284807f8a8cSLuciano Coelho 				struct net_device *dev,
4285807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
42863a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
42873a3ecf1dSArend Van Spriel 				   u64 reqid);
4288e5497d76SJohannes Berg 
4289e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4290e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4291109086ceSArik Nemtsov 
4292109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
42933b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
4294df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
429531fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
4296109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
42973b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
42987f6cf311SJohannes Berg 
42997f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
43007f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4301e999882aSJohannes Berg 
43021d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
43031d9d9213SSimon Wunderlich 				  struct net_device *dev,
43041d9d9213SSimon Wunderlich 				  u16 noack_map);
43051d9d9213SSimon Wunderlich 
4306683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
43075b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
4308683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
430998104fdeSJohannes Berg 
431098104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
431198104fdeSJohannes Berg 				    struct wireless_dev *wdev);
431298104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
431398104fdeSJohannes Berg 				   struct wireless_dev *wdev);
431477765eafSVasanthakumar Thiagarajan 
431577765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
431677765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
431704f39047SSimon Wunderlich 
431804f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
431904f39047SSimon Wunderlich 					 struct net_device *dev,
432031559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
432131559f35SJanusz Dziedzic 					 u32 cac_time_ms);
432226ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
432326ec17a1SOrr Mazor 				struct net_device *dev);
4324355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4325355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
43265de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
43275de17984SArend van Spriel 				    struct wireless_dev *wdev,
43285de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
43295de17984SArend van Spriel 				    u16 duration);
43305de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
43315de17984SArend van Spriel 				   struct wireless_dev *wdev);
4332be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4333be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
433416ef1fe2SSimon Wunderlich 
433516ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
433616ef1fe2SSimon Wunderlich 				  struct net_device *dev,
433716ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4338e16821bcSJouni Malinen 
4339fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4340fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4341fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4342e16821bcSJouni Malinen 
4343e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4344e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4345960d01acSJohannes Berg 
4346960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4347960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4348960d01acSJohannes Berg 			     u16 admitted_time);
4349960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4350960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
43511057d35eSArik Nemtsov 
43521057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
43531057d35eSArik Nemtsov 				       struct net_device *dev,
43541057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
43551057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
43561057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
43571057d35eSArik Nemtsov 					      struct net_device *dev,
43581057d35eSArik Nemtsov 					      const u8 *addr);
4359cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4360cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4361cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4362a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4363a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4364a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4365a442b761SAyala Beker 			       u64 cookie);
4366a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4367a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4368a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4369a5a9dcf2SAyala Beker 				   u32 changes);
4370ce0ce13aSMichael Braun 
4371ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4372ce0ce13aSMichael Braun 					    struct net_device *dev,
4373ce0ce13aSMichael Braun 					    const bool enabled);
43743a00df57SAvraham Stern 
437552539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
437652539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
437752539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
437852539ca8SToke Høiland-Jørgensen 
43793a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
43803a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
43813a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
43823a00df57SAvraham Stern 			   const u8 *aa);
438340cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
438440cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
43852576a9acSDenis Kenzior 
43862576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
43872576a9acSDenis Kenzior 				   struct net_device *dev,
43882576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
43898d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
4390dca9ca2dSMarkus Theil 				   const bool noencrypt,
4391dca9ca2dSMarkus Theil 				   u64 *cookie);
439281e54d08SPradeep Kumar Chitrapu 
439381e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
439481e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
439581e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
43969bb7e0f2SJohannes Berg 
43979bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
43989bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
43999bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
44009bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4401cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4402cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
44035ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
44045ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
440577f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
44063710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
440777f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
44083710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
44096bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
44106bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
44110d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
44120d2ab3aeSJohn Crispin 				struct net_device *dev,
44130d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4414e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4415e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4416*bc2dfc02SLorenzo Bianconi 	int	(*set_radar_offchan)(struct wiphy *wiphy,
4417*bc2dfc02SLorenzo Bianconi 				     struct cfg80211_chan_def *chandef);
4418704232c2SJohannes Berg };
4419704232c2SJohannes Berg 
4420d3236553SJohannes Berg /*
4421d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4422d3236553SJohannes Berg  * and registration/helper functions
4423d3236553SJohannes Berg  */
4424d3236553SJohannes Berg 
4425d3236553SJohannes Berg /**
44265be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
44275be83de5SJohannes Berg  *
4428c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4429c8cb5b85STova Mussai  *	 into two, first for legacy bands and second for UHB.
44305be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
44315be83de5SJohannes Berg  *	wiphy at all
44325be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
44335be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
44345be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
44355be83de5SJohannes Berg  *	reason to override the default
44369bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
443733d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
443833d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
44399bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4440c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4441c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4442c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4443e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
444415d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
444515d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4446f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4447f4b34b55SVivek Natarajan  *	firmware.
4448cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4449109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4450109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4451109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4452109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4453109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4454109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4455562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
44565e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
44575e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
44585e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
445987bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
446087bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
44617c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
44627c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
44632f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
446416ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
446516ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4466b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4467b8676221SDavid Spinadel  *	before connection.
4468093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
44695be83de5SJohannes Berg  */
44705be83de5SJohannes Berg enum wiphy_flags {
4471093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
4472a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
4473c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
44745be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
44755be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
44769bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
44779bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4478c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4479309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
448015d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4481ca986ad9SArend Van Spriel 	/* use hole at 11 */
44828e8b41f9SJohannes Berg 	/* use hole at 12 */
4483f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4484cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4485109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4486109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4487562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
44885e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
448987bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
44907c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
44917c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
44922f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
449316ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4494b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
44957527a782SJohannes Berg };
44967527a782SJohannes Berg 
44977527a782SJohannes Berg /**
44987527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
44997527a782SJohannes Berg  * @max: maximum number of interfaces of these types
45007527a782SJohannes Berg  * @types: interface types (bits)
45017527a782SJohannes Berg  */
45027527a782SJohannes Berg struct ieee80211_iface_limit {
45037527a782SJohannes Berg 	u16 max;
45047527a782SJohannes Berg 	u16 types;
45057527a782SJohannes Berg };
45067527a782SJohannes Berg 
45077527a782SJohannes Berg /**
45087527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
45097527a782SJohannes Berg  *
4510b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4511b80edbc1SLuciano Coelho  * combinations it supports concurrently.
45127527a782SJohannes Berg  *
4513b80edbc1SLuciano Coelho  * Examples:
4514b80edbc1SLuciano Coelho  *
4515b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
45167527a782SJohannes Berg  *
4517819bf593SJohannes Berg  *    .. code-block:: c
4518819bf593SJohannes Berg  *
45197527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
45207527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
45217527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
45227527a782SJohannes Berg  *	};
45237527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
45247527a782SJohannes Berg  *		.limits = limits1,
45257527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
45267527a782SJohannes Berg  *		.max_interfaces = 2,
45277527a782SJohannes Berg  *		.beacon_int_infra_match = true,
45287527a782SJohannes Berg  *	};
45297527a782SJohannes Berg  *
45307527a782SJohannes Berg  *
4531b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
45327527a782SJohannes Berg  *
4533819bf593SJohannes Berg  *    .. code-block:: c
4534819bf593SJohannes Berg  *
45357527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
45367527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
45377527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
45387527a782SJohannes Berg  *	};
45397527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
45407527a782SJohannes Berg  *		.limits = limits2,
45417527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
45427527a782SJohannes Berg  *		.max_interfaces = 8,
45437527a782SJohannes Berg  *		.num_different_channels = 1,
45447527a782SJohannes Berg  *	};
45457527a782SJohannes Berg  *
45467527a782SJohannes Berg  *
4547b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4548b80edbc1SLuciano Coelho  *
45497527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
45507527a782SJohannes Berg  *
4551819bf593SJohannes Berg  *    .. code-block:: c
4552819bf593SJohannes Berg  *
45537527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
45547527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
45557527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
45567527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
45577527a782SJohannes Berg  *	};
45587527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
45597527a782SJohannes Berg  *		.limits = limits3,
45607527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
45617527a782SJohannes Berg  *		.max_interfaces = 4,
45627527a782SJohannes Berg  *		.num_different_channels = 2,
45637527a782SJohannes Berg  *	};
4564819bf593SJohannes Berg  *
45657527a782SJohannes Berg  */
45667527a782SJohannes Berg struct ieee80211_iface_combination {
4567c6c94aeaSJohannes Berg 	/**
4568c6c94aeaSJohannes Berg 	 * @limits:
4569c6c94aeaSJohannes Berg 	 * limits for the given interface types
4570c6c94aeaSJohannes Berg 	 */
45717527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4572c6c94aeaSJohannes Berg 
4573c6c94aeaSJohannes Berg 	/**
4574c6c94aeaSJohannes Berg 	 * @num_different_channels:
4575c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4576c6c94aeaSJohannes Berg 	 */
45777527a782SJohannes Berg 	u32 num_different_channels;
4578c6c94aeaSJohannes Berg 
4579c6c94aeaSJohannes Berg 	/**
4580c6c94aeaSJohannes Berg 	 * @max_interfaces:
4581c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4582c6c94aeaSJohannes Berg 	 */
45837527a782SJohannes Berg 	u16 max_interfaces;
4584c6c94aeaSJohannes Berg 
4585c6c94aeaSJohannes Berg 	/**
4586c6c94aeaSJohannes Berg 	 * @n_limits:
4587c6c94aeaSJohannes Berg 	 * number of limitations
4588c6c94aeaSJohannes Berg 	 */
45897527a782SJohannes Berg 	u8 n_limits;
4590c6c94aeaSJohannes Berg 
4591c6c94aeaSJohannes Berg 	/**
4592c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4593c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4594c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4595c6c94aeaSJohannes Berg 	 */
45967527a782SJohannes Berg 	bool beacon_int_infra_match;
4597c6c94aeaSJohannes Berg 
4598c6c94aeaSJohannes Berg 	/**
4599c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4600c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4601c6c94aeaSJohannes Berg 	 */
460211c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4603c6c94aeaSJohannes Berg 
4604c6c94aeaSJohannes Berg 	/**
4605c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4606c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4607c6c94aeaSJohannes Berg 	 */
46088c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4609c6c94aeaSJohannes Berg 
4610c6c94aeaSJohannes Berg 	/**
4611c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4612c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4613c6c94aeaSJohannes Berg 	 *
4614c6c94aeaSJohannes Berg 	 * = 0
4615c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4616c6c94aeaSJohannes Berg 	 * > 0
4617c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4618c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4619c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4620c6c94aeaSJohannes Berg 	 */
46210c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
46225be83de5SJohannes Berg };
46235be83de5SJohannes Berg 
46242e161f78SJohannes Berg struct ieee80211_txrx_stypes {
46252e161f78SJohannes Berg 	u16 tx, rx;
46262e161f78SJohannes Berg };
46272e161f78SJohannes Berg 
46285be83de5SJohannes Berg /**
4629ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4630ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4631ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4632ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4633ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4634ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4635ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4636ff1b6e69SJohannes Berg  *	(see nl80211.h)
4637ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
463877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
463977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
464077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
464177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
464277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
46438cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4644ff1b6e69SJohannes Berg  */
4645ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4646ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4647ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4648ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
464977dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
465077dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
465177dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
465277dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
465377dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
46548cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4655ff1b6e69SJohannes Berg };
4656ff1b6e69SJohannes Berg 
46572a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
46582a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
46592a0e047eSJohannes Berg 	u32 data_payload_max;
46602a0e047eSJohannes Berg 	u32 data_interval_max;
46612a0e047eSJohannes Berg 	u32 wake_payload_max;
46622a0e047eSJohannes Berg 	bool seq;
46632a0e047eSJohannes Berg };
46642a0e047eSJohannes Berg 
4665ff1b6e69SJohannes Berg /**
4666ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4667ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4668ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4669ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4670ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4671ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4672bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
46738cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
46748cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
46758cd4d456SLuciano Coelho  *	scheduled scans.
46768cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
46778cd4d456SLuciano Coelho  *	details.
46782a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4679ff1b6e69SJohannes Berg  */
4680ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4681ff1b6e69SJohannes Berg 	u32 flags;
4682ff1b6e69SJohannes Berg 	int n_patterns;
4683ff1b6e69SJohannes Berg 	int pattern_max_len;
4684ff1b6e69SJohannes Berg 	int pattern_min_len;
4685bb92d199SAmitkumar Karwar 	int max_pkt_offset;
46868cd4d456SLuciano Coelho 	int max_nd_match_sets;
46872a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4688ff1b6e69SJohannes Berg };
4689ff1b6e69SJohannes Berg 
4690ff1b6e69SJohannes Berg /**
4691be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4692be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4693be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4694be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4695be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4696be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4697be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4698be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4699be29b99aSAmitkumar Karwar  */
4700be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4701be29b99aSAmitkumar Karwar 	int n_rules;
4702be29b99aSAmitkumar Karwar 	int max_delay;
4703be29b99aSAmitkumar Karwar 	int n_patterns;
4704be29b99aSAmitkumar Karwar 	int pattern_max_len;
4705be29b99aSAmitkumar Karwar 	int pattern_min_len;
4706be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4707be29b99aSAmitkumar Karwar };
4708be29b99aSAmitkumar Karwar 
4709be29b99aSAmitkumar Karwar /**
4710ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4711ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4712ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4713ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4714ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4715ad7e718cSJohannes Berg  */
4716ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4717ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4718ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4719ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4720ad7e718cSJohannes Berg };
4721ad7e718cSJohannes Berg 
4722ad7e718cSJohannes Berg /**
4723466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4724466b9936Stamizhr@codeaurora.org  *
4725466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4726466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4727466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4728466b9936Stamizhr@codeaurora.org  *
4729466b9936Stamizhr@codeaurora.org  */
4730466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4731466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4732466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4733466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4734466b9936Stamizhr@codeaurora.org };
4735466b9936Stamizhr@codeaurora.org 
4736466b9936Stamizhr@codeaurora.org /**
4737466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4738466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
47395e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
47405e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4741466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4742466b9936Stamizhr@codeaurora.org  */
4743466b9936Stamizhr@codeaurora.org 
4744466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4745466b9936Stamizhr@codeaurora.org 	u32 changed;
47465e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
47475e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4748466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4749466b9936Stamizhr@codeaurora.org };
4750466b9936Stamizhr@codeaurora.org 
475191046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4752901bb989SJohannes Berg 
4753466b9936Stamizhr@codeaurora.org /**
4754ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4755ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4756ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4757ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4758ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4759ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
47607bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
47617bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
47627bdbe400SJohannes Berg  *	dumpit calls.
4763901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4764901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4765901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4766901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
47677bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
47687bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
47697bdbe400SJohannes Berg  * are used with dump requests.
4770ad7e718cSJohannes Berg  */
4771ad7e718cSJohannes Berg struct wiphy_vendor_command {
4772ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4773ad7e718cSJohannes Berg 	u32 flags;
4774ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4775ad7e718cSJohannes Berg 		    const void *data, int data_len);
47767bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
47777bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
47787bdbe400SJohannes Berg 		      unsigned long *storage);
4779901bb989SJohannes Berg 	const struct nla_policy *policy;
4780901bb989SJohannes Berg 	unsigned int maxattr;
4781ad7e718cSJohannes Berg };
4782ad7e718cSJohannes Berg 
4783ad7e718cSJohannes Berg /**
4784019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4785019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4786019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4787019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4788019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4789019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4790019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4791019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4792019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4793019ae3a9SKanchanapally, Vidyullatha  */
4794019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4795019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4796019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4797019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4798019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4799019ae3a9SKanchanapally, Vidyullatha };
4800019ae3a9SKanchanapally, Vidyullatha 
4801019ae3a9SKanchanapally, Vidyullatha /**
48029bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
48039bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
48049bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
48059bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
48069bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
48079bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
48089bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
48099bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
48109bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
48119bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
48129bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
48139bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
48149bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
48159bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
48169bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
48179bb7e0f2SJohannes Berg  *	not limited)
4818efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
4819efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
48209bb7e0f2SJohannes Berg  */
48219bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
48229bb7e0f2SJohannes Berg 	unsigned int max_peers;
48239bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
48249bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
48259bb7e0f2SJohannes Berg 
48269bb7e0f2SJohannes Berg 	struct {
48279bb7e0f2SJohannes Berg 		u32 preambles;
48289bb7e0f2SJohannes Berg 		u32 bandwidths;
48299bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
48309bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
48319bb7e0f2SJohannes Berg 		u8 supported:1,
48329bb7e0f2SJohannes Berg 		   asap:1,
48339bb7e0f2SJohannes Berg 		   non_asap:1,
48349bb7e0f2SJohannes Berg 		   request_lci:1,
4835efb5520dSAvraham Stern 		   request_civicloc:1,
4836efb5520dSAvraham Stern 		   trigger_based:1,
4837efb5520dSAvraham Stern 		   non_trigger_based:1;
48389bb7e0f2SJohannes Berg 	} ftm;
48399bb7e0f2SJohannes Berg };
48409bb7e0f2SJohannes Berg 
48419bb7e0f2SJohannes Berg /**
4842d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4843d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
4844d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4845d6039a34SVeerendranath Jakkam  *
4846d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
4847d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
4848d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4849d6039a34SVeerendranath Jakkam  */
4850d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
4851d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
4852d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
4853d6039a34SVeerendranath Jakkam 	int n_akm_suites;
4854d6039a34SVeerendranath Jakkam };
4855d6039a34SVeerendranath Jakkam 
4856d6039a34SVeerendranath Jakkam /**
48575be83de5SJohannes Berg  * struct wiphy - wireless hardware description
4858a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
48592784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
48602784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
48612784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4862d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4863d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
4864d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4865d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4866d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4867d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4868d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4869d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
4870d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
4871d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
4872ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4873d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
4874d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
4875d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
4876d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
4877d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
4878d6039a34SVeerendranath Jakkam  *	suites are specified separately.
4879b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4880b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4881b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4882b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4883b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4884abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4885ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4886ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4887ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
48880fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4889ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4890ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4891ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4892ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4893ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4894ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4895ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4896ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4897fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4898fd235913SRandy Dunlap  *	unregister hardware
4899edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4900edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
490115bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
490215bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
490315bc6dfbSJérôme Pouiller  *	(see below).
4904abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4905abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4906abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4907abe37c4bSJohannes Berg  *	must be set by driver
49087527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
49097527a782SJohannes Berg  *	list single interface types.
49107527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
49117527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
49127527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4913abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4914a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4915a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
49161f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4917d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4918d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4919abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4920abe37c4bSJohannes Berg  *	this variable determines its size
4921abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4922abe37c4bSJohannes Berg  *	any given scan
4923ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4924ca986ad9SArend Van Spriel  *	the device can run concurrently.
492593b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
492693b6aa69SLuciano Coelho  *	for in any given scheduled scan
4927a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
4928a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
4929a1f1c21cSLuciano Coelho  *	supported.
4930abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
4931abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
4932abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
49335a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
49345a865badSLuciano Coelho  *	scans
49353b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
49363b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
49373b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
49383b06d277SAvraham Stern  *	single scan plan supported by the device.
49393b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
49403b06d277SAvraham Stern  *	scan plan supported by the device.
4941abe37c4bSJohannes Berg  * @coverage_class: current coverage class
4942abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
4943abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
4944abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
4945abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
4946abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
4947abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
49482e161f78SJohannes Berg  *
49492e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
49502e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
49512e161f78SJohannes Berg  *	type
4952a7ffac95SBruno Randolf  *
49537f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
49547f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
49557f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
49567f531e03SBruno Randolf  *
49577f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
49587f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
49597f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
4960a293911dSJohannes Berg  *
496115f0ebc2SRandy Dunlap  * @probe_resp_offload:
496215f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
496315f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
496415f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
496515f0ebc2SRandy Dunlap  *
4966a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4967a293911dSJohannes Berg  *	may request, if implemented.
4968ff1b6e69SJohannes Berg  *
4969ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
49706abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
49716abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
49726abb9cb9SJohannes Berg  *	to the suspend() operation instead.
4973562a7480SJohannes Berg  *
4974562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
49757e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
49767e7c8926SBen Greear  *	If null, then none can be over-ridden.
4977ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
4978ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
497977765eafSVasanthakumar Thiagarajan  *
498053873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
498153873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
498253873f13SJohannes Berg  *
498377765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
498477765eafSVasanthakumar Thiagarajan  *	supports for ACL.
4985a50df0c4SJohannes Berg  *
4986a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
4987a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
4988a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
4989a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
4990019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
4991019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
4992019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
4993a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
4994a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
4995019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
4996019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
4997019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
4998be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
4999ad7e718cSJohannes Berg  *
5000ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5001ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5002567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5003567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5004b43504cfSJouni Malinen  *
5005b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5006b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5007b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5008b43504cfSJouni Malinen  *	some cases, but may not always reach.
5009c2e4323bSLuciano Coelho  *
5010c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5011c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5012c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5013c2e4323bSLuciano Coelho  *	infinite.
501438de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
501538de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
501638de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5017a442b761SAyala Beker  *
50188585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
50198585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
50208585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
50218585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5022f3a7ca64SJohannes Berg  *
5023f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5024f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5025f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
50269bb7e0f2SJohannes Berg  *
5027a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5028a710d214SLothar Rubusch  *	wake_tx_queue
5029a710d214SLothar Rubusch  *
5030213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5031213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5032213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5033213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5034213ed579SSara Sharon  *
50359bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
50363710a8a6SJohannes Berg  *
50373710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
50383710a8a6SJohannes Berg  *	device has
50393710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
50403710a8a6SJohannes Berg  *	supported by the driver for each vif
50413710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
50423710a8a6SJohannes Berg  *	supported by the driver for each peer
50436a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
50446a21d16cSTamizh chelvam  *	long/short retry configuration
5045a710d214SLothar Rubusch  *
5046a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5047a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5048a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
504970b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5050358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5051dc1e3cb8SJohn Crispin  *
5052dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5053dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5054dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5055f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5056dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5057dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5058d3236553SJohannes Berg  */
5059d3236553SJohannes Berg struct wiphy {
5060a05829a7SJohannes Berg 	struct mutex mtx;
5061a05829a7SJohannes Berg 
5062d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5063d3236553SJohannes Berg 
5064d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5065ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5066ef15aac6SJohannes Berg 
5067ef15aac6SJohannes Berg 	struct mac_address *addresses;
5068d3236553SJohannes Berg 
50692e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
50702e161f78SJohannes Berg 
50717527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
50727527a782SJohannes Berg 	int n_iface_combinations;
50737527a782SJohannes Berg 	u16 software_iftypes;
50747527a782SJohannes Berg 
50752e161f78SJohannes Berg 	u16 n_addresses;
50762e161f78SJohannes Berg 
5077d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5078d3236553SJohannes Berg 	u16 interface_modes;
5079d3236553SJohannes Berg 
508077765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
508177765eafSVasanthakumar Thiagarajan 
5082a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5083d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5084463d0183SJohannes Berg 
5085562a7480SJohannes Berg 	u32 ap_sme_capa;
5086562a7480SJohannes Berg 
5087d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5088d3236553SJohannes Berg 
5089d3236553SJohannes Berg 	int bss_priv_size;
5090d3236553SJohannes Berg 	u8 max_scan_ssids;
5091ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
509293b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5093a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5094d3236553SJohannes Berg 	u16 max_scan_ie_len;
50955a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
50963b06d277SAvraham Stern 	u32 max_sched_scan_plans;
50973b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
50983b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5099d3236553SJohannes Berg 
5100d3236553SJohannes Berg 	int n_cipher_suites;
5101d3236553SJohannes Berg 	const u32 *cipher_suites;
5102d3236553SJohannes Berg 
5103ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5104ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5105ab4dfa20SVeerendranath Jakkam 
5106d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5107d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5108d6039a34SVeerendranath Jakkam 
5109b9a5f8caSJouni Malinen 	u8 retry_short;
5110b9a5f8caSJouni Malinen 	u8 retry_long;
5111b9a5f8caSJouni Malinen 	u32 frag_threshold;
5112b9a5f8caSJouni Malinen 	u32 rts_threshold;
511381077e82SLukáš Turek 	u8 coverage_class;
5114b9a5f8caSJouni Malinen 
511581135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5116dfce95f5SKalle Valo 	u32 hw_version;
5117dfce95f5SKalle Valo 
5118dfb89c56SJohannes Berg #ifdef CONFIG_PM
5119964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
51206abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5121dfb89c56SJohannes Berg #endif
5122ff1b6e69SJohannes Berg 
5123a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5124a293911dSJohannes Berg 
512567fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
512667fbb16bSSamuel Ortiz 
51277f531e03SBruno Randolf 	u32 available_antennas_tx;
51287f531e03SBruno Randolf 	u32 available_antennas_rx;
5129a7ffac95SBruno Randolf 
513087bbbe22SArik Nemtsov 	u32 probe_resp_offload;
513187bbbe22SArik Nemtsov 
5132a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5133a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5134a50df0c4SJohannes Berg 
5135019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5136019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5137019ae3a9SKanchanapally, Vidyullatha 
5138cf5aa2f1SDavid Kilroy 	const void *privid;
5139d3236553SJohannes Berg 
514057fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5141d3236553SJohannes Berg 
51420c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5143d3236553SJohannes Berg 			     struct regulatory_request *request);
5144d3236553SJohannes Berg 
5145d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5146d3236553SJohannes Berg 
5147458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5148d3236553SJohannes Berg 
5149d3236553SJohannes Berg 	struct device dev;
5150d3236553SJohannes Berg 
5151ecb44335SStanislaw Gruszka 	bool registered;
5152ecb44335SStanislaw Gruszka 
5153d3236553SJohannes Berg 	struct dentry *debugfsdir;
5154d3236553SJohannes Berg 
51557e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5156ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
51577e7c8926SBen Greear 
515853873f13SJohannes Berg 	struct list_head wdev_list;
515953873f13SJohannes Berg 
51600c5c9fb5SEric W. Biederman 	possible_net_t _net;
5161463d0183SJohannes Berg 
51623d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
51633d23e349SJohannes Berg 	const struct iw_handler_def *wext;
51643d23e349SJohannes Berg #endif
51653d23e349SJohannes Berg 
5166be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5167be29b99aSAmitkumar Karwar 
5168ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5169567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5170567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5171ad7e718cSJohannes Berg 
5172b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5173b43504cfSJouni Malinen 
51749a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
51759a774c78SAndrei Otcheretianski 
517638de03d2SArend van Spriel 	u32 bss_select_support;
517738de03d2SArend van Spriel 
51788585989dSLuca Coelho 	u8 nan_supported_bands;
51798585989dSLuca Coelho 
518052539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
518152539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
518252539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
518352539ca8SToke Høiland-Jørgensen 
51841f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
51851f6e0baaSJohn Crispin 
5186213ed579SSara Sharon 	u8 support_mbssid:1,
5187213ed579SSara Sharon 	   support_only_he_mbssid:1;
5188213ed579SSara Sharon 
51899bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
51909bb7e0f2SJohannes Berg 
51913710a8a6SJohannes Berg 	struct {
51923710a8a6SJohannes Berg 		u64 peer, vif;
51936a21d16cSTamizh chelvam 		u8 max_retry;
51943710a8a6SJohannes Berg 	} tid_config_support;
51953710a8a6SJohannes Berg 
51966a21d16cSTamizh chelvam 	u8 max_data_retry_count;
51976a21d16cSTamizh chelvam 
51986bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
51996bdb68ceSCarl Huang 
5200358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5201358ae888SEmmanuel Grumbach 
5202dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5203dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5204dc1e3cb8SJohn Crispin 
5205396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5206d3236553SJohannes Berg };
5207d3236553SJohannes Berg 
5208463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5209463d0183SJohannes Berg {
5210c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5211463d0183SJohannes Berg }
5212463d0183SJohannes Berg 
5213463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5214463d0183SJohannes Berg {
5215c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5216463d0183SJohannes Berg }
5217463d0183SJohannes Berg 
5218d3236553SJohannes Berg /**
5219d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5220d3236553SJohannes Berg  *
5221d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
52220ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5223d3236553SJohannes Berg  */
5224d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5225d3236553SJohannes Berg {
5226d3236553SJohannes Berg 	BUG_ON(!wiphy);
5227d3236553SJohannes Berg 	return &wiphy->priv;
5228d3236553SJohannes Berg }
5229d3236553SJohannes Berg 
5230d3236553SJohannes Berg /**
5231f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5232f1f74825SDavid Kilroy  *
5233f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
52340ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5235f1f74825SDavid Kilroy  */
5236f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5237f1f74825SDavid Kilroy {
5238f1f74825SDavid Kilroy 	BUG_ON(!priv);
5239f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5240f1f74825SDavid Kilroy }
5241f1f74825SDavid Kilroy 
5242f1f74825SDavid Kilroy /**
5243d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5244d3236553SJohannes Berg  *
5245d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5246d3236553SJohannes Berg  * @dev: The device to parent it to
5247d3236553SJohannes Berg  */
5248d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5249d3236553SJohannes Berg {
5250d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5251d3236553SJohannes Berg }
5252d3236553SJohannes Berg 
5253d3236553SJohannes Berg /**
5254d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5255d3236553SJohannes Berg  *
5256d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
52570ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5258d3236553SJohannes Berg  */
5259d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5260d3236553SJohannes Berg {
5261d3236553SJohannes Berg 	return wiphy->dev.parent;
5262d3236553SJohannes Berg }
5263d3236553SJohannes Berg 
5264d3236553SJohannes Berg /**
5265d3236553SJohannes Berg  * wiphy_name - get wiphy name
5266d3236553SJohannes Berg  *
5267d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
52680ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5269d3236553SJohannes Berg  */
5270e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5271d3236553SJohannes Berg {
5272d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5273d3236553SJohannes Berg }
5274d3236553SJohannes Berg 
5275d3236553SJohannes Berg /**
52761998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
52771998d90aSBen Greear  *
52781998d90aSBen Greear  * @ops: The configuration operations for this device
52791998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
52801998d90aSBen Greear  * @requested_name: Request a particular name.
52811998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
52821998d90aSBen Greear  *
52831998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
52841998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
52851998d90aSBen Greear  *
52861998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
52871998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
52881998d90aSBen Greear  */
52891998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
52901998d90aSBen Greear 			   const char *requested_name);
52911998d90aSBen Greear 
52921998d90aSBen Greear /**
5293d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5294d3236553SJohannes Berg  *
5295d3236553SJohannes Berg  * @ops: The configuration operations for this device
5296d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5297d3236553SJohannes Berg  *
5298d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5299d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5300d3236553SJohannes Berg  *
53010ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
53020ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5303d3236553SJohannes Berg  */
53041998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
53051998d90aSBen Greear 				      int sizeof_priv)
53061998d90aSBen Greear {
53071998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
53081998d90aSBen Greear }
5309d3236553SJohannes Berg 
5310d3236553SJohannes Berg /**
5311d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5312d3236553SJohannes Berg  *
5313d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5314d3236553SJohannes Berg  *
53150ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5316d3236553SJohannes Berg  */
531710dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5318d3236553SJohannes Berg 
5319a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5320a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5321a05829a7SJohannes Berg 
5322a05829a7SJohannes Berg /**
5323a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5324a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5325a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5326a05829a7SJohannes Berg  *
5327a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5328a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5329a05829a7SJohannes Berg  */
5330a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5331a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5332a05829a7SJohannes Berg 
5333a05829a7SJohannes Berg /**
5334a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5335a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5336a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5337a05829a7SJohannes Berg  *
5338a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5339a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5340a05829a7SJohannes Berg  */
5341a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5342a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5343a05829a7SJohannes Berg 
5344a05829a7SJohannes Berg /**
5345a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5346a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
5347a05829a7SJohannes Berg  */
5348a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5349a05829a7SJohannes Berg 
5350d3236553SJohannes Berg /**
5351d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5352d3236553SJohannes Berg  *
5353d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5354d3236553SJohannes Berg  *
5355d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5356d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5357d3236553SJohannes Berg  * request that is being handled.
5358d3236553SJohannes Berg  */
535910dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5360d3236553SJohannes Berg 
5361d3236553SJohannes Berg /**
5362d3236553SJohannes Berg  * wiphy_free - free wiphy
5363d3236553SJohannes Berg  *
5364d3236553SJohannes Berg  * @wiphy: The wiphy to free
5365d3236553SJohannes Berg  */
536610dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5367d3236553SJohannes Berg 
5368fffd0934SJohannes Berg /* internal structs */
53696829c878SJohannes Berg struct cfg80211_conn;
537019957bb3SJohannes Berg struct cfg80211_internal_bss;
5371fffd0934SJohannes Berg struct cfg80211_cached_keys;
53724a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
537319957bb3SJohannes Berg 
5374d3236553SJohannes Berg /**
5375a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5376a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5377a05829a7SJohannes Berg  *
5378a05829a7SJohannes Berg  * This is mostly exposed so it can be done around registering and
5379a05829a7SJohannes Berg  * unregistering netdevs that aren't created through cfg80211 calls,
5380a05829a7SJohannes Berg  * since that requires locking in cfg80211 when the notifiers is
5381a05829a7SJohannes Berg  * called, but that cannot differentiate which way it's called.
5382a05829a7SJohannes Berg  *
5383a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
5384a05829a7SJohannes Berg  */
5385a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
5386a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
5387a05829a7SJohannes Berg {
5388a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
5389a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
5390a05829a7SJohannes Berg }
5391a05829a7SJohannes Berg 
5392a05829a7SJohannes Berg /**
5393a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
5394a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
5395a05829a7SJohannes Berg  */
5396a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
5397a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
5398a05829a7SJohannes Berg {
5399a05829a7SJohannes Berg 	__release(&wiphy->mtx);
5400a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
5401a05829a7SJohannes Berg }
5402a05829a7SJohannes Berg 
5403a05829a7SJohannes Berg /**
540489a54e48SJohannes Berg  * struct wireless_dev - wireless device state
5405d3236553SJohannes Berg  *
540689a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
540789a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
540889a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
540989a54e48SJohannes Berg  * It need not be registered then as netdev registration will
5410a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
5411a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
5412a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
5413a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
541489a54e48SJohannes Berg  *
541589a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
541689a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
541789a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
541889a54e48SJohannes Berg  * allocated outside of callback operations that return it.
5419d3236553SJohannes Berg  *
5420d3236553SJohannes Berg  * @wiphy: pointer to hardware description
5421d3236553SJohannes Berg  * @iftype: interface type
54222fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
542340c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
542440c575d1SJohannes Berg  *	for the notifier
5425d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
542689a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
542789a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
542889a54e48SJohannes Berg  *	wireless device if it has no netdev
5429d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
54309e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
54319e0e2961SMichal Kazior  *	the user-set channel definition.
5432780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
5433aa430da4SJohannes Berg  *	track the channel to be used for AP later
5434d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
5435d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
5436d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
543729cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
543829cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
5439d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
54409874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
54419874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
54429874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
54439874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
54449874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
54459874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
54469874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
54479874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
54489874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
54499874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
54509874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
54519bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
54529bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
54539bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
54549bc383deSJohannes Berg  *	by cfg80211 on change_interface
54552e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
545679ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
545779ea1e12SJohannes Berg  *	need to propagate the update to the driver
54588d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
54598d61ffa5SJohannes Berg  *	and some API functions require it held
546056d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
546156d1893dSJohannes Berg  *	beacons, 0 when not valid
546298104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
546373c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
546473c7da3dSArend Van Spriel  *	the P2P Device.
546504f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
546604f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
546731559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
5468780b40dfSJohannes Berg  * @ps: powersave mode is enabled
5469780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
5470780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
5471780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
5472780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
5473780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
547434d50519SLior David  * @conn_bss_type: connecting/connected BSS type
5475bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
5476bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
5477bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5478780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
54795336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5480780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
5481780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
548278f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5483ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
54844a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
54859bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
54869bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
54879bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
54884d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
54894d797fceSJouni Malinen  *	unprotected beacon report
5490d3236553SJohannes Berg  */
5491d3236553SJohannes Berg struct wireless_dev {
5492d3236553SJohannes Berg 	struct wiphy *wiphy;
5493d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5494d3236553SJohannes Berg 
5495667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5496d3236553SJohannes Berg 	struct list_head list;
5497d3236553SJohannes Berg 	struct net_device *netdev;
5498d3236553SJohannes Berg 
549989a54e48SJohannes Berg 	u32 identifier;
550089a54e48SJohannes Berg 
55012e161f78SJohannes Berg 	struct list_head mgmt_registrations;
550279ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
5503026331c4SJouni Malinen 
5504667503ddSJohannes Berg 	struct mutex mtx;
5505667503ddSJohannes Berg 
550640c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
550798104fdeSJohannes Berg 
550898104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
55099bc383deSJohannes Berg 
5510b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
5511d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
551229cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
55136829c878SJohannes Berg 	struct cfg80211_conn *conn;
5514fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
551534d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5516bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5517bd2522b1SAndrzej Zaborowski 
5518bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5519bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5520d3236553SJohannes Berg 
5521667503ddSJohannes Berg 	struct list_head event_list;
5522667503ddSJohannes Berg 	spinlock_t event_lock;
5523667503ddSJohannes Berg 
552419957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
5525683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
55269e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
5527f4489ebeSMichal Kazior 
5528c30a3d38SMichal Kazior 	bool ibss_fixed;
55295336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
5530c30a3d38SMichal Kazior 
5531ffb9eb3dSKalle Valo 	bool ps;
5532ffb9eb3dSKalle Valo 	int ps_timeout;
5533ffb9eb3dSKalle Valo 
553456d1893dSJohannes Berg 	int beacon_interval;
553556d1893dSJohannes Berg 
553615e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
553728946da7SJohannes Berg 
5538ab81007aSJohannes Berg 	u32 owner_nlportid;
5539ab81007aSJohannes Berg 	bool nl_owner_dead;
5540ab81007aSJohannes Berg 
554104f39047SSimon Wunderlich 	bool cac_started;
554204f39047SSimon Wunderlich 	unsigned long cac_start_time;
554331559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
554404f39047SSimon Wunderlich 
55453d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5546d3236553SJohannes Berg 	/* wext data */
5547cbe8fa9cSJohannes Berg 	struct {
5548cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
5549f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
5550fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
5551c1e5f471SJohannes Berg 		const u8 *ie;
5552f2129354SJohannes Berg 		size_t ie_len;
55539874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
55549874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
5555f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
555608645126SJohannes Berg 		s8 default_key, default_mgmt_key;
5557ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
5558cbe8fa9cSJohannes Berg 	} wext;
5559d3236553SJohannes Berg #endif
55604a4b8169SAndrew Zaborowski 
55614a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
55629bb7e0f2SJohannes Berg 
55639bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
55649bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
55659bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
55664d797fceSJouni Malinen 
55674d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
5568d3236553SJohannes Berg };
5569d3236553SJohannes Berg 
557010de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
557198104fdeSJohannes Berg {
557298104fdeSJohannes Berg 	if (wdev->netdev)
557398104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
557498104fdeSJohannes Berg 	return wdev->address;
557598104fdeSJohannes Berg }
557698104fdeSJohannes Berg 
557773c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
557873c7da3dSArend Van Spriel {
557973c7da3dSArend Van Spriel 	if (wdev->netdev)
558073c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
558173c7da3dSArend Van Spriel 	return wdev->is_running;
558273c7da3dSArend Van Spriel }
558373c7da3dSArend Van Spriel 
5584d3236553SJohannes Berg /**
5585d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5586d3236553SJohannes Berg  *
5587d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
55880ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5589d3236553SJohannes Berg  */
5590d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5591d3236553SJohannes Berg {
5592d3236553SJohannes Berg 	BUG_ON(!wdev);
5593d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5594d3236553SJohannes Berg }
5595d3236553SJohannes Berg 
5596d70e9693SJohannes Berg /**
5597d70e9693SJohannes Berg  * DOC: Utility functions
5598d70e9693SJohannes Berg  *
5599d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5600d3236553SJohannes Berg  */
5601d3236553SJohannes Berg 
5602d3236553SJohannes Berg /**
5603934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
5604934f4c7dSThomas Pedersen  *
5605934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
5606934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
5607934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
5608934f4c7dSThomas Pedersen  */
5609934f4c7dSThomas Pedersen static inline bool
5610934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
5611934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
5612934f4c7dSThomas Pedersen {
5613934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
5614934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
5615934f4c7dSThomas Pedersen }
5616934f4c7dSThomas Pedersen 
5617934f4c7dSThomas Pedersen /**
5618934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5619934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
5620934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
5621934f4c7dSThomas Pedersen  */
5622934f4c7dSThomas Pedersen static inline u32
5623934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5624934f4c7dSThomas Pedersen {
5625934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5626934f4c7dSThomas Pedersen }
5627934f4c7dSThomas Pedersen 
5628934f4c7dSThomas Pedersen /**
562911b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
563011b34737SThomas Pedersen  *
563111b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
563211b34737SThomas Pedersen  * @chan: channel
563311b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
563411b34737SThomas Pedersen  */
563511b34737SThomas Pedersen enum nl80211_chan_width
563611b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
563711b34737SThomas Pedersen 
563811b34737SThomas Pedersen /**
5639934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
5640934f4c7dSThomas Pedersen  * @chan: channel number
5641934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
5642934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5643934f4c7dSThomas Pedersen  */
5644934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5645934f4c7dSThomas Pedersen 
5646934f4c7dSThomas Pedersen /**
5647d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5648abe37c4bSJohannes Berg  * @chan: channel number
564959eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
56500ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5651d3236553SJohannes Berg  */
5652934f4c7dSThomas Pedersen static inline int
5653934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5654934f4c7dSThomas Pedersen {
5655934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5656934f4c7dSThomas Pedersen }
5657934f4c7dSThomas Pedersen 
5658934f4c7dSThomas Pedersen /**
5659934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
5660934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
5661934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
5662934f4c7dSThomas Pedersen  */
5663934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
5664d3236553SJohannes Berg 
5665d3236553SJohannes Berg /**
5666d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5667934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
56680ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5669d3236553SJohannes Berg  */
5670934f4c7dSThomas Pedersen static inline int
5671934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
5672934f4c7dSThomas Pedersen {
5673934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5674934f4c7dSThomas Pedersen }
5675934f4c7dSThomas Pedersen 
5676934f4c7dSThomas Pedersen /**
5677934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5678934f4c7dSThomas Pedersen  * frequency
5679934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
5680934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
5681934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
5682934f4c7dSThomas Pedersen  */
5683934f4c7dSThomas Pedersen struct ieee80211_channel *
5684934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5685d3236553SJohannes Berg 
5686d3236553SJohannes Berg /**
5687d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5688543b921bSArend Van Spriel  *
5689abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5690934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
56910ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5692d3236553SJohannes Berg  */
5693934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
5694934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
5695934f4c7dSThomas Pedersen {
5696934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5697934f4c7dSThomas Pedersen }
5698d3236553SJohannes Berg 
5699d3236553SJohannes Berg /**
5700afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5701afbc9c9eSJohannes Berg  * @chan: control channel to check
5702afbc9c9eSJohannes Berg  *
5703afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
5704afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5705afbc9c9eSJohannes Berg  */
5706afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5707afbc9c9eSJohannes Berg {
5708afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
5709afbc9c9eSJohannes Berg 		return false;
5710afbc9c9eSJohannes Berg 
5711afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5712afbc9c9eSJohannes Berg }
5713afbc9c9eSJohannes Berg 
5714afbc9c9eSJohannes Berg /**
5715d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5716d3236553SJohannes Berg  *
5717d3236553SJohannes Berg  * @sband: the band to look for rates in
5718d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5719d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
5720d3236553SJohannes Berg  *
57210ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
57220ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
57230ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
57240ae997dcSYacine Belkadi  * rates in the band's bitrate table.
5725d3236553SJohannes Berg  */
5726623b988fSJoe Perches const struct ieee80211_rate *
5727d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5728d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
5729d3236553SJohannes Berg 
5730b422c6cdSAshok Nagarajan /**
5731b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
5732b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
573374608acaSSimon Wunderlich  * @scan_width: width of the control channel
5734b422c6cdSAshok Nagarajan  *
5735b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
5736b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
5737b422c6cdSAshok Nagarajan  */
573874608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
573974608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
5740b422c6cdSAshok Nagarajan 
5741d3236553SJohannes Berg /*
5742d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
5743d3236553SJohannes Berg  *
5744d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
574566d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
5746d3236553SJohannes Berg  */
5747d3236553SJohannes Berg 
574833e5a2f7SJohannes Berg struct radiotap_align_size {
574933e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
575033e5a2f7SJohannes Berg };
575133e5a2f7SJohannes Berg 
575233e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
575333e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
575433e5a2f7SJohannes Berg 	int n_bits;
575533e5a2f7SJohannes Berg 	uint32_t oui;
575633e5a2f7SJohannes Berg 	uint8_t subns;
575733e5a2f7SJohannes Berg };
575833e5a2f7SJohannes Berg 
575933e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
576033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
576133e5a2f7SJohannes Berg 	int n_ns;
576233e5a2f7SJohannes Berg };
576333e5a2f7SJohannes Berg 
5764d3236553SJohannes Berg /**
5765d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
576633e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
576733e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
576833e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
576933e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
577033e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
577133e5a2f7SJohannes Berg  *	the beginning of the actual data portion
577233e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
577333e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
577433e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
577533e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
577633e5a2f7SJohannes Berg  *	radiotap namespace or not
577733e5a2f7SJohannes Berg  *
577833e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
577933e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
578033e5a2f7SJohannes Berg  * @_arg_index: next argument index
578133e5a2f7SJohannes Berg  * @_arg: next argument pointer
578233e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
578333e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
578433e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
578533e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
578633e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
578733e5a2f7SJohannes Berg  *	next bitmap word
578833e5a2f7SJohannes Berg  *
578933e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
579033e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5791d3236553SJohannes Berg  */
5792d3236553SJohannes Berg 
5793d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
579433e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
579533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
579633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5797d3236553SJohannes Berg 
579833e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
579967272440SJohannes Berg 	__le32 *_next_bitmap;
580033e5a2f7SJohannes Berg 
580133e5a2f7SJohannes Berg 	unsigned char *this_arg;
580233e5a2f7SJohannes Berg 	int this_arg_index;
580333e5a2f7SJohannes Berg 	int this_arg_size;
580433e5a2f7SJohannes Berg 
580533e5a2f7SJohannes Berg 	int is_radiotap_ns;
580633e5a2f7SJohannes Berg 
580733e5a2f7SJohannes Berg 	int _max_length;
580833e5a2f7SJohannes Berg 	int _arg_index;
580933e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
581033e5a2f7SJohannes Berg 	int _reset_on_ext;
5811d3236553SJohannes Berg };
5812d3236553SJohannes Berg 
581310dd9b7cSJoe Perches int
581410dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5815d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
581610dd9b7cSJoe Perches 				 int max_length,
581710dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
5818d3236553SJohannes Berg 
581910dd9b7cSJoe Perches int
582010dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5821d3236553SJohannes Berg 
582233e5a2f7SJohannes Berg 
5823e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
5824e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
5825e31a16d6SZhu Yi 
5826e31a16d6SZhu Yi /**
5827e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
5828e31a16d6SZhu Yi  *
5829e31a16d6SZhu Yi  * @skb: the frame
58300ae997dcSYacine Belkadi  *
58310ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
58320ae997dcSYacine Belkadi  * returns the 802.11 header length.
58330ae997dcSYacine Belkadi  *
58340ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
58350ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
58360ae997dcSYacine Belkadi  * 802.11 header.
5837e31a16d6SZhu Yi  */
5838e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5839e31a16d6SZhu Yi 
5840e31a16d6SZhu Yi /**
5841e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
5842e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
58430ae997dcSYacine Belkadi  * Return: The header length in bytes.
5844e31a16d6SZhu Yi  */
5845633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5846e31a16d6SZhu Yi 
5847e31a16d6SZhu Yi /**
58489b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
58499b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
58509b395bc3SJohannes Berg  *	(first byte) will be accessed
58510ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
58529b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
58539b395bc3SJohannes Berg  */
58549b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
58559b395bc3SJohannes Berg 
58569b395bc3SJohannes Berg /**
5857d70e9693SJohannes Berg  * DOC: Data path helpers
5858d70e9693SJohannes Berg  *
5859d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
5860d70e9693SJohannes Berg  * functions that help implement the data path for devices
5861d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
5862d70e9693SJohannes Berg  */
5863d70e9693SJohannes Berg 
5864d70e9693SJohannes Berg /**
58657f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
58667f6990c8SJohannes Berg  * @skb: the 802.11 data frame
58677f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
58687f6990c8SJohannes Berg  *	of it being pushed into the SKB
58697f6990c8SJohannes Berg  * @addr: the device MAC address
58707f6990c8SJohannes Berg  * @iftype: the virtual interface type
587124bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
58727f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
58737f6990c8SJohannes Berg  */
58747f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
587524bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
5876a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
58777f6990c8SJohannes Berg 
58787f6990c8SJohannes Berg /**
5879e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5880e31a16d6SZhu Yi  * @skb: the 802.11 data frame
5881e31a16d6SZhu Yi  * @addr: the device MAC address
5882e31a16d6SZhu Yi  * @iftype: the virtual interface type
58830ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
5884e31a16d6SZhu Yi  */
58857f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
58867f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
58877f6990c8SJohannes Berg {
5888a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
58897f6990c8SJohannes Berg }
5890e31a16d6SZhu Yi 
5891e31a16d6SZhu Yi /**
5892eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5893eaf85ca7SZhu Yi  *
58947f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
58957f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
58967f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
5897eaf85ca7SZhu Yi  *
58987f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
5899eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
5900085a6c10SRandy Dunlap  *	initialized by the caller.
5901eaf85ca7SZhu Yi  * @addr: The device MAC address.
5902eaf85ca7SZhu Yi  * @iftype: The device interface type.
5903eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
59048b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
59058b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
5906eaf85ca7SZhu Yi  */
5907eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5908eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
59098b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
59108b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
5911eaf85ca7SZhu Yi 
5912eaf85ca7SZhu Yi /**
5913e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5914e31a16d6SZhu Yi  * @skb: the data frame
5915fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
59160ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
5917e31a16d6SZhu Yi  */
5918fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5919fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
5920e31a16d6SZhu Yi 
5921c21dbf92SJohannes Berg /**
592249a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
592349a68e0dSJohannes Berg  *
592449a68e0dSJohannes Berg  * @eid: element ID
592549a68e0dSJohannes Berg  * @ies: data consisting of IEs
592649a68e0dSJohannes Berg  * @len: length of data
592749a68e0dSJohannes Berg  * @match: byte array to match
592849a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
592949a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
593049a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
593149a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
593249a68e0dSJohannes Berg  *	the data portion instead.
593349a68e0dSJohannes Berg  *
593449a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
593549a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
593649a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
593749a68e0dSJohannes Berg  * requested element struct.
593849a68e0dSJohannes Berg  *
593949a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
594049a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
594149a68e0dSJohannes Berg  * byte array to match.
594249a68e0dSJohannes Berg  */
594349a68e0dSJohannes Berg const struct element *
594449a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
594549a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
594649a68e0dSJohannes Berg 			 unsigned int match_offset);
594749a68e0dSJohannes Berg 
594849a68e0dSJohannes Berg /**
5949fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
5950fbd05e4aSLuca Coelho  *
5951fbd05e4aSLuca Coelho  * @eid: element ID
5952fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
5953fbd05e4aSLuca Coelho  * @len: length of data
5954fbd05e4aSLuca Coelho  * @match: byte array to match
5955fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
5956fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
5957fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
5958fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
5959fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
5960fbd05e4aSLuca Coelho  *	the second byte is the IE length.
5961fbd05e4aSLuca Coelho  *
5962fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
5963fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
5964fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
5965fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
5966fbd05e4aSLuca Coelho  * element ID.
5967fbd05e4aSLuca Coelho  *
5968fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
5969fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
5970fbd05e4aSLuca Coelho  * byte array to match.
5971fbd05e4aSLuca Coelho  */
597249a68e0dSJohannes Berg static inline const u8 *
597349a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
597449a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
597549a68e0dSJohannes Berg 		       unsigned int match_offset)
597649a68e0dSJohannes Berg {
597749a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
597849a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
597949a68e0dSJohannes Berg 	 */
598049a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
598149a68e0dSJohannes Berg 		    (!match_len && match_offset)))
598249a68e0dSJohannes Berg 		return NULL;
598349a68e0dSJohannes Berg 
598449a68e0dSJohannes Berg 	return (void *)cfg80211_find_elem_match(eid, ies, len,
598549a68e0dSJohannes Berg 						match, match_len,
598649a68e0dSJohannes Berg 						match_offset ?
598749a68e0dSJohannes Berg 							match_offset - 2 : 0);
598849a68e0dSJohannes Berg }
598949a68e0dSJohannes Berg 
599049a68e0dSJohannes Berg /**
599149a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
599249a68e0dSJohannes Berg  *
599349a68e0dSJohannes Berg  * @eid: element ID
599449a68e0dSJohannes Berg  * @ies: data consisting of IEs
599549a68e0dSJohannes Berg  * @len: length of data
599649a68e0dSJohannes Berg  *
599749a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
599849a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
599949a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
600049a68e0dSJohannes Berg  * requested element struct.
600149a68e0dSJohannes Berg  *
600249a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
600349a68e0dSJohannes Berg  * having to fit into the given data.
600449a68e0dSJohannes Berg  */
600549a68e0dSJohannes Berg static inline const struct element *
600649a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
600749a68e0dSJohannes Berg {
600849a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
600949a68e0dSJohannes Berg }
6010fbd05e4aSLuca Coelho 
6011fbd05e4aSLuca Coelho /**
6012c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6013c21dbf92SJohannes Berg  *
6014c21dbf92SJohannes Berg  * @eid: element ID
6015c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6016c21dbf92SJohannes Berg  * @len: length of data
6017c21dbf92SJohannes Berg  *
60180ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
60190ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
60200ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
60210ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
60220ae997dcSYacine Belkadi  *
60230ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
60240ae997dcSYacine Belkadi  * having to fit into the given data.
6025c21dbf92SJohannes Berg  */
6026fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6027fbd05e4aSLuca Coelho {
6028fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6029fbd05e4aSLuca Coelho }
6030c21dbf92SJohannes Berg 
6031d70e9693SJohannes Berg /**
603249a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
603349a68e0dSJohannes Berg  *
603449a68e0dSJohannes Berg  * @ext_eid: element ID Extension
603549a68e0dSJohannes Berg  * @ies: data consisting of IEs
603649a68e0dSJohannes Berg  * @len: length of data
603749a68e0dSJohannes Berg  *
603849a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
603949a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
604049a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
604149a68e0dSJohannes Berg  * requested element struct.
604249a68e0dSJohannes Berg  *
604349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
604449a68e0dSJohannes Berg  * having to fit into the given data.
604549a68e0dSJohannes Berg  */
604649a68e0dSJohannes Berg static inline const struct element *
604749a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
604849a68e0dSJohannes Berg {
604949a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
605049a68e0dSJohannes Berg 					&ext_eid, 1, 0);
605149a68e0dSJohannes Berg }
605249a68e0dSJohannes Berg 
605349a68e0dSJohannes Berg /**
60543f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
60553f817fe7SJouni Malinen  *
60563f817fe7SJouni Malinen  * @ext_eid: element ID Extension
60573f817fe7SJouni Malinen  * @ies: data consisting of IEs
60583f817fe7SJouni Malinen  * @len: length of data
60593f817fe7SJouni Malinen  *
60603f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
60613f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
60623f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
60633f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
60643f817fe7SJouni Malinen  *
60653f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
60663f817fe7SJouni Malinen  * having to fit into the given data.
60673f817fe7SJouni Malinen  */
60683f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
60693f817fe7SJouni Malinen {
60703f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
60713f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
60723f817fe7SJouni Malinen }
60733f817fe7SJouni Malinen 
60743f817fe7SJouni Malinen /**
607549a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
607649a68e0dSJohannes Berg  *
607749a68e0dSJohannes Berg  * @oui: vendor OUI
607849a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
607949a68e0dSJohannes Berg  * @ies: data consisting of IEs
608049a68e0dSJohannes Berg  * @len: length of data
608149a68e0dSJohannes Berg  *
608249a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
608349a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
608449a68e0dSJohannes Berg  * return the element structure for the requested element.
608549a68e0dSJohannes Berg  *
608649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
608749a68e0dSJohannes Berg  * the given data.
608849a68e0dSJohannes Berg  */
608949a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
609049a68e0dSJohannes Berg 						const u8 *ies,
609149a68e0dSJohannes Berg 						unsigned int len);
609249a68e0dSJohannes Berg 
609349a68e0dSJohannes Berg /**
60940c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
60950c28ec58SEliad Peller  *
60960c28ec58SEliad Peller  * @oui: vendor OUI
60979e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
60980c28ec58SEliad Peller  * @ies: data consisting of IEs
60990c28ec58SEliad Peller  * @len: length of data
61000c28ec58SEliad Peller  *
61010ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
61020ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
61030ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
61040ae997dcSYacine Belkadi  * element ID.
61050ae997dcSYacine Belkadi  *
61060ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
61070ae997dcSYacine Belkadi  * the given data.
61080c28ec58SEliad Peller  */
610949a68e0dSJohannes Berg static inline const u8 *
611049a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
611149a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
611249a68e0dSJohannes Berg {
611349a68e0dSJohannes Berg 	return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
611449a68e0dSJohannes Berg }
61150c28ec58SEliad Peller 
61160c28ec58SEliad Peller /**
611730ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
611830ca1aa5SDedy Lansky  *
611930ca1aa5SDedy Lansky  * @dev: network device
612030ca1aa5SDedy Lansky  * @addr: STA MAC address
612130ca1aa5SDedy Lansky  *
612230ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
612330ca1aa5SDedy Lansky  * devices upon STA association.
612430ca1aa5SDedy Lansky  */
612530ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
612630ca1aa5SDedy Lansky 
612730ca1aa5SDedy Lansky /**
6128d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
6129d70e9693SJohannes Berg  *
6130d70e9693SJohannes Berg  * TODO
6131d3236553SJohannes Berg  */
6132d3236553SJohannes Berg 
6133d3236553SJohannes Berg /**
6134d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
6135d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
6136d3236553SJohannes Berg  *	conflicts)
6137d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6138d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
6139d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
6140d3236553SJohannes Berg  *	alpha2.
6141d3236553SJohannes Berg  *
6142d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
6143d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
6144d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6145d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
6146d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6147d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
6148d3236553SJohannes Berg  *
6149d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
6150d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
6151d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
6152d3236553SJohannes Berg  *
6153d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
6154d3236553SJohannes Berg  * an -ENOMEM.
61550ae997dcSYacine Belkadi  *
61560ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
6157d3236553SJohannes Berg  */
615810dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6159d3236553SJohannes Berg 
6160d3236553SJohannes Berg /**
6161b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6162b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
6163b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
6164b0d7aa59SJonathan Doron  *
6165b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
6166b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6167b0d7aa59SJonathan Doron  * information.
6168b0d7aa59SJonathan Doron  *
6169b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
6170b0d7aa59SJonathan Doron  */
6171b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6172b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
6173b0d7aa59SJonathan Doron 
6174b0d7aa59SJonathan Doron /**
6175a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
61762c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
61772c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
61782c3e861cSArik Nemtsov  *
6179a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
6180a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
6181a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
61822c3e861cSArik Nemtsov  *
61832c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
61842c3e861cSArik Nemtsov  */
6185a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
61862c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
61872c3e861cSArik Nemtsov 
61882c3e861cSArik Nemtsov /**
6189d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6190d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
6191d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
6192d3236553SJohannes Berg  *
6193d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
6194d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
6195d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
6196d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
6197d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
6198d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
6199222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
6200ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6201222ea581SLuis R. Rodriguez  * that called this helper.
6202d3236553SJohannes Berg  */
620310dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6204d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
6205d3236553SJohannes Berg 
6206d3236553SJohannes Berg /**
6207d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
6208d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
6209d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
6210d3236553SJohannes Berg  *
6211d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
6212d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
6213d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
6214d3236553SJohannes Berg  * and processed already.
6215d3236553SJohannes Berg  *
62160ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
62170ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
62180ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
62190ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
62200ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
62210ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
62220ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
6223d3236553SJohannes Berg  */
6224361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6225361c9c8bSJohannes Berg 					       u32 center_freq);
6226d3236553SJohannes Berg 
6227034c6d6eSLuis R. Rodriguez /**
6228034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
6229034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
6230034c6d6eSLuis R. Rodriguez  *
6231034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
6232034c6d6eSLuis R. Rodriguez  * proper string representation.
6233034c6d6eSLuis R. Rodriguez  */
6234034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6235034c6d6eSLuis R. Rodriguez 
623619d3577eSHaim Dreyfuss /**
6237dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6238dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
6239dc0c18edSAaron Komisar  *
6240dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
6241dc0c18edSAaron Komisar  */
6242dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6243dc0c18edSAaron Komisar 
6244dc0c18edSAaron Komisar /**
624519d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
624619d3577eSHaim Dreyfuss  *
624719d3577eSHaim Dreyfuss  */
624819d3577eSHaim Dreyfuss 
624919d3577eSHaim Dreyfuss /**
625019d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
625119d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
625219d3577eSHaim Dreyfuss  *
625319d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
625419d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
625519d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
625619d3577eSHaim Dreyfuss  *
625719d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
625819d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
625919d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
626019d3577eSHaim Dreyfuss  *
626119d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
626219d3577eSHaim Dreyfuss  * an -ENODATA.
626319d3577eSHaim Dreyfuss  *
626419d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
626519d3577eSHaim Dreyfuss  */
626638cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
626738cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
626819d3577eSHaim Dreyfuss 
6269d3236553SJohannes Berg /*
6270d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
6271d3236553SJohannes Berg  * functions and BSS handling helpers
6272d3236553SJohannes Berg  */
6273d3236553SJohannes Berg 
62742a519311SJohannes Berg /**
62752a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
62762a519311SJohannes Berg  *
62772a519311SJohannes Berg  * @request: the corresponding scan request
62781d76250bSAvraham Stern  * @info: information about the completed scan
62792a519311SJohannes Berg  */
62801d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
62811d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
62822a519311SJohannes Berg 
62832a519311SJohannes Berg /**
6284807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
6285807f8a8cSLuciano Coelho  *
6286807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
6287b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6288807f8a8cSLuciano Coelho  */
6289b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6290807f8a8cSLuciano Coelho 
6291807f8a8cSLuciano Coelho /**
6292807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6293807f8a8cSLuciano Coelho  *
6294807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
6295b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6296807f8a8cSLuciano Coelho  *
6297807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
6298807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
6299807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
6300807f8a8cSLuciano Coelho  */
6301b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6302807f8a8cSLuciano Coelho 
6303807f8a8cSLuciano Coelho /**
6304a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6305792e6aa7SEliad Peller  *
6306792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
6307b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6308792e6aa7SEliad Peller  *
6309792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
6310792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
6311792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
6312a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
6313792e6aa7SEliad Peller  */
6314a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6315792e6aa7SEliad Peller 
6316792e6aa7SEliad Peller /**
63176e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
63182a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
63196e19bc4bSDmitry Shmidt  * @data: the BSS metadata
6320abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
6321abe37c4bSJohannes Berg  * @len: length of the management frame
63222a519311SJohannes Berg  * @gfp: context flags
63232a519311SJohannes Berg  *
63242a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
63252a519311SJohannes Berg  * the BSS should be updated/added.
6326ef100682SJohannes Berg  *
63270ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
63280ae997dcSYacine Belkadi  * Or %NULL on error.
63292a519311SJohannes Berg  */
6330ef100682SJohannes Berg struct cfg80211_bss * __must_check
63316e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
63326e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
63336e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
63346e19bc4bSDmitry Shmidt 			       gfp_t gfp);
63356e19bc4bSDmitry Shmidt 
63366e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6337dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
63383afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
6339dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
6340dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
63416e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
63426e19bc4bSDmitry Shmidt {
63436e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
63446e19bc4bSDmitry Shmidt 		.chan = rx_channel,
63456e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
63466e19bc4bSDmitry Shmidt 		.signal = signal,
63476e19bc4bSDmitry Shmidt 	};
63486e19bc4bSDmitry Shmidt 
63496e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
63506e19bc4bSDmitry Shmidt }
6351dcd6eac1SSimon Wunderlich 
6352dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
63532a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
63543afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
63552a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
6356dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
6357dcd6eac1SSimon Wunderlich {
63586e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
63596e19bc4bSDmitry Shmidt 		.chan = rx_channel,
63606e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
63616e19bc4bSDmitry Shmidt 		.signal = signal,
63626e19bc4bSDmitry Shmidt 	};
63636e19bc4bSDmitry Shmidt 
63646e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6365dcd6eac1SSimon Wunderlich }
63662a519311SJohannes Berg 
6367abe37c4bSJohannes Berg /**
63687ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
63697ece9c37SSara Sharon  * @bssid: transmitter BSSID
63707ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
63717ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
63725d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
63737ece9c37SSara Sharon  */
63747ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
63755d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
63767ece9c37SSara Sharon {
63775d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
63785d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
63795d4071abSJohannes Berg 	u64 new_bssid_u64;
63807ece9c37SSara Sharon 
63815d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
63827ece9c37SSara Sharon 
63835d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
63847ece9c37SSara Sharon 
63855d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
63867ece9c37SSara Sharon }
63877ece9c37SSara Sharon 
63887ece9c37SSara Sharon /**
638997981d89SWen Gong  * cfg80211_get_ies_channel_number - returns the channel number from ies
639097981d89SWen Gong  * @ie: IEs
639197981d89SWen Gong  * @ielen: length of IEs
639297981d89SWen Gong  * @band: enum nl80211_band of the channel
639397981d89SWen Gong  *
639497981d89SWen Gong  * Returns the channel number, or -1 if none could be determined.
639597981d89SWen Gong  */
639697981d89SWen Gong int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
639797981d89SWen Gong 				    enum nl80211_band band);
639897981d89SWen Gong 
639997981d89SWen Gong /**
6400f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
6401f7dacfb1SSara Sharon  * @element: element to check
6402f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
6403f7dacfb1SSara Sharon  */
6404f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
6405f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
6406f7dacfb1SSara Sharon 
6407f7dacfb1SSara Sharon /**
6408fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6409fe806e49SSara Sharon  * @ie: ies
6410fe806e49SSara Sharon  * @ielen: length of IEs
6411fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
6412fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
6413fe806e49SSara Sharon  * @merged_ie: location of the merged profile
6414fe806e49SSara Sharon  * @max_copy_len: max merged profile length
6415fe806e49SSara Sharon  */
6416fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6417fe806e49SSara Sharon 			      const struct element *mbssid_elem,
6418fe806e49SSara Sharon 			      const struct element *sub_elem,
64195809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
6420fe806e49SSara Sharon 
6421fe806e49SSara Sharon /**
64225bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
64235bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
64245bc8c1f2SJohannes Berg  *	from a beacon or probe response
64255bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
64265bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
64275bc8c1f2SJohannes Berg  */
64285bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
64295bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
64305bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
64315bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
64325bc8c1f2SJohannes Berg };
64335bc8c1f2SJohannes Berg 
64345bc8c1f2SJohannes Berg /**
64356e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6436abe37c4bSJohannes Berg  *
6437abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
64386e19bc4bSDmitry Shmidt  * @data: the BSS metadata
64395bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
6440abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
64417b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6442abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
6443abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
6444abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
6445abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
6446abe37c4bSJohannes Berg  * @gfp: context flags
6447abe37c4bSJohannes Berg  *
6448abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
6449abe37c4bSJohannes Berg  * the BSS should be updated/added.
6450ef100682SJohannes Berg  *
64510ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
64520ae997dcSYacine Belkadi  * Or %NULL on error.
6453abe37c4bSJohannes Berg  */
6454ef100682SJohannes Berg struct cfg80211_bss * __must_check
64556e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
64566e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
64576e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
64586e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
64596e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
64606e19bc4bSDmitry Shmidt 			 gfp_t gfp);
64616e19bc4bSDmitry Shmidt 
64626e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6463dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
64643afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
6465dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
64665bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
6467dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
6468dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
64696e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
64706e19bc4bSDmitry Shmidt {
64716e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
64726e19bc4bSDmitry Shmidt 		.chan = rx_channel,
64736e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
64746e19bc4bSDmitry Shmidt 		.signal = signal,
64756e19bc4bSDmitry Shmidt 	};
64766e19bc4bSDmitry Shmidt 
64776e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
64786e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
64796e19bc4bSDmitry Shmidt 					gfp);
64806e19bc4bSDmitry Shmidt }
6481dcd6eac1SSimon Wunderlich 
6482dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
648306aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
64843afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
64855bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
64867b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
64877b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
6488dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
6489dcd6eac1SSimon Wunderlich {
64906e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
64916e19bc4bSDmitry Shmidt 		.chan = rx_channel,
64926e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
64936e19bc4bSDmitry Shmidt 		.signal = signal,
64946e19bc4bSDmitry Shmidt 	};
64956e19bc4bSDmitry Shmidt 
64966e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
64976e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
6498dcd6eac1SSimon Wunderlich 					gfp);
6499dcd6eac1SSimon Wunderlich }
650006aa7afaSJussi Kivilinna 
650127548677SJohannes Berg /**
650227548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
650327548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
650427548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
650527548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
650627548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
650727548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
650827548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
650927548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
651027548677SJohannes Berg  */
65112a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
65122a519311SJohannes Berg 				      struct ieee80211_channel *channel,
65132a519311SJohannes Berg 				      const u8 *bssid,
651479420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
65156eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
651627548677SJohannes Berg 				      enum ieee80211_privacy privacy);
651779420f09SJohannes Berg static inline struct cfg80211_bss *
651879420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
651979420f09SJohannes Berg 		  struct ieee80211_channel *channel,
652079420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
652179420f09SJohannes Berg {
652279420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
65236eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
65246eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
652579420f09SJohannes Berg }
652679420f09SJohannes Berg 
65274c0c0b75SJohannes Berg /**
65284c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
65295b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
65304c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
65314c0c0b75SJohannes Berg  *
65324c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
65334c0c0b75SJohannes Berg  */
65345b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
65354c0c0b75SJohannes Berg 
65364c0c0b75SJohannes Berg /**
65374c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
65385b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
65394c0c0b75SJohannes Berg  * @bss: the BSS struct
65404c0c0b75SJohannes Berg  *
65414c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
65424c0c0b75SJohannes Berg  */
65435b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6544d3236553SJohannes Berg 
6545d491af19SJohannes Berg /**
6546d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
6547d491af19SJohannes Berg  * @wiphy: the wiphy
6548d491af19SJohannes Berg  * @bss: the bss to remove
6549d491af19SJohannes Berg  *
6550d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
6551d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
6552d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
6553d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
6554d491af19SJohannes Berg  */
6555d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6556fee52678SJohannes Berg 
65574770c8f9SIlan Peer /**
65584770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
65594770c8f9SIlan Peer  *
65604770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
65614770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
65624770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
65634770c8f9SIlan Peer  *
65644770c8f9SIlan Peer  * @wiphy: the wiphy
65654770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
65664770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
65674770c8f9SIlan Peer  * @iter: the iterator function to call
65684770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
65694770c8f9SIlan Peer  */
65704770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
65714770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
65724770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
65734770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
65744770c8f9SIlan Peer 				    void *data),
65754770c8f9SIlan Peer 		       void *iter_data);
65764770c8f9SIlan Peer 
6577dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
6578dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6579dcd6eac1SSimon Wunderlich {
6580dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
6581dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6582dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
6583dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6584dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
6585dcd6eac1SSimon Wunderlich 	default:
6586dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
6587dcd6eac1SSimon Wunderlich 	}
6588dcd6eac1SSimon Wunderlich }
6589dcd6eac1SSimon Wunderlich 
65906039f6d2SJouni Malinen /**
65916ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
65926039f6d2SJouni Malinen  * @dev: network device
65936039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
65946039f6d2SJouni Malinen  * @len: length of the frame data
65956039f6d2SJouni Malinen  *
65966ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
65976ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
65986ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
65996ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
66006ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
66016ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
66026ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
66036ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
66046ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
66056ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
66066ff57cf8SJohannes Berg  *
66076ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
66086039f6d2SJouni Malinen  */
66096ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
66106039f6d2SJouni Malinen 
66116039f6d2SJouni Malinen /**
66126ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
66131965c853SJouni Malinen  * @dev: network device
66141965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
6615cb0b4bebSJohannes Berg  *
66168d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
66178d61ffa5SJohannes Berg  * mutex.
66181965c853SJouni Malinen  */
66196ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
66201965c853SJouni Malinen 
66211965c853SJouni Malinen /**
66226ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
66236039f6d2SJouni Malinen  * @dev: network device
66246ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
66256ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
66264d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
66276039f6d2SJouni Malinen  * @len: length of the frame data
6628f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6629f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
66304d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
66314d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
66326039f6d2SJouni Malinen  *
66336ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
66346ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
66356ff57cf8SJohannes Berg  *
66366ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
66376039f6d2SJouni Malinen  */
66386ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
66396ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
6640b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
66414d9ec73dSJouni Malinen 			    int uapsd_queues,
66424d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
66436039f6d2SJouni Malinen 
66446039f6d2SJouni Malinen /**
66456ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
66461965c853SJouni Malinen  * @dev: network device
6647959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
6648cb0b4bebSJohannes Berg  *
66498d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
66501965c853SJouni Malinen  */
6651959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
66521965c853SJouni Malinen 
66531965c853SJouni Malinen /**
6654e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6655e6f462dfSJohannes Berg  * @dev: network device
6656e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
6657e6f462dfSJohannes Berg  *
6658e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
6659e6f462dfSJohannes Berg  * an association attempt was abandoned.
6660e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
6661e6f462dfSJohannes Berg  */
6662e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6663e6f462dfSJohannes Berg 
6664e6f462dfSJohannes Berg /**
66656ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
66666039f6d2SJouni Malinen  * @dev: network device
66676ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
66686039f6d2SJouni Malinen  * @len: length of the frame data
66693bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
66706039f6d2SJouni Malinen  *
66716039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
667253b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
66738d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
66748d61ffa5SJohannes Berg  * corresponding wdev's mutex.
66756039f6d2SJouni Malinen  */
66763bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
66773bb02143SJohannes Berg 			   bool reconnect);
6678ce470613SHolger Schurig 
6679ce470613SHolger Schurig /**
66806ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6681cf4e594eSJouni Malinen  * @dev: network device
66824d797fceSJouni Malinen  * @buf: received management frame (header + body)
6683cf4e594eSJouni Malinen  * @len: length of the frame data
6684cf4e594eSJouni Malinen  *
66856ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
66866ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
66874d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
66884d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
66894d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
66904d797fceSJouni Malinen  *
66914d797fceSJouni Malinen  * This function may sleep.
6692cf4e594eSJouni Malinen  */
66936ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
66946ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
6695cf4e594eSJouni Malinen 
6696cf4e594eSJouni Malinen /**
6697a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6698a3b8b056SJouni Malinen  * @dev: network device
6699a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
6700a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
6701a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
6702a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6703e6d6e342SJohannes Berg  * @gfp: allocation flags
6704a3b8b056SJouni Malinen  *
6705a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
6706a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6707a3b8b056SJouni Malinen  * primitive.
6708a3b8b056SJouni Malinen  */
6709a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6710a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
6711e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
6712a3b8b056SJouni Malinen 
671304a773adSJohannes Berg /**
671404a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
671504a773adSJohannes Berg  *
671604a773adSJohannes Berg  * @dev: network device
671704a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
6718fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
671904a773adSJohannes Berg  * @gfp: allocation flags
672004a773adSJohannes Berg  *
672104a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
672204a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
672304a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
672404a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
672504a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
672604a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
672704a773adSJohannes Berg  */
6728fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6729fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
673004a773adSJohannes Berg 
67311f87f7d3SJohannes Berg /**
6732b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6733b1e8eb11SMauro Carvalho Chehab  * 					candidate
6734c93b5e71SJavier Cardona  *
6735c93b5e71SJavier Cardona  * @dev: network device
6736c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
6737c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
67385ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
6739c93b5e71SJavier Cardona  * @gfp: allocation flags
6740c93b5e71SJavier Cardona  *
6741c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
6742c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
6743c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
6744c93b5e71SJavier Cardona  */
6745c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6746ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
6747ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
6748c93b5e71SJavier Cardona 
6749c93b5e71SJavier Cardona /**
6750d70e9693SJohannes Berg  * DOC: RFkill integration
6751d70e9693SJohannes Berg  *
6752d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
6753d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
6754d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
6755d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
6756d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
6757d70e9693SJohannes Berg  *
6758d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
6759d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
6760d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
6761d70e9693SJohannes Berg  */
6762d70e9693SJohannes Berg 
6763d70e9693SJohannes Berg /**
6764810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
67651f87f7d3SJohannes Berg  * @wiphy: the wiphy
67661f87f7d3SJohannes Berg  * @blocked: block status
67676f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
67681f87f7d3SJohannes Berg  */
67696f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
67706f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
67716f779a66SEmmanuel Grumbach 
67726f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
67736f779a66SEmmanuel Grumbach {
67746f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
67756f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
67766f779a66SEmmanuel Grumbach }
67771f87f7d3SJohannes Berg 
67781f87f7d3SJohannes Berg /**
67791f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
67801f87f7d3SJohannes Berg  * @wiphy: the wiphy
67811f87f7d3SJohannes Berg  */
67821f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
67831f87f7d3SJohannes Berg 
67841f87f7d3SJohannes Berg /**
67851f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
67861f87f7d3SJohannes Berg  * @wiphy: the wiphy
67871f87f7d3SJohannes Berg  */
6788358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
6789358ae888SEmmanuel Grumbach {
6790358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
6791358ae888SEmmanuel Grumbach }
67921f87f7d3SJohannes Berg 
6793ad7e718cSJohannes Berg /**
6794ad7e718cSJohannes Berg  * DOC: Vendor commands
6795ad7e718cSJohannes Berg  *
6796ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
6797ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
6798ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
6799ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
6800ad7e718cSJohannes Berg  * the configuration mechanism.
6801ad7e718cSJohannes Berg  *
6802ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
6803ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
6804ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
6805ad7e718cSJohannes Berg  *
6806ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
6807ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
6808ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
6809ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
6810ad7e718cSJohannes Berg  * managers etc. need.
6811ad7e718cSJohannes Berg  */
6812ad7e718cSJohannes Berg 
6813ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6814ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
6815ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
6816ad7e718cSJohannes Berg 					   int approxlen);
6817ad7e718cSJohannes Berg 
6818567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
68196c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
6820567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
6821567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
682255c1fdf0SJohannes Berg 					   unsigned int portid,
6823567ffc35SJohannes Berg 					   int vendor_event_idx,
6824567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
6825567ffc35SJohannes Berg 
6826567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6827567ffc35SJohannes Berg 
6828ad7e718cSJohannes Berg /**
6829ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6830ad7e718cSJohannes Berg  * @wiphy: the wiphy
6831ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6832ad7e718cSJohannes Berg  *	be put into the skb
6833ad7e718cSJohannes Berg  *
6834ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6835ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
6836ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
6837ad7e718cSJohannes Berg  *
6838ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
6839ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
6840ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
6841ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6842ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
6843ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
6844ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
6845ad7e718cSJohannes Berg  *
6846ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6847ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
6848ad7e718cSJohannes Berg  *
6849ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6850ad7e718cSJohannes Berg  */
6851ad7e718cSJohannes Berg static inline struct sk_buff *
6852ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6853ad7e718cSJohannes Berg {
6854ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6855ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
6856ad7e718cSJohannes Berg }
6857ad7e718cSJohannes Berg 
6858ad7e718cSJohannes Berg /**
6859ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
6860ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
6861ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
6862ad7e718cSJohannes Berg  *
6863ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
6864ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
6865ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
6866ad7e718cSJohannes Berg  * skb regardless of the return value.
6867ad7e718cSJohannes Berg  *
6868ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
6869ad7e718cSJohannes Berg  */
6870ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6871ad7e718cSJohannes Berg 
6872567ffc35SJohannes Berg /**
68735d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
687455c1fdf0SJohannes Berg  * @wiphy: the wiphy
687555c1fdf0SJohannes Berg  *
687655c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
687755c1fdf0SJohannes Berg  * Valid to call only there.
687855c1fdf0SJohannes Berg  */
687955c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
688055c1fdf0SJohannes Berg 
688155c1fdf0SJohannes Berg /**
6882567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6883567ffc35SJohannes Berg  * @wiphy: the wiphy
68846c09e791SAhmad Kholaif  * @wdev: the wireless device
6885567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
6886567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6887567ffc35SJohannes Berg  *	be put into the skb
6888567ffc35SJohannes Berg  * @gfp: allocation flags
6889567ffc35SJohannes Berg  *
6890567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6891567ffc35SJohannes Berg  * vendor-specific multicast group.
6892567ffc35SJohannes Berg  *
68936c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
68946c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
68956c09e791SAhmad Kholaif  * attribute.
68966c09e791SAhmad Kholaif  *
6897567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
6898567ffc35SJohannes Berg  * skb to send the event.
6899567ffc35SJohannes Berg  *
6900567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6901567ffc35SJohannes Berg  */
6902567ffc35SJohannes Berg static inline struct sk_buff *
69036c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
69046c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
6905567ffc35SJohannes Berg {
69066c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6907567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
690855c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
690955c1fdf0SJohannes Berg }
691055c1fdf0SJohannes Berg 
691155c1fdf0SJohannes Berg /**
691255c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
691355c1fdf0SJohannes Berg  * @wiphy: the wiphy
691455c1fdf0SJohannes Berg  * @wdev: the wireless device
691555c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
691655c1fdf0SJohannes Berg  * @portid: port ID of the receiver
691755c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
691855c1fdf0SJohannes Berg  *	be put into the skb
691955c1fdf0SJohannes Berg  * @gfp: allocation flags
692055c1fdf0SJohannes Berg  *
692155c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
692255c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
692355c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
692455c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
692555c1fdf0SJohannes Berg  *
692655c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
692755c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
692855c1fdf0SJohannes Berg  * attribute.
692955c1fdf0SJohannes Berg  *
693055c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
693155c1fdf0SJohannes Berg  * skb to send the event.
693255c1fdf0SJohannes Berg  *
693355c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
693455c1fdf0SJohannes Berg  */
693555c1fdf0SJohannes Berg static inline struct sk_buff *
693655c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
693755c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
693855c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
693955c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
694055c1fdf0SJohannes Berg {
694155c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
694255c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
694355c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
6944567ffc35SJohannes Berg }
6945567ffc35SJohannes Berg 
6946567ffc35SJohannes Berg /**
6947567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
6948567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6949567ffc35SJohannes Berg  * @gfp: allocation flags
6950567ffc35SJohannes Berg  *
6951567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
6952567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6953567ffc35SJohannes Berg  */
6954567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6955567ffc35SJohannes Berg {
6956567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6957567ffc35SJohannes Berg }
6958567ffc35SJohannes Berg 
6959aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
6960aff89a9bSJohannes Berg /**
6961d70e9693SJohannes Berg  * DOC: Test mode
6962d70e9693SJohannes Berg  *
6963d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
6964d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
6965d70e9693SJohannes Berg  * factory programming.
6966d70e9693SJohannes Berg  *
6967d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
6968d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
6969d70e9693SJohannes Berg  */
6970d70e9693SJohannes Berg 
6971d70e9693SJohannes Berg /**
6972aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6973aff89a9bSJohannes Berg  * @wiphy: the wiphy
6974aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6975aff89a9bSJohannes Berg  *	be put into the skb
6976aff89a9bSJohannes Berg  *
6977aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6978aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
6979aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
6980aff89a9bSJohannes Berg  *
69810ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
69820ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
69830ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
69840ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
69850ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
69860ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
69870ae997dcSYacine Belkadi  * must not modify the skb in any other way.
6988aff89a9bSJohannes Berg  *
6989aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
6990aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
69910ae997dcSYacine Belkadi  *
69920ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6993aff89a9bSJohannes Berg  */
6994ad7e718cSJohannes Berg static inline struct sk_buff *
6995ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6996ad7e718cSJohannes Berg {
6997ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6998ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
6999ad7e718cSJohannes Berg }
7000aff89a9bSJohannes Berg 
7001aff89a9bSJohannes Berg /**
7002aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7003aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7004aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7005aff89a9bSJohannes Berg  *
70060ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
70070ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
70080ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
70090ae997dcSYacine Belkadi  * regardless of the return value.
70100ae997dcSYacine Belkadi  *
70110ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7012aff89a9bSJohannes Berg  */
7013ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7014ad7e718cSJohannes Berg {
7015ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7016ad7e718cSJohannes Berg }
7017aff89a9bSJohannes Berg 
7018aff89a9bSJohannes Berg /**
7019aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7020aff89a9bSJohannes Berg  * @wiphy: the wiphy
7021aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7022aff89a9bSJohannes Berg  *	be put into the skb
7023aff89a9bSJohannes Berg  * @gfp: allocation flags
7024aff89a9bSJohannes Berg  *
7025aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7026aff89a9bSJohannes Berg  * testmode multicast group.
7027aff89a9bSJohannes Berg  *
70280ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
70290ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
70300ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
70310ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
70320ae997dcSYacine Belkadi  * in any other way.
7033aff89a9bSJohannes Berg  *
7034aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7035aff89a9bSJohannes Berg  * skb to send the event.
70360ae997dcSYacine Belkadi  *
70370ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7038aff89a9bSJohannes Berg  */
7039567ffc35SJohannes Berg static inline struct sk_buff *
7040567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7041567ffc35SJohannes Berg {
70426c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
704355c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7044567ffc35SJohannes Berg 					  approxlen, gfp);
7045567ffc35SJohannes Berg }
7046aff89a9bSJohannes Berg 
7047aff89a9bSJohannes Berg /**
7048aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7049aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7050aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7051aff89a9bSJohannes Berg  * @gfp: allocation flags
7052aff89a9bSJohannes Berg  *
7053aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7054aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7055aff89a9bSJohannes Berg  * consumes it.
7056aff89a9bSJohannes Berg  */
7057567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7058567ffc35SJohannes Berg {
7059567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7060567ffc35SJohannes Berg }
7061aff89a9bSJohannes Berg 
7062aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
706371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
7064aff89a9bSJohannes Berg #else
7065aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
706671063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
7067aff89a9bSJohannes Berg #endif
7068aff89a9bSJohannes Berg 
7069b23aa676SSamuel Ortiz /**
707076804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
707176804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
707276804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
707376804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
707476804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
707576804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
707676804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
707776804d28SArend Van Spriel  *	status for a FILS connection.
707876804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
707976804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
708076804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
708176804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
708276804d28SArend Van Spriel  */
708376804d28SArend Van Spriel struct cfg80211_fils_resp_params {
708476804d28SArend Van Spriel 	const u8 *kek;
708576804d28SArend Van Spriel 	size_t kek_len;
708676804d28SArend Van Spriel 	bool update_erp_next_seq_num;
708776804d28SArend Van Spriel 	u16 erp_next_seq_num;
708876804d28SArend Van Spriel 	const u8 *pmk;
708976804d28SArend Van Spriel 	size_t pmk_len;
709076804d28SArend Van Spriel 	const u8 *pmkid;
709176804d28SArend Van Spriel };
709276804d28SArend Van Spriel 
709376804d28SArend Van Spriel /**
70945349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
70955349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
70965349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
70975349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
70985349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
70995349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
71005349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
71015349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
71025349a0f7SVidyullatha Kanchanapally  *	case.
71035349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
71045349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
7105a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7106a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7107a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7108a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7109a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
71105349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
71115349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
71125349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
71135349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
711476804d28SArend Van Spriel  * @fils: FILS connection response parameters.
71155349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
71165349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
71175349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
71185349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
71195349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
71205349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
71215349a0f7SVidyullatha Kanchanapally  */
71225349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
71235349a0f7SVidyullatha Kanchanapally 	int status;
71245349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
71255349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
71265349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
71275349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
71285349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
71295349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
713076804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
71315349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
71325349a0f7SVidyullatha Kanchanapally };
71335349a0f7SVidyullatha Kanchanapally 
71345349a0f7SVidyullatha Kanchanapally /**
71355349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
71365349a0f7SVidyullatha Kanchanapally  *
71375349a0f7SVidyullatha Kanchanapally  * @dev: network device
71385349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
71395349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
71405349a0f7SVidyullatha Kanchanapally  *
71415349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
71425349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
71435349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
71445349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
71455349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
71465349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
71475349a0f7SVidyullatha Kanchanapally  */
71485349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
71495349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
71505349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
71515349a0f7SVidyullatha Kanchanapally 
71525349a0f7SVidyullatha Kanchanapally /**
7153e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
7154e7054989SKanchanapally, Vidyullatha  *
7155e7054989SKanchanapally, Vidyullatha  * @dev: network device
7156e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
7157a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
7158a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7159a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7160a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7161a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7162a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
7163e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
7164e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
7165e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
7166e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
7167c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7168e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7169c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
7170c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
7171c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
7172c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
7173c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
7174c88215d7SJouni Malinen  *	case.
7175e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
71763093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
71773093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
71783093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
71793093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
71803093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
71813093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
7182e7054989SKanchanapally, Vidyullatha  *
7183c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7184c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7185c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
71865349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
71875349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
71885349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7189e7054989SKanchanapally, Vidyullatha  */
71905349a0f7SVidyullatha Kanchanapally static inline void
71915349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7192e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
7193e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
71943093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
71955349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
71965349a0f7SVidyullatha Kanchanapally {
71975349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
71985349a0f7SVidyullatha Kanchanapally 
71995349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
72005349a0f7SVidyullatha Kanchanapally 	params.status = status;
72015349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
72025349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
72035349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
72045349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
72055349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
72065349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
72075349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
72085349a0f7SVidyullatha Kanchanapally 
72095349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
72105349a0f7SVidyullatha Kanchanapally }
7211e7054989SKanchanapally, Vidyullatha 
7212e7054989SKanchanapally, Vidyullatha /**
7213b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
7214b23aa676SSamuel Ortiz  *
7215b23aa676SSamuel Ortiz  * @dev: network device
7216b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
7217b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
7218b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
7219b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
7220b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
7221c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7222b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7223b23aa676SSamuel Ortiz  *	the real status code for failures.
7224b23aa676SSamuel Ortiz  * @gfp: allocation flags
7225b23aa676SSamuel Ortiz  *
7226c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7227c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7228c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
72295349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
72305349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7231b23aa676SSamuel Ortiz  */
7232e7054989SKanchanapally, Vidyullatha static inline void
7233e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7234b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
7235b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
7236e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
7237e7054989SKanchanapally, Vidyullatha {
7238e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
72393093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
72403093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
7241e7054989SKanchanapally, Vidyullatha }
7242b23aa676SSamuel Ortiz 
7243b23aa676SSamuel Ortiz /**
7244bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7245bf1ecd21SJouni Malinen  *
7246bf1ecd21SJouni Malinen  * @dev: network device
7247bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
7248bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
7249bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
7250bf1ecd21SJouni Malinen  * @gfp: allocation flags
72513093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
7252bf1ecd21SJouni Malinen  *
7253bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
7254bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
7255bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
7256bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
72575349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
72585349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
72595349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7260bf1ecd21SJouni Malinen  */
7261bf1ecd21SJouni Malinen static inline void
7262bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
72633093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
72643093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
7265bf1ecd21SJouni Malinen {
7266bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
72673093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
7268bf1ecd21SJouni Malinen }
7269bf1ecd21SJouni Malinen 
7270bf1ecd21SJouni Malinen /**
727129ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
727229ce6ecbSAvraham Stern  *
727329ce6ecbSAvraham Stern  * @channel: the channel of the new AP
727429ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
727529ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
727629ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
727729ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
727829ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
727929ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
7280e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
728129ce6ecbSAvraham Stern  */
728229ce6ecbSAvraham Stern struct cfg80211_roam_info {
728329ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
728429ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
728529ce6ecbSAvraham Stern 	const u8 *bssid;
728629ce6ecbSAvraham Stern 	const u8 *req_ie;
728729ce6ecbSAvraham Stern 	size_t req_ie_len;
728829ce6ecbSAvraham Stern 	const u8 *resp_ie;
728929ce6ecbSAvraham Stern 	size_t resp_ie_len;
7290e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
729129ce6ecbSAvraham Stern };
729229ce6ecbSAvraham Stern 
729329ce6ecbSAvraham Stern /**
7294b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
7295b23aa676SSamuel Ortiz  *
7296b23aa676SSamuel Ortiz  * @dev: network device
729729ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
7298b23aa676SSamuel Ortiz  * @gfp: allocation flags
7299b23aa676SSamuel Ortiz  *
730029ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
730129ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
730229ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
730329ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
730429ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
730529ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
730629ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7307adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
730829ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7309e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
7310adbde344SVasanthakumar Thiagarajan  */
731129ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
731229ce6ecbSAvraham Stern 		     gfp_t gfp);
7313adbde344SVasanthakumar Thiagarajan 
7314adbde344SVasanthakumar Thiagarajan /**
7315503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
7316503c1fb9SAvraham Stern  *
7317503c1fb9SAvraham Stern  * @dev: network device
7318503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
7319503c1fb9SAvraham Stern  * @gfp: allocation flags
7320503c1fb9SAvraham Stern  *
7321503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
7322503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
7323503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
7324503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
7325503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7326503c1fb9SAvraham Stern  * indicate the 802.11 association.
7327503c1fb9SAvraham Stern  */
7328503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7329503c1fb9SAvraham Stern 			      gfp_t gfp);
7330503c1fb9SAvraham Stern 
7331503c1fb9SAvraham Stern /**
7332b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
7333b23aa676SSamuel Ortiz  *
7334b23aa676SSamuel Ortiz  * @dev: network device
7335b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7336b23aa676SSamuel Ortiz  * @ie_len: length of IEs
7337b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
733880279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
7339b23aa676SSamuel Ortiz  * @gfp: allocation flags
7340b23aa676SSamuel Ortiz  *
7341b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
7342b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
7343b23aa676SSamuel Ortiz  */
7344b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
734580279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
734680279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
7347b23aa676SSamuel Ortiz 
73489588bbd5SJouni Malinen /**
73499588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
735071bbc994SJohannes Berg  * @wdev: wireless device
73519588bbd5SJouni Malinen  * @cookie: the request cookie
73529588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
73539588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
73549588bbd5SJouni Malinen  *	channel
73559588bbd5SJouni Malinen  * @gfp: allocation flags
73569588bbd5SJouni Malinen  */
735771bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
73589588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
73599588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
73609588bbd5SJouni Malinen 
73619588bbd5SJouni Malinen /**
73629588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
736371bbc994SJohannes Berg  * @wdev: wireless device
73649588bbd5SJouni Malinen  * @cookie: the request cookie
73659588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
73669588bbd5SJouni Malinen  * @gfp: allocation flags
73679588bbd5SJouni Malinen  */
736871bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
73699588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
73709588bbd5SJouni Malinen 					gfp_t gfp);
7371b23aa676SSamuel Ortiz 
73728689c051SArend van Spriel /**
73731c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
73741c38c7f2SJames Prestwood  * @wdev: wireless device
73751c38c7f2SJames Prestwood  * @cookie: the requested cookie
73761c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
73771c38c7f2SJames Prestwood  * @gfp: allocation flags
73781c38c7f2SJames Prestwood  */
73791c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
73801c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
73811c38c7f2SJames Prestwood 
73821c38c7f2SJames Prestwood /**
73838689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
73848689c051SArend van Spriel  *
73858689c051SArend van Spriel  * @sinfo: the station information
73868689c051SArend van Spriel  * @gfp: allocation flags
73878689c051SArend van Spriel  */
73888689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
738998b62183SJohannes Berg 
739098b62183SJohannes Berg /**
73917ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
73927ea3e110SJohannes Berg  * @sinfo: the station information
73937ea3e110SJohannes Berg  *
73947ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
73957ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
73967ea3e110SJohannes Berg  * the stack.)
73977ea3e110SJohannes Berg  */
73987ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
73997ea3e110SJohannes Berg {
74007ea3e110SJohannes Berg 	kfree(sinfo->pertid);
74017ea3e110SJohannes Berg }
74027ea3e110SJohannes Berg 
74037ea3e110SJohannes Berg /**
740498b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
740598b62183SJohannes Berg  *
740698b62183SJohannes Berg  * @dev: the netdev
740798b62183SJohannes Berg  * @mac_addr: the station's address
740898b62183SJohannes Berg  * @sinfo: the station information
740998b62183SJohannes Berg  * @gfp: allocation flags
741098b62183SJohannes Berg  */
741198b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
741298b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
741398b62183SJohannes Berg 
7414026331c4SJouni Malinen /**
7415cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7416cf5ead82SJohannes Berg  * @dev: the netdev
7417cf5ead82SJohannes Berg  * @mac_addr: the station's address
7418cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
7419cf5ead82SJohannes Berg  * @gfp: allocation flags
7420cf5ead82SJohannes Berg  */
7421cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7422cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
7423cf5ead82SJohannes Berg 
7424cf5ead82SJohannes Berg /**
7425ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
7426ec15e68bSJouni Malinen  *
7427ec15e68bSJouni Malinen  * @dev: the netdev
7428ec15e68bSJouni Malinen  * @mac_addr: the station's address
7429ec15e68bSJouni Malinen  * @gfp: allocation flags
7430ec15e68bSJouni Malinen  */
7431cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
7432cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
7433cf5ead82SJohannes Berg {
7434cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7435cf5ead82SJohannes Berg }
7436ec15e68bSJouni Malinen 
7437ec15e68bSJouni Malinen /**
7438ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
7439ed44a951SPandiyarajan Pitchaimuthu  *
7440ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
7441ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
7442ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
7443ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
7444ed44a951SPandiyarajan Pitchaimuthu  *
7445ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
7446ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
7447ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
7448ed44a951SPandiyarajan Pitchaimuthu  *
7449ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
7450ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
7451ed44a951SPandiyarajan Pitchaimuthu  */
7452ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7453ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
7454ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
7455ed44a951SPandiyarajan Pitchaimuthu 
7456ed44a951SPandiyarajan Pitchaimuthu /**
7457e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7458e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
7459e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
7460e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7461e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
7462e76fede8SThomas Pedersen  * @len: length of the frame data
7463e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7464e76fede8SThomas Pedersen  *
7465e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
7466e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
7467e76fede8SThomas Pedersen  *
7468e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
7469e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
7470e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
7471e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
7472e76fede8SThomas Pedersen  */
7473e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7474e76fede8SThomas Pedersen 			  const u8 *buf, size_t len, u32 flags);
7475e76fede8SThomas Pedersen 
7476e76fede8SThomas Pedersen /**
74772e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
747871bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
7479026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
74806c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
74812e161f78SJohannes Berg  * @buf: Management frame (header + body)
7482026331c4SJouni Malinen  * @len: length of the frame data
748319504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
74842e161f78SJohannes Berg  *
74850ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
74860ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
74870ae997dcSYacine Belkadi  *
74880ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
74892e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
74902e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
74912e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
7492026331c4SJouni Malinen  */
7493e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7494e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
7495e76fede8SThomas Pedersen 				    u32 flags)
7496e76fede8SThomas Pedersen {
7497e76fede8SThomas Pedersen 	return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7498e76fede8SThomas Pedersen 				    flags);
7499e76fede8SThomas Pedersen }
7500026331c4SJouni Malinen 
7501026331c4SJouni Malinen /**
75022e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
750371bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
75042e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
75052e161f78SJohannes Berg  * @buf: Management frame (header + body)
7506026331c4SJouni Malinen  * @len: length of the frame data
7507026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
7508026331c4SJouni Malinen  * @gfp: context flags
7509026331c4SJouni Malinen  *
75102e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
75112e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7512026331c4SJouni Malinen  * transmission attempt.
7513026331c4SJouni Malinen  */
751471bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7515026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
7516026331c4SJouni Malinen 
7517dca9ca2dSMarkus Theil /**
7518dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
7519dca9ca2dSMarkus Theil  *                                   port frames
7520dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
7521dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7522dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
7523dca9ca2dSMarkus Theil  * @len: length of the frame data
7524dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
7525dca9ca2dSMarkus Theil  * @gfp: context flags
7526dca9ca2dSMarkus Theil  *
7527dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
7528dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7529dca9ca2dSMarkus Theil  * the transmission attempt.
7530dca9ca2dSMarkus Theil  */
7531dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7532dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
7533dca9ca2dSMarkus Theil 				     gfp_t gfp);
7534d6dc1a38SJuuso Oikarinen 
7535d6dc1a38SJuuso Oikarinen /**
75366a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
75376a671a50SDenis Kenzior  * @dev: The device the frame matched to
7538a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
7539a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
7540a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
7541a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
7542a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
75436a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
75446a671a50SDenis Kenzior  *
75456a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
75466a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
75476a671a50SDenis Kenzior  * control port frames over nl80211.
75486a671a50SDenis Kenzior  *
75496a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
75506a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
75516a671a50SDenis Kenzior  *
75526a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
75536a671a50SDenis Kenzior  */
75546a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
7555a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
75566a671a50SDenis Kenzior 
75576a671a50SDenis Kenzior /**
7558d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7559d6dc1a38SJuuso Oikarinen  * @dev: network device
7560d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
7561bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
7562d6dc1a38SJuuso Oikarinen  * @gfp: context flags
7563d6dc1a38SJuuso Oikarinen  *
7564d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
7565d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
7566d6dc1a38SJuuso Oikarinen  */
7567d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
7568d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
7569bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
7570d6dc1a38SJuuso Oikarinen 
7571c063dbf5SJohannes Berg /**
7572c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7573c063dbf5SJohannes Berg  * @dev: network device
7574c063dbf5SJohannes Berg  * @peer: peer's MAC address
7575c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
7576c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
7577c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
7578c063dbf5SJohannes Berg  * @gfp: context flags
7579c063dbf5SJohannes Berg  */
7580c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7581c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
7582c063dbf5SJohannes Berg 
7583e5497d76SJohannes Berg /**
758484f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
758584f10708SThomas Pedersen  * @dev: network device
758684f10708SThomas Pedersen  * @peer: peer's MAC address
758784f10708SThomas Pedersen  * @num_packets: how many packets were lost
758884f10708SThomas Pedersen  * @rate: % of packets which failed transmission
758984f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
759084f10708SThomas Pedersen  * @gfp: context flags
759184f10708SThomas Pedersen  *
759284f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
759384f10708SThomas Pedersen  * given interval is exceeded.
759484f10708SThomas Pedersen  */
759584f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
759684f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
759784f10708SThomas Pedersen 
759884f10708SThomas Pedersen /**
759998f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
760098f03342SJohannes Berg  * @dev: network device
760198f03342SJohannes Berg  * @gfp: context flags
760298f03342SJohannes Berg  *
760398f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
760498f03342SJohannes Berg  */
760598f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
760698f03342SJohannes Berg 
760798f03342SJohannes Berg /**
76085b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
76095b97f49dSJohannes Berg  * @wiphy: the wiphy
76105b97f49dSJohannes Berg  * @chandef: chandef for the current channel
76115b97f49dSJohannes Berg  * @gfp: context flags
76125b97f49dSJohannes Berg  *
76135b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
76145b97f49dSJohannes Berg  */
76155b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
76165b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
76175b97f49dSJohannes Berg 
76185b97f49dSJohannes Berg /**
7619466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7620466b9936Stamizhr@codeaurora.org  * @dev: network device
7621466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
7622466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
7623466b9936Stamizhr@codeaurora.org  * @gfp: context flags
7624466b9936Stamizhr@codeaurora.org  *
7625466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
7626466b9936Stamizhr@codeaurora.org  * frame.
7627466b9936Stamizhr@codeaurora.org  */
7628466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7629466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
7630466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
7631466b9936Stamizhr@codeaurora.org 
7632466b9936Stamizhr@codeaurora.org /**
76335b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
76345b97f49dSJohannes Berg  * @netdev: network device
76355b97f49dSJohannes Berg  * @chandef: chandef for the current channel
76365b97f49dSJohannes Berg  * @event: type of event
76375b97f49dSJohannes Berg  * @gfp: context flags
76385b97f49dSJohannes Berg  *
76395b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
76405b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
76415b97f49dSJohannes Berg  * also by full-MAC drivers.
76425b97f49dSJohannes Berg  */
76435b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
76445b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
76455b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
76465b97f49dSJohannes Berg 
7647*bc2dfc02SLorenzo Bianconi /**
7648*bc2dfc02SLorenzo Bianconi  * cfg80211_offchan_cac_event - Channel Availability Check (CAC) offchan event
7649*bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
7650*bc2dfc02SLorenzo Bianconi  * @chandef: chandef for the current channel
7651*bc2dfc02SLorenzo Bianconi  * @event: type of event
7652*bc2dfc02SLorenzo Bianconi  *
7653*bc2dfc02SLorenzo Bianconi  * This function is called when a Channel Availability Check (CAC) is finished,
7654*bc2dfc02SLorenzo Bianconi  * started or aborted by a offchannel dedicated chain.
7655*bc2dfc02SLorenzo Bianconi  *
7656*bc2dfc02SLorenzo Bianconi  * Note that this acquires the wiphy lock.
7657*bc2dfc02SLorenzo Bianconi  */
7658*bc2dfc02SLorenzo Bianconi void cfg80211_offchan_cac_event(struct wiphy *wiphy,
7659*bc2dfc02SLorenzo Bianconi 				const struct cfg80211_chan_def *chandef,
7660*bc2dfc02SLorenzo Bianconi 				enum nl80211_radar_event event);
76615b97f49dSJohannes Berg 
76625b97f49dSJohannes Berg /**
7663e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7664e5497d76SJohannes Berg  * @dev: network device
7665e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
7666e5497d76SJohannes Berg  * @replay_ctr: new replay counter
7667af71ff85SJohannes Berg  * @gfp: allocation flags
7668e5497d76SJohannes Berg  */
7669e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7670e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
7671e5497d76SJohannes Berg 
7672c9df56b4SJouni Malinen /**
7673c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7674c9df56b4SJouni Malinen  * @dev: network device
7675c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
7676c9df56b4SJouni Malinen  * @bssid: BSSID of AP
7677c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
7678c9df56b4SJouni Malinen  * @gfp: allocation flags
7679c9df56b4SJouni Malinen  */
7680c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7681c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
7682c9df56b4SJouni Malinen 
768328946da7SJohannes Berg /**
768428946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
768528946da7SJohannes Berg  * @dev: The device the frame matched to
768628946da7SJohannes Berg  * @addr: the transmitter address
768728946da7SJohannes Berg  * @gfp: context flags
768828946da7SJohannes Berg  *
768928946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
769028946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
769128946da7SJohannes Berg  * sender.
76920ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
769328946da7SJohannes Berg  * for a reason other than not having a subscription.)
769428946da7SJohannes Berg  */
769528946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
769628946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
769728946da7SJohannes Berg 
76987f6cf311SJohannes Berg /**
7699b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7700b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
7701b92ab5d8SJohannes Berg  * @addr: the transmitter address
7702b92ab5d8SJohannes Berg  * @gfp: context flags
7703b92ab5d8SJohannes Berg  *
7704b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
7705b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
7706b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
7707b92ab5d8SJohannes Berg  * station to avoid event flooding.
77080ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
7709b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
7710b92ab5d8SJohannes Berg  */
7711b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7712b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
7713b92ab5d8SJohannes Berg 
7714b92ab5d8SJohannes Berg /**
77157f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
77167f6cf311SJohannes Berg  * @dev: the device the probe was sent on
77177f6cf311SJohannes Berg  * @addr: the address of the peer
77187f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
77197f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
7720c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
7721c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
77227f6cf311SJohannes Berg  * @gfp: allocation flags
77237f6cf311SJohannes Berg  */
77247f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7725c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
7726c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
77277f6cf311SJohannes Berg 
77285e760230SJohannes Berg /**
7729e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
7730e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
7731e76fede8SThomas Pedersen  * @frame: the frame
7732e76fede8SThomas Pedersen  * @len: length of the frame
7733e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
7734e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7735e76fede8SThomas Pedersen  *
7736e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
7737e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
7738e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
7739e76fede8SThomas Pedersen  */
7740e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7741e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
7742e76fede8SThomas Pedersen 
7743e76fede8SThomas Pedersen /**
77445e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
77455e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
77465e760230SJohannes Berg  * @frame: the frame
77475e760230SJohannes Berg  * @len: length of the frame
77485e760230SJohannes Berg  * @freq: frequency the frame was received on
77496c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
77505e760230SJohannes Berg  *
77515e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
77525e760230SJohannes Berg  * received. It is not useful to call this when there is no
77535e760230SJohannes Berg  * netdev that is in AP/GO mode.
77545e760230SJohannes Berg  */
7755e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
77565e760230SJohannes Berg 					       const u8 *frame, size_t len,
7757e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
7758e76fede8SThomas Pedersen {
7759e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7760e76fede8SThomas Pedersen 					sig_dbm);
7761e76fede8SThomas Pedersen }
77625e760230SJohannes Berg 
7763d58e7e37SJohannes Berg /**
7764683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
776554858ee5SAlexander Simon  * @wiphy: the wiphy
7766683b6d3bSJohannes Berg  * @chandef: the channel definition
7767174e0cd2SIlan Peer  * @iftype: interface type
7768d58e7e37SJohannes Berg  *
77690ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
77700ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
777154858ee5SAlexander Simon  */
7772683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7773174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
7774174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
777554858ee5SAlexander Simon 
7776923b352fSArik Nemtsov /**
7777923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7778923b352fSArik Nemtsov  * @wiphy: the wiphy
7779923b352fSArik Nemtsov  * @chandef: the channel definition
7780923b352fSArik Nemtsov  * @iftype: interface type
7781923b352fSArik Nemtsov  *
7782923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
7783923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
7784923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
7785923b352fSArik Nemtsov  * more permissive conditions.
7786923b352fSArik Nemtsov  *
7787a05829a7SJohannes Berg  * Requires the wiphy mutex to be held.
7788923b352fSArik Nemtsov  */
7789923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7790923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
7791923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
7792923b352fSArik Nemtsov 
77938097e149SThomas Pedersen /*
77945314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
77955314526bSThomas Pedersen  * @dev: the device which switched channels
7796683b6d3bSJohannes Berg  * @chandef: the new channel definition
77975314526bSThomas Pedersen  *
7798e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
7799e487eaebSSimon Wunderlich  * driver context!
78005314526bSThomas Pedersen  */
7801683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
7802683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
78035314526bSThomas Pedersen 
7804f8d7552eSLuciano Coelho /*
7805f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
7806f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
7807f8d7552eSLuciano Coelho  * @chandef: the future channel definition
7808f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
7809669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
7810f8d7552eSLuciano Coelho  *
7811f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
7812f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
7813f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
7814f8d7552eSLuciano Coelho  */
7815f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
7816f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
7817669b8413SJohannes Berg 				       u8 count, bool quiet);
7818f8d7552eSLuciano Coelho 
78191ce3e82bSJohannes Berg /**
78201ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
78211ce3e82bSJohannes Berg  *
78221ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
78231ce3e82bSJohannes Berg  * @band: band pointer to fill
78241ce3e82bSJohannes Berg  *
78251ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
78261ce3e82bSJohannes Berg  */
78271ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
782857fbcce3SJohannes Berg 				       enum nl80211_band *band);
78291ce3e82bSJohannes Berg 
7830a38700ddSArik Nemtsov /**
7831a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
7832a38700ddSArik Nemtsov  *
7833a38700ddSArik Nemtsov  * @chandef: the chandef to convert
7834a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
7835a38700ddSArik Nemtsov  *
7836a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
7837a38700ddSArik Nemtsov  */
7838a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7839a38700ddSArik Nemtsov 					  u8 *op_class);
7840a38700ddSArik Nemtsov 
7841934f4c7dSThomas Pedersen /**
7842934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7843934f4c7dSThomas Pedersen  *
7844934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
7845934f4c7dSThomas Pedersen  *
7846934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
7847934f4c7dSThomas Pedersen  */
7848934f4c7dSThomas Pedersen static inline u32
7849934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7850934f4c7dSThomas Pedersen {
7851934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7852934f4c7dSThomas Pedersen }
7853934f4c7dSThomas Pedersen 
78545314526bSThomas Pedersen /*
78553475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
78563475b094SJouni Malinen  * @dev: the device on which the operation is requested
78573475b094SJouni Malinen  * @peer: the MAC address of the peer device
78583475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
78593475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
78603475b094SJouni Malinen  * @reason_code: the reason code for teardown request
78613475b094SJouni Malinen  * @gfp: allocation flags
78623475b094SJouni Malinen  *
78633475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
78643475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
78653475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
78663475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
78673475b094SJouni Malinen  * based on traffic and signal strength for a peer).
78683475b094SJouni Malinen  */
78693475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
78703475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
78713475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
78723475b094SJouni Malinen 
78733475b094SJouni Malinen /*
78748097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
78758097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
78768097e149SThomas Pedersen  *
78778097e149SThomas Pedersen  * return 0 if MCS index >= 32
78788097e149SThomas Pedersen  */
78798eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
78808097e149SThomas Pedersen 
788198104fdeSJohannes Berg /**
788298104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
788398104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
788498104fdeSJohannes Berg  *
78852fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
78862fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
78872fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
78882fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
78892fe8ef10SJohannes Berg  * is unbound from the driver.
789098104fdeSJohannes Berg  *
7891a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
789298104fdeSJohannes Berg  */
789398104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
789498104fdeSJohannes Berg 
78950ee45355SJohannes Berg /**
78962fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
78972fe8ef10SJohannes Berg  * @dev: the netdev to register
78982fe8ef10SJohannes Berg  *
78992fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
79002fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
79012fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
79022fe8ef10SJohannes Berg  * instead as well.
7903a05829a7SJohannes Berg  *
7904a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
79052fe8ef10SJohannes Berg  */
79062fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
79072fe8ef10SJohannes Berg 
79082fe8ef10SJohannes Berg /**
79092fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
79102fe8ef10SJohannes Berg  * @dev: the netdev to register
79112fe8ef10SJohannes Berg  *
79122fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
79132fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
79142fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
79152fe8ef10SJohannes Berg  * usable instead as well.
7916a05829a7SJohannes Berg  *
7917a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
79182fe8ef10SJohannes Berg  */
79192fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
79202fe8ef10SJohannes Berg {
79212fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
79222fe8ef10SJohannes Berg }
79232fe8ef10SJohannes Berg 
79242fe8ef10SJohannes Berg /**
7925b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
7926355199e0SJouni Malinen  * @ies: FT IEs
7927355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
7928355199e0SJouni Malinen  * @target_ap: target AP's MAC address
7929355199e0SJouni Malinen  * @ric_ies: RIC IE
7930355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
7931355199e0SJouni Malinen  */
7932355199e0SJouni Malinen struct cfg80211_ft_event_params {
7933355199e0SJouni Malinen 	const u8 *ies;
7934355199e0SJouni Malinen 	size_t ies_len;
7935355199e0SJouni Malinen 	const u8 *target_ap;
7936355199e0SJouni Malinen 	const u8 *ric_ies;
7937355199e0SJouni Malinen 	size_t ric_ies_len;
7938355199e0SJouni Malinen };
7939355199e0SJouni Malinen 
7940355199e0SJouni Malinen /**
7941355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7942355199e0SJouni Malinen  * @netdev: network device
7943355199e0SJouni Malinen  * @ft_event: IE information
7944355199e0SJouni Malinen  */
7945355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
7946355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
7947355199e0SJouni Malinen 
7948355199e0SJouni Malinen /**
79490ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
79500ee45355SJohannes Berg  * @ies: the input IE buffer
79510ee45355SJohannes Berg  * @len: the input length
79520ee45355SJohannes Berg  * @attr: the attribute ID to find
79530ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
79540ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
79550ee45355SJohannes Berg  * @bufsize: size of the output buffer
79560ee45355SJohannes Berg  *
79570ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
79580ee45355SJohannes Berg  * copies its contents to the given buffer.
79590ee45355SJohannes Berg  *
79600ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
79610ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
79620ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
79630ee45355SJohannes Berg  */
7964c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7965c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
7966c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
79670ee45355SJohannes Berg 
7968cd8f7cb4SJohannes Berg /**
796929464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
797029464cccSJohannes Berg  * @ies: the IE buffer
797129464cccSJohannes Berg  * @ielen: the length of the IE buffer
797229464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
79732512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
79742512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
797529464cccSJohannes Berg  * @n_ids: the size of the element ID array
797629464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
797729464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
797829464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
797929464cccSJohannes Berg  *
798029464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
798129464cccSJohannes Berg  * variable to point to the location where the buffer should be
798229464cccSJohannes Berg  * split.
798329464cccSJohannes Berg  *
798429464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
798529464cccSJohannes Berg  * has to be guaranteed by the caller!
798629464cccSJohannes Berg  *
798729464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
798829464cccSJohannes Berg  * correctly, if not the result of using this function will not
798929464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
799029464cccSJohannes Berg  *
799129464cccSJohannes Berg  * The function returns the offset where the next part of the
799229464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
799329464cccSJohannes Berg  * of the buffer should be used.
799429464cccSJohannes Berg  */
799529464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
799629464cccSJohannes Berg 			      const u8 *ids, int n_ids,
799729464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
799829464cccSJohannes Berg 			      size_t offset);
799929464cccSJohannes Berg 
800029464cccSJohannes Berg /**
800129464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
800229464cccSJohannes Berg  * @ies: the IE buffer
800329464cccSJohannes Berg  * @ielen: the length of the IE buffer
800429464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
80052512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
80062512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
800729464cccSJohannes Berg  * @n_ids: the size of the element ID array
800829464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
800929464cccSJohannes Berg  *
801029464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
801129464cccSJohannes Berg  * variable to point to the location where the buffer should be
801229464cccSJohannes Berg  * split.
801329464cccSJohannes Berg  *
801429464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
801529464cccSJohannes Berg  * has to be guaranteed by the caller!
801629464cccSJohannes Berg  *
801729464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
801829464cccSJohannes Berg  * correctly, if not the result of using this function will not
801929464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
802029464cccSJohannes Berg  *
802129464cccSJohannes Berg  * The function returns the offset where the next part of the
802229464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
802329464cccSJohannes Berg  * of the buffer should be used.
802429464cccSJohannes Berg  */
80250483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
80260483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
80270483eeacSJohannes Berg {
80280483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
80290483eeacSJohannes Berg }
803029464cccSJohannes Berg 
803129464cccSJohannes Berg /**
8032cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
8033cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
8034cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
8035cd8f7cb4SJohannes Berg  * @gfp: allocation flags
8036cd8f7cb4SJohannes Berg  *
8037cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
8038cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
8039cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
8040cd8f7cb4SJohannes Berg  * else caused the wakeup.
8041cd8f7cb4SJohannes Berg  */
8042cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
8043cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
8044cd8f7cb4SJohannes Berg 				   gfp_t gfp);
8045cd8f7cb4SJohannes Berg 
80465de17984SArend van Spriel /**
80475de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
80485de17984SArend van Spriel  *
80495de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
805003f831a6SRobert P. J. Day  * @gfp: allocation flags
80515de17984SArend van Spriel  *
80525de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
80535de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
80545de17984SArend van Spriel  * by .crit_proto_start() has expired.
80555de17984SArend van Spriel  */
80565de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
80575de17984SArend van Spriel 
8058bdfbec2dSIlan Peer /**
8059bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
8060bdfbec2dSIlan Peer  * @wiphy: the wiphy
8061bdfbec2dSIlan Peer  *
8062bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
8063bdfbec2dSIlan Peer  */
8064bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
8065bdfbec2dSIlan Peer 
8066cb2d956dSLuciano Coelho /**
8067cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
8068cb2d956dSLuciano Coelho  *
8069cb2d956dSLuciano Coelho  * @wiphy: the wiphy
8070e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
8071cb2d956dSLuciano Coelho  *
8072cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
8073cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
8074cb2d956dSLuciano Coelho  * the interface combinations.
8075cb2d956dSLuciano Coelho  */
8076cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
8077e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
8078cb2d956dSLuciano Coelho 
807965a124ddSMichal Kazior /**
808065a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
808165a124ddSMichal Kazior  *
808265a124ddSMichal Kazior  * @wiphy: the wiphy
8083e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
808465a124ddSMichal Kazior  * @iter: function to call for each matching combination
808565a124ddSMichal Kazior  * @data: pointer to pass to iter function
808665a124ddSMichal Kazior  *
808765a124ddSMichal Kazior  * This function can be called by the driver to check what possible
808865a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
808965a124ddSMichal Kazior  * purposes.
809065a124ddSMichal Kazior  */
809165a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
8092e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
809365a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
809465a124ddSMichal Kazior 					    void *data),
809565a124ddSMichal Kazior 			       void *data);
809665a124ddSMichal Kazior 
8097f04c2203SMichal Kazior /*
8098f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
8099f04c2203SMichal Kazior  *
8100f04c2203SMichal Kazior  * @wiphy: the wiphy
8101f04c2203SMichal Kazior  * @wdev: wireless device
8102f04c2203SMichal Kazior  * @gfp: context flags
8103f04c2203SMichal Kazior  *
8104f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
8105f04c2203SMichal Kazior  * disconnected.
8106f04c2203SMichal Kazior  *
8107f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
8108f04c2203SMichal Kazior  */
8109f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
8110f04c2203SMichal Kazior 			 gfp_t gfp);
8111f04c2203SMichal Kazior 
8112f6837ba8SJohannes Berg /**
8113f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
8114f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
8115f6837ba8SJohannes Berg  *
8116f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
8117f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
8118f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
8119f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
8120f6837ba8SJohannes Berg  *
8121f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
8122f6837ba8SJohannes Berg  * the driver while the function is running.
8123f6837ba8SJohannes Berg  */
8124f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
8125f6837ba8SJohannes Berg 
8126d75bb06bSGautam Kumar Shukla /**
8127d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
8128d75bb06bSGautam Kumar Shukla  *
8129d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8130d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8131d75bb06bSGautam Kumar Shukla  *
8132d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8133d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8134d75bb06bSGautam Kumar Shukla  */
8135d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
8136d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
8137d75bb06bSGautam Kumar Shukla {
8138d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
8139d75bb06bSGautam Kumar Shukla 
8140d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
8141d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
8142d75bb06bSGautam Kumar Shukla }
8143d75bb06bSGautam Kumar Shukla 
8144d75bb06bSGautam Kumar Shukla /**
8145d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
8146d75bb06bSGautam Kumar Shukla  *
8147d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8148d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8149d75bb06bSGautam Kumar Shukla  *
8150d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8151d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8152d75bb06bSGautam Kumar Shukla  */
8153d75bb06bSGautam Kumar Shukla static inline bool
8154d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
8155d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
8156d75bb06bSGautam Kumar Shukla {
8157d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
8158d75bb06bSGautam Kumar Shukla 
8159d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
8160d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
8161d75bb06bSGautam Kumar Shukla }
8162b7ffbd7eSJohannes Berg 
8163a442b761SAyala Beker /**
8164a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
8165a442b761SAyala Beker  * @f: NAN function that should be freed
8166a442b761SAyala Beker  *
8167a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
8168a442b761SAyala Beker  */
8169a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8170a442b761SAyala Beker 
817150bcd31dSAyala Beker /**
817250bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
817350bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
817450bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
817550bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
817650bcd31dSAyala Beker  *	 result.
817750bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
817850bcd31dSAyala Beker  * @inst_id: the local instance id
817950bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
818050bcd31dSAyala Beker  * @addr: the MAC address of the peer
818150bcd31dSAyala Beker  * @info_len: the length of the &info
818250bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
818350bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
818450bcd31dSAyala Beker  */
818550bcd31dSAyala Beker struct cfg80211_nan_match_params {
818650bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
818750bcd31dSAyala Beker 	u8 inst_id;
818850bcd31dSAyala Beker 	u8 peer_inst_id;
818950bcd31dSAyala Beker 	const u8 *addr;
819050bcd31dSAyala Beker 	u8 info_len;
819150bcd31dSAyala Beker 	const u8 *info;
819250bcd31dSAyala Beker 	u64 cookie;
819350bcd31dSAyala Beker };
819450bcd31dSAyala Beker 
819550bcd31dSAyala Beker /**
819650bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
819750bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
819850bcd31dSAyala Beker  * @match: match notification parameters
819950bcd31dSAyala Beker  * @gfp: allocation flags
820050bcd31dSAyala Beker  *
820150bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
820250bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
820350bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
820450bcd31dSAyala Beker  */
820550bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
820650bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
820750bcd31dSAyala Beker 
8208368e5a7bSAyala Beker /**
8209368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
8210368e5a7bSAyala Beker  *
8211368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
8212368e5a7bSAyala Beker  * @inst_id: the local instance id
8213368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8214368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
8215368e5a7bSAyala Beker  * @gfp: allocation flags
8216368e5a7bSAyala Beker  *
8217368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
8218368e5a7bSAyala Beker  */
8219368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8220368e5a7bSAyala Beker 				  u8 inst_id,
8221368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
8222368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
8223368e5a7bSAyala Beker 
8224b7ffbd7eSJohannes Berg /* ethtool helper */
8225b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
8226b7ffbd7eSJohannes Berg 
822740cbfa90SSrinivas Dasari /**
822840cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
822940cbfa90SSrinivas Dasari  * @netdev: network device
823040cbfa90SSrinivas Dasari  * @params: External authentication parameters
823140cbfa90SSrinivas Dasari  * @gfp: allocation flags
823240cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
823340cbfa90SSrinivas Dasari  */
823440cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
823540cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
823640cbfa90SSrinivas Dasari 				   gfp_t gfp);
823740cbfa90SSrinivas Dasari 
82389bb7e0f2SJohannes Berg /**
82399bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
82409bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
82419bb7e0f2SJohannes Berg  * @req: the original measurement request
82429bb7e0f2SJohannes Berg  * @result: the result data
82439bb7e0f2SJohannes Berg  * @gfp: allocation flags
82449bb7e0f2SJohannes Berg  */
82459bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
82469bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
82479bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
82489bb7e0f2SJohannes Berg 			  gfp_t gfp);
82499bb7e0f2SJohannes Berg 
82509bb7e0f2SJohannes Berg /**
82519bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
82529bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
82539bb7e0f2SJohannes Berg  * @req: the original measurement request
82549bb7e0f2SJohannes Berg  * @gfp: allocation flags
82559bb7e0f2SJohannes Berg  *
82569bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
82579bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
82589bb7e0f2SJohannes Berg  */
82599bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
82609bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
82619bb7e0f2SJohannes Berg 			    gfp_t gfp);
82629bb7e0f2SJohannes Berg 
8263e6f40511SManikanta Pubbisetty /**
8264e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
8265e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
8266e6f40511SManikanta Pubbisetty  * @iftype: interface type
8267e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8268e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
8269e6f40511SManikanta Pubbisetty  *
8270e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
8271e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
8272e6f40511SManikanta Pubbisetty  * check_swif is '1'.
8273e6f40511SManikanta Pubbisetty  */
8274e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8275e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
8276e6f40511SManikanta Pubbisetty 
8277e6f40511SManikanta Pubbisetty 
8278e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
8279e1db74fcSJoe Perches 
8280e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
8281e1db74fcSJoe Perches 
8282e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
82839c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
8284e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
82859c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
8286e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
82879c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
8288e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
82899c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
8290e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
82919c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
8292e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
82939c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
8294e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
82959c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
8296e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
82979c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
8298761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
8299761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
8300073730d7SJoe Perches 
8301a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
8302a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8303a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
8304a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8305a58d7525SStanislaw Gruszka 
83069c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
8307e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
83089c376639SJoe Perches 
8309e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
83109c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
8311e1db74fcSJoe Perches 
8312e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
8313e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
8314e1db74fcSJoe Perches #else
8315e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
8316e1db74fcSJoe Perches ({									\
8317e1db74fcSJoe Perches 	if (0)								\
8318e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
8319e1db74fcSJoe Perches 	0;								\
8320e1db74fcSJoe Perches })
8321e1db74fcSJoe Perches #endif
8322e1db74fcSJoe Perches 
8323e1db74fcSJoe Perches /*
8324e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8325e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
8326e1db74fcSJoe Perches  * file/line information and a backtrace.
8327e1db74fcSJoe Perches  */
8328e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
8329e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8330e1db74fcSJoe Perches 
8331cb74e977SSunil Dutt /**
8332cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8333cb74e977SSunil Dutt  * @netdev: network device
8334cb74e977SSunil Dutt  * @owe_info: peer's owe info
8335cb74e977SSunil Dutt  * @gfp: allocation flags
8336cb74e977SSunil Dutt  */
8337cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
8338cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
8339cb74e977SSunil Dutt 				    gfp_t gfp);
8340cb74e977SSunil Dutt 
83412f1805eaSEmmanuel Grumbach /**
83422f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
83432f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
83442f1805eaSEmmanuel Grumbach  */
83452f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
83462f1805eaSEmmanuel Grumbach 
83470d2ab3aeSJohn Crispin /**
83480d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
83490d2ab3aeSJohn Crispin  * @dev: network device
83500d2ab3aeSJohn Crispin  * @gfp: allocation flags
83510d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
83520d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
83530d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
83540d2ab3aeSJohn Crispin  */
83550d2ab3aeSJohn Crispin int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp,
83560d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
83570d2ab3aeSJohn Crispin 			      u64 color_bitmap);
83580d2ab3aeSJohn Crispin 
83590d2ab3aeSJohn Crispin /**
83600d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
83610d2ab3aeSJohn Crispin  * @dev: network device
83620d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
83630d2ab3aeSJohn Crispin  */
83640d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
83650d2ab3aeSJohn Crispin 						       u64 color_bitmap)
83660d2ab3aeSJohn Crispin {
83670d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
83680d2ab3aeSJohn Crispin 					 NL80211_CMD_OBSS_COLOR_COLLISION,
83690d2ab3aeSJohn Crispin 					 0, color_bitmap);
83700d2ab3aeSJohn Crispin }
83710d2ab3aeSJohn Crispin 
83720d2ab3aeSJohn Crispin /**
83730d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
83740d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
83750d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
83760d2ab3aeSJohn Crispin  *
83770d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
83780d2ab3aeSJohn Crispin  */
83790d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
83800d2ab3aeSJohn Crispin 						       u8 count)
83810d2ab3aeSJohn Crispin {
83820d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
83830d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_STARTED,
83840d2ab3aeSJohn Crispin 					 count, 0);
83850d2ab3aeSJohn Crispin }
83860d2ab3aeSJohn Crispin 
83870d2ab3aeSJohn Crispin /**
83880d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
83890d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
83900d2ab3aeSJohn Crispin  *
83910d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
83920d2ab3aeSJohn Crispin  */
83930d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
83940d2ab3aeSJohn Crispin {
83950d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
83960d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_ABORTED,
83970d2ab3aeSJohn Crispin 					 0, 0);
83980d2ab3aeSJohn Crispin }
83990d2ab3aeSJohn Crispin 
84000d2ab3aeSJohn Crispin /**
84010d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
84020d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
84030d2ab3aeSJohn Crispin  *
84040d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
84050d2ab3aeSJohn Crispin  */
84060d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev)
84070d2ab3aeSJohn Crispin {
84080d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
84090d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
84100d2ab3aeSJohn Crispin 					 0, 0);
84110d2ab3aeSJohn Crispin }
84120d2ab3aeSJohn Crispin 
8413704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
8414