xref: /linux/include/net/cfg80211.h (revision 11c4a075db2f8774d37544342c8cb9752b4db9e1)
1704232c2SJohannes Berg #ifndef __NET_CFG80211_H
2704232c2SJohannes Berg #define __NET_CFG80211_H
3d3236553SJohannes Berg /*
4d3236553SJohannes Berg  * 802.11 device and configuration interface
5d3236553SJohannes Berg  *
6026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
7d3236553SJohannes Berg  *
8d3236553SJohannes Berg  * This program is free software; you can redistribute it and/or modify
9d3236553SJohannes Berg  * it under the terms of the GNU General Public License version 2 as
10d3236553SJohannes Berg  * published by the Free Software Foundation.
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13d3236553SJohannes Berg #include <linux/netdevice.h>
14d3236553SJohannes Berg #include <linux/debugfs.h>
15d3236553SJohannes Berg #include <linux/list.h>
16187f1882SPaul Gortmaker #include <linux/bug.h>
17704232c2SJohannes Berg #include <linux/netlink.h>
18704232c2SJohannes Berg #include <linux/skbuff.h>
1955682965SJohannes Berg #include <linux/nl80211.h>
202a519311SJohannes Berg #include <linux/if_ether.h>
212a519311SJohannes Berg #include <linux/ieee80211.h>
22d3236553SJohannes Berg #include <net/regulatory.h>
23d3236553SJohannes Berg 
24d70e9693SJohannes Berg /**
25d70e9693SJohannes Berg  * DOC: Introduction
26d70e9693SJohannes Berg  *
27d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
28d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
29d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
30d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
31d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
32d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
33d70e9693SJohannes Berg  *
34d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
35d70e9693SJohannes Berg  * use restrictions.
36d70e9693SJohannes Berg  */
37d70e9693SJohannes Berg 
38d70e9693SJohannes Berg 
39d70e9693SJohannes Berg /**
40d70e9693SJohannes Berg  * DOC: Device registration
41d70e9693SJohannes Berg  *
42d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
43d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
44d70e9693SJohannes Berg  * described below.
45d70e9693SJohannes Berg  *
46d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
47d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
48d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
49d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
50d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
51d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
52d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
53d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
54d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
55d70e9693SJohannes Berg  *
56d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
57d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
58d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
59d70e9693SJohannes Berg  */
60d70e9693SJohannes Berg 
619f5e8f6eSJohannes Berg struct wiphy;
629f5e8f6eSJohannes Berg 
63704232c2SJohannes Berg /*
64d3236553SJohannes Berg  * wireless hardware capability structures
65d3236553SJohannes Berg  */
66d3236553SJohannes Berg 
67d3236553SJohannes Berg /**
68d3236553SJohannes Berg  * enum ieee80211_band - supported frequency bands
69704232c2SJohannes Berg  *
70d3236553SJohannes Berg  * The bands are assigned this way because the supported
71d3236553SJohannes Berg  * bitrates differ in these bands.
72d3236553SJohannes Berg  *
73d3236553SJohannes Berg  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
74d3236553SJohannes Berg  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
753a0c52a6SVladimir Kondratiev  * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
76abe37c4bSJohannes Berg  * @IEEE80211_NUM_BANDS: number of defined bands
77d3236553SJohannes Berg  */
78d3236553SJohannes Berg enum ieee80211_band {
7913ae75b1SJouni Malinen 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
8013ae75b1SJouni Malinen 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
813a0c52a6SVladimir Kondratiev 	IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
82d3236553SJohannes Berg 
83d3236553SJohannes Berg 	/* keep last */
84d3236553SJohannes Berg 	IEEE80211_NUM_BANDS
85d3236553SJohannes Berg };
86d3236553SJohannes Berg 
87d3236553SJohannes Berg /**
88d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
89d3236553SJohannes Berg  *
90d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
91d3236553SJohannes Berg  *
92d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
93d3236553SJohannes Berg  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
94d3236553SJohannes Berg  *	on this channel.
95d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
96d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
97689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
98d3236553SJohannes Berg  * 	is not permitted.
99689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
100d3236553SJohannes Berg  * 	is not permitted.
10103f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
102d3236553SJohannes Berg  */
103d3236553SJohannes Berg enum ieee80211_channel_flags {
104d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
105d3236553SJohannes Berg 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
106d3236553SJohannes Berg 	IEEE80211_CHAN_NO_IBSS		= 1<<2,
107d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
108689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
109689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
11003f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
111d3236553SJohannes Berg };
112d3236553SJohannes Berg 
113038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
114689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
115038659e7SLuis R. Rodriguez 
116d3236553SJohannes Berg /**
117d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
118d3236553SJohannes Berg  *
119d3236553SJohannes Berg  * This structure describes a single channel for use
120d3236553SJohannes Berg  * with cfg80211.
121d3236553SJohannes Berg  *
122d3236553SJohannes Berg  * @center_freq: center frequency in MHz
123d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
124d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
125d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
126d3236553SJohannes Berg  *	code to support devices with additional restrictions
127d3236553SJohannes Berg  * @band: band this channel belongs to.
128d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
129d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
130eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
131d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
132d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
13377c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
134d3236553SJohannes Berg  * @orig_mag: internal use
135d3236553SJohannes Berg  * @orig_mpwr: internal use
136d3236553SJohannes Berg  */
137d3236553SJohannes Berg struct ieee80211_channel {
138d3236553SJohannes Berg 	enum ieee80211_band band;
139d3236553SJohannes Berg 	u16 center_freq;
140d3236553SJohannes Berg 	u16 hw_value;
141d3236553SJohannes Berg 	u32 flags;
142d3236553SJohannes Berg 	int max_antenna_gain;
143d3236553SJohannes Berg 	int max_power;
144eccc068eSHong Wu 	int max_reg_power;
145d3236553SJohannes Berg 	bool beacon_found;
146d3236553SJohannes Berg 	u32 orig_flags;
147d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
148d3236553SJohannes Berg };
149d3236553SJohannes Berg 
150d3236553SJohannes Berg /**
151d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
152d3236553SJohannes Berg  *
153d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
154d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
155d3236553SJohannes Berg  * different bands/PHY modes.
156d3236553SJohannes Berg  *
157d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
158d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
159d3236553SJohannes Berg  *	with CCK rates.
160d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
161d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
162d3236553SJohannes Berg  *	core code when registering the wiphy.
163d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
164d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
165d3236553SJohannes Berg  *	core code when registering the wiphy.
166d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
167d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
168d3236553SJohannes Berg  *	core code when registering the wiphy.
169d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
170d3236553SJohannes Berg  */
171d3236553SJohannes Berg enum ieee80211_rate_flags {
172d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
173d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
174d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
175d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
176d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
177d3236553SJohannes Berg };
178d3236553SJohannes Berg 
179d3236553SJohannes Berg /**
180d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
181d3236553SJohannes Berg  *
182d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
183d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
184d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
185d3236553SJohannes Berg  * passed around.
186d3236553SJohannes Berg  *
187d3236553SJohannes Berg  * @flags: rate-specific flags
188d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
189d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
190d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
191d3236553SJohannes Berg  *	short preamble is used
192d3236553SJohannes Berg  */
193d3236553SJohannes Berg struct ieee80211_rate {
194d3236553SJohannes Berg 	u32 flags;
195d3236553SJohannes Berg 	u16 bitrate;
196d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
197d3236553SJohannes Berg };
198d3236553SJohannes Berg 
199d3236553SJohannes Berg /**
200d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
201d3236553SJohannes Berg  *
202d3236553SJohannes Berg  * This structure describes most essential parameters needed
203d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
204d3236553SJohannes Berg  *
205d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
206d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
207d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
208d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
209d3236553SJohannes Berg  * @mcs: Supported MCS rates
210d3236553SJohannes Berg  */
211d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
212d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
213d3236553SJohannes Berg 	bool ht_supported;
214d3236553SJohannes Berg 	u8 ampdu_factor;
215d3236553SJohannes Berg 	u8 ampdu_density;
216d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
217d3236553SJohannes Berg };
218d3236553SJohannes Berg 
219d3236553SJohannes Berg /**
220bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
221bf0c111eSMahesh Palivela  *
222bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
223bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
224bf0c111eSMahesh Palivela  *
225bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
226bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
227bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
228bf0c111eSMahesh Palivela  */
229bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
230bf0c111eSMahesh Palivela 	bool vht_supported;
231bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
232bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
233bf0c111eSMahesh Palivela };
234bf0c111eSMahesh Palivela 
235bf0c111eSMahesh Palivela /**
236d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
237d3236553SJohannes Berg  *
238d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
239d3236553SJohannes Berg  * is able to operate in.
240d3236553SJohannes Berg  *
241d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
242d3236553SJohannes Berg  *	in this band.
243d3236553SJohannes Berg  * @band: the band this structure represents
244d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
245d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
246d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
247d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
248d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
249abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
250c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
251d3236553SJohannes Berg  */
252d3236553SJohannes Berg struct ieee80211_supported_band {
253d3236553SJohannes Berg 	struct ieee80211_channel *channels;
254d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
255d3236553SJohannes Berg 	enum ieee80211_band band;
256d3236553SJohannes Berg 	int n_channels;
257d3236553SJohannes Berg 	int n_bitrates;
258d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
259bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
260d3236553SJohannes Berg };
261d3236553SJohannes Berg 
262d3236553SJohannes Berg /*
263d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
264704232c2SJohannes Berg  */
265704232c2SJohannes Berg 
2662ec600d6SLuis Carlos Cobo /**
267d70e9693SJohannes Berg  * DOC: Actions and configuration
268d70e9693SJohannes Berg  *
269d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
270d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
271d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
272d70e9693SJohannes Berg  * operations use are described separately.
273d70e9693SJohannes Berg  *
274d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
275d70e9693SJohannes Berg  * information via some functions that drivers need to call.
276d70e9693SJohannes Berg  *
277d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
278d70e9693SJohannes Berg  * in a separate chapter.
279d70e9693SJohannes Berg  */
280d70e9693SJohannes Berg 
281d70e9693SJohannes Berg /**
2822ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
2838b787643SFelix Fietkau  * @use_4addr: use 4-address frames
2841c18f145SArend van Spriel  * @macaddr: address to use for this virtual interface. This will only
2851c18f145SArend van Spriel  * 	be used for non-netdevice interfaces. If this parameter is set
2861c18f145SArend van Spriel  * 	to zero address the driver may determine the address as needed.
2872ec600d6SLuis Carlos Cobo  */
2882ec600d6SLuis Carlos Cobo struct vif_params {
2898b787643SFelix Fietkau        int use_4addr;
2901c18f145SArend van Spriel        u8 macaddr[ETH_ALEN];
2912ec600d6SLuis Carlos Cobo };
2922ec600d6SLuis Carlos Cobo 
29341ade00fSJohannes Berg /**
29441ade00fSJohannes Berg  * struct key_params - key information
29541ade00fSJohannes Berg  *
29641ade00fSJohannes Berg  * Information about a key
29741ade00fSJohannes Berg  *
29841ade00fSJohannes Berg  * @key: key material
29941ade00fSJohannes Berg  * @key_len: length of key material
30041ade00fSJohannes Berg  * @cipher: cipher suite selector
30141ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
30241ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
30341ade00fSJohannes Berg  *	length given by @seq_len.
304abe37c4bSJohannes Berg  * @seq_len: length of @seq.
30541ade00fSJohannes Berg  */
30641ade00fSJohannes Berg struct key_params {
30741ade00fSJohannes Berg 	u8 *key;
30841ade00fSJohannes Berg 	u8 *seq;
30941ade00fSJohannes Berg 	int key_len;
31041ade00fSJohannes Berg 	int seq_len;
31141ade00fSJohannes Berg 	u32 cipher;
31241ade00fSJohannes Berg };
31341ade00fSJohannes Berg 
314ed1b6cc7SJohannes Berg /**
315683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
316683b6d3bSJohannes Berg  * @chan: the (control) channel
3173d9d1d66SJohannes Berg  * @width: channel width
3183d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
3193d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
3203d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
321683b6d3bSJohannes Berg  */
322683b6d3bSJohannes Berg struct cfg80211_chan_def {
323683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
3243d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
3253d9d1d66SJohannes Berg 	u32 center_freq1;
3263d9d1d66SJohannes Berg 	u32 center_freq2;
327683b6d3bSJohannes Berg };
328683b6d3bSJohannes Berg 
3293d9d1d66SJohannes Berg /**
3303d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
3313d9d1d66SJohannes Berg  * @chandef: the channel definition
3323d9d1d66SJohannes Berg  *
3330ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
3343d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
3353d9d1d66SJohannes Berg  */
336683b6d3bSJohannes Berg static inline enum nl80211_channel_type
337683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
338683b6d3bSJohannes Berg {
3393d9d1d66SJohannes Berg 	switch (chandef->width) {
3403d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
3413d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
3423d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
3433d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
3443d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
3453d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
3463d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
3473d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
3483d9d1d66SJohannes Berg 	default:
3493d9d1d66SJohannes Berg 		WARN_ON(1);
3503d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
351683b6d3bSJohannes Berg 	}
3523d9d1d66SJohannes Berg }
3533d9d1d66SJohannes Berg 
3543d9d1d66SJohannes Berg /**
3553d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
3563d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
3573d9d1d66SJohannes Berg  * @channel: the control channel
3583d9d1d66SJohannes Berg  * @chantype: the channel type
3593d9d1d66SJohannes Berg  *
3603d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
3613d9d1d66SJohannes Berg  */
3623d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
3633d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
3643d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
3653d9d1d66SJohannes Berg 
3663d9d1d66SJohannes Berg /**
3673d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
3683d9d1d66SJohannes Berg  * @chandef1: first channel definition
3693d9d1d66SJohannes Berg  * @chandef2: second channel definition
3703d9d1d66SJohannes Berg  *
3710ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
3723d9d1d66SJohannes Berg  * identical, %false otherwise.
3733d9d1d66SJohannes Berg  */
3743d9d1d66SJohannes Berg static inline bool
3753d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
3763d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
3773d9d1d66SJohannes Berg {
3783d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
3793d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
3803d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
3813d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
3823d9d1d66SJohannes Berg }
3833d9d1d66SJohannes Berg 
3843d9d1d66SJohannes Berg /**
3853d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
3863d9d1d66SJohannes Berg  * @chandef1: first channel definition
3873d9d1d66SJohannes Berg  * @chandef2: second channel definition
3883d9d1d66SJohannes Berg  *
3890ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
3903d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
3913d9d1d66SJohannes Berg  */
3923d9d1d66SJohannes Berg const struct cfg80211_chan_def *
3933d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
3943d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
395683b6d3bSJohannes Berg 
396683b6d3bSJohannes Berg /**
3979f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
3989f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
3990ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
4009f5e8f6eSJohannes Berg  */
4019f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
4029f5e8f6eSJohannes Berg 
4039f5e8f6eSJohannes Berg /**
4049f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
4059f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
4069f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4070ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
4080ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
4099f5e8f6eSJohannes Berg  */
4109f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
4119f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
4129f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
4139f5e8f6eSJohannes Berg 
4149f5e8f6eSJohannes Berg /**
41561fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
41661fa713cSHolger Schurig  *
417abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
41817e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
4198610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
4208610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
4218610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
4228610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
4238610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
424abe37c4bSJohannes Berg  *
42561fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
42661fa713cSHolger Schurig  * it has filled in during the get_survey().
42761fa713cSHolger Schurig  */
42861fa713cSHolger Schurig enum survey_info_flags {
42961fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
43017e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
4318610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
4328610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
4338610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
4348610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
4358610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
43661fa713cSHolger Schurig };
43761fa713cSHolger Schurig 
43861fa713cSHolger Schurig /**
43961fa713cSHolger Schurig  * struct survey_info - channel survey response
44061fa713cSHolger Schurig  *
44161fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
44261fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
44361fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
44461fa713cSHolger Schurig  *     optional
4458610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
4468610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
4478610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
4488610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
4498610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
45061fa713cSHolger Schurig  *
451abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
452abe37c4bSJohannes Berg  *
45361fa713cSHolger Schurig  * This structure can later be expanded with things like
45461fa713cSHolger Schurig  * channel duty cycle etc.
45561fa713cSHolger Schurig  */
45661fa713cSHolger Schurig struct survey_info {
45761fa713cSHolger Schurig 	struct ieee80211_channel *channel;
4588610c29aSFelix Fietkau 	u64 channel_time;
4598610c29aSFelix Fietkau 	u64 channel_time_busy;
4608610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
4618610c29aSFelix Fietkau 	u64 channel_time_rx;
4628610c29aSFelix Fietkau 	u64 channel_time_tx;
46361fa713cSHolger Schurig 	u32 filled;
46461fa713cSHolger Schurig 	s8 noise;
46561fa713cSHolger Schurig };
46661fa713cSHolger Schurig 
46761fa713cSHolger Schurig /**
4685fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
4695fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
4705fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
4715fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
4725fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
4735fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
4745fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
4755fb628e9SJouni Malinen  * @akm_suites: AKM suites
4765fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
4775fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
4785fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
4795fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
4805fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
4815fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
4825fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
4835fb628e9SJouni Malinen  *	protocol frames.
4845fb628e9SJouni Malinen  */
4855fb628e9SJouni Malinen struct cfg80211_crypto_settings {
4865fb628e9SJouni Malinen 	u32 wpa_versions;
4875fb628e9SJouni Malinen 	u32 cipher_group;
4885fb628e9SJouni Malinen 	int n_ciphers_pairwise;
4895fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
4905fb628e9SJouni Malinen 	int n_akm_suites;
4915fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
4925fb628e9SJouni Malinen 	bool control_port;
4935fb628e9SJouni Malinen 	__be16 control_port_ethertype;
4945fb628e9SJouni Malinen 	bool control_port_no_encrypt;
4955fb628e9SJouni Malinen };
4965fb628e9SJouni Malinen 
4975fb628e9SJouni Malinen /**
4988860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
499ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
500ed1b6cc7SJohannes Berg  *     or %NULL if not changed
501ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
502ed1b6cc7SJohannes Berg  *     or %NULL if not changed
503ed1b6cc7SJohannes Berg  * @head_len: length of @head
504ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
5059946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
5069946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
5079946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
5089946ecfbSJouni Malinen  *	frames or %NULL
5099946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
5109946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
5119946ecfbSJouni Malinen  *	Response frames or %NULL
5129946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
51300f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
51400f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
515ed1b6cc7SJohannes Berg  */
5168860020eSJohannes Berg struct cfg80211_beacon_data {
5178860020eSJohannes Berg 	const u8 *head, *tail;
5188860020eSJohannes Berg 	const u8 *beacon_ies;
5198860020eSJohannes Berg 	const u8 *proberesp_ies;
5208860020eSJohannes Berg 	const u8 *assocresp_ies;
5218860020eSJohannes Berg 	const u8 *probe_resp;
5228860020eSJohannes Berg 
5238860020eSJohannes Berg 	size_t head_len, tail_len;
5248860020eSJohannes Berg 	size_t beacon_ies_len;
5258860020eSJohannes Berg 	size_t proberesp_ies_len;
5268860020eSJohannes Berg 	size_t assocresp_ies_len;
5278860020eSJohannes Berg 	size_t probe_resp_len;
5288860020eSJohannes Berg };
5298860020eSJohannes Berg 
5308860020eSJohannes Berg /**
5318860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
5328860020eSJohannes Berg  *
5338860020eSJohannes Berg  * Used to configure an AP interface.
5348860020eSJohannes Berg  *
535683b6d3bSJohannes Berg  * @chandef: defines the channel to use
5368860020eSJohannes Berg  * @beacon: beacon data
5378860020eSJohannes Berg  * @beacon_interval: beacon interval
5388860020eSJohannes Berg  * @dtim_period: DTIM period
5398860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
5408860020eSJohannes Berg  *	user space)
5418860020eSJohannes Berg  * @ssid_len: length of @ssid
5428860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
5438860020eSJohannes Berg  * @crypto: crypto settings
5448860020eSJohannes Berg  * @privacy: the BSS uses privacy
5458860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
5461b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
54753cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
54853cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
5498860020eSJohannes Berg  */
5508860020eSJohannes Berg struct cfg80211_ap_settings {
551683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
552aa430da4SJohannes Berg 
5538860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
5548860020eSJohannes Berg 
5558860020eSJohannes Berg 	int beacon_interval, dtim_period;
55632e9de84SJouni Malinen 	const u8 *ssid;
55732e9de84SJouni Malinen 	size_t ssid_len;
55832e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
5595fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
5605fb628e9SJouni Malinen 	bool privacy;
5615fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
5621b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
56353cabad7SJohannes Berg 	u8 p2p_ctwindow;
56453cabad7SJohannes Berg 	bool p2p_opp_ps;
565ed1b6cc7SJohannes Berg };
566ed1b6cc7SJohannes Berg 
5675727ef1bSJohannes Berg /**
5682ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
5692ec600d6SLuis Carlos Cobo  *
5702ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
5712ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
572abe37c4bSJohannes Berg  * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
5732ec600d6SLuis Carlos Cobo  */
5742ec600d6SLuis Carlos Cobo enum plink_actions {
5752ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
5762ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
5772ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
5782ec600d6SLuis Carlos Cobo };
5792ec600d6SLuis Carlos Cobo 
5802ec600d6SLuis Carlos Cobo /**
5813b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
5823b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
5833b9ce80cSJohannes Berg  *
5843b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
5853b9ce80cSJohannes Berg  * for those that don't these flags will are used.
5863b9ce80cSJohannes Berg  */
5873b9ce80cSJohannes Berg enum station_parameters_apply_mask {
5883b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
5893b9ce80cSJohannes Berg };
5903b9ce80cSJohannes Berg 
5913b9ce80cSJohannes Berg /**
5925727ef1bSJohannes Berg  * struct station_parameters - station parameters
5935727ef1bSJohannes Berg  *
5945727ef1bSJohannes Berg  * Used to change and create a new station.
5955727ef1bSJohannes Berg  *
5965727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
5975727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
5985727ef1bSJohannes Berg  *	(or NULL for no change)
5995727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
600eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
601eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
602eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
603eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
6045727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
6055727ef1bSJohannes Berg  * @aid: AID or zero for no change
606abe37c4bSJohannes Berg  * @plink_action: plink action to take
6079c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
608abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
609f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
610910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
611910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
612910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
613910868dbSEliad Peller  *	QoS info field (but already shifted down)
614c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
615c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
616c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
6173b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
6183b1c5a53SMarco Porsch  *	to unknown)
6195727ef1bSJohannes Berg  */
6205727ef1bSJohannes Berg struct station_parameters {
6215727ef1bSJohannes Berg 	u8 *supported_rates;
6225727ef1bSJohannes Berg 	struct net_device *vlan;
623eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
6243b9ce80cSJohannes Berg 	u32 sta_modify_mask;
6255727ef1bSJohannes Berg 	int listen_interval;
6265727ef1bSJohannes Berg 	u16 aid;
6275727ef1bSJohannes Berg 	u8 supported_rates_len;
6282ec600d6SLuis Carlos Cobo 	u8 plink_action;
6299c3990aaSJavier Cardona 	u8 plink_state;
63036aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
631f461be3eSMahesh Palivela 	struct ieee80211_vht_cap *vht_capa;
632c75786c9SEliad Peller 	u8 uapsd_queues;
633c75786c9SEliad Peller 	u8 max_sp;
6343b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
6355727ef1bSJohannes Berg };
6365727ef1bSJohannes Berg 
637fd5b74dcSJohannes Berg /**
6382ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
639fd5b74dcSJohannes Berg  *
6402ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
6412ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
642fd5b74dcSJohannes Berg  *
6432ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
6442ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
6452ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
6462ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
6472ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
6482ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
649420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
650c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
651420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
65298c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
65398c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
654b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
655b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
6565a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
657541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
658c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
659f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
660ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
661040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
662bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
663a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
664d299a1f2SJavier Cardona  * @STATION_INFO_T_OFFSET: @t_offset filled
6653b1c5a53SMarco Porsch  * @STATION_INFO_LOCAL_PM: @local_pm filled
6663b1c5a53SMarco Porsch  * @STATION_INFO_PEER_PM: @peer_pm filled
6673b1c5a53SMarco Porsch  * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
668fd5b74dcSJohannes Berg  */
6692ec600d6SLuis Carlos Cobo enum station_info_flags {
6702ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
6712ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
6722ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
6732ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
6742ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
6752ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
676420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
677420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
67898c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
67998c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
680b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
681b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
6825a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
683541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
684c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
685f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
686040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
687bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
688a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
689d299a1f2SJavier Cardona 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19,
690d299a1f2SJavier Cardona 	STATION_INFO_T_OFFSET		= 1<<20,
6913b1c5a53SMarco Porsch 	STATION_INFO_LOCAL_PM		= 1<<21,
6923b1c5a53SMarco Porsch 	STATION_INFO_PEER_PM		= 1<<22,
6933b1c5a53SMarco Porsch 	STATION_INFO_NONPEER_PM		= 1<<23,
694420e7fabSHenning Rogge };
695420e7fabSHenning Rogge 
696420e7fabSHenning Rogge /**
697420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
698420e7fabSHenning Rogge  *
699420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
700420e7fabSHenning Rogge  * type for 802.11n transmissions.
701420e7fabSHenning Rogge  *
702db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
703db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
704db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
705db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
706db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
707db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
708420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
709db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
710420e7fabSHenning Rogge  */
711420e7fabSHenning Rogge enum rate_info_flags {
712db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
713db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
714db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_40_MHZ_WIDTH		= BIT(2),
715db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80_MHZ_WIDTH		= BIT(3),
716db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80P80_MHZ_WIDTH		= BIT(4),
717db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_160_MHZ_WIDTH		= BIT(5),
718db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(6),
719db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(7),
720420e7fabSHenning Rogge };
721420e7fabSHenning Rogge 
722420e7fabSHenning Rogge /**
723420e7fabSHenning Rogge  * struct rate_info - bitrate information
724420e7fabSHenning Rogge  *
725420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
726420e7fabSHenning Rogge  *
727420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
728420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
729420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
730db9c64cfSJohannes Berg  * @nss: number of streams (VHT only)
731420e7fabSHenning Rogge  */
732420e7fabSHenning Rogge struct rate_info {
733420e7fabSHenning Rogge 	u8 flags;
734420e7fabSHenning Rogge 	u8 mcs;
735420e7fabSHenning Rogge 	u16 legacy;
736db9c64cfSJohannes Berg 	u8 nss;
737fd5b74dcSJohannes Berg };
738fd5b74dcSJohannes Berg 
739fd5b74dcSJohannes Berg /**
740f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
741f4263c98SPaul Stewart  *
742f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
743f4263c98SPaul Stewart  * type for 802.11n transmissions.
744f4263c98SPaul Stewart  *
745f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
746f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
747f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
748f4263c98SPaul Stewart  */
749f4263c98SPaul Stewart enum bss_param_flags {
750f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
751f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
752f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
753f4263c98SPaul Stewart };
754f4263c98SPaul Stewart 
755f4263c98SPaul Stewart /**
756f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
757f4263c98SPaul Stewart  *
758f4263c98SPaul Stewart  * Information about the currently associated BSS
759f4263c98SPaul Stewart  *
760f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
761f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
762f4263c98SPaul Stewart  * @beacon_interval: beacon interval
763f4263c98SPaul Stewart  */
764f4263c98SPaul Stewart struct sta_bss_parameters {
765f4263c98SPaul Stewart 	u8 flags;
766f4263c98SPaul Stewart 	u8 dtim_period;
767f4263c98SPaul Stewart 	u16 beacon_interval;
768f4263c98SPaul Stewart };
769f4263c98SPaul Stewart 
770f4263c98SPaul Stewart /**
7712ec600d6SLuis Carlos Cobo  * struct station_info - station information
772fd5b74dcSJohannes Berg  *
7732ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
774fd5b74dcSJohannes Berg  *
7752ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
776ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
777fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
778fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
779fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
7802ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
7812ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
7822ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
78373c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
78473c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
78573c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
78673c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
787858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
788858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
78998c8a60aSJouni Malinen  * @rx_packets: packets received from this station
79098c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
791b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
792b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
7935a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
7941ba01458SRandy Dunlap  * @bss_param: current BSS parameters
795f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
796f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
797f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
798f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
79950d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
80050d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
80150d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
80250d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
80350d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
804c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
805a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
806d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
8073b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
8083b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
8093b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
810fd5b74dcSJohannes Berg  */
8112ec600d6SLuis Carlos Cobo struct station_info {
812fd5b74dcSJohannes Berg 	u32 filled;
813ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
814fd5b74dcSJohannes Berg 	u32 inactive_time;
815fd5b74dcSJohannes Berg 	u32 rx_bytes;
816fd5b74dcSJohannes Berg 	u32 tx_bytes;
8172ec600d6SLuis Carlos Cobo 	u16 llid;
8182ec600d6SLuis Carlos Cobo 	u16 plid;
8192ec600d6SLuis Carlos Cobo 	u8 plink_state;
820420e7fabSHenning Rogge 	s8 signal;
821541a45a1SBruno Randolf 	s8 signal_avg;
822420e7fabSHenning Rogge 	struct rate_info txrate;
823c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
82498c8a60aSJouni Malinen 	u32 rx_packets;
82598c8a60aSJouni Malinen 	u32 tx_packets;
826b206b4efSBruno Randolf 	u32 tx_retries;
827b206b4efSBruno Randolf 	u32 tx_failed;
8285a5c731aSBen Greear 	u32 rx_dropped_misc;
829f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
830bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
831f5ea9120SJohannes Berg 
832f5ea9120SJohannes Berg 	int generation;
83350d3dfb7SJouni Malinen 
83450d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
83550d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
836f612cedfSJouni Malinen 
837a85e1d55SPaul Stewart 	u32 beacon_loss_count;
838d299a1f2SJavier Cardona 	s64 t_offset;
8393b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
8403b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
8413b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
842a85e1d55SPaul Stewart 
843f612cedfSJouni Malinen 	/*
844f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
845f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
846f612cedfSJouni Malinen 	 */
847fd5b74dcSJohannes Berg };
848fd5b74dcSJohannes Berg 
84966f7ac50SMichael Wu /**
85066f7ac50SMichael Wu  * enum monitor_flags - monitor flags
85166f7ac50SMichael Wu  *
85266f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
85366f7ac50SMichael Wu  * according to the nl80211 flags.
85466f7ac50SMichael Wu  *
85566f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
85666f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
85766f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
85866f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
85966f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
86066f7ac50SMichael Wu  */
86166f7ac50SMichael Wu enum monitor_flags {
86266f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
86366f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
86466f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
86566f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
86666f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
86766f7ac50SMichael Wu };
86866f7ac50SMichael Wu 
8692ec600d6SLuis Carlos Cobo /**
8702ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
8712ec600d6SLuis Carlos Cobo  *
8722ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
8732ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
8742ec600d6SLuis Carlos Cobo  *
875abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
876abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
877abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
878abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
879abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
880abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
881abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
8822ec600d6SLuis Carlos Cobo  */
8832ec600d6SLuis Carlos Cobo enum mpath_info_flags {
8842ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
885d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
8862ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
8872ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
8882ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
8892ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
8902ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
8912ec600d6SLuis Carlos Cobo };
8922ec600d6SLuis Carlos Cobo 
8932ec600d6SLuis Carlos Cobo /**
8942ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
8952ec600d6SLuis Carlos Cobo  *
8962ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
8972ec600d6SLuis Carlos Cobo  *
8982ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
8992ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
900d19b3bf6SRui Paulo  * @sn: target sequence number
9012ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
9022ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
9032ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
9042ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
9052ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
906f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
907f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
908f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
909f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
9102ec600d6SLuis Carlos Cobo  */
9112ec600d6SLuis Carlos Cobo struct mpath_info {
9122ec600d6SLuis Carlos Cobo 	u32 filled;
9132ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
914d19b3bf6SRui Paulo 	u32 sn;
9152ec600d6SLuis Carlos Cobo 	u32 metric;
9162ec600d6SLuis Carlos Cobo 	u32 exptime;
9172ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
9182ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
9192ec600d6SLuis Carlos Cobo 	u8 flags;
920f5ea9120SJohannes Berg 
921f5ea9120SJohannes Berg 	int generation;
9222ec600d6SLuis Carlos Cobo };
9232ec600d6SLuis Carlos Cobo 
9249f1ba906SJouni Malinen /**
9259f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
9269f1ba906SJouni Malinen  *
9279f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
9289f1ba906SJouni Malinen  *
9299f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
9309f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
9319f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
9329f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
9339f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
9349f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
93590c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
93690c97a04SJouni Malinen  *	(or NULL for no change)
93790c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
938fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
93950b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
94050b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
94153cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
94253cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
9439f1ba906SJouni Malinen  */
9449f1ba906SJouni Malinen struct bss_parameters {
9459f1ba906SJouni Malinen 	int use_cts_prot;
9469f1ba906SJouni Malinen 	int use_short_preamble;
9479f1ba906SJouni Malinen 	int use_short_slot_time;
94890c97a04SJouni Malinen 	u8 *basic_rates;
94990c97a04SJouni Malinen 	u8 basic_rates_len;
950fd8aaaf3SFelix Fietkau 	int ap_isolate;
95150b12f59SHelmut Schaa 	int ht_opmode;
95253cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
9539f1ba906SJouni Malinen };
9542ec600d6SLuis Carlos Cobo 
9553ddd53f3SChun-Yeow Yeoh /**
95629cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
95729cbe68cSJohannes Berg  *
95829cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
9593ddd53f3SChun-Yeow Yeoh  *
9603ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
9613ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
9623ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
9633ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
9643ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
9653ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
9663ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
9673ddd53f3SChun-Yeow Yeoh  *	mesh interface
9683ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
9693ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
9703ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
9713ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
9723ddd53f3SChun-Yeow Yeoh  *	elements
9733ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
9743ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
9753ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
9763ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
9773ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
9783ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
9793ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
9803ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
9813ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
9823ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
9833ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
9843ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
9853ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
9863ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
9873ddd53f3SChun-Yeow Yeoh  *	element
9883ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
9893ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
9903ddd53f3SChun-Yeow Yeoh  *	element
9913ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
9923ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
9933ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
9943ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
9953ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
9963ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
9973ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
9983ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
9993ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
10003ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
10013ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
10023ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
10033ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
10043ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
10053ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
10063ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1007ac1073a6SChun-Yeow Yeoh  *
1008ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1009ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1010ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1011ac1073a6SChun-Yeow Yeoh  *
1012ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1013ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1014728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1015728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1016728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
10173b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
10183b1c5a53SMarco Porsch  *	setting for new peer links.
10193b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
10203b1c5a53SMarco Porsch  *	after transmitting its beacon.
102129cbe68cSJohannes Berg  */
102293da9cc1Scolin@cozybit.com struct mesh_config {
102393da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
102493da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
102593da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
102693da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
102793da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
102893da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
102945904f21SJavier Cardona 	u8 element_ttl;
103093da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1031d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
103293da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
103393da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
103493da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
103593da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
103693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1037dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
103893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
103963c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
10400507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
104116dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
104294f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
104355335137SAshok Nagarajan 	s32 rssi_threshold;
104470c33eaaSAshok Nagarajan 	u16 ht_opmode;
1045ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1046ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1047728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
10483b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
10493b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
105093da9cc1Scolin@cozybit.com };
105193da9cc1Scolin@cozybit.com 
105231888487SJouni Malinen /**
105329cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1054683b6d3bSJohannes Berg  * @chandef: defines the channel to use
105529cbe68cSJohannes Berg  * @mesh_id: the mesh ID
105629cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1057d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1058c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1059c80d545dSJavier Cardona  * @path_metric: which metric to use
1060581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1061581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1062b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1063b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
10649bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
10659bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
10664bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
106729cbe68cSJohannes Berg  *
106829cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
106929cbe68cSJohannes Berg  */
107029cbe68cSJohannes Berg struct mesh_setup {
1071683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
107229cbe68cSJohannes Berg 	const u8 *mesh_id;
107329cbe68cSJohannes Berg 	u8 mesh_id_len;
1074d299a1f2SJavier Cardona 	u8 sync_method;
1075c80d545dSJavier Cardona 	u8 path_sel_proto;
1076c80d545dSJavier Cardona 	u8 path_metric;
1077581a8b0fSJavier Cardona 	const u8 *ie;
1078581a8b0fSJavier Cardona 	u8 ie_len;
1079b130e5ceSJavier Cardona 	bool is_authenticated;
108015d5dda6SJavier Cardona 	bool is_secure;
10819bdbf04dSMarco Porsch 	u8 dtim_period;
10829bdbf04dSMarco Porsch 	u16 beacon_interval;
10834bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
108429cbe68cSJohannes Berg };
108529cbe68cSJohannes Berg 
108629cbe68cSJohannes Berg /**
108731888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1088a3304b0aSJohannes Berg  * @ac: AC identifier
108931888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
109031888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
109131888487SJouni Malinen  *	1..32767]
109231888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
109331888487SJouni Malinen  *	1..32767]
109431888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
109531888487SJouni Malinen  */
109631888487SJouni Malinen struct ieee80211_txq_params {
1097a3304b0aSJohannes Berg 	enum nl80211_ac ac;
109831888487SJouni Malinen 	u16 txop;
109931888487SJouni Malinen 	u16 cwmin;
110031888487SJouni Malinen 	u16 cwmax;
110131888487SJouni Malinen 	u8 aifs;
110231888487SJouni Malinen };
110331888487SJouni Malinen 
1104d70e9693SJohannes Berg /**
1105d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1106d70e9693SJohannes Berg  *
1107d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1108d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1109d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1110d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1111d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1112d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1113d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1114d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1115d70e9693SJohannes Berg  * in the wiphy structure.
1116d70e9693SJohannes Berg  *
1117d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1118d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1119d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1120d70e9693SJohannes Berg  *
1121d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1122d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1123d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1124d70e9693SJohannes Berg  * to userspace.
1125d70e9693SJohannes Berg  */
112672bdcf34SJouni Malinen 
1127704232c2SJohannes Berg /**
11282a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
11292a519311SJohannes Berg  * @ssid: the SSID
11302a519311SJohannes Berg  * @ssid_len: length of the ssid
11312a519311SJohannes Berg  */
11322a519311SJohannes Berg struct cfg80211_ssid {
11332a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
11342a519311SJohannes Berg 	u8 ssid_len;
11352a519311SJohannes Berg };
11362a519311SJohannes Berg 
11372a519311SJohannes Berg /**
11382a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
11392a519311SJohannes Berg  *
11402a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
11412a519311SJohannes Berg  * @n_ssids: number of SSIDs
11422a519311SJohannes Berg  * @channels: channels to scan on.
1143ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
114470692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
114570692ad2SJouni Malinen  * @ie_len: length of ie in octets
1146ed473771SSam Leffler  * @flags: bit field of flags controlling operation
114734850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
11482a519311SJohannes Berg  * @wiphy: the wiphy this was for
114915d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1150fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1151abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
1152e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
11532a519311SJohannes Berg  */
11542a519311SJohannes Berg struct cfg80211_scan_request {
11552a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
11562a519311SJohannes Berg 	int n_ssids;
11572a519311SJohannes Berg 	u32 n_channels;
1158de95a54bSJohannes Berg 	const u8 *ie;
115970692ad2SJouni Malinen 	size_t ie_len;
1160ed473771SSam Leffler 	u32 flags;
11612a519311SJohannes Berg 
116234850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
116334850ab2SJohannes Berg 
1164fd014284SJohannes Berg 	struct wireless_dev *wdev;
1165fd014284SJohannes Berg 
11662a519311SJohannes Berg 	/* internal */
11672a519311SJohannes Berg 	struct wiphy *wiphy;
116815d6030bSSam Leffler 	unsigned long scan_start;
1169667503ddSJohannes Berg 	bool aborted;
1170e9f935e3SRajkumar Manoharan 	bool no_cck;
11715ba63533SJohannes Berg 
11725ba63533SJohannes Berg 	/* keep last */
11735ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
11742a519311SJohannes Berg };
11752a519311SJohannes Berg 
11762a519311SJohannes Berg /**
1177a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1178a1f1c21cSLuciano Coelho  *
1179a1f1c21cSLuciano Coelho  * @ssid: SSID to be matched
1180a1f1c21cSLuciano Coelho  */
1181a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1182a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1183a1f1c21cSLuciano Coelho };
1184a1f1c21cSLuciano Coelho 
1185a1f1c21cSLuciano Coelho /**
1186807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1187807f8a8cSLuciano Coelho  *
1188807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1189807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1190807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1191bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1192807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1193807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1194ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1195a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1196a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1197a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1198a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1199a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1200807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1201807f8a8cSLuciano Coelho  * @dev: the interface
1202807f8a8cSLuciano Coelho  * @channels: channels to scan
120388e920b4SThomas Pedersen  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1204807f8a8cSLuciano Coelho  */
1205807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1206807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1207807f8a8cSLuciano Coelho 	int n_ssids;
1208807f8a8cSLuciano Coelho 	u32 n_channels;
1209bbe6ad6dSLuciano Coelho 	u32 interval;
1210807f8a8cSLuciano Coelho 	const u8 *ie;
1211807f8a8cSLuciano Coelho 	size_t ie_len;
1212ed473771SSam Leffler 	u32 flags;
1213a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1214a1f1c21cSLuciano Coelho 	int n_match_sets;
121588e920b4SThomas Pedersen 	s32 rssi_thold;
1216807f8a8cSLuciano Coelho 
1217807f8a8cSLuciano Coelho 	/* internal */
1218807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1219807f8a8cSLuciano Coelho 	struct net_device *dev;
122015d6030bSSam Leffler 	unsigned long scan_start;
1221807f8a8cSLuciano Coelho 
1222807f8a8cSLuciano Coelho 	/* keep last */
1223807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1224807f8a8cSLuciano Coelho };
1225807f8a8cSLuciano Coelho 
1226807f8a8cSLuciano Coelho /**
12272a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
12282a519311SJohannes Berg  *
12292a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
12302a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
12312a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
12322a519311SJohannes Berg  */
12332a519311SJohannes Berg enum cfg80211_signal_type {
12342a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
12352a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
12362a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
12372a519311SJohannes Berg };
12382a519311SJohannes Berg 
12392a519311SJohannes Berg /**
12409caf0364SJohannes Berg  * struct cfg80211_bss_ie_data - BSS entry IE data
12419caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
12429caf0364SJohannes Berg  * @len: length of the IEs
12439caf0364SJohannes Berg  * @data: IE data
12449caf0364SJohannes Berg  */
12459caf0364SJohannes Berg struct cfg80211_bss_ies {
12469caf0364SJohannes Berg 	struct rcu_head rcu_head;
12479caf0364SJohannes Berg 	int len;
12489caf0364SJohannes Berg 	u8 data[];
12499caf0364SJohannes Berg };
12509caf0364SJohannes Berg 
12519caf0364SJohannes Berg /**
12522a519311SJohannes Berg  * struct cfg80211_bss - BSS description
12532a519311SJohannes Berg  *
12542a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
12552a519311SJohannes Berg  * for use in scan results and similar.
12562a519311SJohannes Berg  *
1257abe37c4bSJohannes Berg  * @channel: channel this BSS is on
12582a519311SJohannes Berg  * @bssid: BSSID of the BSS
12592a519311SJohannes Berg  * @tsf: timestamp of last received update
12602a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
12612a519311SJohannes Berg  * @capability: the capability field in host byte order
12629caf0364SJohannes Berg  * @ies: the information elements (Note that there
126334a6eddbSJouni Malinen  *	is no guarantee that these are well-formed!); this is a pointer to
126434a6eddbSJouni Malinen  *	either the beacon_ies or proberesp_ies depending on whether Probe
126534a6eddbSJouni Malinen  *	Response frame has been received
126634a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
126734a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
126877965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
126978c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
12702a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
12712a519311SJohannes Berg  */
12722a519311SJohannes Berg struct cfg80211_bss {
12739caf0364SJohannes Berg 	u64 tsf;
12749caf0364SJohannes Berg 
12752a519311SJohannes Berg 	struct ieee80211_channel *channel;
12762a519311SJohannes Berg 
12779caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
12789caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
12799caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
12809caf0364SJohannes Berg 
12819caf0364SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
12822a519311SJohannes Berg 
12832a519311SJohannes Berg 	s32 signal;
12842a519311SJohannes Berg 
12859caf0364SJohannes Berg 	u16 beacon_interval;
12869caf0364SJohannes Berg 	u16 capability;
12879caf0364SJohannes Berg 
12889caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
12899caf0364SJohannes Berg 
12901c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
12912a519311SJohannes Berg };
12922a519311SJohannes Berg 
12932a519311SJohannes Berg /**
1294517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1295517357c6SJohannes Berg  * @bss: the bss to search
1296517357c6SJohannes Berg  * @ie: the IE ID
12979caf0364SJohannes Berg  *
12989caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
12999caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
13000ae997dcSYacine Belkadi  * Return: %NULL if not found.
1301517357c6SJohannes Berg  */
1302517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1303517357c6SJohannes Berg 
1304517357c6SJohannes Berg 
1305517357c6SJohannes Berg /**
1306636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1307636a5d36SJouni Malinen  *
1308636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1309636a5d36SJouni Malinen  * authentication.
1310636a5d36SJouni Malinen  *
131119957bb3SJohannes Berg  * @bss: The BSS to authenticate with.
1312636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1313636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1314636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1315fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1316fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1317fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1318e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1319e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1320e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1321636a5d36SJouni Malinen  */
1322636a5d36SJouni Malinen struct cfg80211_auth_request {
132319957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1324636a5d36SJouni Malinen 	const u8 *ie;
1325636a5d36SJouni Malinen 	size_t ie_len;
132619957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1327fffd0934SJohannes Berg 	const u8 *key;
1328fffd0934SJohannes Berg 	u8 key_len, key_idx;
1329e39e5b5eSJouni Malinen 	const u8 *sae_data;
1330e39e5b5eSJouni Malinen 	size_t sae_data_len;
1331636a5d36SJouni Malinen };
1332636a5d36SJouni Malinen 
1333636a5d36SJouni Malinen /**
13347e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
13357e7c8926SBen Greear  *
13367e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
13377e7c8926SBen Greear  */
13387e7c8926SBen Greear enum cfg80211_assoc_req_flags {
13397e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
13407e7c8926SBen Greear };
13417e7c8926SBen Greear 
13427e7c8926SBen Greear /**
1343636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1344636a5d36SJouni Malinen  *
1345636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1346636a5d36SJouni Malinen  * (re)association.
134795de817bSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver
134895de817bSJohannes Berg  *	is given a reference that it must release, normally via a call to
134995de817bSJohannes Berg  *	cfg80211_send_rx_assoc(), or, if association timed out, with a
135095de817bSJohannes Berg  *	call to cfg80211_put_bss() (in addition to calling
135195de817bSJohannes Berg  *	cfg80211_send_assoc_timeout())
1352636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1353636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1354dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1355b23aa676SSamuel Ortiz  * @crypto: crypto settings
13563e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
13577e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
13587e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
13597e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
13607e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1361636a5d36SJouni Malinen  */
1362636a5d36SJouni Malinen struct cfg80211_assoc_request {
136319957bb3SJohannes Berg 	struct cfg80211_bss *bss;
13643e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1365636a5d36SJouni Malinen 	size_t ie_len;
1366b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
136719957bb3SJohannes Berg 	bool use_mfp;
13687e7c8926SBen Greear 	u32 flags;
13697e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
13707e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1371636a5d36SJouni Malinen };
1372636a5d36SJouni Malinen 
1373636a5d36SJouni Malinen /**
1374636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1375636a5d36SJouni Malinen  *
1376636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1377636a5d36SJouni Malinen  * deauthentication.
1378636a5d36SJouni Malinen  *
137995de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1380636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1381636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
138219957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1383636a5d36SJouni Malinen  */
1384636a5d36SJouni Malinen struct cfg80211_deauth_request {
138595de817bSJohannes Berg 	const u8 *bssid;
1386636a5d36SJouni Malinen 	const u8 *ie;
1387636a5d36SJouni Malinen 	size_t ie_len;
138819957bb3SJohannes Berg 	u16 reason_code;
13896863255bSStanislaw Gruszka 	bool local_state_change;
1390636a5d36SJouni Malinen };
1391636a5d36SJouni Malinen 
1392636a5d36SJouni Malinen /**
1393636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1394636a5d36SJouni Malinen  *
1395636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1396636a5d36SJouni Malinen  * disassocation.
1397636a5d36SJouni Malinen  *
139819957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1399636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1400636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
140119957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1402d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1403d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1404636a5d36SJouni Malinen  */
1405636a5d36SJouni Malinen struct cfg80211_disassoc_request {
140619957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1407636a5d36SJouni Malinen 	const u8 *ie;
1408636a5d36SJouni Malinen 	size_t ie_len;
140919957bb3SJohannes Berg 	u16 reason_code;
1410d5cdfacbSJouni Malinen 	bool local_state_change;
1411636a5d36SJouni Malinen };
1412636a5d36SJouni Malinen 
1413636a5d36SJouni Malinen /**
141404a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
141504a773adSJohannes Berg  *
141604a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
141704a773adSJohannes Berg  * method.
141804a773adSJohannes Berg  *
141904a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
142004a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
142104a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
142204a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
1423683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
142404a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
142504a773adSJohannes Berg  *	IBSSs to join on other channels.
142604a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
142704a773adSJohannes Berg  * @ie_len: length of that
14288e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1429fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1430fffd0934SJohannes Berg  *	after joining
1431267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1432267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1433267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1434267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
1435fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1436dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
143704a773adSJohannes Berg  */
143804a773adSJohannes Berg struct cfg80211_ibss_params {
143904a773adSJohannes Berg 	u8 *ssid;
144004a773adSJohannes Berg 	u8 *bssid;
1441683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
144204a773adSJohannes Berg 	u8 *ie;
144304a773adSJohannes Berg 	u8 ssid_len, ie_len;
14448e30bc55SJohannes Berg 	u16 beacon_interval;
1445fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
144604a773adSJohannes Berg 	bool channel_fixed;
1447fffd0934SJohannes Berg 	bool privacy;
1448267335d6SAntonio Quartulli 	bool control_port;
1449dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
145004a773adSJohannes Berg };
145104a773adSJohannes Berg 
145204a773adSJohannes Berg /**
1453b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1454b23aa676SSamuel Ortiz  *
1455b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1456b23aa676SSamuel Ortiz  * authentication and association.
1457b23aa676SSamuel Ortiz  *
1458b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1459b23aa676SSamuel Ortiz  *	on scan results)
1460b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1461b23aa676SSamuel Ortiz  *	results)
1462b23aa676SSamuel Ortiz  * @ssid: SSID
1463b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1464b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1465abe37c4bSJohannes Berg  * @ie: IEs for association request
1466abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1467b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1468cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
1469b23aa676SSamuel Ortiz  * @crypto: crypto settings
1470fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1471fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1472fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
14737e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
14744486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
14754486ea98SBala Shanmugam  *   or -1 to indicate that default value is to be used.
14767e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
14777e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
14787e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1479b23aa676SSamuel Ortiz  */
1480b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1481b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1482b23aa676SSamuel Ortiz 	u8 *bssid;
1483b23aa676SSamuel Ortiz 	u8 *ssid;
1484b23aa676SSamuel Ortiz 	size_t ssid_len;
1485b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1486b23aa676SSamuel Ortiz 	u8 *ie;
1487b23aa676SSamuel Ortiz 	size_t ie_len;
1488b23aa676SSamuel Ortiz 	bool privacy;
1489cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
1490b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1491fffd0934SJohannes Berg 	const u8 *key;
1492fffd0934SJohannes Berg 	u8 key_len, key_idx;
14937e7c8926SBen Greear 	u32 flags;
14944486ea98SBala Shanmugam 	int bg_scan_period;
14957e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
14967e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1497b23aa676SSamuel Ortiz };
1498b23aa676SSamuel Ortiz 
1499b23aa676SSamuel Ortiz /**
1500b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1501abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1502abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1503abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1504abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1505abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1506b9a5f8caSJouni Malinen  */
1507b9a5f8caSJouni Malinen enum wiphy_params_flags {
1508b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1509b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1510b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1511b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
151281077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1513b9a5f8caSJouni Malinen };
1514b9a5f8caSJouni Malinen 
15159930380fSJohannes Berg /*
15169930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
15179930380fSJohannes Berg  */
15189930380fSJohannes Berg struct cfg80211_bitrate_mask {
15199930380fSJohannes Berg 	struct {
15209930380fSJohannes Berg 		u32 legacy;
152124db78c0SSimon Wunderlich 		u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
15229930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
15239930380fSJohannes Berg };
152467fbb16bSSamuel Ortiz /**
152567fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
152667fbb16bSSamuel Ortiz  *
152767fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
152867fbb16bSSamuel Ortiz  * caching.
152967fbb16bSSamuel Ortiz  *
153067fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
153167fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
153267fbb16bSSamuel Ortiz  */
153367fbb16bSSamuel Ortiz struct cfg80211_pmksa {
153467fbb16bSSamuel Ortiz 	u8 *bssid;
153567fbb16bSSamuel Ortiz 	u8 *pmkid;
153667fbb16bSSamuel Ortiz };
15379930380fSJohannes Berg 
15387643a2c3SJohannes Berg /**
1539ff1b6e69SJohannes Berg  * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
1540ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1541ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1542ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1543ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1544ff1b6e69SJohannes Berg  *
1545ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1546ff1b6e69SJohannes Berg  * memory, free @mask only!
1547ff1b6e69SJohannes Berg  */
1548ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern {
1549ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1550ff1b6e69SJohannes Berg 	int pattern_len;
1551ff1b6e69SJohannes Berg };
1552ff1b6e69SJohannes Berg 
1553ff1b6e69SJohannes Berg /**
1554ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1555ff1b6e69SJohannes Berg  *
1556ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1557ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1558ff1b6e69SJohannes Berg  *	operating as normal during suspend
1559ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1560ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1561ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1562ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
156377dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
156477dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
156577dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
156677dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
1567ff1b6e69SJohannes Berg  */
1568ff1b6e69SJohannes Berg struct cfg80211_wowlan {
156977dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
157077dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
157177dbbb13SJohannes Berg 	     rfkill_release;
1572ff1b6e69SJohannes Berg 	struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1573ff1b6e69SJohannes Berg 	int n_patterns;
1574ff1b6e69SJohannes Berg };
1575ff1b6e69SJohannes Berg 
1576ff1b6e69SJohannes Berg /**
1577e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1578e5497d76SJohannes Berg  * @kek: key encryption key
1579e5497d76SJohannes Berg  * @kck: key confirmation key
1580e5497d76SJohannes Berg  * @replay_ctr: replay counter
1581e5497d76SJohannes Berg  */
1582e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1583e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1584e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1585e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1586e5497d76SJohannes Berg };
1587e5497d76SJohannes Berg 
1588e5497d76SJohannes Berg /**
1589704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1590704232c2SJohannes Berg  *
1591704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1592704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1593704232c2SJohannes Berg  *
1594704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1595704232c2SJohannes Berg  * on success or a negative error code.
1596704232c2SJohannes Berg  *
159743fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
159843fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
159943fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
160043fb45cbSJohannes Berg  *
1601ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1602ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1603ff1b6e69SJohannes Berg  *	configured for the device.
16040378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
16056d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
16066d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
16076d52563fSJohannes Berg  *	the device.
16080378b3f1SJohannes Berg  *
160960719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1610463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
161184efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
161298104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
161398104fdeSJohannes Berg  *	also set the address member in the wdev.
1614704232c2SJohannes Berg  *
161584efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
161655682965SJohannes Berg  *
161760719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
161860719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
161955682965SJohannes Berg  *
162041ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
162141ade00fSJohannes Berg  *	when adding a group key.
162241ade00fSJohannes Berg  *
162341ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
162441ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
162541ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1626e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1627e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
162841ade00fSJohannes Berg  *
162941ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1630e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
163141ade00fSJohannes Berg  *
163241ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1633ed1b6cc7SJohannes Berg  *
16343cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
16353cfcf6acSJouni Malinen  *
1636e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1637e5497d76SJohannes Berg  *
1638c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
1639c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
1640c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
1641c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
16425727ef1bSJohannes Berg  *
16435727ef1bSJohannes Berg  * @add_station: Add a new station.
16445727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
1645bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
1646bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
1647bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
1648bdd90d5eSJohannes Berg  *	them, also against the existing state! Also, supported_rates changes are
1649bdd90d5eSJohannes Berg  *	not checked in station mode -- drivers need to reject (or ignore) them
1650bdd90d5eSJohannes Berg  *	for anything but TDLS peers.
1651abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
1652abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
1653abe37c4bSJohannes Berg  *
1654abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
1655abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
1656abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
1657abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
1658abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1659f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
1660f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
16612ec600d6SLuis Carlos Cobo  *
166224bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
166393da9cc1Scolin@cozybit.com  *
166424bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
166593da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
166693da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
166793da9cc1Scolin@cozybit.com  *
16689f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
166931888487SJouni Malinen  *
167031888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
167172bdcf34SJouni Malinen  *
1672e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
1673e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
1674e8c9bd5bSJohannes Berg  *	join the mesh instead.
1675e8c9bd5bSJohannes Berg  *
1676e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
1677e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
1678e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
1679e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
16809aed3cc1SJouni Malinen  *
16812a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
16822a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
16832a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
16842a519311SJohannes Berg  *	the scan/scan_done bracket too.
1685636a5d36SJouni Malinen  *
1686636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
1687636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
1688636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
1689636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
169004a773adSJohannes Berg  *
1691b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
1692b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1693b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
1694b23aa676SSamuel Ortiz  *	with the status from the AP.
1695b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
1696b23aa676SSamuel Ortiz  *
169704a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
169804a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
169904a773adSJohannes Berg  *	to a merge.
170004a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
1701b9a5f8caSJouni Malinen  *
1702f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1703f4e583c8SAntonio Quartulli  *	MESH mode)
1704f4e583c8SAntonio Quartulli  *
1705b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
1706b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
1707b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
1708b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
17097643a2c3SJohannes Berg  *
17101432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
1711c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
1712c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
1713c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
1714c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
17157643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
17161f87f7d3SJohannes Berg  *	return 0 if successful
17171f87f7d3SJohannes Berg  *
1718abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
1719abe37c4bSJohannes Berg  *
17201f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
17211f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
1722aff89a9bSJohannes Berg  *
172361fa713cSHolger Schurig  * @dump_survey: get site survey information.
172461fa713cSHolger Schurig  *
17259588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
17269588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
17279588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
17289588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
17299588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
17309588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
17319588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
17329588bbd5SJouni Malinen  *	the duration value.
1733f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
1734f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
1735f7ca38dfSJohannes Berg  *	frame on another channel
17369588bbd5SJouni Malinen  *
1737aff89a9bSJohannes Berg  * @testmode_cmd: run a test mode command
173871063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
173971063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
174071063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
174171063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
174271063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
174371063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
174467fbb16bSSamuel Ortiz  *
1745abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
1746abe37c4bSJohannes Berg  *
174767fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
174867fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
174967fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
175067fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
175167fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
17529043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
17539043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
1754d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
175584f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
175684f10708SThomas Pedersen  *	thresholds.
1757807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
175830d08a46SArend van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan.
175967fbb16bSSamuel Ortiz  *
1760271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
1761271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
1762271733cfSJohannes Berg  *	concurrently with itself.
1763547025d5SBruno Randolf  *
1764547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1765547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1766547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
1767547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1768547025d5SBruno Randolf  *
1769547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
17703677713bSJohn W. Linville  *
17713677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
17723677713bSJohn W. Linville  *
17733677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
1774109086ceSArik Nemtsov  *
1775109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
1776109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
17777f6cf311SJohannes Berg  *
17787f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
17797f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
17801d9d9213SSimon Wunderlich  *
17811d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
1782d6199218SBen Greear  *
1783d6199218SBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
1784d6199218SBen Greear  *	See @ethtool_ops.get_sset_count
1785d6199218SBen Greear  *
1786d6199218SBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
1787d6199218SBen Greear  *	See @ethtool_ops.get_ethtool_stats
1788d6199218SBen Greear  *
1789d6199218SBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
1790d6199218SBen Greear  *	and perhaps other supported types of ethtool data-sets.
1791d6199218SBen Greear  *	See @ethtool_ops.get_strings
17925b7ccaf3SJohannes Berg  *
17935b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
17945b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
17955b7ccaf3SJohannes Berg  *	current monitoring channel.
179698104fdeSJohannes Berg  *
179798104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
179898104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
1799704232c2SJohannes Berg  */
1800704232c2SJohannes Berg struct cfg80211_ops {
1801ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
18020378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
18036d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
18040378b3f1SJohannes Berg 
180584efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
1806552bff0cSJohannes Berg 						  const char *name,
1807f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
1808f9e10ce4SJohannes Berg 						  u32 *flags,
18092ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
181084efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
181184efbb84SJohannes Berg 				    struct wireless_dev *wdev);
1812e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
1813e36d56b6SJohannes Berg 				       struct net_device *dev,
18142ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
18152ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
181641ade00fSJohannes Berg 
181741ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1818e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
181941ade00fSJohannes Berg 			   struct key_params *params);
182041ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1821e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
1822e31b8213SJohannes Berg 			   void *cookie,
182341ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
182441ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1825e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
182641ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
182741ade00fSJohannes Berg 				   struct net_device *netdev,
1828dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
18293cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
18303cfcf6acSJouni Malinen 					struct net_device *netdev,
18313cfcf6acSJouni Malinen 					u8 key_index);
1832ed1b6cc7SJohannes Berg 
18338860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
18348860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
18358860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
18368860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
18378860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
18385727ef1bSJohannes Berg 
18395727ef1bSJohannes Berg 
18405727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
18415727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
18425727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
18435727ef1bSJohannes Berg 			       u8 *mac);
18445727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
18455727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
1846fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
18472ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
18482ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
18492ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
18502ec600d6SLuis Carlos Cobo 
18512ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
18522ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
18532ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
18542ec600d6SLuis Carlos Cobo 			       u8 *dst);
18552ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
18562ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
18572ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
18582ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
18592ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
18602ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
18612ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
18622ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
186324bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
186493da9cc1Scolin@cozybit.com 				struct net_device *dev,
186593da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
186624bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
186729cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
186829cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
186929cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
187029cbe68cSJohannes Berg 			     const struct mesh_config *conf,
187129cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
187229cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
187329cbe68cSJohannes Berg 
18749f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
18759f1ba906SJouni Malinen 			      struct bss_parameters *params);
187631888487SJouni Malinen 
1877f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
187831888487SJouni Malinen 				  struct ieee80211_txq_params *params);
187972bdcf34SJouni Malinen 
1880e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
1881e8c9bd5bSJohannes Berg 					     struct net_device *dev,
1882e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
1883e8c9bd5bSJohannes Berg 
1884e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
1885683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
18869aed3cc1SJouni Malinen 
1887fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
18882a519311SJohannes Berg 			struct cfg80211_scan_request *request);
1889636a5d36SJouni Malinen 
1890636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
1891636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
1892636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
1893636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
1894636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
189563c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
1896636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
189763c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
189804a773adSJohannes Berg 
1899b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
1900b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
1901b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1902b23aa676SSamuel Ortiz 			      u16 reason_code);
1903b23aa676SSamuel Ortiz 
190404a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
190504a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
190604a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1907b9a5f8caSJouni Malinen 
1908f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
1909f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
1910f4e583c8SAntonio Quartulli 
1911b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
19127643a2c3SJohannes Berg 
1913c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1914fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
1915c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1916c8442118SJohannes Berg 				int *dbm);
19171f87f7d3SJohannes Berg 
1918ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1919388ac775SJohannes Berg 				const u8 *addr);
1920ab737a4fSJohannes Berg 
19211f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
1922aff89a9bSJohannes Berg 
1923aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
1924aff89a9bSJohannes Berg 	int	(*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
192571063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
192671063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
192771063f0eSWey-Yi Guy 				 void *data, int len);
1928aff89a9bSJohannes Berg #endif
1929bc92afd9SJohannes Berg 
19309930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
19319930380fSJohannes Berg 				    struct net_device *dev,
19329930380fSJohannes Berg 				    const u8 *peer,
19339930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
19349930380fSJohannes Berg 
193561fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
193661fa713cSHolger Schurig 			int idx, struct survey_info *info);
193761fa713cSHolger Schurig 
193867fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
193967fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
194067fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
194167fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
194267fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
194367fbb16bSSamuel Ortiz 
19449588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
194571bbc994SJohannes Berg 				     struct wireless_dev *wdev,
19469588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
19479588bbd5SJouni Malinen 				     unsigned int duration,
19489588bbd5SJouni Malinen 				     u64 *cookie);
19499588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
195071bbc994SJohannes Berg 					    struct wireless_dev *wdev,
19519588bbd5SJouni Malinen 					    u64 cookie);
19529588bbd5SJouni Malinen 
195371bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1954f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
195542d97a59SJohannes Berg 			  unsigned int wait, const u8 *buf, size_t len,
195642d97a59SJohannes Berg 			  bool no_cck, bool dont_wait_for_ack, u64 *cookie);
1957f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
195871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
1959f7ca38dfSJohannes Berg 				       u64 cookie);
1960026331c4SJouni Malinen 
1961bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1962bc92afd9SJohannes Berg 				  bool enabled, int timeout);
1963d6dc1a38SJuuso Oikarinen 
1964d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
1965d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
1966d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
1967271733cfSJohannes Berg 
196884f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
196984f10708SThomas Pedersen 				      struct net_device *dev,
197084f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
197184f10708SThomas Pedersen 
1972271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
197371bbc994SJohannes Berg 				       struct wireless_dev *wdev,
1974271733cfSJohannes Berg 				       u16 frame_type, bool reg);
1975afe0cbf8SBruno Randolf 
1976afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1977afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
19783677713bSJohn W. Linville 
19793677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
19803677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
19813677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1982807f8a8cSLuciano Coelho 
1983807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
1984807f8a8cSLuciano Coelho 				struct net_device *dev,
1985807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
198685a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
1987e5497d76SJohannes Berg 
1988e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
1989e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
1990109086ceSArik Nemtsov 
1991109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1992109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
1993109086ceSArik Nemtsov 			     u16 status_code, const u8 *buf, size_t len);
1994109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1995109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
19967f6cf311SJohannes Berg 
19977f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
19987f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
1999e999882aSJohannes Berg 
20001d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
20011d9d9213SSimon Wunderlich 				  struct net_device *dev,
20021d9d9213SSimon Wunderlich 				  u16 noack_map);
20031d9d9213SSimon Wunderlich 
2004d6199218SBen Greear 	int	(*get_et_sset_count)(struct wiphy *wiphy,
2005d6199218SBen Greear 				     struct net_device *dev, int sset);
2006d6199218SBen Greear 	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2007d6199218SBen Greear 				struct ethtool_stats *stats, u64 *data);
2008d6199218SBen Greear 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2009d6199218SBen Greear 				  u32 sset, u8 *data);
2010dbbae26aSMichal Kazior 
2011683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
20125b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
2013683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
201498104fdeSJohannes Berg 
201598104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
201698104fdeSJohannes Berg 				    struct wireless_dev *wdev);
201798104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
201898104fdeSJohannes Berg 				   struct wireless_dev *wdev);
2019704232c2SJohannes Berg };
2020704232c2SJohannes Berg 
2021d3236553SJohannes Berg /*
2022d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
2023d3236553SJohannes Berg  * and registration/helper functions
2024d3236553SJohannes Berg  */
2025d3236553SJohannes Berg 
2026d3236553SJohannes Berg /**
20275be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
20285be83de5SJohannes Berg  *
20295be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
2030d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
2031d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
2032d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
2033d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
20345be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
20355be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
2036749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
2037749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
2038749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
2039749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
2040749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
2041749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
2042749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
2043061acaaeSLuis R. Rodriguez  *	outside of its regulatory domain. If used in combination with
2044061acaaeSLuis R. Rodriguez  *	WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
2045061acaaeSLuis R. Rodriguez  *	will be followed.
20465be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
20475be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
20485be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
204937184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
20505be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
20515be83de5SJohannes Berg  *	wiphy at all
20525be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
20535be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
20545be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
20555be83de5SJohannes Berg  *	reason to override the default
20569bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
20579bc383deSJohannes Berg  *	on a VLAN interface)
20589bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
2059c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
2060c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
2061c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
2062e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
206315d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
206415d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
20651ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
2066f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
2067f4b34b55SVivek Natarajan  *	firmware.
2068cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
2069109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
2070109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
2071109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
2072109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
2073109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
2074109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
2075562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
20765e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
20775e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
20785e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
207987bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
208087bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
20817c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
20827c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
20835be83de5SJohannes Berg  */
20845be83de5SJohannes Berg enum wiphy_flags {
20855be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
20865be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
20875be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
20885be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
20895be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
20909bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
20919bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
2092c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
2093309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
209415d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
2095807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
20968e8b41f9SJohannes Berg 	/* use hole at 12 */
2097f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
2098cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
2099109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
2100109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
2101562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
21025e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
210387bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
21047c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
21057c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
21067527a782SJohannes Berg };
21077527a782SJohannes Berg 
21087527a782SJohannes Berg /**
21097527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
21107527a782SJohannes Berg  * @max: maximum number of interfaces of these types
21117527a782SJohannes Berg  * @types: interface types (bits)
21127527a782SJohannes Berg  */
21137527a782SJohannes Berg struct ieee80211_iface_limit {
21147527a782SJohannes Berg 	u16 max;
21157527a782SJohannes Berg 	u16 types;
21167527a782SJohannes Berg };
21177527a782SJohannes Berg 
21187527a782SJohannes Berg /**
21197527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
21207527a782SJohannes Berg  * @limits: limits for the given interface types
21217527a782SJohannes Berg  * @n_limits: number of limitations
21227527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
21237527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
21247527a782SJohannes Berg  *	group
21257527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
21267527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
21277527a782SJohannes Berg  *	only in special cases.
2128*11c4a075SSimon Wunderlich  * @radar_detect_widths: bitmap of channel widths supported for radar detection
21297527a782SJohannes Berg  *
21307527a782SJohannes Berg  * These examples can be expressed as follows:
21317527a782SJohannes Berg  *
21327527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
21337527a782SJohannes Berg  *
21347527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
21357527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
21367527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
21377527a782SJohannes Berg  *  };
21387527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
21397527a782SJohannes Berg  *	.limits = limits1,
21407527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
21417527a782SJohannes Berg  *	.max_interfaces = 2,
21427527a782SJohannes Berg  *	.beacon_int_infra_match = true,
21437527a782SJohannes Berg  *  };
21447527a782SJohannes Berg  *
21457527a782SJohannes Berg  *
21467527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
21477527a782SJohannes Berg  *
21487527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
21497527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
21507527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
21517527a782SJohannes Berg  *  };
21527527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
21537527a782SJohannes Berg  *	.limits = limits2,
21547527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
21557527a782SJohannes Berg  *	.max_interfaces = 8,
21567527a782SJohannes Berg  *	.num_different_channels = 1,
21577527a782SJohannes Berg  *  };
21587527a782SJohannes Berg  *
21597527a782SJohannes Berg  *
21607527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
21617527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
21627527a782SJohannes Berg  *
21637527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
21647527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
21657527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
21667527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
21677527a782SJohannes Berg  *  };
21687527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
21697527a782SJohannes Berg  *	.limits = limits3,
21707527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
21717527a782SJohannes Berg  *	.max_interfaces = 4,
21727527a782SJohannes Berg  *	.num_different_channels = 2,
21737527a782SJohannes Berg  *  };
21747527a782SJohannes Berg  */
21757527a782SJohannes Berg struct ieee80211_iface_combination {
21767527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
21777527a782SJohannes Berg 	u32 num_different_channels;
21787527a782SJohannes Berg 	u16 max_interfaces;
21797527a782SJohannes Berg 	u8 n_limits;
21807527a782SJohannes Berg 	bool beacon_int_infra_match;
2181*11c4a075SSimon Wunderlich 	u8 radar_detect_widths;
21825be83de5SJohannes Berg };
21835be83de5SJohannes Berg 
2184ef15aac6SJohannes Berg struct mac_address {
2185ef15aac6SJohannes Berg 	u8 addr[ETH_ALEN];
2186ef15aac6SJohannes Berg };
2187ef15aac6SJohannes Berg 
21882e161f78SJohannes Berg struct ieee80211_txrx_stypes {
21892e161f78SJohannes Berg 	u16 tx, rx;
21902e161f78SJohannes Berg };
21912e161f78SJohannes Berg 
21925be83de5SJohannes Berg /**
2193ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2194ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2195ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2196ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2197ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2198ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2199ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2200ff1b6e69SJohannes Berg  *	(see nl80211.h)
2201ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
220277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
220377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
220477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
220577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
220677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2207ff1b6e69SJohannes Berg  */
2208ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2209ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2210ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2211ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
221277dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
221377dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
221477dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
221577dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
221677dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
2217ff1b6e69SJohannes Berg };
2218ff1b6e69SJohannes Berg 
2219ff1b6e69SJohannes Berg /**
2220ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2221ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2222ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2223ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2224ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2225ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2226ff1b6e69SJohannes Berg  */
2227ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2228ff1b6e69SJohannes Berg 	u32 flags;
2229ff1b6e69SJohannes Berg 	int n_patterns;
2230ff1b6e69SJohannes Berg 	int pattern_max_len;
2231ff1b6e69SJohannes Berg 	int pattern_min_len;
2232ff1b6e69SJohannes Berg };
2233ff1b6e69SJohannes Berg 
2234ff1b6e69SJohannes Berg /**
22355be83de5SJohannes Berg  * struct wiphy - wireless hardware description
22362784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
22372784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
22382784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2239d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
2240d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
2241d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
2242d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
2243d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
2244d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
2245d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
2246b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
2247b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
2248b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
2249b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
2250b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
2251abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
2252ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
2253ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
2254ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
2255ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
2256ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
2257ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
2258ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
2259ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
2260ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
2261ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
2262ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
2263ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
2264fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
2265fd235913SRandy Dunlap  *	unregister hardware
2266abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
2267abe37c4bSJohannes Berg  *	automatically on wiphy renames
2268abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
22694a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
2270abe37c4bSJohannes Berg  * @wext: wireless extension handlers
2271abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
2272abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
2273abe37c4bSJohannes Berg  *	must be set by driver
22747527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
22757527a782SJohannes Berg  *	list single interface types.
22767527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
22777527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
22787527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
2279abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
22801f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
2281abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
2282abe37c4bSJohannes Berg  *	this variable determines its size
2283abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
2284abe37c4bSJohannes Berg  *	any given scan
228593b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
228693b6aa69SLuciano Coelho  *	for in any given scheduled scan
2287a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
2288a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
2289a1f1c21cSLuciano Coelho  *	supported.
2290abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
2291abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
2292abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
22935a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
22945a865badSLuciano Coelho  *	scans
2295abe37c4bSJohannes Berg  * @coverage_class: current coverage class
2296abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
2297abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
2298abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
2299abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
2300abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
2301abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
23022e161f78SJohannes Berg  *
23032e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
23042e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
23052e161f78SJohannes Berg  *	type
2306a7ffac95SBruno Randolf  *
23077f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
23087f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
23097f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
23107f531e03SBruno Randolf  *
23117f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
23127f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
23137f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
2314a293911dSJohannes Berg  *
231515f0ebc2SRandy Dunlap  * @probe_resp_offload:
231615f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
231715f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
231815f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
231915f0ebc2SRandy Dunlap  *
2320a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
2321a293911dSJohannes Berg  *	may request, if implemented.
2322ff1b6e69SJohannes Berg  *
2323ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
2324562a7480SJohannes Berg  *
2325562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
23267e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
23277e7c8926SBen Greear  *	If null, then none can be over-ridden.
2328d3236553SJohannes Berg  */
2329d3236553SJohannes Berg struct wiphy {
2330d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2331d3236553SJohannes Berg 
2332ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2333d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2334ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2335ef15aac6SJohannes Berg 
2336ef15aac6SJohannes Berg 	struct mac_address *addresses;
2337d3236553SJohannes Berg 
23382e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
23392e161f78SJohannes Berg 
23407527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
23417527a782SJohannes Berg 	int n_iface_combinations;
23427527a782SJohannes Berg 	u16 software_iftypes;
23437527a782SJohannes Berg 
23442e161f78SJohannes Berg 	u16 n_addresses;
23452e161f78SJohannes Berg 
2346d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2347d3236553SJohannes Berg 	u16 interface_modes;
2348d3236553SJohannes Berg 
23491f074bd8SJohannes Berg 	u32 flags, features;
2350463d0183SJohannes Berg 
2351562a7480SJohannes Berg 	u32 ap_sme_capa;
2352562a7480SJohannes Berg 
2353d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2354d3236553SJohannes Berg 
2355d3236553SJohannes Berg 	int bss_priv_size;
2356d3236553SJohannes Berg 	u8 max_scan_ssids;
235793b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2358a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2359d3236553SJohannes Berg 	u16 max_scan_ie_len;
23605a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2361d3236553SJohannes Berg 
2362d3236553SJohannes Berg 	int n_cipher_suites;
2363d3236553SJohannes Berg 	const u32 *cipher_suites;
2364d3236553SJohannes Berg 
2365b9a5f8caSJouni Malinen 	u8 retry_short;
2366b9a5f8caSJouni Malinen 	u8 retry_long;
2367b9a5f8caSJouni Malinen 	u32 frag_threshold;
2368b9a5f8caSJouni Malinen 	u32 rts_threshold;
236981077e82SLukáš Turek 	u8 coverage_class;
2370b9a5f8caSJouni Malinen 
2371dfce95f5SKalle Valo 	char fw_version[ETHTOOL_BUSINFO_LEN];
2372dfce95f5SKalle Valo 	u32 hw_version;
2373dfce95f5SKalle Valo 
2374dfb89c56SJohannes Berg #ifdef CONFIG_PM
2375ff1b6e69SJohannes Berg 	struct wiphy_wowlan_support wowlan;
2376dfb89c56SJohannes Berg #endif
2377ff1b6e69SJohannes Berg 
2378a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2379a293911dSJohannes Berg 
238067fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
238167fbb16bSSamuel Ortiz 
23827f531e03SBruno Randolf 	u32 available_antennas_tx;
23837f531e03SBruno Randolf 	u32 available_antennas_rx;
2384a7ffac95SBruno Randolf 
238587bbbe22SArik Nemtsov 	/*
238687bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
238787bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
238887bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
238987bbbe22SArik Nemtsov 	 */
239087bbbe22SArik Nemtsov 	u32 probe_resp_offload;
239187bbbe22SArik Nemtsov 
2392d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2393d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2394d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2395d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2396d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2397cf5aa2f1SDavid Kilroy 	const void *privid;
2398d3236553SJohannes Berg 
2399d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2400d3236553SJohannes Berg 
2401d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
24020c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
2403d3236553SJohannes Berg 			     struct regulatory_request *request);
2404d3236553SJohannes Berg 
2405d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2406d3236553SJohannes Berg 
2407458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
2408d3236553SJohannes Berg 
2409d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
2410d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
2411d3236553SJohannes Berg 	struct device dev;
2412d3236553SJohannes Berg 
2413ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2414ecb44335SStanislaw Gruszka 	bool registered;
2415ecb44335SStanislaw Gruszka 
2416d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
2417d3236553SJohannes Berg 	struct dentry *debugfsdir;
2418d3236553SJohannes Berg 
24197e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
24207e7c8926SBen Greear 
2421463d0183SJohannes Berg #ifdef CONFIG_NET_NS
2422463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
2423463d0183SJohannes Berg 	struct net *_net;
2424463d0183SJohannes Berg #endif
2425463d0183SJohannes Berg 
24263d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
24273d23e349SJohannes Berg 	const struct iw_handler_def *wext;
24283d23e349SJohannes Berg #endif
24293d23e349SJohannes Berg 
24301c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
2431d3236553SJohannes Berg };
2432d3236553SJohannes Berg 
2433463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
2434463d0183SJohannes Berg {
2435c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
2436463d0183SJohannes Berg }
2437463d0183SJohannes Berg 
2438463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2439463d0183SJohannes Berg {
2440c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
2441463d0183SJohannes Berg }
2442463d0183SJohannes Berg 
2443d3236553SJohannes Berg /**
2444d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
2445d3236553SJohannes Berg  *
2446d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
24470ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
2448d3236553SJohannes Berg  */
2449d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
2450d3236553SJohannes Berg {
2451d3236553SJohannes Berg 	BUG_ON(!wiphy);
2452d3236553SJohannes Berg 	return &wiphy->priv;
2453d3236553SJohannes Berg }
2454d3236553SJohannes Berg 
2455d3236553SJohannes Berg /**
2456f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
2457f1f74825SDavid Kilroy  *
2458f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
24590ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
2460f1f74825SDavid Kilroy  */
2461f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
2462f1f74825SDavid Kilroy {
2463f1f74825SDavid Kilroy 	BUG_ON(!priv);
2464f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
2465f1f74825SDavid Kilroy }
2466f1f74825SDavid Kilroy 
2467f1f74825SDavid Kilroy /**
2468d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
2469d3236553SJohannes Berg  *
2470d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
2471d3236553SJohannes Berg  * @dev: The device to parent it to
2472d3236553SJohannes Berg  */
2473d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2474d3236553SJohannes Berg {
2475d3236553SJohannes Berg 	wiphy->dev.parent = dev;
2476d3236553SJohannes Berg }
2477d3236553SJohannes Berg 
2478d3236553SJohannes Berg /**
2479d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
2480d3236553SJohannes Berg  *
2481d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
24820ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
2483d3236553SJohannes Berg  */
2484d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
2485d3236553SJohannes Berg {
2486d3236553SJohannes Berg 	return wiphy->dev.parent;
2487d3236553SJohannes Berg }
2488d3236553SJohannes Berg 
2489d3236553SJohannes Berg /**
2490d3236553SJohannes Berg  * wiphy_name - get wiphy name
2491d3236553SJohannes Berg  *
2492d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
24930ae997dcSYacine Belkadi  * Return: The name of @wiphy.
2494d3236553SJohannes Berg  */
2495e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
2496d3236553SJohannes Berg {
2497d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
2498d3236553SJohannes Berg }
2499d3236553SJohannes Berg 
2500d3236553SJohannes Berg /**
2501d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
2502d3236553SJohannes Berg  *
2503d3236553SJohannes Berg  * @ops: The configuration operations for this device
2504d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
2505d3236553SJohannes Berg  *
2506d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
2507d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
2508d3236553SJohannes Berg  *
25090ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
25100ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
2511d3236553SJohannes Berg  */
25123dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2513d3236553SJohannes Berg 
2514d3236553SJohannes Berg /**
2515d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
2516d3236553SJohannes Berg  *
2517d3236553SJohannes Berg  * @wiphy: The wiphy to register.
2518d3236553SJohannes Berg  *
25190ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
2520d3236553SJohannes Berg  */
2521d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
2522d3236553SJohannes Berg 
2523d3236553SJohannes Berg /**
2524d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
2525d3236553SJohannes Berg  *
2526d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
2527d3236553SJohannes Berg  *
2528d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
2529d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
2530d3236553SJohannes Berg  * request that is being handled.
2531d3236553SJohannes Berg  */
2532d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
2533d3236553SJohannes Berg 
2534d3236553SJohannes Berg /**
2535d3236553SJohannes Berg  * wiphy_free - free wiphy
2536d3236553SJohannes Berg  *
2537d3236553SJohannes Berg  * @wiphy: The wiphy to free
2538d3236553SJohannes Berg  */
2539d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
2540d3236553SJohannes Berg 
2541fffd0934SJohannes Berg /* internal structs */
25426829c878SJohannes Berg struct cfg80211_conn;
254319957bb3SJohannes Berg struct cfg80211_internal_bss;
2544fffd0934SJohannes Berg struct cfg80211_cached_keys;
254519957bb3SJohannes Berg 
2546d3236553SJohannes Berg /**
254789a54e48SJohannes Berg  * struct wireless_dev - wireless device state
2548d3236553SJohannes Berg  *
254989a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
255089a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
255189a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
255289a54e48SJohannes Berg  * It need not be registered then as netdev registration will
255389a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
255489a54e48SJohannes Berg  *
255589a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
255689a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
255789a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
255889a54e48SJohannes Berg  * allocated outside of callback operations that return it.
2559d3236553SJohannes Berg  *
2560d3236553SJohannes Berg  * @wiphy: pointer to hardware description
2561d3236553SJohannes Berg  * @iftype: interface type
2562d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
256389a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
256489a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
256589a54e48SJohannes Berg  *	wireless device if it has no netdev
2566d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
2567f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
2568aa430da4SJohannes Berg  *	the user-set AP, monitor and WDS channel
2569aa430da4SJohannes Berg  * @preset_chan: (private) Used by the internal configuration code to
2570aa430da4SJohannes Berg  *	track the channel to be used for AP later
2571aa430da4SJohannes Berg  * @preset_chantype: (private) the corresponding channel type
2572d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
2573d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
2574d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
257529cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
257629cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
2577d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
25789bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
25799bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
25809bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
25819bc383deSJohannes Berg  *	by cfg80211 on change_interface
25822e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
25832e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
2584abe37c4bSJohannes Berg  * @mtx: mutex used to lock data in this struct
2585abe37c4bSJohannes Berg  * @cleanup_work: work struct used for cleanup that can't be done directly
258656d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
258756d1893dSJohannes Berg  *	beacons, 0 when not valid
258898104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
258998104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
2590d3236553SJohannes Berg  */
2591d3236553SJohannes Berg struct wireless_dev {
2592d3236553SJohannes Berg 	struct wiphy *wiphy;
2593d3236553SJohannes Berg 	enum nl80211_iftype iftype;
2594d3236553SJohannes Berg 
2595667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
2596d3236553SJohannes Berg 	struct list_head list;
2597d3236553SJohannes Berg 	struct net_device *netdev;
2598d3236553SJohannes Berg 
259989a54e48SJohannes Berg 	u32 identifier;
260089a54e48SJohannes Berg 
26012e161f78SJohannes Berg 	struct list_head mgmt_registrations;
26022e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
2603026331c4SJouni Malinen 
2604667503ddSJohannes Berg 	struct mutex mtx;
2605667503ddSJohannes Berg 
2606ad002395SJohannes Berg 	struct work_struct cleanup_work;
2607ad002395SJohannes Berg 
260898104fdeSJohannes Berg 	bool use_4addr, p2p_started;
260998104fdeSJohannes Berg 
261098104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
26119bc383deSJohannes Berg 
2612b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
2613d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
261429cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
2615b23aa676SSamuel Ortiz 	enum {
2616b23aa676SSamuel Ortiz 		CFG80211_SME_IDLE,
26176829c878SJohannes Berg 		CFG80211_SME_CONNECTING,
2618b23aa676SSamuel Ortiz 		CFG80211_SME_CONNECTED,
2619b23aa676SSamuel Ortiz 	} sme_state;
26206829c878SJohannes Berg 	struct cfg80211_conn *conn;
2621fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
2622d3236553SJohannes Berg 
2623667503ddSJohannes Berg 	struct list_head event_list;
2624667503ddSJohannes Berg 	spinlock_t event_lock;
2625667503ddSJohannes Berg 
262619957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
2627683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
262819957bb3SJohannes Berg 
2629f4489ebeSMichal Kazior 	/* for AP and mesh channel tracking */
2630f4489ebeSMichal Kazior 	struct ieee80211_channel *channel;
2631f4489ebeSMichal Kazior 
2632c30a3d38SMichal Kazior 	bool ibss_fixed;
2633c30a3d38SMichal Kazior 
2634ffb9eb3dSKalle Valo 	bool ps;
2635ffb9eb3dSKalle Valo 	int ps_timeout;
2636ffb9eb3dSKalle Valo 
263756d1893dSJohannes Berg 	int beacon_interval;
263856d1893dSJohannes Berg 
263915e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
264028946da7SJohannes Berg 
26413d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
2642d3236553SJohannes Berg 	/* wext data */
2643cbe8fa9cSJohannes Berg 	struct {
2644cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
2645f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
2646fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
2647f2129354SJohannes Berg 		u8 *ie;
2648f2129354SJohannes Berg 		size_t ie_len;
2649f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
2650f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
265108645126SJohannes Berg 		s8 default_key, default_mgmt_key;
2652ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
2653cbe8fa9cSJohannes Berg 	} wext;
2654d3236553SJohannes Berg #endif
2655d3236553SJohannes Berg };
2656d3236553SJohannes Berg 
265798104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
265898104fdeSJohannes Berg {
265998104fdeSJohannes Berg 	if (wdev->netdev)
266098104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
266198104fdeSJohannes Berg 	return wdev->address;
266298104fdeSJohannes Berg }
266398104fdeSJohannes Berg 
2664d3236553SJohannes Berg /**
2665d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
2666d3236553SJohannes Berg  *
2667d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
26680ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
2669d3236553SJohannes Berg  */
2670d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
2671d3236553SJohannes Berg {
2672d3236553SJohannes Berg 	BUG_ON(!wdev);
2673d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
2674d3236553SJohannes Berg }
2675d3236553SJohannes Berg 
2676d70e9693SJohannes Berg /**
2677d70e9693SJohannes Berg  * DOC: Utility functions
2678d70e9693SJohannes Berg  *
2679d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
2680d3236553SJohannes Berg  */
2681d3236553SJohannes Berg 
2682d3236553SJohannes Berg /**
2683d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
2684abe37c4bSJohannes Berg  * @chan: channel number
268559eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
26860ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
2687d3236553SJohannes Berg  */
268859eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2689d3236553SJohannes Berg 
2690d3236553SJohannes Berg /**
2691d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
2692abe37c4bSJohannes Berg  * @freq: center frequency
26930ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
2694d3236553SJohannes Berg  */
2695d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
2696d3236553SJohannes Berg 
2697d3236553SJohannes Berg /*
2698d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
2699d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
2700d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
2701d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
2702d3236553SJohannes Berg  * clash.
2703d3236553SJohannes Berg  */
2704d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2705d3236553SJohannes Berg 							 int freq);
2706d3236553SJohannes Berg /**
2707d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
2708abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
2709abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
27100ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
2711d3236553SJohannes Berg  */
2712d3236553SJohannes Berg static inline struct ieee80211_channel *
2713d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
2714d3236553SJohannes Berg {
2715d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
2716d3236553SJohannes Berg }
2717d3236553SJohannes Berg 
2718d3236553SJohannes Berg /**
2719d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
2720d3236553SJohannes Berg  *
2721d3236553SJohannes Berg  * @sband: the band to look for rates in
2722d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
2723d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
2724d3236553SJohannes Berg  *
27250ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
27260ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
27270ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
27280ae997dcSYacine Belkadi  * rates in the band's bitrate table.
2729d3236553SJohannes Berg  */
2730d3236553SJohannes Berg struct ieee80211_rate *
2731d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2732d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
2733d3236553SJohannes Berg 
2734d3236553SJohannes Berg /*
2735d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
2736d3236553SJohannes Berg  *
2737d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
2738d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
2739d3236553SJohannes Berg  */
2740d3236553SJohannes Berg 
274133e5a2f7SJohannes Berg struct radiotap_align_size {
274233e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
274333e5a2f7SJohannes Berg };
274433e5a2f7SJohannes Berg 
274533e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
274633e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
274733e5a2f7SJohannes Berg 	int n_bits;
274833e5a2f7SJohannes Berg 	uint32_t oui;
274933e5a2f7SJohannes Berg 	uint8_t subns;
275033e5a2f7SJohannes Berg };
275133e5a2f7SJohannes Berg 
275233e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
275333e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
275433e5a2f7SJohannes Berg 	int n_ns;
275533e5a2f7SJohannes Berg };
275633e5a2f7SJohannes Berg 
2757d3236553SJohannes Berg /**
2758d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
275933e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
276033e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
276133e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
276233e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
276333e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
276433e5a2f7SJohannes Berg  *	the beginning of the actual data portion
276533e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
276633e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
276733e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
276833e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
276933e5a2f7SJohannes Berg  *	radiotap namespace or not
277033e5a2f7SJohannes Berg  *
277133e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
277233e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
277333e5a2f7SJohannes Berg  * @_arg_index: next argument index
277433e5a2f7SJohannes Berg  * @_arg: next argument pointer
277533e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
277633e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
277733e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
277833e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
277933e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
278033e5a2f7SJohannes Berg  *	next bitmap word
278133e5a2f7SJohannes Berg  *
278233e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
278333e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
2784d3236553SJohannes Berg  */
2785d3236553SJohannes Berg 
2786d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
278733e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
278833e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
278933e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
2790d3236553SJohannes Berg 
279133e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
279267272440SJohannes Berg 	__le32 *_next_bitmap;
279333e5a2f7SJohannes Berg 
279433e5a2f7SJohannes Berg 	unsigned char *this_arg;
279533e5a2f7SJohannes Berg 	int this_arg_index;
279633e5a2f7SJohannes Berg 	int this_arg_size;
279733e5a2f7SJohannes Berg 
279833e5a2f7SJohannes Berg 	int is_radiotap_ns;
279933e5a2f7SJohannes Berg 
280033e5a2f7SJohannes Berg 	int _max_length;
280133e5a2f7SJohannes Berg 	int _arg_index;
280233e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
280333e5a2f7SJohannes Berg 	int _reset_on_ext;
2804d3236553SJohannes Berg };
2805d3236553SJohannes Berg 
2806d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
2807d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator,
2808d3236553SJohannes Berg 	struct ieee80211_radiotap_header *radiotap_header,
280933e5a2f7SJohannes Berg 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
2810d3236553SJohannes Berg 
2811d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
2812d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator);
2813d3236553SJohannes Berg 
281433e5a2f7SJohannes Berg 
2815e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
2816e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
2817e31a16d6SZhu Yi 
2818e31a16d6SZhu Yi /**
2819e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
2820e31a16d6SZhu Yi  *
2821e31a16d6SZhu Yi  * @skb: the frame
28220ae997dcSYacine Belkadi  *
28230ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
28240ae997dcSYacine Belkadi  * returns the 802.11 header length.
28250ae997dcSYacine Belkadi  *
28260ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
28270ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
28280ae997dcSYacine Belkadi  * 802.11 header.
2829e31a16d6SZhu Yi  */
2830e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2831e31a16d6SZhu Yi 
2832e31a16d6SZhu Yi /**
2833e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
2834e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
28350ae997dcSYacine Belkadi  * Return: The header length in bytes.
2836e31a16d6SZhu Yi  */
2837633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2838e31a16d6SZhu Yi 
2839e31a16d6SZhu Yi /**
28409b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
28419b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
28429b395bc3SJohannes Berg  *	(first byte) will be accessed
28430ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
28449b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
28459b395bc3SJohannes Berg  */
28469b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
28479b395bc3SJohannes Berg 
28489b395bc3SJohannes Berg /**
2849d70e9693SJohannes Berg  * DOC: Data path helpers
2850d70e9693SJohannes Berg  *
2851d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
2852d70e9693SJohannes Berg  * functions that help implement the data path for devices
2853d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
2854d70e9693SJohannes Berg  */
2855d70e9693SJohannes Berg 
2856d70e9693SJohannes Berg /**
2857e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
2858e31a16d6SZhu Yi  * @skb: the 802.11 data frame
2859e31a16d6SZhu Yi  * @addr: the device MAC address
2860e31a16d6SZhu Yi  * @iftype: the virtual interface type
28610ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
2862e31a16d6SZhu Yi  */
2863eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2864e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
2865e31a16d6SZhu Yi 
2866e31a16d6SZhu Yi /**
2867e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
2868e31a16d6SZhu Yi  * @skb: the 802.3 frame
2869e31a16d6SZhu Yi  * @addr: the device MAC address
2870e31a16d6SZhu Yi  * @iftype: the virtual interface type
2871e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
2872e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
28730ae997dcSYacine Belkadi  * Return: 0 on success, or a negative error code.
2874e31a16d6SZhu Yi  */
2875eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2876e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
2877e31a16d6SZhu Yi 
2878e31a16d6SZhu Yi /**
2879eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
2880eaf85ca7SZhu Yi  *
2881eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
2882eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
2883eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
2884eaf85ca7SZhu Yi  *
2885eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
2886eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
2887eaf85ca7SZhu Yi  *	initialized by by the caller.
2888eaf85ca7SZhu Yi  * @addr: The device MAC address.
2889eaf85ca7SZhu Yi  * @iftype: The device interface type.
2890eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
28918b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
2892eaf85ca7SZhu Yi  */
2893eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2894eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
28958b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
28968b3becadSYogesh Ashok Powar 			      bool has_80211_header);
2897eaf85ca7SZhu Yi 
2898eaf85ca7SZhu Yi /**
2899e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
2900e31a16d6SZhu Yi  * @skb: the data frame
29010ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
2902e31a16d6SZhu Yi  */
2903e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2904e31a16d6SZhu Yi 
2905c21dbf92SJohannes Berg /**
2906c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
2907c21dbf92SJohannes Berg  *
2908c21dbf92SJohannes Berg  * @eid: element ID
2909c21dbf92SJohannes Berg  * @ies: data consisting of IEs
2910c21dbf92SJohannes Berg  * @len: length of data
2911c21dbf92SJohannes Berg  *
29120ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
29130ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
29140ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
29150ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
29160ae997dcSYacine Belkadi  *
29170ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
29180ae997dcSYacine Belkadi  * having to fit into the given data.
2919c21dbf92SJohannes Berg  */
2920c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2921c21dbf92SJohannes Berg 
2922d70e9693SJohannes Berg /**
29230c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
29240c28ec58SEliad Peller  *
29250c28ec58SEliad Peller  * @oui: vendor OUI
29260c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
29270c28ec58SEliad Peller  * @ies: data consisting of IEs
29280c28ec58SEliad Peller  * @len: length of data
29290c28ec58SEliad Peller  *
29300ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
29310ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
29320ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
29330ae997dcSYacine Belkadi  * element ID.
29340ae997dcSYacine Belkadi  *
29350ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
29360ae997dcSYacine Belkadi  * the given data.
29370c28ec58SEliad Peller  */
29380c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
29390c28ec58SEliad Peller 				  const u8 *ies, int len);
29400c28ec58SEliad Peller 
29410c28ec58SEliad Peller /**
2942d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
2943d70e9693SJohannes Berg  *
2944d70e9693SJohannes Berg  * TODO
2945d3236553SJohannes Berg  */
2946d3236553SJohannes Berg 
2947d3236553SJohannes Berg /**
2948d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
2949d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
2950d3236553SJohannes Berg  *	conflicts)
2951d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
2952d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
2953d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
2954d3236553SJohannes Berg  * 	alpha2.
2955d3236553SJohannes Berg  *
2956d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
2957d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
2958d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
2959d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
2960d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
2961d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
2962d3236553SJohannes Berg  *
2963d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
2964d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
2965d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
2966d3236553SJohannes Berg  *
2967d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
2968d3236553SJohannes Berg  * an -ENOMEM.
29690ae997dcSYacine Belkadi  *
29700ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
2971d3236553SJohannes Berg  */
2972d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2973d3236553SJohannes Berg 
2974d3236553SJohannes Berg /**
2975d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
2976d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
2977d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
2978d3236553SJohannes Berg  *
2979d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
2980d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
2981d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
2982d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
2983d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
2984d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
2985d3236553SJohannes Berg  */
2986d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
2987d3236553SJohannes Berg 	struct wiphy *wiphy,
2988d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
2989d3236553SJohannes Berg 
2990d3236553SJohannes Berg /**
2991d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
2992d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
2993d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
2994d3236553SJohannes Berg  *
2995d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
2996d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
2997d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
2998d3236553SJohannes Berg  * and processed already.
2999d3236553SJohannes Berg  *
30000ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
30010ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
30020ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
30030ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
30040ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
30050ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
30060ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
3007d3236553SJohannes Berg  */
3008361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3009361c9c8bSJohannes Berg 					       u32 center_freq);
3010d3236553SJohannes Berg 
3011d3236553SJohannes Berg /*
3012d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
3013d3236553SJohannes Berg  * functions and BSS handling helpers
3014d3236553SJohannes Berg  */
3015d3236553SJohannes Berg 
30162a519311SJohannes Berg /**
30172a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
30182a519311SJohannes Berg  *
30192a519311SJohannes Berg  * @request: the corresponding scan request
30202a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
30212a519311SJohannes Berg  *	userspace will be notified of that
30222a519311SJohannes Berg  */
30232a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
30242a519311SJohannes Berg 
30252a519311SJohannes Berg /**
3026807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
3027807f8a8cSLuciano Coelho  *
3028807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
3029807f8a8cSLuciano Coelho  */
3030807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
3031807f8a8cSLuciano Coelho 
3032807f8a8cSLuciano Coelho /**
3033807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
3034807f8a8cSLuciano Coelho  *
3035807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
3036807f8a8cSLuciano Coelho  *
3037807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
3038807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
3039807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
3040807f8a8cSLuciano Coelho  */
3041807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3042807f8a8cSLuciano Coelho 
3043807f8a8cSLuciano Coelho /**
3044abe37c4bSJohannes Berg  * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
30452a519311SJohannes Berg  *
30462a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
3047abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3048abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
3049abe37c4bSJohannes Berg  * @len: length of the management frame
305077965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
30512a519311SJohannes Berg  * @gfp: context flags
30522a519311SJohannes Berg  *
30532a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
30542a519311SJohannes Berg  * the BSS should be updated/added.
3055ef100682SJohannes Berg  *
30560ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
30570ae997dcSYacine Belkadi  * Or %NULL on error.
30582a519311SJohannes Berg  */
3059ef100682SJohannes Berg struct cfg80211_bss * __must_check
30602a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
30612a519311SJohannes Berg 			  struct ieee80211_channel *channel,
30622a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
306377965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
30642a519311SJohannes Berg 
3065abe37c4bSJohannes Berg /**
3066abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
3067abe37c4bSJohannes Berg  *
3068abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
3069abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3070abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
30717b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
3072abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
3073abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
3074abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
3075abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
3076abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
3077abe37c4bSJohannes Berg  * @gfp: context flags
3078abe37c4bSJohannes Berg  *
3079abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
3080abe37c4bSJohannes Berg  * the BSS should be updated/added.
3081ef100682SJohannes Berg  *
30820ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
30830ae997dcSYacine Belkadi  * Or %NULL on error.
3084abe37c4bSJohannes Berg  */
3085ef100682SJohannes Berg struct cfg80211_bss * __must_check
308606aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
308706aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
30887b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
30897b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
309006aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
309106aa7afaSJussi Kivilinna 
30922a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
30932a519311SJohannes Berg 				      struct ieee80211_channel *channel,
30942a519311SJohannes Berg 				      const u8 *bssid,
309579420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
309679420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
309779420f09SJohannes Berg static inline struct cfg80211_bss *
309879420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
309979420f09SJohannes Berg 		  struct ieee80211_channel *channel,
310079420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
310179420f09SJohannes Berg {
310279420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
310379420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
310479420f09SJohannes Berg }
310579420f09SJohannes Berg 
31062a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
31072a519311SJohannes Berg 				       struct ieee80211_channel *channel,
31082a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
31092a519311SJohannes Berg 				       const u8 *meshcfg);
31104c0c0b75SJohannes Berg /**
31114c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
31124c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
31134c0c0b75SJohannes Berg  *
31144c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
31154c0c0b75SJohannes Berg  */
31164c0c0b75SJohannes Berg void cfg80211_ref_bss(struct cfg80211_bss *bss);
31174c0c0b75SJohannes Berg 
31184c0c0b75SJohannes Berg /**
31194c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
31204c0c0b75SJohannes Berg  * @bss: the BSS struct
31214c0c0b75SJohannes Berg  *
31224c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
31234c0c0b75SJohannes Berg  */
31242a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
3125d3236553SJohannes Berg 
3126d491af19SJohannes Berg /**
3127d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
3128d491af19SJohannes Berg  * @wiphy: the wiphy
3129d491af19SJohannes Berg  * @bss: the bss to remove
3130d491af19SJohannes Berg  *
3131d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
3132d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
3133d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
3134d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
3135d491af19SJohannes Berg  */
3136d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3137fee52678SJohannes Berg 
31386039f6d2SJouni Malinen /**
31396039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
31406039f6d2SJouni Malinen  * @dev: network device
31416039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
31426039f6d2SJouni Malinen  * @len: length of the frame data
31436039f6d2SJouni Malinen  *
31446039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
31451965c853SJouni Malinen  * station mode. The driver is required to call either this function or
31461965c853SJouni Malinen  * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
3147cb0b4bebSJohannes Berg  * call. This function may sleep.
31486039f6d2SJouni Malinen  */
3149cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
31506039f6d2SJouni Malinen 
31516039f6d2SJouni Malinen /**
31521965c853SJouni Malinen  * cfg80211_send_auth_timeout - notification of timed out authentication
31531965c853SJouni Malinen  * @dev: network device
31541965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
3155cb0b4bebSJohannes Berg  *
3156cb0b4bebSJohannes Berg  * This function may sleep.
31571965c853SJouni Malinen  */
3158cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
31591965c853SJouni Malinen 
31601965c853SJouni Malinen /**
31616039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
31626039f6d2SJouni Malinen  * @dev: network device
316395de817bSJohannes Berg  * @bss: the BSS struct association was requested for, the struct reference
316495de817bSJohannes Berg  *	is owned by cfg80211 after this call
31656039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
31666039f6d2SJouni Malinen  * @len: length of the frame data
31676039f6d2SJouni Malinen  *
31686039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
31691965c853SJouni Malinen  * processed in station mode. The driver is required to call either this
31701965c853SJouni Malinen  * function or cfg80211_send_assoc_timeout() to indicate the result of
3171cb0b4bebSJohannes Berg  * cfg80211_ops::assoc() call. This function may sleep.
31726039f6d2SJouni Malinen  */
317395de817bSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
317495de817bSJohannes Berg 			    const u8 *buf, size_t len);
31756039f6d2SJouni Malinen 
31766039f6d2SJouni Malinen /**
31771965c853SJouni Malinen  * cfg80211_send_assoc_timeout - notification of timed out association
31781965c853SJouni Malinen  * @dev: network device
31791965c853SJouni Malinen  * @addr: The MAC address of the device with which the association timed out
3180cb0b4bebSJohannes Berg  *
3181cb0b4bebSJohannes Berg  * This function may sleep.
31821965c853SJouni Malinen  */
3183cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
31841965c853SJouni Malinen 
31851965c853SJouni Malinen /**
318653b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
31876039f6d2SJouni Malinen  * @dev: network device
31886039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
31896039f6d2SJouni Malinen  * @len: length of the frame data
31906039f6d2SJouni Malinen  *
31916039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
319253b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
3193cb0b4bebSJohannes Berg  * locally generated ones. This function may sleep.
31946039f6d2SJouni Malinen  */
3195ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3196ce470613SHolger Schurig 
3197ce470613SHolger Schurig /**
3198ce470613SHolger Schurig  * __cfg80211_send_deauth - notification of processed deauthentication
3199ce470613SHolger Schurig  * @dev: network device
3200ce470613SHolger Schurig  * @buf: deauthentication frame (header + body)
3201ce470613SHolger Schurig  * @len: length of the frame data
3202ce470613SHolger Schurig  *
3203ce470613SHolger Schurig  * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
3204ce470613SHolger Schurig  */
3205ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
32066039f6d2SJouni Malinen 
32076039f6d2SJouni Malinen /**
320853b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
32096039f6d2SJouni Malinen  * @dev: network device
32106039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
32116039f6d2SJouni Malinen  * @len: length of the frame data
32126039f6d2SJouni Malinen  *
32136039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
321453b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
3215cb0b4bebSJohannes Berg  * generated ones. This function may sleep.
32166039f6d2SJouni Malinen  */
3217ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
3218ce470613SHolger Schurig 
3219ce470613SHolger Schurig /**
3220ce470613SHolger Schurig  * __cfg80211_send_disassoc - notification of processed disassociation
3221ce470613SHolger Schurig  * @dev: network device
3222ce470613SHolger Schurig  * @buf: disassociation response frame (header + body)
3223ce470613SHolger Schurig  * @len: length of the frame data
3224ce470613SHolger Schurig  *
3225ce470613SHolger Schurig  * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
3226ce470613SHolger Schurig  */
3227ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
3228ce470613SHolger Schurig 	size_t len);
32296039f6d2SJouni Malinen 
3230a08c1c1aSKalle Valo /**
3231cf4e594eSJouni Malinen  * cfg80211_send_unprot_deauth - notification of unprotected deauthentication
3232cf4e594eSJouni Malinen  * @dev: network device
3233cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
3234cf4e594eSJouni Malinen  * @len: length of the frame data
3235cf4e594eSJouni Malinen  *
3236cf4e594eSJouni Malinen  * This function is called whenever a received Deauthentication frame has been
3237cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Deauthentication
3238cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3239cf4e594eSJouni Malinen  */
3240cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
3241cf4e594eSJouni Malinen 				 size_t len);
3242cf4e594eSJouni Malinen 
3243cf4e594eSJouni Malinen /**
3244cf4e594eSJouni Malinen  * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
3245cf4e594eSJouni Malinen  * @dev: network device
3246cf4e594eSJouni Malinen  * @buf: disassociation frame (header + body)
3247cf4e594eSJouni Malinen  * @len: length of the frame data
3248cf4e594eSJouni Malinen  *
3249cf4e594eSJouni Malinen  * This function is called whenever a received Disassociation frame has been
3250cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Disassociation
3251cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3252cf4e594eSJouni Malinen  */
3253cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
3254cf4e594eSJouni Malinen 				   size_t len);
3255cf4e594eSJouni Malinen 
3256cf4e594eSJouni Malinen /**
3257a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
3258a3b8b056SJouni Malinen  * @dev: network device
3259a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
3260a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
3261a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
3262a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
3263e6d6e342SJohannes Berg  * @gfp: allocation flags
3264a3b8b056SJouni Malinen  *
3265a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
3266a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
3267a3b8b056SJouni Malinen  * primitive.
3268a3b8b056SJouni Malinen  */
3269a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3270a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
3271e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
3272a3b8b056SJouni Malinen 
327304a773adSJohannes Berg /**
327404a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
327504a773adSJohannes Berg  *
327604a773adSJohannes Berg  * @dev: network device
327704a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
327804a773adSJohannes Berg  * @gfp: allocation flags
327904a773adSJohannes Berg  *
328004a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
328104a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
328204a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
328304a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
328404a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
328504a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
328604a773adSJohannes Berg  */
328704a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
328804a773adSJohannes Berg 
32891f87f7d3SJohannes Berg /**
3290c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
3291c93b5e71SJavier Cardona  *
3292c93b5e71SJavier Cardona  * @dev: network device
3293c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
3294c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
3295c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
3296c93b5e71SJavier Cardona  * @gfp: allocation flags
3297c93b5e71SJavier Cardona  *
3298c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
3299c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
3300c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
3301c93b5e71SJavier Cardona  */
3302c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
3303c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3304c93b5e71SJavier Cardona 
3305c93b5e71SJavier Cardona /**
3306d70e9693SJohannes Berg  * DOC: RFkill integration
3307d70e9693SJohannes Berg  *
3308d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
3309d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
3310d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
3311d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
3312d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
3313d70e9693SJohannes Berg  *
3314d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
3315d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
3316d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
3317d70e9693SJohannes Berg  */
3318d70e9693SJohannes Berg 
3319d70e9693SJohannes Berg /**
33201f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
33211f87f7d3SJohannes Berg  * @wiphy: the wiphy
33221f87f7d3SJohannes Berg  * @blocked: block status
33231f87f7d3SJohannes Berg  */
33241f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
33251f87f7d3SJohannes Berg 
33261f87f7d3SJohannes Berg /**
33271f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
33281f87f7d3SJohannes Berg  * @wiphy: the wiphy
33291f87f7d3SJohannes Berg  */
33301f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
33311f87f7d3SJohannes Berg 
33321f87f7d3SJohannes Berg /**
33331f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
33341f87f7d3SJohannes Berg  * @wiphy: the wiphy
33351f87f7d3SJohannes Berg  */
33361f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
33371f87f7d3SJohannes Berg 
3338aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3339aff89a9bSJohannes Berg /**
3340d70e9693SJohannes Berg  * DOC: Test mode
3341d70e9693SJohannes Berg  *
3342d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
3343d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
3344d70e9693SJohannes Berg  * factory programming.
3345d70e9693SJohannes Berg  *
3346d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
3347d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
3348d70e9693SJohannes Berg  */
3349d70e9693SJohannes Berg 
3350d70e9693SJohannes Berg /**
3351aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
3352aff89a9bSJohannes Berg  * @wiphy: the wiphy
3353aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3354aff89a9bSJohannes Berg  *	be put into the skb
3355aff89a9bSJohannes Berg  *
3356aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
3357aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
3358aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
3359aff89a9bSJohannes Berg  *
33600ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
33610ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
33620ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
33630ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
33640ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
33650ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
33660ae997dcSYacine Belkadi  * must not modify the skb in any other way.
3367aff89a9bSJohannes Berg  *
3368aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
3369aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
33700ae997dcSYacine Belkadi  *
33710ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3372aff89a9bSJohannes Berg  */
3373aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3374aff89a9bSJohannes Berg 						  int approxlen);
3375aff89a9bSJohannes Berg 
3376aff89a9bSJohannes Berg /**
3377aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
3378aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3379aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
3380aff89a9bSJohannes Berg  *
33810ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
33820ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
33830ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
33840ae997dcSYacine Belkadi  * regardless of the return value.
33850ae997dcSYacine Belkadi  *
33860ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
3387aff89a9bSJohannes Berg  */
3388aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
3389aff89a9bSJohannes Berg 
3390aff89a9bSJohannes Berg /**
3391aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
3392aff89a9bSJohannes Berg  * @wiphy: the wiphy
3393aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3394aff89a9bSJohannes Berg  *	be put into the skb
3395aff89a9bSJohannes Berg  * @gfp: allocation flags
3396aff89a9bSJohannes Berg  *
3397aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
3398aff89a9bSJohannes Berg  * testmode multicast group.
3399aff89a9bSJohannes Berg  *
34000ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
34010ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
34020ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
34030ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
34040ae997dcSYacine Belkadi  * in any other way.
3405aff89a9bSJohannes Berg  *
3406aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
3407aff89a9bSJohannes Berg  * skb to send the event.
34080ae997dcSYacine Belkadi  *
34090ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3410aff89a9bSJohannes Berg  */
3411aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3412aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
3413aff89a9bSJohannes Berg 
3414aff89a9bSJohannes Berg /**
3415aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
3416aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3417aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
3418aff89a9bSJohannes Berg  * @gfp: allocation flags
3419aff89a9bSJohannes Berg  *
3420aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
3421aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
3422aff89a9bSJohannes Berg  * consumes it.
3423aff89a9bSJohannes Berg  */
3424aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3425aff89a9bSJohannes Berg 
3426aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
342771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
3428aff89a9bSJohannes Berg #else
3429aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
343071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
3431aff89a9bSJohannes Berg #endif
3432aff89a9bSJohannes Berg 
3433b23aa676SSamuel Ortiz /**
3434b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
3435b23aa676SSamuel Ortiz  *
3436b23aa676SSamuel Ortiz  * @dev: network device
3437b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
3438b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3439b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3440b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3441b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3442b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
3443b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
3444b23aa676SSamuel Ortiz  *	the real status code for failures.
3445b23aa676SSamuel Ortiz  * @gfp: allocation flags
3446b23aa676SSamuel Ortiz  *
3447b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
3448b23aa676SSamuel Ortiz  * succeeded.
3449b23aa676SSamuel Ortiz  */
3450b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3451b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
3452b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
3453b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
3454b23aa676SSamuel Ortiz 
3455b23aa676SSamuel Ortiz /**
3456b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
3457b23aa676SSamuel Ortiz  *
3458b23aa676SSamuel Ortiz  * @dev: network device
3459ed9d0102SJouni Malinen  * @channel: the channel of the new AP
3460b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
3461b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3462b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3463b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3464b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3465b23aa676SSamuel Ortiz  * @gfp: allocation flags
3466b23aa676SSamuel Ortiz  *
3467b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
3468b23aa676SSamuel Ortiz  * from one AP to another while connected.
3469b23aa676SSamuel Ortiz  */
3470ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
3471ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
3472ed9d0102SJouni Malinen 		     const u8 *bssid,
3473b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
3474b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3475b23aa676SSamuel Ortiz 
3476b23aa676SSamuel Ortiz /**
3477adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
3478adbde344SVasanthakumar Thiagarajan  *
3479adbde344SVasanthakumar Thiagarajan  * @dev: network device
3480adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
3481adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
3482adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
3483adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
3484adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
3485adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
3486adbde344SVasanthakumar Thiagarajan  *
3487adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
3488adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
3489adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
3490adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
3491adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
3492adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
3493adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
3494adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
3495adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3496adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
3497adbde344SVasanthakumar Thiagarajan  */
3498adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3499adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
3500adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3501adbde344SVasanthakumar Thiagarajan 
3502adbde344SVasanthakumar Thiagarajan /**
3503b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
3504b23aa676SSamuel Ortiz  *
3505b23aa676SSamuel Ortiz  * @dev: network device
3506b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
3507b23aa676SSamuel Ortiz  * @ie_len: length of IEs
3508b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
3509b23aa676SSamuel Ortiz  * @gfp: allocation flags
3510b23aa676SSamuel Ortiz  *
3511b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
3512b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
3513b23aa676SSamuel Ortiz  */
3514b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
3515b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
3516b23aa676SSamuel Ortiz 
35179588bbd5SJouni Malinen /**
35189588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
351971bbc994SJohannes Berg  * @wdev: wireless device
35209588bbd5SJouni Malinen  * @cookie: the request cookie
35219588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
35229588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
35239588bbd5SJouni Malinen  *	channel
35249588bbd5SJouni Malinen  * @gfp: allocation flags
35259588bbd5SJouni Malinen  */
352671bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
35279588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
35289588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
35299588bbd5SJouni Malinen 
35309588bbd5SJouni Malinen /**
35319588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
353271bbc994SJohannes Berg  * @wdev: wireless device
35339588bbd5SJouni Malinen  * @cookie: the request cookie
35349588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
35359588bbd5SJouni Malinen  * @gfp: allocation flags
35369588bbd5SJouni Malinen  */
353771bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
35389588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
35399588bbd5SJouni Malinen 					gfp_t gfp);
3540b23aa676SSamuel Ortiz 
354198b62183SJohannes Berg 
354298b62183SJohannes Berg /**
354398b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
354498b62183SJohannes Berg  *
354598b62183SJohannes Berg  * @dev: the netdev
354698b62183SJohannes Berg  * @mac_addr: the station's address
354798b62183SJohannes Berg  * @sinfo: the station information
354898b62183SJohannes Berg  * @gfp: allocation flags
354998b62183SJohannes Berg  */
355098b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
355198b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
355298b62183SJohannes Berg 
3553026331c4SJouni Malinen /**
3554ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
3555ec15e68bSJouni Malinen  *
3556ec15e68bSJouni Malinen  * @dev: the netdev
3557ec15e68bSJouni Malinen  * @mac_addr: the station's address
3558ec15e68bSJouni Malinen  * @gfp: allocation flags
3559ec15e68bSJouni Malinen  */
3560ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3561ec15e68bSJouni Malinen 
3562ec15e68bSJouni Malinen /**
3563ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
3564ed44a951SPandiyarajan Pitchaimuthu  *
3565ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
3566ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
3567ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
3568ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
3569ed44a951SPandiyarajan Pitchaimuthu  *
3570ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
3571ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
3572ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
3573ed44a951SPandiyarajan Pitchaimuthu  *
3574ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
3575ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
3576ed44a951SPandiyarajan Pitchaimuthu  */
3577ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
3578ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
3579ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
3580ed44a951SPandiyarajan Pitchaimuthu 
3581ed44a951SPandiyarajan Pitchaimuthu /**
35822e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
358371bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
3584026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
3585804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
35862e161f78SJohannes Berg  * @buf: Management frame (header + body)
3587026331c4SJouni Malinen  * @len: length of the frame data
3588026331c4SJouni Malinen  * @gfp: context flags
35892e161f78SJohannes Berg  *
35900ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
35910ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
35920ae997dcSYacine Belkadi  *
35930ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
35942e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
35952e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
35962e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
3597026331c4SJouni Malinen  */
359871bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3599804483e9SJohannes Berg 		      const u8 *buf, size_t len, gfp_t gfp);
3600026331c4SJouni Malinen 
3601026331c4SJouni Malinen /**
36022e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
360371bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
36042e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
36052e161f78SJohannes Berg  * @buf: Management frame (header + body)
3606026331c4SJouni Malinen  * @len: length of the frame data
3607026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
3608026331c4SJouni Malinen  * @gfp: context flags
3609026331c4SJouni Malinen  *
36102e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
36112e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3612026331c4SJouni Malinen  * transmission attempt.
3613026331c4SJouni Malinen  */
361471bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
3615026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
3616026331c4SJouni Malinen 
3617d6dc1a38SJuuso Oikarinen 
3618d6dc1a38SJuuso Oikarinen /**
3619d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
3620d6dc1a38SJuuso Oikarinen  * @dev: network device
3621d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
3622d6dc1a38SJuuso Oikarinen  * @gfp: context flags
3623d6dc1a38SJuuso Oikarinen  *
3624d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
3625d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
3626d6dc1a38SJuuso Oikarinen  */
3627d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
3628d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
3629d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
3630d6dc1a38SJuuso Oikarinen 
3631c063dbf5SJohannes Berg /**
3632c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
3633c063dbf5SJohannes Berg  * @dev: network device
3634c063dbf5SJohannes Berg  * @peer: peer's MAC address
3635c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
3636c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
3637c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
3638c063dbf5SJohannes Berg  * @gfp: context flags
3639c063dbf5SJohannes Berg  */
3640c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3641c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
3642c063dbf5SJohannes Berg 
3643e5497d76SJohannes Berg /**
364484f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
364584f10708SThomas Pedersen  * @dev: network device
364684f10708SThomas Pedersen  * @peer: peer's MAC address
364784f10708SThomas Pedersen  * @num_packets: how many packets were lost
364884f10708SThomas Pedersen  * @rate: % of packets which failed transmission
364984f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
365084f10708SThomas Pedersen  * @gfp: context flags
365184f10708SThomas Pedersen  *
365284f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
365384f10708SThomas Pedersen  * given interval is exceeded.
365484f10708SThomas Pedersen  */
365584f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
365684f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
365784f10708SThomas Pedersen 
365884f10708SThomas Pedersen /**
3659e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3660e5497d76SJohannes Berg  * @dev: network device
3661e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
3662e5497d76SJohannes Berg  * @replay_ctr: new replay counter
3663af71ff85SJohannes Berg  * @gfp: allocation flags
3664e5497d76SJohannes Berg  */
3665e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3666e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
3667e5497d76SJohannes Berg 
3668c9df56b4SJouni Malinen /**
3669c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
3670c9df56b4SJouni Malinen  * @dev: network device
3671c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
3672c9df56b4SJouni Malinen  * @bssid: BSSID of AP
3673c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
3674c9df56b4SJouni Malinen  * @gfp: allocation flags
3675c9df56b4SJouni Malinen  */
3676c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3677c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
3678c9df56b4SJouni Malinen 
367928946da7SJohannes Berg /**
368028946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
368128946da7SJohannes Berg  * @dev: The device the frame matched to
368228946da7SJohannes Berg  * @addr: the transmitter address
368328946da7SJohannes Berg  * @gfp: context flags
368428946da7SJohannes Berg  *
368528946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
368628946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
368728946da7SJohannes Berg  * sender.
36880ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
368928946da7SJohannes Berg  * for a reason other than not having a subscription.)
369028946da7SJohannes Berg  */
369128946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
369228946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
369328946da7SJohannes Berg 
36947f6cf311SJohannes Berg /**
3695b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
3696b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
3697b92ab5d8SJohannes Berg  * @addr: the transmitter address
3698b92ab5d8SJohannes Berg  * @gfp: context flags
3699b92ab5d8SJohannes Berg  *
3700b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
3701b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
3702b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
3703b92ab5d8SJohannes Berg  * station to avoid event flooding.
37040ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
3705b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
3706b92ab5d8SJohannes Berg  */
3707b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
3708b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
3709b92ab5d8SJohannes Berg 
3710b92ab5d8SJohannes Berg /**
37117f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
37127f6cf311SJohannes Berg  * @dev: the device the probe was sent on
37137f6cf311SJohannes Berg  * @addr: the address of the peer
37147f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
37157f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
37167f6cf311SJohannes Berg  * @gfp: allocation flags
37177f6cf311SJohannes Berg  */
37187f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
37197f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
37207f6cf311SJohannes Berg 
37215e760230SJohannes Berg /**
37225e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
37235e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
37245e760230SJohannes Berg  * @frame: the frame
37255e760230SJohannes Berg  * @len: length of the frame
37265e760230SJohannes Berg  * @freq: frequency the frame was received on
3727804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
37285e760230SJohannes Berg  *
37295e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
37305e760230SJohannes Berg  * received. It is not useful to call this when there is no
37315e760230SJohannes Berg  * netdev that is in AP/GO mode.
37325e760230SJohannes Berg  */
37335e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
37345e760230SJohannes Berg 				 const u8 *frame, size_t len,
373537c73b5fSBen Greear 				 int freq, int sig_dbm);
37365e760230SJohannes Berg 
3737d58e7e37SJohannes Berg /**
3738683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
373954858ee5SAlexander Simon  * @wiphy: the wiphy
3740683b6d3bSJohannes Berg  * @chandef: the channel definition
3741d58e7e37SJohannes Berg  *
37420ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
37430ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
374454858ee5SAlexander Simon  */
3745683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3746683b6d3bSJohannes Berg 			     struct cfg80211_chan_def *chandef);
374754858ee5SAlexander Simon 
37488097e149SThomas Pedersen /*
37495314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
37505314526bSThomas Pedersen  * @dev: the device which switched channels
3751683b6d3bSJohannes Berg  * @chandef: the new channel definition
37525314526bSThomas Pedersen  *
37535314526bSThomas Pedersen  * Acquires wdev_lock, so must only be called from sleepable driver context!
37545314526bSThomas Pedersen  */
3755683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
3756683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
37575314526bSThomas Pedersen 
37585314526bSThomas Pedersen /*
37593475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
37603475b094SJouni Malinen  * @dev: the device on which the operation is requested
37613475b094SJouni Malinen  * @peer: the MAC address of the peer device
37623475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
37633475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
37643475b094SJouni Malinen  * @reason_code: the reason code for teardown request
37653475b094SJouni Malinen  * @gfp: allocation flags
37663475b094SJouni Malinen  *
37673475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
37683475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
37693475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
37703475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
37713475b094SJouni Malinen  * based on traffic and signal strength for a peer).
37723475b094SJouni Malinen  */
37733475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
37743475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
37753475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
37763475b094SJouni Malinen 
37773475b094SJouni Malinen /*
37788097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
37798097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
37808097e149SThomas Pedersen  *
37818097e149SThomas Pedersen  * return 0 if MCS index >= 32
37828097e149SThomas Pedersen  */
37838eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
37848097e149SThomas Pedersen 
378598104fdeSJohannes Berg /**
378698104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
378798104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
378898104fdeSJohannes Berg  *
378998104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
379098104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
379198104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
379298104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
379398104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
379498104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
379598104fdeSJohannes Berg  * when the device is unbound from the driver.
379698104fdeSJohannes Berg  *
379798104fdeSJohannes Berg  * Requires the RTNL to be held.
379898104fdeSJohannes Berg  */
379998104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
380098104fdeSJohannes Berg 
38010ee45355SJohannes Berg /**
38020ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
38030ee45355SJohannes Berg  * @ies: the input IE buffer
38040ee45355SJohannes Berg  * @len: the input length
38050ee45355SJohannes Berg  * @attr: the attribute ID to find
38060ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
38070ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
38080ee45355SJohannes Berg  * @bufsize: size of the output buffer
38090ee45355SJohannes Berg  *
38100ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
38110ee45355SJohannes Berg  * copies its contents to the given buffer.
38120ee45355SJohannes Berg  *
38130ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
38140ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
38150ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
38160ee45355SJohannes Berg  */
3817c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
3818c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
3819c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
38200ee45355SJohannes Berg 
3821e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
3822e1db74fcSJoe Perches 
3823e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
3824e1db74fcSJoe Perches 
3825e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
38269c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
3827e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
38289c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
3829e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
38309c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
3831e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
38329c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
3833e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
38349c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
3835e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
38369c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
3837e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
38389c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
3839e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
38409c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
3841073730d7SJoe Perches 
38429c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
3843e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
38449c376639SJoe Perches 
3845e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
38469c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
3847e1db74fcSJoe Perches 
3848e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
3849e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
3850e1db74fcSJoe Perches #else
3851e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
3852e1db74fcSJoe Perches ({									\
3853e1db74fcSJoe Perches 	if (0)								\
3854e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
3855e1db74fcSJoe Perches 	0;								\
3856e1db74fcSJoe Perches })
3857e1db74fcSJoe Perches #endif
3858e1db74fcSJoe Perches 
3859e1db74fcSJoe Perches /*
3860e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
3861e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
3862e1db74fcSJoe Perches  * file/line information and a backtrace.
3863e1db74fcSJoe Perches  */
3864e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
3865e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
3866e1db74fcSJoe Perches 
3867704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
3868