xref: /linux/include/net/cfg80211.h (revision 9caf03640279e64d0ba36539b42daa1b43a49486)
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
2842ec600d6SLuis Carlos Cobo  */
2852ec600d6SLuis Carlos Cobo struct vif_params {
2868b787643SFelix Fietkau        int use_4addr;
2872ec600d6SLuis Carlos Cobo };
2882ec600d6SLuis Carlos Cobo 
28941ade00fSJohannes Berg /**
29041ade00fSJohannes Berg  * struct key_params - key information
29141ade00fSJohannes Berg  *
29241ade00fSJohannes Berg  * Information about a key
29341ade00fSJohannes Berg  *
29441ade00fSJohannes Berg  * @key: key material
29541ade00fSJohannes Berg  * @key_len: length of key material
29641ade00fSJohannes Berg  * @cipher: cipher suite selector
29741ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
29841ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
29941ade00fSJohannes Berg  *	length given by @seq_len.
300abe37c4bSJohannes Berg  * @seq_len: length of @seq.
30141ade00fSJohannes Berg  */
30241ade00fSJohannes Berg struct key_params {
30341ade00fSJohannes Berg 	u8 *key;
30441ade00fSJohannes Berg 	u8 *seq;
30541ade00fSJohannes Berg 	int key_len;
30641ade00fSJohannes Berg 	int seq_len;
30741ade00fSJohannes Berg 	u32 cipher;
30841ade00fSJohannes Berg };
30941ade00fSJohannes Berg 
310ed1b6cc7SJohannes Berg /**
311683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
312683b6d3bSJohannes Berg  * @chan: the (control) channel
3133d9d1d66SJohannes Berg  * @width: channel width
3143d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
3153d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
3163d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
317683b6d3bSJohannes Berg  */
318683b6d3bSJohannes Berg struct cfg80211_chan_def {
319683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
3203d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
3213d9d1d66SJohannes Berg 	u32 center_freq1;
3223d9d1d66SJohannes Berg 	u32 center_freq2;
323683b6d3bSJohannes Berg };
324683b6d3bSJohannes Berg 
3253d9d1d66SJohannes Berg /**
3263d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
3273d9d1d66SJohannes Berg  * @chandef: the channel definition
3283d9d1d66SJohannes Berg  *
3293d9d1d66SJohannes Berg  * Returns the old channel type (NOHT, HT20, HT40+/-) from a given
3303d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
3313d9d1d66SJohannes Berg  */
332683b6d3bSJohannes Berg static inline enum nl80211_channel_type
333683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
334683b6d3bSJohannes Berg {
3353d9d1d66SJohannes Berg 	switch (chandef->width) {
3363d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
3373d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
3383d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
3393d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
3403d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
3413d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
3423d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
3433d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
3443d9d1d66SJohannes Berg 	default:
3453d9d1d66SJohannes Berg 		WARN_ON(1);
3463d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
347683b6d3bSJohannes Berg 	}
3483d9d1d66SJohannes Berg }
3493d9d1d66SJohannes Berg 
3503d9d1d66SJohannes Berg /**
3513d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
3523d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
3533d9d1d66SJohannes Berg  * @channel: the control channel
3543d9d1d66SJohannes Berg  * @chantype: the channel type
3553d9d1d66SJohannes Berg  *
3563d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
3573d9d1d66SJohannes Berg  */
3583d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
3593d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
3603d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
3613d9d1d66SJohannes Berg 
3623d9d1d66SJohannes Berg /**
3633d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
3643d9d1d66SJohannes Berg  * @chandef1: first channel definition
3653d9d1d66SJohannes Berg  * @chandef2: second channel definition
3663d9d1d66SJohannes Berg  *
3673d9d1d66SJohannes Berg  * Returns %true if the channels defined by the channel definitions are
3683d9d1d66SJohannes Berg  * identical, %false otherwise.
3693d9d1d66SJohannes Berg  */
3703d9d1d66SJohannes Berg static inline bool
3713d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
3723d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
3733d9d1d66SJohannes Berg {
3743d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
3753d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
3763d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
3773d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
3783d9d1d66SJohannes Berg }
3793d9d1d66SJohannes Berg 
3803d9d1d66SJohannes Berg /**
3813d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
3823d9d1d66SJohannes Berg  * @chandef1: first channel definition
3833d9d1d66SJohannes Berg  * @chandef2: second channel definition
3843d9d1d66SJohannes Berg  *
3853d9d1d66SJohannes Berg  * Returns %NULL if the given channel definitions are incompatible,
3863d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
3873d9d1d66SJohannes Berg  */
3883d9d1d66SJohannes Berg const struct cfg80211_chan_def *
3893d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
3903d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
391683b6d3bSJohannes Berg 
392683b6d3bSJohannes Berg /**
3939f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
3949f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
3959f5e8f6eSJohannes Berg  */
3969f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
3979f5e8f6eSJohannes Berg 
3989f5e8f6eSJohannes Berg /**
3999f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
4009f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
4019f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4029f5e8f6eSJohannes Berg  * @prohibited_flags: the regulatory chanenl flags that must not be set
4039f5e8f6eSJohannes Berg  */
4049f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
4059f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
4069f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
4079f5e8f6eSJohannes Berg 
4089f5e8f6eSJohannes Berg /**
40961fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
41061fa713cSHolger Schurig  *
411abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
41217e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
4138610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
4148610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
4158610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
4168610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
4178610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
418abe37c4bSJohannes Berg  *
41961fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
42061fa713cSHolger Schurig  * it has filled in during the get_survey().
42161fa713cSHolger Schurig  */
42261fa713cSHolger Schurig enum survey_info_flags {
42361fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
42417e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
4258610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
4268610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
4278610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
4288610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
4298610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
43061fa713cSHolger Schurig };
43161fa713cSHolger Schurig 
43261fa713cSHolger Schurig /**
43361fa713cSHolger Schurig  * struct survey_info - channel survey response
43461fa713cSHolger Schurig  *
43561fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
43661fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
43761fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
43861fa713cSHolger Schurig  *     optional
4398610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
4408610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
4418610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
4428610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
4438610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
44461fa713cSHolger Schurig  *
445abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
446abe37c4bSJohannes Berg  *
44761fa713cSHolger Schurig  * This structure can later be expanded with things like
44861fa713cSHolger Schurig  * channel duty cycle etc.
44961fa713cSHolger Schurig  */
45061fa713cSHolger Schurig struct survey_info {
45161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
4528610c29aSFelix Fietkau 	u64 channel_time;
4538610c29aSFelix Fietkau 	u64 channel_time_busy;
4548610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
4558610c29aSFelix Fietkau 	u64 channel_time_rx;
4568610c29aSFelix Fietkau 	u64 channel_time_tx;
45761fa713cSHolger Schurig 	u32 filled;
45861fa713cSHolger Schurig 	s8 noise;
45961fa713cSHolger Schurig };
46061fa713cSHolger Schurig 
46161fa713cSHolger Schurig /**
4625fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
4635fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
4645fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
4655fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
4665fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
4675fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
4685fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
4695fb628e9SJouni Malinen  * @akm_suites: AKM suites
4705fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
4715fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
4725fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
4735fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
4745fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
4755fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
4765fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
4775fb628e9SJouni Malinen  *	protocol frames.
4785fb628e9SJouni Malinen  */
4795fb628e9SJouni Malinen struct cfg80211_crypto_settings {
4805fb628e9SJouni Malinen 	u32 wpa_versions;
4815fb628e9SJouni Malinen 	u32 cipher_group;
4825fb628e9SJouni Malinen 	int n_ciphers_pairwise;
4835fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
4845fb628e9SJouni Malinen 	int n_akm_suites;
4855fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
4865fb628e9SJouni Malinen 	bool control_port;
4875fb628e9SJouni Malinen 	__be16 control_port_ethertype;
4885fb628e9SJouni Malinen 	bool control_port_no_encrypt;
4895fb628e9SJouni Malinen };
4905fb628e9SJouni Malinen 
4915fb628e9SJouni Malinen /**
4928860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
493ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
494ed1b6cc7SJohannes Berg  *     or %NULL if not changed
495ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
496ed1b6cc7SJohannes Berg  *     or %NULL if not changed
497ed1b6cc7SJohannes Berg  * @head_len: length of @head
498ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
4999946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
5009946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
5019946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
5029946ecfbSJouni Malinen  *	frames or %NULL
5039946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
5049946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
5059946ecfbSJouni Malinen  *	Response frames or %NULL
5069946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
50700f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
50800f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
509ed1b6cc7SJohannes Berg  */
5108860020eSJohannes Berg struct cfg80211_beacon_data {
5118860020eSJohannes Berg 	const u8 *head, *tail;
5128860020eSJohannes Berg 	const u8 *beacon_ies;
5138860020eSJohannes Berg 	const u8 *proberesp_ies;
5148860020eSJohannes Berg 	const u8 *assocresp_ies;
5158860020eSJohannes Berg 	const u8 *probe_resp;
5168860020eSJohannes Berg 
5178860020eSJohannes Berg 	size_t head_len, tail_len;
5188860020eSJohannes Berg 	size_t beacon_ies_len;
5198860020eSJohannes Berg 	size_t proberesp_ies_len;
5208860020eSJohannes Berg 	size_t assocresp_ies_len;
5218860020eSJohannes Berg 	size_t probe_resp_len;
5228860020eSJohannes Berg };
5238860020eSJohannes Berg 
5248860020eSJohannes Berg /**
5258860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
5268860020eSJohannes Berg  *
5278860020eSJohannes Berg  * Used to configure an AP interface.
5288860020eSJohannes Berg  *
529683b6d3bSJohannes Berg  * @chandef: defines the channel to use
5308860020eSJohannes Berg  * @beacon: beacon data
5318860020eSJohannes Berg  * @beacon_interval: beacon interval
5328860020eSJohannes Berg  * @dtim_period: DTIM period
5338860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
5348860020eSJohannes Berg  *	user space)
5358860020eSJohannes Berg  * @ssid_len: length of @ssid
5368860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
5378860020eSJohannes Berg  * @crypto: crypto settings
5388860020eSJohannes Berg  * @privacy: the BSS uses privacy
5398860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
5401b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
54153cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
54253cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
5438860020eSJohannes Berg  */
5448860020eSJohannes Berg struct cfg80211_ap_settings {
545683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
546aa430da4SJohannes Berg 
5478860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
5488860020eSJohannes Berg 
5498860020eSJohannes Berg 	int beacon_interval, dtim_period;
55032e9de84SJouni Malinen 	const u8 *ssid;
55132e9de84SJouni Malinen 	size_t ssid_len;
55232e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
5535fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
5545fb628e9SJouni Malinen 	bool privacy;
5555fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
5561b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
55753cabad7SJohannes Berg 	u8 p2p_ctwindow;
55853cabad7SJohannes Berg 	bool p2p_opp_ps;
559ed1b6cc7SJohannes Berg };
560ed1b6cc7SJohannes Berg 
5615727ef1bSJohannes Berg /**
5622ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
5632ec600d6SLuis Carlos Cobo  *
5642ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
5652ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
566abe37c4bSJohannes Berg  * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
5672ec600d6SLuis Carlos Cobo  */
5682ec600d6SLuis Carlos Cobo enum plink_actions {
5692ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
5702ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
5712ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
5722ec600d6SLuis Carlos Cobo };
5732ec600d6SLuis Carlos Cobo 
5742ec600d6SLuis Carlos Cobo /**
5753b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
5763b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
5773b9ce80cSJohannes Berg  *
5783b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
5793b9ce80cSJohannes Berg  * for those that don't these flags will are used.
5803b9ce80cSJohannes Berg  */
5813b9ce80cSJohannes Berg enum station_parameters_apply_mask {
5823b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
5833b9ce80cSJohannes Berg };
5843b9ce80cSJohannes Berg 
5853b9ce80cSJohannes Berg /**
5865727ef1bSJohannes Berg  * struct station_parameters - station parameters
5875727ef1bSJohannes Berg  *
5885727ef1bSJohannes Berg  * Used to change and create a new station.
5895727ef1bSJohannes Berg  *
5905727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
5915727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
5925727ef1bSJohannes Berg  *	(or NULL for no change)
5935727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
594eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
595eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
596eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
597eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
5985727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
5995727ef1bSJohannes Berg  * @aid: AID or zero for no change
600abe37c4bSJohannes Berg  * @plink_action: plink action to take
6019c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
602abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
603f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
604910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
605910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
606910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
607910868dbSEliad Peller  *	QoS info field (but already shifted down)
608c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
609c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
610c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
6115727ef1bSJohannes Berg  */
6125727ef1bSJohannes Berg struct station_parameters {
6135727ef1bSJohannes Berg 	u8 *supported_rates;
6145727ef1bSJohannes Berg 	struct net_device *vlan;
615eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
6163b9ce80cSJohannes Berg 	u32 sta_modify_mask;
6175727ef1bSJohannes Berg 	int listen_interval;
6185727ef1bSJohannes Berg 	u16 aid;
6195727ef1bSJohannes Berg 	u8 supported_rates_len;
6202ec600d6SLuis Carlos Cobo 	u8 plink_action;
6219c3990aaSJavier Cardona 	u8 plink_state;
62236aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
623f461be3eSMahesh Palivela 	struct ieee80211_vht_cap *vht_capa;
624c75786c9SEliad Peller 	u8 uapsd_queues;
625c75786c9SEliad Peller 	u8 max_sp;
6265727ef1bSJohannes Berg };
6275727ef1bSJohannes Berg 
628fd5b74dcSJohannes Berg /**
6292ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
630fd5b74dcSJohannes Berg  *
6312ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
6322ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
633fd5b74dcSJohannes Berg  *
6342ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
6352ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
6362ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
6372ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
6382ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
6392ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
640420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
641c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
642420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
64398c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
64498c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
645b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
646b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
6475a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
648541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
649c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
650f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
651ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
652040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
653bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
654a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
655d299a1f2SJavier Cardona  * @STATION_INFO_T_OFFSET: @t_offset filled
656fd5b74dcSJohannes Berg  */
6572ec600d6SLuis Carlos Cobo enum station_info_flags {
6582ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
6592ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
6602ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
6612ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
6622ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
6632ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
664420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
665420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
66698c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
66798c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
668b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
669b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
6705a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
671541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
672c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
673f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
674040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
675bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
676a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
677d299a1f2SJavier Cardona 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19,
678d299a1f2SJavier Cardona 	STATION_INFO_T_OFFSET		= 1<<20,
679420e7fabSHenning Rogge };
680420e7fabSHenning Rogge 
681420e7fabSHenning Rogge /**
682420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
683420e7fabSHenning Rogge  *
684420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
685420e7fabSHenning Rogge  * type for 802.11n transmissions.
686420e7fabSHenning Rogge  *
687db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
688db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
689db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
690db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
691db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
692db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
693420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
694db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
695420e7fabSHenning Rogge  */
696420e7fabSHenning Rogge enum rate_info_flags {
697db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
698db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
699db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_40_MHZ_WIDTH		= BIT(2),
700db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80_MHZ_WIDTH		= BIT(3),
701db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80P80_MHZ_WIDTH		= BIT(4),
702db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_160_MHZ_WIDTH		= BIT(5),
703db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(6),
704db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(7),
705420e7fabSHenning Rogge };
706420e7fabSHenning Rogge 
707420e7fabSHenning Rogge /**
708420e7fabSHenning Rogge  * struct rate_info - bitrate information
709420e7fabSHenning Rogge  *
710420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
711420e7fabSHenning Rogge  *
712420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
713420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
714420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
715db9c64cfSJohannes Berg  * @nss: number of streams (VHT only)
716420e7fabSHenning Rogge  */
717420e7fabSHenning Rogge struct rate_info {
718420e7fabSHenning Rogge 	u8 flags;
719420e7fabSHenning Rogge 	u8 mcs;
720420e7fabSHenning Rogge 	u16 legacy;
721db9c64cfSJohannes Berg 	u8 nss;
722fd5b74dcSJohannes Berg };
723fd5b74dcSJohannes Berg 
724fd5b74dcSJohannes Berg /**
725f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
726f4263c98SPaul Stewart  *
727f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
728f4263c98SPaul Stewart  * type for 802.11n transmissions.
729f4263c98SPaul Stewart  *
730f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
731f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
732f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
733f4263c98SPaul Stewart  */
734f4263c98SPaul Stewart enum bss_param_flags {
735f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
736f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
737f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
738f4263c98SPaul Stewart };
739f4263c98SPaul Stewart 
740f4263c98SPaul Stewart /**
741f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
742f4263c98SPaul Stewart  *
743f4263c98SPaul Stewart  * Information about the currently associated BSS
744f4263c98SPaul Stewart  *
745f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
746f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
747f4263c98SPaul Stewart  * @beacon_interval: beacon interval
748f4263c98SPaul Stewart  */
749f4263c98SPaul Stewart struct sta_bss_parameters {
750f4263c98SPaul Stewart 	u8 flags;
751f4263c98SPaul Stewart 	u8 dtim_period;
752f4263c98SPaul Stewart 	u16 beacon_interval;
753f4263c98SPaul Stewart };
754f4263c98SPaul Stewart 
755f4263c98SPaul Stewart /**
7562ec600d6SLuis Carlos Cobo  * struct station_info - station information
757fd5b74dcSJohannes Berg  *
7582ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
759fd5b74dcSJohannes Berg  *
7602ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
761ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
762fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
763fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
764fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
7652ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
7662ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
7672ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
76873c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
76973c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
77073c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
77173c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
772858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
773858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
77498c8a60aSJouni Malinen  * @rx_packets: packets received from this station
77598c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
776b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
777b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
7785a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
7791ba01458SRandy Dunlap  * @bss_param: current BSS parameters
780f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
781f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
782f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
783f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
78450d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
78550d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
78650d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
78750d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
78850d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
789c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
790a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
791d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
792fd5b74dcSJohannes Berg  */
7932ec600d6SLuis Carlos Cobo struct station_info {
794fd5b74dcSJohannes Berg 	u32 filled;
795ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
796fd5b74dcSJohannes Berg 	u32 inactive_time;
797fd5b74dcSJohannes Berg 	u32 rx_bytes;
798fd5b74dcSJohannes Berg 	u32 tx_bytes;
7992ec600d6SLuis Carlos Cobo 	u16 llid;
8002ec600d6SLuis Carlos Cobo 	u16 plid;
8012ec600d6SLuis Carlos Cobo 	u8 plink_state;
802420e7fabSHenning Rogge 	s8 signal;
803541a45a1SBruno Randolf 	s8 signal_avg;
804420e7fabSHenning Rogge 	struct rate_info txrate;
805c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
80698c8a60aSJouni Malinen 	u32 rx_packets;
80798c8a60aSJouni Malinen 	u32 tx_packets;
808b206b4efSBruno Randolf 	u32 tx_retries;
809b206b4efSBruno Randolf 	u32 tx_failed;
8105a5c731aSBen Greear 	u32 rx_dropped_misc;
811f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
812bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
813f5ea9120SJohannes Berg 
814f5ea9120SJohannes Berg 	int generation;
81550d3dfb7SJouni Malinen 
81650d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
81750d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
818f612cedfSJouni Malinen 
819a85e1d55SPaul Stewart 	u32 beacon_loss_count;
820d299a1f2SJavier Cardona 	s64 t_offset;
821a85e1d55SPaul Stewart 
822f612cedfSJouni Malinen 	/*
823f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
824f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
825f612cedfSJouni Malinen 	 */
826fd5b74dcSJohannes Berg };
827fd5b74dcSJohannes Berg 
82866f7ac50SMichael Wu /**
82966f7ac50SMichael Wu  * enum monitor_flags - monitor flags
83066f7ac50SMichael Wu  *
83166f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
83266f7ac50SMichael Wu  * according to the nl80211 flags.
83366f7ac50SMichael Wu  *
83466f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
83566f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
83666f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
83766f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
83866f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
83966f7ac50SMichael Wu  */
84066f7ac50SMichael Wu enum monitor_flags {
84166f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
84266f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
84366f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
84466f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
84566f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
84666f7ac50SMichael Wu };
84766f7ac50SMichael Wu 
8482ec600d6SLuis Carlos Cobo /**
8492ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
8502ec600d6SLuis Carlos Cobo  *
8512ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
8522ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
8532ec600d6SLuis Carlos Cobo  *
854abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
855abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
856abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
857abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
858abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
859abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
860abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
8612ec600d6SLuis Carlos Cobo  */
8622ec600d6SLuis Carlos Cobo enum mpath_info_flags {
8632ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
864d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
8652ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
8662ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
8672ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
8682ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
8692ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
8702ec600d6SLuis Carlos Cobo };
8712ec600d6SLuis Carlos Cobo 
8722ec600d6SLuis Carlos Cobo /**
8732ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
8742ec600d6SLuis Carlos Cobo  *
8752ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
8762ec600d6SLuis Carlos Cobo  *
8772ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
8782ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
879d19b3bf6SRui Paulo  * @sn: target sequence number
8802ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
8812ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
8822ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
8832ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
8842ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
885f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
886f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
887f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
888f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
8892ec600d6SLuis Carlos Cobo  */
8902ec600d6SLuis Carlos Cobo struct mpath_info {
8912ec600d6SLuis Carlos Cobo 	u32 filled;
8922ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
893d19b3bf6SRui Paulo 	u32 sn;
8942ec600d6SLuis Carlos Cobo 	u32 metric;
8952ec600d6SLuis Carlos Cobo 	u32 exptime;
8962ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
8972ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
8982ec600d6SLuis Carlos Cobo 	u8 flags;
899f5ea9120SJohannes Berg 
900f5ea9120SJohannes Berg 	int generation;
9012ec600d6SLuis Carlos Cobo };
9022ec600d6SLuis Carlos Cobo 
9039f1ba906SJouni Malinen /**
9049f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
9059f1ba906SJouni Malinen  *
9069f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
9079f1ba906SJouni Malinen  *
9089f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
9099f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
9109f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
9119f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
9129f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
9139f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
91490c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
91590c97a04SJouni Malinen  *	(or NULL for no change)
91690c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
917fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
91850b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
91950b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
92053cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
92153cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
9229f1ba906SJouni Malinen  */
9239f1ba906SJouni Malinen struct bss_parameters {
9249f1ba906SJouni Malinen 	int use_cts_prot;
9259f1ba906SJouni Malinen 	int use_short_preamble;
9269f1ba906SJouni Malinen 	int use_short_slot_time;
92790c97a04SJouni Malinen 	u8 *basic_rates;
92890c97a04SJouni Malinen 	u8 basic_rates_len;
929fd8aaaf3SFelix Fietkau 	int ap_isolate;
93050b12f59SHelmut Schaa 	int ht_opmode;
93153cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
9329f1ba906SJouni Malinen };
9332ec600d6SLuis Carlos Cobo 
9343ddd53f3SChun-Yeow Yeoh /**
93529cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
93629cbe68cSJohannes Berg  *
93729cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
9383ddd53f3SChun-Yeow Yeoh  *
9393ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
9403ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
9413ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
9423ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
9433ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
9443ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
9453ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
9463ddd53f3SChun-Yeow Yeoh  *	mesh interface
9473ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
9483ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
9493ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
9503ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
9513ddd53f3SChun-Yeow Yeoh  *	elements
9523ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
9533ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
9543ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
9553ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
9563ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
9573ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
9583ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
9593ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
9603ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
9613ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
9623ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
9633ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
9643ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
9653ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
9663ddd53f3SChun-Yeow Yeoh  *	element
9673ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
9683ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
9693ddd53f3SChun-Yeow Yeoh  *	element
9703ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
9713ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
9723ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
9733ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
9743ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
9753ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
9763ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
9773ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
9783ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
9793ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
9803ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
9813ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
9823ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
9833ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
9843ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
9853ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
986ac1073a6SChun-Yeow Yeoh  *
987ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
988ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
989ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
990ac1073a6SChun-Yeow Yeoh  *
991ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
992ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
993728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
994728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
995728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
99629cbe68cSJohannes Berg  */
99793da9cc1Scolin@cozybit.com struct mesh_config {
99893da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
99993da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
100093da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
100193da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
100293da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
100393da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
100445904f21SJavier Cardona 	u8 element_ttl;
100593da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1006d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
100793da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
100893da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
100993da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
101093da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
101193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1012dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
101393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
101463c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
10150507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
101616dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
101794f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
101855335137SAshok Nagarajan 	s32 rssi_threshold;
101970c33eaaSAshok Nagarajan 	u16 ht_opmode;
1020ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1021ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1022728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
102393da9cc1Scolin@cozybit.com };
102493da9cc1Scolin@cozybit.com 
102531888487SJouni Malinen /**
102629cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1027683b6d3bSJohannes Berg  * @chandef: defines the channel to use
102829cbe68cSJohannes Berg  * @mesh_id: the mesh ID
102929cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1030d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1031c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1032c80d545dSJavier Cardona  * @path_metric: which metric to use
1033581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1034581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1035b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1036b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
10374bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
103829cbe68cSJohannes Berg  *
103929cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
104029cbe68cSJohannes Berg  */
104129cbe68cSJohannes Berg struct mesh_setup {
1042683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
104329cbe68cSJohannes Berg 	const u8 *mesh_id;
104429cbe68cSJohannes Berg 	u8 mesh_id_len;
1045d299a1f2SJavier Cardona 	u8 sync_method;
1046c80d545dSJavier Cardona 	u8 path_sel_proto;
1047c80d545dSJavier Cardona 	u8 path_metric;
1048581a8b0fSJavier Cardona 	const u8 *ie;
1049581a8b0fSJavier Cardona 	u8 ie_len;
1050b130e5ceSJavier Cardona 	bool is_authenticated;
105115d5dda6SJavier Cardona 	bool is_secure;
10524bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
105329cbe68cSJohannes Berg };
105429cbe68cSJohannes Berg 
105529cbe68cSJohannes Berg /**
105631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1057a3304b0aSJohannes Berg  * @ac: AC identifier
105831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
105931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
106031888487SJouni Malinen  *	1..32767]
106131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
106231888487SJouni Malinen  *	1..32767]
106331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
106431888487SJouni Malinen  */
106531888487SJouni Malinen struct ieee80211_txq_params {
1066a3304b0aSJohannes Berg 	enum nl80211_ac ac;
106731888487SJouni Malinen 	u16 txop;
106831888487SJouni Malinen 	u16 cwmin;
106931888487SJouni Malinen 	u16 cwmax;
107031888487SJouni Malinen 	u8 aifs;
107131888487SJouni Malinen };
107231888487SJouni Malinen 
1073d70e9693SJohannes Berg /**
1074d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1075d70e9693SJohannes Berg  *
1076d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1077d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1078d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1079d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1080d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1081d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1082d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1083d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1084d70e9693SJohannes Berg  * in the wiphy structure.
1085d70e9693SJohannes Berg  *
1086d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1087d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1088d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1089d70e9693SJohannes Berg  *
1090d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1091d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1092d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1093d70e9693SJohannes Berg  * to userspace.
1094d70e9693SJohannes Berg  */
109572bdcf34SJouni Malinen 
1096704232c2SJohannes Berg /**
10972a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
10982a519311SJohannes Berg  * @ssid: the SSID
10992a519311SJohannes Berg  * @ssid_len: length of the ssid
11002a519311SJohannes Berg  */
11012a519311SJohannes Berg struct cfg80211_ssid {
11022a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
11032a519311SJohannes Berg 	u8 ssid_len;
11042a519311SJohannes Berg };
11052a519311SJohannes Berg 
11062a519311SJohannes Berg /**
11072a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
11082a519311SJohannes Berg  *
11092a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
11102a519311SJohannes Berg  * @n_ssids: number of SSIDs
11112a519311SJohannes Berg  * @channels: channels to scan on.
1112ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
111370692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
111470692ad2SJouni Malinen  * @ie_len: length of ie in octets
1115ed473771SSam Leffler  * @flags: bit field of flags controlling operation
111634850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
11172a519311SJohannes Berg  * @wiphy: the wiphy this was for
111815d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1119fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1120abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
1121e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
11222a519311SJohannes Berg  */
11232a519311SJohannes Berg struct cfg80211_scan_request {
11242a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
11252a519311SJohannes Berg 	int n_ssids;
11262a519311SJohannes Berg 	u32 n_channels;
1127de95a54bSJohannes Berg 	const u8 *ie;
112870692ad2SJouni Malinen 	size_t ie_len;
1129ed473771SSam Leffler 	u32 flags;
11302a519311SJohannes Berg 
113134850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
113234850ab2SJohannes Berg 
1133fd014284SJohannes Berg 	struct wireless_dev *wdev;
1134fd014284SJohannes Berg 
11352a519311SJohannes Berg 	/* internal */
11362a519311SJohannes Berg 	struct wiphy *wiphy;
113715d6030bSSam Leffler 	unsigned long scan_start;
1138667503ddSJohannes Berg 	bool aborted;
1139e9f935e3SRajkumar Manoharan 	bool no_cck;
11405ba63533SJohannes Berg 
11415ba63533SJohannes Berg 	/* keep last */
11425ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
11432a519311SJohannes Berg };
11442a519311SJohannes Berg 
11452a519311SJohannes Berg /**
1146a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1147a1f1c21cSLuciano Coelho  *
1148a1f1c21cSLuciano Coelho  * @ssid: SSID to be matched
1149a1f1c21cSLuciano Coelho  */
1150a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1151a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1152a1f1c21cSLuciano Coelho };
1153a1f1c21cSLuciano Coelho 
1154a1f1c21cSLuciano Coelho /**
1155807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1156807f8a8cSLuciano Coelho  *
1157807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1158807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1159807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1160bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1161807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1162807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1163ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1164a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1165a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1166a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1167a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1168a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1169807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1170807f8a8cSLuciano Coelho  * @dev: the interface
1171807f8a8cSLuciano Coelho  * @channels: channels to scan
117288e920b4SThomas Pedersen  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1173807f8a8cSLuciano Coelho  */
1174807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1175807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1176807f8a8cSLuciano Coelho 	int n_ssids;
1177807f8a8cSLuciano Coelho 	u32 n_channels;
1178bbe6ad6dSLuciano Coelho 	u32 interval;
1179807f8a8cSLuciano Coelho 	const u8 *ie;
1180807f8a8cSLuciano Coelho 	size_t ie_len;
1181ed473771SSam Leffler 	u32 flags;
1182a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1183a1f1c21cSLuciano Coelho 	int n_match_sets;
118488e920b4SThomas Pedersen 	s32 rssi_thold;
1185807f8a8cSLuciano Coelho 
1186807f8a8cSLuciano Coelho 	/* internal */
1187807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1188807f8a8cSLuciano Coelho 	struct net_device *dev;
118915d6030bSSam Leffler 	unsigned long scan_start;
1190807f8a8cSLuciano Coelho 
1191807f8a8cSLuciano Coelho 	/* keep last */
1192807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1193807f8a8cSLuciano Coelho };
1194807f8a8cSLuciano Coelho 
1195807f8a8cSLuciano Coelho /**
11962a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
11972a519311SJohannes Berg  *
11982a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
11992a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
12002a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
12012a519311SJohannes Berg  */
12022a519311SJohannes Berg enum cfg80211_signal_type {
12032a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
12042a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
12052a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
12062a519311SJohannes Berg };
12072a519311SJohannes Berg 
12082a519311SJohannes Berg /**
1209*9caf0364SJohannes Berg  * struct cfg80211_bss_ie_data - BSS entry IE data
1210*9caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
1211*9caf0364SJohannes Berg  * @len: length of the IEs
1212*9caf0364SJohannes Berg  * @data: IE data
1213*9caf0364SJohannes Berg  */
1214*9caf0364SJohannes Berg struct cfg80211_bss_ies {
1215*9caf0364SJohannes Berg 	struct rcu_head rcu_head;
1216*9caf0364SJohannes Berg 	int len;
1217*9caf0364SJohannes Berg 	u8 data[];
1218*9caf0364SJohannes Berg };
1219*9caf0364SJohannes Berg 
1220*9caf0364SJohannes Berg /**
12212a519311SJohannes Berg  * struct cfg80211_bss - BSS description
12222a519311SJohannes Berg  *
12232a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
12242a519311SJohannes Berg  * for use in scan results and similar.
12252a519311SJohannes Berg  *
1226abe37c4bSJohannes Berg  * @channel: channel this BSS is on
12272a519311SJohannes Berg  * @bssid: BSSID of the BSS
12282a519311SJohannes Berg  * @tsf: timestamp of last received update
12292a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
12302a519311SJohannes Berg  * @capability: the capability field in host byte order
1231*9caf0364SJohannes Berg  * @ies: the information elements (Note that there
123234a6eddbSJouni Malinen  *	is no guarantee that these are well-formed!); this is a pointer to
123334a6eddbSJouni Malinen  *	either the beacon_ies or proberesp_ies depending on whether Probe
123434a6eddbSJouni Malinen  *	Response frame has been received
123534a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
123634a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
123777965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
123878c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
12392a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
12402a519311SJohannes Berg  */
12412a519311SJohannes Berg struct cfg80211_bss {
1242*9caf0364SJohannes Berg 	u64 tsf;
1243*9caf0364SJohannes Berg 
12442a519311SJohannes Berg 	struct ieee80211_channel *channel;
12452a519311SJohannes Berg 
1246*9caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
1247*9caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
1248*9caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
1249*9caf0364SJohannes Berg 
1250*9caf0364SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
12512a519311SJohannes Berg 
12522a519311SJohannes Berg 	s32 signal;
12532a519311SJohannes Berg 
1254*9caf0364SJohannes Berg 	u16 beacon_interval;
1255*9caf0364SJohannes Berg 	u16 capability;
1256*9caf0364SJohannes Berg 
1257*9caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
1258*9caf0364SJohannes Berg 
12592a519311SJohannes Berg 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
12602a519311SJohannes Berg };
12612a519311SJohannes Berg 
12622a519311SJohannes Berg /**
1263517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1264517357c6SJohannes Berg  * @bss: the bss to search
1265517357c6SJohannes Berg  * @ie: the IE ID
1266*9caf0364SJohannes Berg  *
1267*9caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
1268*9caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
1269517357c6SJohannes Berg  * Returns %NULL if not found.
1270517357c6SJohannes Berg  */
1271517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1272517357c6SJohannes Berg 
1273517357c6SJohannes Berg 
1274517357c6SJohannes Berg /**
1275636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1276636a5d36SJouni Malinen  *
1277636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1278636a5d36SJouni Malinen  * authentication.
1279636a5d36SJouni Malinen  *
128019957bb3SJohannes Berg  * @bss: The BSS to authenticate with.
1281636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1282636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1283636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1284fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1285fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1286fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1287e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1288e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1289e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1290636a5d36SJouni Malinen  */
1291636a5d36SJouni Malinen struct cfg80211_auth_request {
129219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1293636a5d36SJouni Malinen 	const u8 *ie;
1294636a5d36SJouni Malinen 	size_t ie_len;
129519957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1296fffd0934SJohannes Berg 	const u8 *key;
1297fffd0934SJohannes Berg 	u8 key_len, key_idx;
1298e39e5b5eSJouni Malinen 	const u8 *sae_data;
1299e39e5b5eSJouni Malinen 	size_t sae_data_len;
1300636a5d36SJouni Malinen };
1301636a5d36SJouni Malinen 
1302636a5d36SJouni Malinen /**
13037e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
13047e7c8926SBen Greear  *
13057e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
13067e7c8926SBen Greear  */
13077e7c8926SBen Greear enum cfg80211_assoc_req_flags {
13087e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
13097e7c8926SBen Greear };
13107e7c8926SBen Greear 
13117e7c8926SBen Greear /**
1312636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1313636a5d36SJouni Malinen  *
1314636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1315636a5d36SJouni Malinen  * (re)association.
131695de817bSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver
131795de817bSJohannes Berg  *	is given a reference that it must release, normally via a call to
131895de817bSJohannes Berg  *	cfg80211_send_rx_assoc(), or, if association timed out, with a
131995de817bSJohannes Berg  *	call to cfg80211_put_bss() (in addition to calling
132095de817bSJohannes Berg  *	cfg80211_send_assoc_timeout())
1321636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1322636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1323dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1324b23aa676SSamuel Ortiz  * @crypto: crypto settings
13253e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
13267e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
13277e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
13287e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
13297e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1330636a5d36SJouni Malinen  */
1331636a5d36SJouni Malinen struct cfg80211_assoc_request {
133219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
13333e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1334636a5d36SJouni Malinen 	size_t ie_len;
1335b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
133619957bb3SJohannes Berg 	bool use_mfp;
13377e7c8926SBen Greear 	u32 flags;
13387e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
13397e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1340636a5d36SJouni Malinen };
1341636a5d36SJouni Malinen 
1342636a5d36SJouni Malinen /**
1343636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1344636a5d36SJouni Malinen  *
1345636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1346636a5d36SJouni Malinen  * deauthentication.
1347636a5d36SJouni Malinen  *
134895de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1349636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1350636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
135119957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1352636a5d36SJouni Malinen  */
1353636a5d36SJouni Malinen struct cfg80211_deauth_request {
135495de817bSJohannes Berg 	const u8 *bssid;
1355636a5d36SJouni Malinen 	const u8 *ie;
1356636a5d36SJouni Malinen 	size_t ie_len;
135719957bb3SJohannes Berg 	u16 reason_code;
13586863255bSStanislaw Gruszka 	bool local_state_change;
1359636a5d36SJouni Malinen };
1360636a5d36SJouni Malinen 
1361636a5d36SJouni Malinen /**
1362636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1363636a5d36SJouni Malinen  *
1364636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1365636a5d36SJouni Malinen  * disassocation.
1366636a5d36SJouni Malinen  *
136719957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1368636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1369636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
137019957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1371d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1372d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1373636a5d36SJouni Malinen  */
1374636a5d36SJouni Malinen struct cfg80211_disassoc_request {
137519957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1376636a5d36SJouni Malinen 	const u8 *ie;
1377636a5d36SJouni Malinen 	size_t ie_len;
137819957bb3SJohannes Berg 	u16 reason_code;
1379d5cdfacbSJouni Malinen 	bool local_state_change;
1380636a5d36SJouni Malinen };
1381636a5d36SJouni Malinen 
1382636a5d36SJouni Malinen /**
138304a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
138404a773adSJohannes Berg  *
138504a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
138604a773adSJohannes Berg  * method.
138704a773adSJohannes Berg  *
138804a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
138904a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
139004a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
139104a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
1392683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
139304a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
139404a773adSJohannes Berg  *	IBSSs to join on other channels.
139504a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
139604a773adSJohannes Berg  * @ie_len: length of that
13978e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1398fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1399fffd0934SJohannes Berg  *	after joining
1400267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1401267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1402267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1403267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
1404fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1405dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
140604a773adSJohannes Berg  */
140704a773adSJohannes Berg struct cfg80211_ibss_params {
140804a773adSJohannes Berg 	u8 *ssid;
140904a773adSJohannes Berg 	u8 *bssid;
1410683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
141104a773adSJohannes Berg 	u8 *ie;
141204a773adSJohannes Berg 	u8 ssid_len, ie_len;
14138e30bc55SJohannes Berg 	u16 beacon_interval;
1414fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
141504a773adSJohannes Berg 	bool channel_fixed;
1416fffd0934SJohannes Berg 	bool privacy;
1417267335d6SAntonio Quartulli 	bool control_port;
1418dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
141904a773adSJohannes Berg };
142004a773adSJohannes Berg 
142104a773adSJohannes Berg /**
1422b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1423b23aa676SSamuel Ortiz  *
1424b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1425b23aa676SSamuel Ortiz  * authentication and association.
1426b23aa676SSamuel Ortiz  *
1427b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1428b23aa676SSamuel Ortiz  *	on scan results)
1429b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1430b23aa676SSamuel Ortiz  *	results)
1431b23aa676SSamuel Ortiz  * @ssid: SSID
1432b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1433b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1434abe37c4bSJohannes Berg  * @ie: IEs for association request
1435abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1436b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1437b23aa676SSamuel Ortiz  * @crypto: crypto settings
1438fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1439fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1440fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
14417e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
14424486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
14434486ea98SBala Shanmugam  *   or -1 to indicate that default value is to be used.
14447e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
14457e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
14467e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1447b23aa676SSamuel Ortiz  */
1448b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1449b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1450b23aa676SSamuel Ortiz 	u8 *bssid;
1451b23aa676SSamuel Ortiz 	u8 *ssid;
1452b23aa676SSamuel Ortiz 	size_t ssid_len;
1453b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1454b23aa676SSamuel Ortiz 	u8 *ie;
1455b23aa676SSamuel Ortiz 	size_t ie_len;
1456b23aa676SSamuel Ortiz 	bool privacy;
1457b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1458fffd0934SJohannes Berg 	const u8 *key;
1459fffd0934SJohannes Berg 	u8 key_len, key_idx;
14607e7c8926SBen Greear 	u32 flags;
14614486ea98SBala Shanmugam 	int bg_scan_period;
14627e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
14637e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1464b23aa676SSamuel Ortiz };
1465b23aa676SSamuel Ortiz 
1466b23aa676SSamuel Ortiz /**
1467b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1468abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1469abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1470abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1471abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1472abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1473b9a5f8caSJouni Malinen  */
1474b9a5f8caSJouni Malinen enum wiphy_params_flags {
1475b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1476b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1477b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1478b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
147981077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1480b9a5f8caSJouni Malinen };
1481b9a5f8caSJouni Malinen 
14829930380fSJohannes Berg /*
14839930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
14849930380fSJohannes Berg  */
14859930380fSJohannes Berg struct cfg80211_bitrate_mask {
14869930380fSJohannes Berg 	struct {
14879930380fSJohannes Berg 		u32 legacy;
148824db78c0SSimon Wunderlich 		u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
14899930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
14909930380fSJohannes Berg };
149167fbb16bSSamuel Ortiz /**
149267fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
149367fbb16bSSamuel Ortiz  *
149467fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
149567fbb16bSSamuel Ortiz  * caching.
149667fbb16bSSamuel Ortiz  *
149767fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
149867fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
149967fbb16bSSamuel Ortiz  */
150067fbb16bSSamuel Ortiz struct cfg80211_pmksa {
150167fbb16bSSamuel Ortiz 	u8 *bssid;
150267fbb16bSSamuel Ortiz 	u8 *pmkid;
150367fbb16bSSamuel Ortiz };
15049930380fSJohannes Berg 
15057643a2c3SJohannes Berg /**
1506ff1b6e69SJohannes Berg  * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
1507ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1508ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1509ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1510ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1511ff1b6e69SJohannes Berg  *
1512ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1513ff1b6e69SJohannes Berg  * memory, free @mask only!
1514ff1b6e69SJohannes Berg  */
1515ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern {
1516ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1517ff1b6e69SJohannes Berg 	int pattern_len;
1518ff1b6e69SJohannes Berg };
1519ff1b6e69SJohannes Berg 
1520ff1b6e69SJohannes Berg /**
1521ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1522ff1b6e69SJohannes Berg  *
1523ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1524ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1525ff1b6e69SJohannes Berg  *	operating as normal during suspend
1526ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1527ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1528ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1529ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
153077dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
153177dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
153277dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
153377dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
1534ff1b6e69SJohannes Berg  */
1535ff1b6e69SJohannes Berg struct cfg80211_wowlan {
153677dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
153777dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
153877dbbb13SJohannes Berg 	     rfkill_release;
1539ff1b6e69SJohannes Berg 	struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1540ff1b6e69SJohannes Berg 	int n_patterns;
1541ff1b6e69SJohannes Berg };
1542ff1b6e69SJohannes Berg 
1543ff1b6e69SJohannes Berg /**
1544e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1545e5497d76SJohannes Berg  * @kek: key encryption key
1546e5497d76SJohannes Berg  * @kck: key confirmation key
1547e5497d76SJohannes Berg  * @replay_ctr: replay counter
1548e5497d76SJohannes Berg  */
1549e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1550e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1551e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1552e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1553e5497d76SJohannes Berg };
1554e5497d76SJohannes Berg 
1555e5497d76SJohannes Berg /**
1556704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1557704232c2SJohannes Berg  *
1558704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1559704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1560704232c2SJohannes Berg  *
1561704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1562704232c2SJohannes Berg  * on success or a negative error code.
1563704232c2SJohannes Berg  *
156443fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
156543fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
156643fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
156743fb45cbSJohannes Berg  *
1568ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1569ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1570ff1b6e69SJohannes Berg  *	configured for the device.
15710378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
15726d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
15736d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
15746d52563fSJohannes Berg  *	the device.
15750378b3f1SJohannes Berg  *
157660719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1577463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
157884efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
157998104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
158098104fdeSJohannes Berg  *	also set the address member in the wdev.
1581704232c2SJohannes Berg  *
158284efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
158355682965SJohannes Berg  *
158460719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
158560719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
158655682965SJohannes Berg  *
158741ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
158841ade00fSJohannes Berg  *	when adding a group key.
158941ade00fSJohannes Berg  *
159041ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
159141ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
159241ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1593e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1594e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
159541ade00fSJohannes Berg  *
159641ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1597e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
159841ade00fSJohannes Berg  *
159941ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1600ed1b6cc7SJohannes Berg  *
16013cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
16023cfcf6acSJouni Malinen  *
1603e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1604e5497d76SJohannes Berg  *
1605c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
1606c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
1607c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
1608c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
16095727ef1bSJohannes Berg  *
16105727ef1bSJohannes Berg  * @add_station: Add a new station.
16115727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
1612bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
1613bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
1614bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
1615bdd90d5eSJohannes Berg  *	them, also against the existing state! Also, supported_rates changes are
1616bdd90d5eSJohannes Berg  *	not checked in station mode -- drivers need to reject (or ignore) them
1617bdd90d5eSJohannes Berg  *	for anything but TDLS peers.
1618abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
1619abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
1620abe37c4bSJohannes Berg  *
1621abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
1622abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
1623abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
1624abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
1625abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1626f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
1627f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
16282ec600d6SLuis Carlos Cobo  *
162924bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
163093da9cc1Scolin@cozybit.com  *
163124bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
163293da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
163393da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
163493da9cc1Scolin@cozybit.com  *
16359f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
163631888487SJouni Malinen  *
163731888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
163872bdcf34SJouni Malinen  *
1639e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
1640e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
1641e8c9bd5bSJohannes Berg  *	join the mesh instead.
1642e8c9bd5bSJohannes Berg  *
1643e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
1644e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
1645e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
1646e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
16479aed3cc1SJouni Malinen  *
16482a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
16492a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
16502a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
16512a519311SJohannes Berg  *	the scan/scan_done bracket too.
1652636a5d36SJouni Malinen  *
1653636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
1654636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
1655636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
1656636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
165704a773adSJohannes Berg  *
1658b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
1659b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1660b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
1661b23aa676SSamuel Ortiz  *	with the status from the AP.
1662b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
1663b23aa676SSamuel Ortiz  *
166404a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
166504a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
166604a773adSJohannes Berg  *	to a merge.
166704a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
1668b9a5f8caSJouni Malinen  *
1669f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1670f4e583c8SAntonio Quartulli  *	MESH mode)
1671f4e583c8SAntonio Quartulli  *
1672b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
1673b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
1674b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
1675b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
16767643a2c3SJohannes Berg  *
16771432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
1678c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
1679c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
1680c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
1681c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
16827643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
16831f87f7d3SJohannes Berg  *	return 0 if successful
16841f87f7d3SJohannes Berg  *
1685abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
1686abe37c4bSJohannes Berg  *
16871f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
16881f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
1689aff89a9bSJohannes Berg  *
169061fa713cSHolger Schurig  * @dump_survey: get site survey information.
169161fa713cSHolger Schurig  *
16929588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
16939588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
16949588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
16959588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
16969588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
16979588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
16989588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
16999588bbd5SJouni Malinen  *	the duration value.
1700f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
1701f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
1702f7ca38dfSJohannes Berg  *	frame on another channel
17039588bbd5SJouni Malinen  *
1704aff89a9bSJohannes Berg  * @testmode_cmd: run a test mode command
170571063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
170671063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
170771063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
170871063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
170971063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
171071063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
171167fbb16bSSamuel Ortiz  *
1712abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
1713abe37c4bSJohannes Berg  *
171467fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
171567fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
171667fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
171767fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
171867fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
17199043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
17209043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
1721d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
172284f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
172384f10708SThomas Pedersen  *	thresholds.
1724807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
172530d08a46SArend van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan.
172667fbb16bSSamuel Ortiz  *
1727271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
1728271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
1729271733cfSJohannes Berg  *	concurrently with itself.
1730547025d5SBruno Randolf  *
1731547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1732547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1733547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
1734547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1735547025d5SBruno Randolf  *
1736547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
17373677713bSJohn W. Linville  *
17383677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
17393677713bSJohn W. Linville  *
17403677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
1741109086ceSArik Nemtsov  *
1742109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
1743109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
17447f6cf311SJohannes Berg  *
17457f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
17467f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
17471d9d9213SSimon Wunderlich  *
17481d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
1749d6199218SBen Greear  *
1750d6199218SBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
1751d6199218SBen Greear  *	See @ethtool_ops.get_sset_count
1752d6199218SBen Greear  *
1753d6199218SBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
1754d6199218SBen Greear  *	See @ethtool_ops.get_ethtool_stats
1755d6199218SBen Greear  *
1756d6199218SBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
1757d6199218SBen Greear  *	and perhaps other supported types of ethtool data-sets.
1758d6199218SBen Greear  *	See @ethtool_ops.get_strings
17595b7ccaf3SJohannes Berg  *
17605b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
17615b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
17625b7ccaf3SJohannes Berg  *	current monitoring channel.
176398104fdeSJohannes Berg  *
176498104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
176598104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
1766704232c2SJohannes Berg  */
1767704232c2SJohannes Berg struct cfg80211_ops {
1768ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
17690378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
17706d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
17710378b3f1SJohannes Berg 
177284efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
1773552bff0cSJohannes Berg 						  const char *name,
1774f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
1775f9e10ce4SJohannes Berg 						  u32 *flags,
17762ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
177784efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
177884efbb84SJohannes Berg 				    struct wireless_dev *wdev);
1779e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
1780e36d56b6SJohannes Berg 				       struct net_device *dev,
17812ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
17822ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
178341ade00fSJohannes Berg 
178441ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1785e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
178641ade00fSJohannes Berg 			   struct key_params *params);
178741ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1788e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
1789e31b8213SJohannes Berg 			   void *cookie,
179041ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
179141ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1792e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
179341ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
179441ade00fSJohannes Berg 				   struct net_device *netdev,
1795dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
17963cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
17973cfcf6acSJouni Malinen 					struct net_device *netdev,
17983cfcf6acSJouni Malinen 					u8 key_index);
1799ed1b6cc7SJohannes Berg 
18008860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
18018860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
18028860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
18038860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
18048860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
18055727ef1bSJohannes Berg 
18065727ef1bSJohannes Berg 
18075727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
18085727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
18095727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
18105727ef1bSJohannes Berg 			       u8 *mac);
18115727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
18125727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
1813fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
18142ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
18152ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
18162ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
18172ec600d6SLuis Carlos Cobo 
18182ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
18192ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
18202ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
18212ec600d6SLuis Carlos Cobo 			       u8 *dst);
18222ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
18232ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
18242ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
18252ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
18262ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
18272ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
18282ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
18292ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
183024bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
183193da9cc1Scolin@cozybit.com 				struct net_device *dev,
183293da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
183324bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
183429cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
183529cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
183629cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
183729cbe68cSJohannes Berg 			     const struct mesh_config *conf,
183829cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
183929cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
184029cbe68cSJohannes Berg 
18419f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
18429f1ba906SJouni Malinen 			      struct bss_parameters *params);
184331888487SJouni Malinen 
1844f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
184531888487SJouni Malinen 				  struct ieee80211_txq_params *params);
184672bdcf34SJouni Malinen 
1847e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
1848e8c9bd5bSJohannes Berg 					     struct net_device *dev,
1849e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
1850e8c9bd5bSJohannes Berg 
1851e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
1852683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
18539aed3cc1SJouni Malinen 
1854fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
18552a519311SJohannes Berg 			struct cfg80211_scan_request *request);
1856636a5d36SJouni Malinen 
1857636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
1858636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
1859636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
1860636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
1861636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
186263c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
1863636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
186463c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
186504a773adSJohannes Berg 
1866b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
1867b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
1868b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1869b23aa676SSamuel Ortiz 			      u16 reason_code);
1870b23aa676SSamuel Ortiz 
187104a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
187204a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
187304a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1874b9a5f8caSJouni Malinen 
1875f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
1876f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
1877f4e583c8SAntonio Quartulli 
1878b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
18797643a2c3SJohannes Berg 
1880c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1881fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
1882c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1883c8442118SJohannes Berg 				int *dbm);
18841f87f7d3SJohannes Berg 
1885ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1886388ac775SJohannes Berg 				const u8 *addr);
1887ab737a4fSJohannes Berg 
18881f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
1889aff89a9bSJohannes Berg 
1890aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
1891aff89a9bSJohannes Berg 	int	(*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
189271063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
189371063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
189471063f0eSWey-Yi Guy 				 void *data, int len);
1895aff89a9bSJohannes Berg #endif
1896bc92afd9SJohannes Berg 
18979930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
18989930380fSJohannes Berg 				    struct net_device *dev,
18999930380fSJohannes Berg 				    const u8 *peer,
19009930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
19019930380fSJohannes Berg 
190261fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
190361fa713cSHolger Schurig 			int idx, struct survey_info *info);
190461fa713cSHolger Schurig 
190567fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
190667fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
190767fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
190867fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
190967fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
191067fbb16bSSamuel Ortiz 
19119588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
191271bbc994SJohannes Berg 				     struct wireless_dev *wdev,
19139588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
19149588bbd5SJouni Malinen 				     unsigned int duration,
19159588bbd5SJouni Malinen 				     u64 *cookie);
19169588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
191771bbc994SJohannes Berg 					    struct wireless_dev *wdev,
19189588bbd5SJouni Malinen 					    u64 cookie);
19199588bbd5SJouni Malinen 
192071bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1921f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
192242d97a59SJohannes Berg 			  unsigned int wait, const u8 *buf, size_t len,
192342d97a59SJohannes Berg 			  bool no_cck, bool dont_wait_for_ack, u64 *cookie);
1924f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
192571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
1926f7ca38dfSJohannes Berg 				       u64 cookie);
1927026331c4SJouni Malinen 
1928bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1929bc92afd9SJohannes Berg 				  bool enabled, int timeout);
1930d6dc1a38SJuuso Oikarinen 
1931d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
1932d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
1933d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
1934271733cfSJohannes Berg 
193584f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
193684f10708SThomas Pedersen 				      struct net_device *dev,
193784f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
193884f10708SThomas Pedersen 
1939271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
194071bbc994SJohannes Berg 				       struct wireless_dev *wdev,
1941271733cfSJohannes Berg 				       u16 frame_type, bool reg);
1942afe0cbf8SBruno Randolf 
1943afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1944afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
19453677713bSJohn W. Linville 
19463677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
19473677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
19483677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1949807f8a8cSLuciano Coelho 
1950807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
1951807f8a8cSLuciano Coelho 				struct net_device *dev,
1952807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
195385a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
1954e5497d76SJohannes Berg 
1955e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
1956e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
1957109086ceSArik Nemtsov 
1958109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1959109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
1960109086ceSArik Nemtsov 			     u16 status_code, const u8 *buf, size_t len);
1961109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1962109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
19637f6cf311SJohannes Berg 
19647f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
19657f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
1966e999882aSJohannes Berg 
19671d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
19681d9d9213SSimon Wunderlich 				  struct net_device *dev,
19691d9d9213SSimon Wunderlich 				  u16 noack_map);
19701d9d9213SSimon Wunderlich 
1971d6199218SBen Greear 	int	(*get_et_sset_count)(struct wiphy *wiphy,
1972d6199218SBen Greear 				     struct net_device *dev, int sset);
1973d6199218SBen Greear 	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
1974d6199218SBen Greear 				struct ethtool_stats *stats, u64 *data);
1975d6199218SBen Greear 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1976d6199218SBen Greear 				  u32 sset, u8 *data);
1977dbbae26aSMichal Kazior 
1978683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
19795b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
1980683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
198198104fdeSJohannes Berg 
198298104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
198398104fdeSJohannes Berg 				    struct wireless_dev *wdev);
198498104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
198598104fdeSJohannes Berg 				   struct wireless_dev *wdev);
1986704232c2SJohannes Berg };
1987704232c2SJohannes Berg 
1988d3236553SJohannes Berg /*
1989d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
1990d3236553SJohannes Berg  * and registration/helper functions
1991d3236553SJohannes Berg  */
1992d3236553SJohannes Berg 
1993d3236553SJohannes Berg /**
19945be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
19955be83de5SJohannes Berg  *
19965be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
1997d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
1998d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
1999d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
2000d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
20015be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
20025be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
2003749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
2004749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
2005749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
2006749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
2007749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
2008749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
2009749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
2010061acaaeSLuis R. Rodriguez  *	outside of its regulatory domain. If used in combination with
2011061acaaeSLuis R. Rodriguez  *	WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
2012061acaaeSLuis R. Rodriguez  *	will be followed.
20135be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
20145be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
20155be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
201637184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
20175be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
20185be83de5SJohannes Berg  *	wiphy at all
20195be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
20205be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
20215be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
20225be83de5SJohannes Berg  *	reason to override the default
20239bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
20249bc383deSJohannes Berg  *	on a VLAN interface)
20259bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
2026c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
2027c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
2028c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
2029e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
203015d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
203115d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
20321ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
2033f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
2034f4b34b55SVivek Natarajan  *	firmware.
2035cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
2036109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
2037109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
2038109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
2039109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
2040109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
2041109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
2042562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
20435e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
20445e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
20455e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
204687bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
204787bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
20487c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
20497c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
20505be83de5SJohannes Berg  */
20515be83de5SJohannes Berg enum wiphy_flags {
20525be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
20535be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
20545be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
20555be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
20565be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
20579bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
20589bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
2059c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
2060309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
206115d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
2062807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
20638e8b41f9SJohannes Berg 	/* use hole at 12 */
2064f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
2065cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
2066109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
2067109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
2068562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
20695e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
207087bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
20717c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
20727c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
20737527a782SJohannes Berg };
20747527a782SJohannes Berg 
20757527a782SJohannes Berg /**
20767527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
20777527a782SJohannes Berg  * @max: maximum number of interfaces of these types
20787527a782SJohannes Berg  * @types: interface types (bits)
20797527a782SJohannes Berg  */
20807527a782SJohannes Berg struct ieee80211_iface_limit {
20817527a782SJohannes Berg 	u16 max;
20827527a782SJohannes Berg 	u16 types;
20837527a782SJohannes Berg };
20847527a782SJohannes Berg 
20857527a782SJohannes Berg /**
20867527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
20877527a782SJohannes Berg  * @limits: limits for the given interface types
20887527a782SJohannes Berg  * @n_limits: number of limitations
20897527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
20907527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
20917527a782SJohannes Berg  *	group
20927527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
20937527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
20947527a782SJohannes Berg  *	only in special cases.
20957527a782SJohannes Berg  *
20967527a782SJohannes Berg  * These examples can be expressed as follows:
20977527a782SJohannes Berg  *
20987527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
20997527a782SJohannes Berg  *
21007527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
21017527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
21027527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
21037527a782SJohannes Berg  *  };
21047527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
21057527a782SJohannes Berg  *	.limits = limits1,
21067527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
21077527a782SJohannes Berg  *	.max_interfaces = 2,
21087527a782SJohannes Berg  *	.beacon_int_infra_match = true,
21097527a782SJohannes Berg  *  };
21107527a782SJohannes Berg  *
21117527a782SJohannes Berg  *
21127527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
21137527a782SJohannes Berg  *
21147527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
21157527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
21167527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
21177527a782SJohannes Berg  *  };
21187527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
21197527a782SJohannes Berg  *	.limits = limits2,
21207527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
21217527a782SJohannes Berg  *	.max_interfaces = 8,
21227527a782SJohannes Berg  *	.num_different_channels = 1,
21237527a782SJohannes Berg  *  };
21247527a782SJohannes Berg  *
21257527a782SJohannes Berg  *
21267527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
21277527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
21287527a782SJohannes Berg  *
21297527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
21307527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
21317527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
21327527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
21337527a782SJohannes Berg  *  };
21347527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
21357527a782SJohannes Berg  *	.limits = limits3,
21367527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
21377527a782SJohannes Berg  *	.max_interfaces = 4,
21387527a782SJohannes Berg  *	.num_different_channels = 2,
21397527a782SJohannes Berg  *  };
21407527a782SJohannes Berg  */
21417527a782SJohannes Berg struct ieee80211_iface_combination {
21427527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
21437527a782SJohannes Berg 	u32 num_different_channels;
21447527a782SJohannes Berg 	u16 max_interfaces;
21457527a782SJohannes Berg 	u8 n_limits;
21467527a782SJohannes Berg 	bool beacon_int_infra_match;
21475be83de5SJohannes Berg };
21485be83de5SJohannes Berg 
2149ef15aac6SJohannes Berg struct mac_address {
2150ef15aac6SJohannes Berg 	u8 addr[ETH_ALEN];
2151ef15aac6SJohannes Berg };
2152ef15aac6SJohannes Berg 
21532e161f78SJohannes Berg struct ieee80211_txrx_stypes {
21542e161f78SJohannes Berg 	u16 tx, rx;
21552e161f78SJohannes Berg };
21562e161f78SJohannes Berg 
21575be83de5SJohannes Berg /**
2158ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2159ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2160ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2161ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2162ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2163ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2164ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2165ff1b6e69SJohannes Berg  *	(see nl80211.h)
2166ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
216777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
216877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
216977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
217077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
217177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2172ff1b6e69SJohannes Berg  */
2173ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2174ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2175ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2176ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
217777dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
217877dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
217977dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
218077dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
218177dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
2182ff1b6e69SJohannes Berg };
2183ff1b6e69SJohannes Berg 
2184ff1b6e69SJohannes Berg /**
2185ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2186ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2187ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2188ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2189ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2190ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2191ff1b6e69SJohannes Berg  */
2192ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2193ff1b6e69SJohannes Berg 	u32 flags;
2194ff1b6e69SJohannes Berg 	int n_patterns;
2195ff1b6e69SJohannes Berg 	int pattern_max_len;
2196ff1b6e69SJohannes Berg 	int pattern_min_len;
2197ff1b6e69SJohannes Berg };
2198ff1b6e69SJohannes Berg 
2199ff1b6e69SJohannes Berg /**
22005be83de5SJohannes Berg  * struct wiphy - wireless hardware description
22012784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
22022784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
22032784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2204d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
2205d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
2206d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
2207d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
2208d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
2209d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
2210d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
2211b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
2212b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
2213b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
2214b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
2215b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
2216abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
2217ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
2218ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
2219ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
2220ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
2221ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
2222ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
2223ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
2224ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
2225ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
2226ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
2227ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
2228ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
2229fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
2230fd235913SRandy Dunlap  *	unregister hardware
2231abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
2232abe37c4bSJohannes Berg  *	automatically on wiphy renames
2233abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
22344a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
2235abe37c4bSJohannes Berg  * @wext: wireless extension handlers
2236abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
2237abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
2238abe37c4bSJohannes Berg  *	must be set by driver
22397527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
22407527a782SJohannes Berg  *	list single interface types.
22417527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
22427527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
22437527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
2244abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
22451f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
2246abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
2247abe37c4bSJohannes Berg  *	this variable determines its size
2248abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
2249abe37c4bSJohannes Berg  *	any given scan
225093b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
225193b6aa69SLuciano Coelho  *	for in any given scheduled scan
2252a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
2253a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
2254a1f1c21cSLuciano Coelho  *	supported.
2255abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
2256abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
2257abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
22585a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
22595a865badSLuciano Coelho  *	scans
2260abe37c4bSJohannes Berg  * @coverage_class: current coverage class
2261abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
2262abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
2263abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
2264abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
2265abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
2266abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
22672e161f78SJohannes Berg  *
22682e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
22692e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
22702e161f78SJohannes Berg  *	type
2271a7ffac95SBruno Randolf  *
22727f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
22737f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
22747f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
22757f531e03SBruno Randolf  *
22767f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
22777f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
22787f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
2279a293911dSJohannes Berg  *
228015f0ebc2SRandy Dunlap  * @probe_resp_offload:
228115f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
228215f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
228315f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
228415f0ebc2SRandy Dunlap  *
2285a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
2286a293911dSJohannes Berg  *	may request, if implemented.
2287ff1b6e69SJohannes Berg  *
2288ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
2289562a7480SJohannes Berg  *
2290562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
22917e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
22927e7c8926SBen Greear  *	If null, then none can be over-ridden.
2293d3236553SJohannes Berg  */
2294d3236553SJohannes Berg struct wiphy {
2295d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2296d3236553SJohannes Berg 
2297ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2298d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2299ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2300ef15aac6SJohannes Berg 
2301ef15aac6SJohannes Berg 	struct mac_address *addresses;
2302d3236553SJohannes Berg 
23032e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
23042e161f78SJohannes Berg 
23057527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
23067527a782SJohannes Berg 	int n_iface_combinations;
23077527a782SJohannes Berg 	u16 software_iftypes;
23087527a782SJohannes Berg 
23092e161f78SJohannes Berg 	u16 n_addresses;
23102e161f78SJohannes Berg 
2311d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2312d3236553SJohannes Berg 	u16 interface_modes;
2313d3236553SJohannes Berg 
23141f074bd8SJohannes Berg 	u32 flags, features;
2315463d0183SJohannes Berg 
2316562a7480SJohannes Berg 	u32 ap_sme_capa;
2317562a7480SJohannes Berg 
2318d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2319d3236553SJohannes Berg 
2320d3236553SJohannes Berg 	int bss_priv_size;
2321d3236553SJohannes Berg 	u8 max_scan_ssids;
232293b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2323a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2324d3236553SJohannes Berg 	u16 max_scan_ie_len;
23255a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2326d3236553SJohannes Berg 
2327d3236553SJohannes Berg 	int n_cipher_suites;
2328d3236553SJohannes Berg 	const u32 *cipher_suites;
2329d3236553SJohannes Berg 
2330b9a5f8caSJouni Malinen 	u8 retry_short;
2331b9a5f8caSJouni Malinen 	u8 retry_long;
2332b9a5f8caSJouni Malinen 	u32 frag_threshold;
2333b9a5f8caSJouni Malinen 	u32 rts_threshold;
233481077e82SLukáš Turek 	u8 coverage_class;
2335b9a5f8caSJouni Malinen 
2336dfce95f5SKalle Valo 	char fw_version[ETHTOOL_BUSINFO_LEN];
2337dfce95f5SKalle Valo 	u32 hw_version;
2338dfce95f5SKalle Valo 
2339dfb89c56SJohannes Berg #ifdef CONFIG_PM
2340ff1b6e69SJohannes Berg 	struct wiphy_wowlan_support wowlan;
2341dfb89c56SJohannes Berg #endif
2342ff1b6e69SJohannes Berg 
2343a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2344a293911dSJohannes Berg 
234567fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
234667fbb16bSSamuel Ortiz 
23477f531e03SBruno Randolf 	u32 available_antennas_tx;
23487f531e03SBruno Randolf 	u32 available_antennas_rx;
2349a7ffac95SBruno Randolf 
235087bbbe22SArik Nemtsov 	/*
235187bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
235287bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
235387bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
235487bbbe22SArik Nemtsov 	 */
235587bbbe22SArik Nemtsov 	u32 probe_resp_offload;
235687bbbe22SArik Nemtsov 
2357d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2358d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2359d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2360d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2361d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2362cf5aa2f1SDavid Kilroy 	const void *privid;
2363d3236553SJohannes Berg 
2364d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2365d3236553SJohannes Berg 
2366d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
2367d3236553SJohannes Berg 	int (*reg_notifier)(struct wiphy *wiphy,
2368d3236553SJohannes Berg 			    struct regulatory_request *request);
2369d3236553SJohannes Berg 
2370d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2371d3236553SJohannes Berg 
2372d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd;
2373d3236553SJohannes Berg 
2374d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
2375d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
2376d3236553SJohannes Berg 	struct device dev;
2377d3236553SJohannes Berg 
2378ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2379ecb44335SStanislaw Gruszka 	bool registered;
2380ecb44335SStanislaw Gruszka 
2381d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
2382d3236553SJohannes Berg 	struct dentry *debugfsdir;
2383d3236553SJohannes Berg 
23847e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
23857e7c8926SBen Greear 
2386463d0183SJohannes Berg #ifdef CONFIG_NET_NS
2387463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
2388463d0183SJohannes Berg 	struct net *_net;
2389463d0183SJohannes Berg #endif
2390463d0183SJohannes Berg 
23913d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
23923d23e349SJohannes Berg 	const struct iw_handler_def *wext;
23933d23e349SJohannes Berg #endif
23943d23e349SJohannes Berg 
2395d3236553SJohannes Berg 	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
2396d3236553SJohannes Berg };
2397d3236553SJohannes Berg 
2398463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
2399463d0183SJohannes Berg {
2400c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
2401463d0183SJohannes Berg }
2402463d0183SJohannes Berg 
2403463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2404463d0183SJohannes Berg {
2405c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
2406463d0183SJohannes Berg }
2407463d0183SJohannes Berg 
2408d3236553SJohannes Berg /**
2409d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
2410d3236553SJohannes Berg  *
2411d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
2412d3236553SJohannes Berg  */
2413d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
2414d3236553SJohannes Berg {
2415d3236553SJohannes Berg 	BUG_ON(!wiphy);
2416d3236553SJohannes Berg 	return &wiphy->priv;
2417d3236553SJohannes Berg }
2418d3236553SJohannes Berg 
2419d3236553SJohannes Berg /**
2420f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
2421f1f74825SDavid Kilroy  *
2422f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
2423f1f74825SDavid Kilroy  */
2424f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
2425f1f74825SDavid Kilroy {
2426f1f74825SDavid Kilroy 	BUG_ON(!priv);
2427f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
2428f1f74825SDavid Kilroy }
2429f1f74825SDavid Kilroy 
2430f1f74825SDavid Kilroy /**
2431d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
2432d3236553SJohannes Berg  *
2433d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
2434d3236553SJohannes Berg  * @dev: The device to parent it to
2435d3236553SJohannes Berg  */
2436d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2437d3236553SJohannes Berg {
2438d3236553SJohannes Berg 	wiphy->dev.parent = dev;
2439d3236553SJohannes Berg }
2440d3236553SJohannes Berg 
2441d3236553SJohannes Berg /**
2442d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
2443d3236553SJohannes Berg  *
2444d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
2445d3236553SJohannes Berg  */
2446d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
2447d3236553SJohannes Berg {
2448d3236553SJohannes Berg 	return wiphy->dev.parent;
2449d3236553SJohannes Berg }
2450d3236553SJohannes Berg 
2451d3236553SJohannes Berg /**
2452d3236553SJohannes Berg  * wiphy_name - get wiphy name
2453d3236553SJohannes Berg  *
2454d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
2455d3236553SJohannes Berg  */
2456e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
2457d3236553SJohannes Berg {
2458d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
2459d3236553SJohannes Berg }
2460d3236553SJohannes Berg 
2461d3236553SJohannes Berg /**
2462d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
2463d3236553SJohannes Berg  *
2464d3236553SJohannes Berg  * @ops: The configuration operations for this device
2465d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
2466d3236553SJohannes Berg  *
2467d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
2468d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
2469d3236553SJohannes Berg  *
2470d3236553SJohannes Berg  * The returned pointer must be assigned to each netdev's
2471d3236553SJohannes Berg  * ieee80211_ptr for proper operation.
2472d3236553SJohannes Berg  */
24733dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2474d3236553SJohannes Berg 
2475d3236553SJohannes Berg /**
2476d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
2477d3236553SJohannes Berg  *
2478d3236553SJohannes Berg  * @wiphy: The wiphy to register.
2479d3236553SJohannes Berg  *
2480d3236553SJohannes Berg  * Returns a non-negative wiphy index or a negative error code.
2481d3236553SJohannes Berg  */
2482d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
2483d3236553SJohannes Berg 
2484d3236553SJohannes Berg /**
2485d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
2486d3236553SJohannes Berg  *
2487d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
2488d3236553SJohannes Berg  *
2489d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
2490d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
2491d3236553SJohannes Berg  * request that is being handled.
2492d3236553SJohannes Berg  */
2493d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
2494d3236553SJohannes Berg 
2495d3236553SJohannes Berg /**
2496d3236553SJohannes Berg  * wiphy_free - free wiphy
2497d3236553SJohannes Berg  *
2498d3236553SJohannes Berg  * @wiphy: The wiphy to free
2499d3236553SJohannes Berg  */
2500d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
2501d3236553SJohannes Berg 
2502fffd0934SJohannes Berg /* internal structs */
25036829c878SJohannes Berg struct cfg80211_conn;
250419957bb3SJohannes Berg struct cfg80211_internal_bss;
2505fffd0934SJohannes Berg struct cfg80211_cached_keys;
250619957bb3SJohannes Berg 
2507d3236553SJohannes Berg /**
250889a54e48SJohannes Berg  * struct wireless_dev - wireless device state
2509d3236553SJohannes Berg  *
251089a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
251189a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
251289a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
251389a54e48SJohannes Berg  * It need not be registered then as netdev registration will
251489a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
251589a54e48SJohannes Berg  *
251689a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
251789a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
251889a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
251989a54e48SJohannes Berg  * allocated outside of callback operations that return it.
2520d3236553SJohannes Berg  *
2521d3236553SJohannes Berg  * @wiphy: pointer to hardware description
2522d3236553SJohannes Berg  * @iftype: interface type
2523d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
252489a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
252589a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
252689a54e48SJohannes Berg  *	wireless device if it has no netdev
2527d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
2528f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
2529aa430da4SJohannes Berg  *	the user-set AP, monitor and WDS channel
2530aa430da4SJohannes Berg  * @preset_chan: (private) Used by the internal configuration code to
2531aa430da4SJohannes Berg  *	track the channel to be used for AP later
2532aa430da4SJohannes Berg  * @preset_chantype: (private) the corresponding channel type
2533d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
2534d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
2535d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
253629cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
253729cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
2538d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
25399bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
25409bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
25419bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
25429bc383deSJohannes Berg  *	by cfg80211 on change_interface
25432e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
25442e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
2545abe37c4bSJohannes Berg  * @mtx: mutex used to lock data in this struct
2546abe37c4bSJohannes Berg  * @cleanup_work: work struct used for cleanup that can't be done directly
254756d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
254856d1893dSJohannes Berg  *	beacons, 0 when not valid
254998104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
255098104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
2551d3236553SJohannes Berg  */
2552d3236553SJohannes Berg struct wireless_dev {
2553d3236553SJohannes Berg 	struct wiphy *wiphy;
2554d3236553SJohannes Berg 	enum nl80211_iftype iftype;
2555d3236553SJohannes Berg 
2556667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
2557d3236553SJohannes Berg 	struct list_head list;
2558d3236553SJohannes Berg 	struct net_device *netdev;
2559d3236553SJohannes Berg 
256089a54e48SJohannes Berg 	u32 identifier;
256189a54e48SJohannes Berg 
25622e161f78SJohannes Berg 	struct list_head mgmt_registrations;
25632e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
2564026331c4SJouni Malinen 
2565667503ddSJohannes Berg 	struct mutex mtx;
2566667503ddSJohannes Berg 
2567ad002395SJohannes Berg 	struct work_struct cleanup_work;
2568ad002395SJohannes Berg 
256998104fdeSJohannes Berg 	bool use_4addr, p2p_started;
257098104fdeSJohannes Berg 
257198104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
25729bc383deSJohannes Berg 
2573b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
2574d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
257529cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
2576b23aa676SSamuel Ortiz 	enum {
2577b23aa676SSamuel Ortiz 		CFG80211_SME_IDLE,
25786829c878SJohannes Berg 		CFG80211_SME_CONNECTING,
2579b23aa676SSamuel Ortiz 		CFG80211_SME_CONNECTED,
2580b23aa676SSamuel Ortiz 	} sme_state;
25816829c878SJohannes Berg 	struct cfg80211_conn *conn;
2582fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
2583d3236553SJohannes Berg 
2584667503ddSJohannes Berg 	struct list_head event_list;
2585667503ddSJohannes Berg 	spinlock_t event_lock;
2586667503ddSJohannes Berg 
258719957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
2588683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
258919957bb3SJohannes Berg 
2590f4489ebeSMichal Kazior 	/* for AP and mesh channel tracking */
2591f4489ebeSMichal Kazior 	struct ieee80211_channel *channel;
2592f4489ebeSMichal Kazior 
2593c30a3d38SMichal Kazior 	bool ibss_fixed;
2594c30a3d38SMichal Kazior 
2595ffb9eb3dSKalle Valo 	bool ps;
2596ffb9eb3dSKalle Valo 	int ps_timeout;
2597ffb9eb3dSKalle Valo 
259856d1893dSJohannes Berg 	int beacon_interval;
259956d1893dSJohannes Berg 
260015e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
260128946da7SJohannes Berg 
26023d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
2603d3236553SJohannes Berg 	/* wext data */
2604cbe8fa9cSJohannes Berg 	struct {
2605cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
2606f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
2607fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
2608f2129354SJohannes Berg 		u8 *ie;
2609f2129354SJohannes Berg 		size_t ie_len;
2610f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
2611f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
261208645126SJohannes Berg 		s8 default_key, default_mgmt_key;
2613ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
2614cbe8fa9cSJohannes Berg 	} wext;
2615d3236553SJohannes Berg #endif
2616d3236553SJohannes Berg };
2617d3236553SJohannes Berg 
261898104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
261998104fdeSJohannes Berg {
262098104fdeSJohannes Berg 	if (wdev->netdev)
262198104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
262298104fdeSJohannes Berg 	return wdev->address;
262398104fdeSJohannes Berg }
262498104fdeSJohannes Berg 
2625d3236553SJohannes Berg /**
2626d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
2627d3236553SJohannes Berg  *
2628d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
2629d3236553SJohannes Berg  */
2630d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
2631d3236553SJohannes Berg {
2632d3236553SJohannes Berg 	BUG_ON(!wdev);
2633d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
2634d3236553SJohannes Berg }
2635d3236553SJohannes Berg 
2636d70e9693SJohannes Berg /**
2637d70e9693SJohannes Berg  * DOC: Utility functions
2638d70e9693SJohannes Berg  *
2639d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
2640d3236553SJohannes Berg  */
2641d3236553SJohannes Berg 
2642d3236553SJohannes Berg /**
2643d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
2644abe37c4bSJohannes Berg  * @chan: channel number
264559eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
2646d3236553SJohannes Berg  */
264759eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2648d3236553SJohannes Berg 
2649d3236553SJohannes Berg /**
2650d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
2651abe37c4bSJohannes Berg  * @freq: center frequency
2652d3236553SJohannes Berg  */
2653d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
2654d3236553SJohannes Berg 
2655d3236553SJohannes Berg /*
2656d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
2657d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
2658d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
2659d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
2660d3236553SJohannes Berg  * clash.
2661d3236553SJohannes Berg  */
2662d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2663d3236553SJohannes Berg 							 int freq);
2664d3236553SJohannes Berg /**
2665d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
2666abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
2667abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
2668d3236553SJohannes Berg  */
2669d3236553SJohannes Berg static inline struct ieee80211_channel *
2670d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
2671d3236553SJohannes Berg {
2672d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
2673d3236553SJohannes Berg }
2674d3236553SJohannes Berg 
2675d3236553SJohannes Berg /**
2676d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
2677d3236553SJohannes Berg  *
2678d3236553SJohannes Berg  * @sband: the band to look for rates in
2679d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
2680d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
2681d3236553SJohannes Berg  *
2682d3236553SJohannes Berg  * This function returns the basic rate corresponding to a given
2683d3236553SJohannes Berg  * bitrate, that is the next lower bitrate contained in the basic
2684d3236553SJohannes Berg  * rate map, which is, for this function, given as a bitmap of
2685d3236553SJohannes Berg  * indices of rates in the band's bitrate table.
2686d3236553SJohannes Berg  */
2687d3236553SJohannes Berg struct ieee80211_rate *
2688d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2689d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
2690d3236553SJohannes Berg 
2691d3236553SJohannes Berg /*
2692d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
2693d3236553SJohannes Berg  *
2694d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
2695d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
2696d3236553SJohannes Berg  */
2697d3236553SJohannes Berg 
269833e5a2f7SJohannes Berg struct radiotap_align_size {
269933e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
270033e5a2f7SJohannes Berg };
270133e5a2f7SJohannes Berg 
270233e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
270333e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
270433e5a2f7SJohannes Berg 	int n_bits;
270533e5a2f7SJohannes Berg 	uint32_t oui;
270633e5a2f7SJohannes Berg 	uint8_t subns;
270733e5a2f7SJohannes Berg };
270833e5a2f7SJohannes Berg 
270933e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
271033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
271133e5a2f7SJohannes Berg 	int n_ns;
271233e5a2f7SJohannes Berg };
271333e5a2f7SJohannes Berg 
2714d3236553SJohannes Berg /**
2715d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
271633e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
271733e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
271833e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
271933e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
272033e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
272133e5a2f7SJohannes Berg  *	the beginning of the actual data portion
272233e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
272333e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
272433e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
272533e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
272633e5a2f7SJohannes Berg  *	radiotap namespace or not
272733e5a2f7SJohannes Berg  *
272833e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
272933e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
273033e5a2f7SJohannes Berg  * @_arg_index: next argument index
273133e5a2f7SJohannes Berg  * @_arg: next argument pointer
273233e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
273333e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
273433e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
273533e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
273633e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
273733e5a2f7SJohannes Berg  *	next bitmap word
273833e5a2f7SJohannes Berg  *
273933e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
274033e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
2741d3236553SJohannes Berg  */
2742d3236553SJohannes Berg 
2743d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
274433e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
274533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
274633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
2747d3236553SJohannes Berg 
274833e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
274967272440SJohannes Berg 	__le32 *_next_bitmap;
275033e5a2f7SJohannes Berg 
275133e5a2f7SJohannes Berg 	unsigned char *this_arg;
275233e5a2f7SJohannes Berg 	int this_arg_index;
275333e5a2f7SJohannes Berg 	int this_arg_size;
275433e5a2f7SJohannes Berg 
275533e5a2f7SJohannes Berg 	int is_radiotap_ns;
275633e5a2f7SJohannes Berg 
275733e5a2f7SJohannes Berg 	int _max_length;
275833e5a2f7SJohannes Berg 	int _arg_index;
275933e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
276033e5a2f7SJohannes Berg 	int _reset_on_ext;
2761d3236553SJohannes Berg };
2762d3236553SJohannes Berg 
2763d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
2764d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator,
2765d3236553SJohannes Berg 	struct ieee80211_radiotap_header *radiotap_header,
276633e5a2f7SJohannes Berg 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
2767d3236553SJohannes Berg 
2768d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
2769d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator);
2770d3236553SJohannes Berg 
277133e5a2f7SJohannes Berg 
2772e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
2773e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
2774e31a16d6SZhu Yi 
2775e31a16d6SZhu Yi /**
2776e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
2777e31a16d6SZhu Yi  *
2778e31a16d6SZhu Yi  * Given an skb with a raw 802.11 header at the data pointer this function
2779e31a16d6SZhu Yi  * returns the 802.11 header length in bytes (not including encryption
2780e31a16d6SZhu Yi  * headers). If the data in the sk_buff is too short to contain a valid 802.11
2781e31a16d6SZhu Yi  * header the function returns 0.
2782e31a16d6SZhu Yi  *
2783e31a16d6SZhu Yi  * @skb: the frame
2784e31a16d6SZhu Yi  */
2785e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2786e31a16d6SZhu Yi 
2787e31a16d6SZhu Yi /**
2788e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
2789e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
2790e31a16d6SZhu Yi  */
2791633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2792e31a16d6SZhu Yi 
2793e31a16d6SZhu Yi /**
27949b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
27959b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
27969b395bc3SJohannes Berg  *	(first byte) will be accessed
27979b395bc3SJohannes Berg  * Returns the length of the extension header, which is always at
27989b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
27999b395bc3SJohannes Berg  */
28009b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
28019b395bc3SJohannes Berg 
28029b395bc3SJohannes Berg /**
2803d70e9693SJohannes Berg  * DOC: Data path helpers
2804d70e9693SJohannes Berg  *
2805d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
2806d70e9693SJohannes Berg  * functions that help implement the data path for devices
2807d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
2808d70e9693SJohannes Berg  */
2809d70e9693SJohannes Berg 
2810d70e9693SJohannes Berg /**
2811e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
2812e31a16d6SZhu Yi  * @skb: the 802.11 data frame
2813e31a16d6SZhu Yi  * @addr: the device MAC address
2814e31a16d6SZhu Yi  * @iftype: the virtual interface type
2815e31a16d6SZhu Yi  */
2816eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2817e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
2818e31a16d6SZhu Yi 
2819e31a16d6SZhu Yi /**
2820e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
2821e31a16d6SZhu Yi  * @skb: the 802.3 frame
2822e31a16d6SZhu Yi  * @addr: the device MAC address
2823e31a16d6SZhu Yi  * @iftype: the virtual interface type
2824e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
2825e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
2826e31a16d6SZhu Yi  */
2827eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2828e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
2829e31a16d6SZhu Yi 
2830e31a16d6SZhu Yi /**
2831eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
2832eaf85ca7SZhu Yi  *
2833eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
2834eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
2835eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
2836eaf85ca7SZhu Yi  *
2837eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
2838eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
2839eaf85ca7SZhu Yi  *	initialized by by the caller.
2840eaf85ca7SZhu Yi  * @addr: The device MAC address.
2841eaf85ca7SZhu Yi  * @iftype: The device interface type.
2842eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
28438b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
2844eaf85ca7SZhu Yi  */
2845eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2846eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
28478b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
28488b3becadSYogesh Ashok Powar 			      bool has_80211_header);
2849eaf85ca7SZhu Yi 
2850eaf85ca7SZhu Yi /**
2851e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
2852e31a16d6SZhu Yi  * @skb: the data frame
2853e31a16d6SZhu Yi  */
2854e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2855e31a16d6SZhu Yi 
2856c21dbf92SJohannes Berg /**
2857c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
2858c21dbf92SJohannes Berg  *
2859c21dbf92SJohannes Berg  * @eid: element ID
2860c21dbf92SJohannes Berg  * @ies: data consisting of IEs
2861c21dbf92SJohannes Berg  * @len: length of data
2862c21dbf92SJohannes Berg  *
2863c21dbf92SJohannes Berg  * This function will return %NULL if the element ID could
2864c21dbf92SJohannes Berg  * not be found or if the element is invalid (claims to be
2865c21dbf92SJohannes Berg  * longer than the given data), or a pointer to the first byte
2866c21dbf92SJohannes Berg  * of the requested element, that is the byte containing the
2867c21dbf92SJohannes Berg  * element ID. There are no checks on the element length
2868c21dbf92SJohannes Berg  * other than having to fit into the given data.
2869c21dbf92SJohannes Berg  */
2870c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2871c21dbf92SJohannes Berg 
2872d70e9693SJohannes Berg /**
28730c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
28740c28ec58SEliad Peller  *
28750c28ec58SEliad Peller  * @oui: vendor OUI
28760c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
28770c28ec58SEliad Peller  * @ies: data consisting of IEs
28780c28ec58SEliad Peller  * @len: length of data
28790c28ec58SEliad Peller  *
28800c28ec58SEliad Peller  * This function will return %NULL if the vendor specific element ID
28810c28ec58SEliad Peller  * could not be found or if the element is invalid (claims to be
28820c28ec58SEliad Peller  * longer than the given data), or a pointer to the first byte
28830c28ec58SEliad Peller  * of the requested element, that is the byte containing the
28840c28ec58SEliad Peller  * element ID. There are no checks on the element length
28850c28ec58SEliad Peller  * other than having to fit into the given data.
28860c28ec58SEliad Peller  */
28870c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
28880c28ec58SEliad Peller 				  const u8 *ies, int len);
28890c28ec58SEliad Peller 
28900c28ec58SEliad Peller /**
2891d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
2892d70e9693SJohannes Berg  *
2893d70e9693SJohannes Berg  * TODO
2894d3236553SJohannes Berg  */
2895d3236553SJohannes Berg 
2896d3236553SJohannes Berg /**
2897d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
2898d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
2899d3236553SJohannes Berg  *	conflicts)
2900d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
2901d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
2902d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
2903d3236553SJohannes Berg  * 	alpha2.
2904d3236553SJohannes Berg  *
2905d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
2906d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
2907d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
2908d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
2909d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
2910d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
2911d3236553SJohannes Berg  *
2912d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
2913d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
2914d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
2915d3236553SJohannes Berg  *
2916d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
2917d3236553SJohannes Berg  * an -ENOMEM.
2918d3236553SJohannes Berg  */
2919d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2920d3236553SJohannes Berg 
2921d3236553SJohannes Berg /**
2922d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
2923d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
2924d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
2925d3236553SJohannes Berg  *
2926d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
2927d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
2928d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
2929d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
2930d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
2931d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
2932d3236553SJohannes Berg  */
2933d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
2934d3236553SJohannes Berg 	struct wiphy *wiphy,
2935d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
2936d3236553SJohannes Berg 
2937d3236553SJohannes Berg /**
2938d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
2939d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
2940d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
2941038659e7SLuis R. Rodriguez  * @desired_bw_khz: the desired max bandwidth you want to use per
2942038659e7SLuis R. Rodriguez  *	channel. Note that this is still 20 MHz if you want to use HT40
2943038659e7SLuis R. Rodriguez  *	as HT40 makes use of two channels for its 40 MHz width bandwidth.
2944038659e7SLuis R. Rodriguez  *	If set to 0 we'll assume you want the standard 20 MHz.
2945d3236553SJohannes Berg  * @reg_rule: the regulatory rule which we have for this frequency
2946d3236553SJohannes Berg  *
2947d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
2948d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
2949d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
2950d3236553SJohannes Berg  * and processed already.
2951d3236553SJohannes Berg  *
2952d3236553SJohannes Berg  * Returns 0 if it was able to find a valid regulatory rule which does
2953d3236553SJohannes Berg  * apply to the given center_freq otherwise it returns non-zero. It will
2954d3236553SJohannes Berg  * also return -ERANGE if we determine the given center_freq does not even have
2955d3236553SJohannes Berg  * a regulatory rule for a frequency range in the center_freq's band. See
2956d3236553SJohannes Berg  * freq_in_rule_band() for our current definition of a band -- this is purely
2957d3236553SJohannes Berg  * subjective and right now its 802.11 specific.
2958d3236553SJohannes Berg  */
2959038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy,
2960038659e7SLuis R. Rodriguez 			 u32 center_freq,
2961038659e7SLuis R. Rodriguez 			 u32 desired_bw_khz,
2962d3236553SJohannes Berg 			 const struct ieee80211_reg_rule **reg_rule);
2963d3236553SJohannes Berg 
2964d3236553SJohannes Berg /*
2965d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
2966d3236553SJohannes Berg  * functions and BSS handling helpers
2967d3236553SJohannes Berg  */
2968d3236553SJohannes Berg 
29692a519311SJohannes Berg /**
29702a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
29712a519311SJohannes Berg  *
29722a519311SJohannes Berg  * @request: the corresponding scan request
29732a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
29742a519311SJohannes Berg  *	userspace will be notified of that
29752a519311SJohannes Berg  */
29762a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
29772a519311SJohannes Berg 
29782a519311SJohannes Berg /**
2979807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
2980807f8a8cSLuciano Coelho  *
2981807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
2982807f8a8cSLuciano Coelho  */
2983807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
2984807f8a8cSLuciano Coelho 
2985807f8a8cSLuciano Coelho /**
2986807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
2987807f8a8cSLuciano Coelho  *
2988807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
2989807f8a8cSLuciano Coelho  *
2990807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
2991807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
2992807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
2993807f8a8cSLuciano Coelho  */
2994807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
2995807f8a8cSLuciano Coelho 
2996807f8a8cSLuciano Coelho /**
2997abe37c4bSJohannes Berg  * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
29982a519311SJohannes Berg  *
29992a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
3000abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3001abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
3002abe37c4bSJohannes Berg  * @len: length of the management frame
300377965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
30042a519311SJohannes Berg  * @gfp: context flags
30052a519311SJohannes Berg  *
30062a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
30072a519311SJohannes Berg  * the BSS should be updated/added.
3008ef100682SJohannes Berg  *
3009ef100682SJohannes Berg  * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
30102a519311SJohannes Berg  */
3011ef100682SJohannes Berg struct cfg80211_bss * __must_check
30122a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
30132a519311SJohannes Berg 			  struct ieee80211_channel *channel,
30142a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
301577965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
30162a519311SJohannes Berg 
3017abe37c4bSJohannes Berg /**
3018abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
3019abe37c4bSJohannes Berg  *
3020abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
3021abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3022abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
30237b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
3024abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
3025abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
3026abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
3027abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
3028abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
3029abe37c4bSJohannes Berg  * @gfp: context flags
3030abe37c4bSJohannes Berg  *
3031abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
3032abe37c4bSJohannes Berg  * the BSS should be updated/added.
3033ef100682SJohannes Berg  *
3034ef100682SJohannes Berg  * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
3035abe37c4bSJohannes Berg  */
3036ef100682SJohannes Berg struct cfg80211_bss * __must_check
303706aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
303806aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
30397b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
30407b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
304106aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
304206aa7afaSJussi Kivilinna 
30432a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
30442a519311SJohannes Berg 				      struct ieee80211_channel *channel,
30452a519311SJohannes Berg 				      const u8 *bssid,
304679420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
304779420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
304879420f09SJohannes Berg static inline struct cfg80211_bss *
304979420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
305079420f09SJohannes Berg 		  struct ieee80211_channel *channel,
305179420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
305279420f09SJohannes Berg {
305379420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
305479420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
305579420f09SJohannes Berg }
305679420f09SJohannes Berg 
30572a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
30582a519311SJohannes Berg 				       struct ieee80211_channel *channel,
30592a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
30602a519311SJohannes Berg 				       const u8 *meshcfg);
30614c0c0b75SJohannes Berg /**
30624c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
30634c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
30644c0c0b75SJohannes Berg  *
30654c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
30664c0c0b75SJohannes Berg  */
30674c0c0b75SJohannes Berg void cfg80211_ref_bss(struct cfg80211_bss *bss);
30684c0c0b75SJohannes Berg 
30694c0c0b75SJohannes Berg /**
30704c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
30714c0c0b75SJohannes Berg  * @bss: the BSS struct
30724c0c0b75SJohannes Berg  *
30734c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
30744c0c0b75SJohannes Berg  */
30752a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
3076d3236553SJohannes Berg 
3077d491af19SJohannes Berg /**
3078d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
3079d491af19SJohannes Berg  * @wiphy: the wiphy
3080d491af19SJohannes Berg  * @bss: the bss to remove
3081d491af19SJohannes Berg  *
3082d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
3083d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
3084d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
3085d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
3086d491af19SJohannes Berg  */
3087d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3088fee52678SJohannes Berg 
30896039f6d2SJouni Malinen /**
30906039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
30916039f6d2SJouni Malinen  * @dev: network device
30926039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
30936039f6d2SJouni Malinen  * @len: length of the frame data
30946039f6d2SJouni Malinen  *
30956039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
30961965c853SJouni Malinen  * station mode. The driver is required to call either this function or
30971965c853SJouni Malinen  * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
3098cb0b4bebSJohannes Berg  * call. This function may sleep.
30996039f6d2SJouni Malinen  */
3100cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
31016039f6d2SJouni Malinen 
31026039f6d2SJouni Malinen /**
31031965c853SJouni Malinen  * cfg80211_send_auth_timeout - notification of timed out authentication
31041965c853SJouni Malinen  * @dev: network device
31051965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
3106cb0b4bebSJohannes Berg  *
3107cb0b4bebSJohannes Berg  * This function may sleep.
31081965c853SJouni Malinen  */
3109cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
31101965c853SJouni Malinen 
31111965c853SJouni Malinen /**
31126039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
31136039f6d2SJouni Malinen  * @dev: network device
311495de817bSJohannes Berg  * @bss: the BSS struct association was requested for, the struct reference
311595de817bSJohannes Berg  *	is owned by cfg80211 after this call
31166039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
31176039f6d2SJouni Malinen  * @len: length of the frame data
31186039f6d2SJouni Malinen  *
31196039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
31201965c853SJouni Malinen  * processed in station mode. The driver is required to call either this
31211965c853SJouni Malinen  * function or cfg80211_send_assoc_timeout() to indicate the result of
3122cb0b4bebSJohannes Berg  * cfg80211_ops::assoc() call. This function may sleep.
31236039f6d2SJouni Malinen  */
312495de817bSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
312595de817bSJohannes Berg 			    const u8 *buf, size_t len);
31266039f6d2SJouni Malinen 
31276039f6d2SJouni Malinen /**
31281965c853SJouni Malinen  * cfg80211_send_assoc_timeout - notification of timed out association
31291965c853SJouni Malinen  * @dev: network device
31301965c853SJouni Malinen  * @addr: The MAC address of the device with which the association timed out
3131cb0b4bebSJohannes Berg  *
3132cb0b4bebSJohannes Berg  * This function may sleep.
31331965c853SJouni Malinen  */
3134cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
31351965c853SJouni Malinen 
31361965c853SJouni Malinen /**
313753b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
31386039f6d2SJouni Malinen  * @dev: network device
31396039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
31406039f6d2SJouni Malinen  * @len: length of the frame data
31416039f6d2SJouni Malinen  *
31426039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
314353b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
3144cb0b4bebSJohannes Berg  * locally generated ones. This function may sleep.
31456039f6d2SJouni Malinen  */
3146ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3147ce470613SHolger Schurig 
3148ce470613SHolger Schurig /**
3149ce470613SHolger Schurig  * __cfg80211_send_deauth - notification of processed deauthentication
3150ce470613SHolger Schurig  * @dev: network device
3151ce470613SHolger Schurig  * @buf: deauthentication frame (header + body)
3152ce470613SHolger Schurig  * @len: length of the frame data
3153ce470613SHolger Schurig  *
3154ce470613SHolger Schurig  * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
3155ce470613SHolger Schurig  */
3156ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
31576039f6d2SJouni Malinen 
31586039f6d2SJouni Malinen /**
315953b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
31606039f6d2SJouni Malinen  * @dev: network device
31616039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
31626039f6d2SJouni Malinen  * @len: length of the frame data
31636039f6d2SJouni Malinen  *
31646039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
316553b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
3166cb0b4bebSJohannes Berg  * generated ones. This function may sleep.
31676039f6d2SJouni Malinen  */
3168ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
3169ce470613SHolger Schurig 
3170ce470613SHolger Schurig /**
3171ce470613SHolger Schurig  * __cfg80211_send_disassoc - notification of processed disassociation
3172ce470613SHolger Schurig  * @dev: network device
3173ce470613SHolger Schurig  * @buf: disassociation response frame (header + body)
3174ce470613SHolger Schurig  * @len: length of the frame data
3175ce470613SHolger Schurig  *
3176ce470613SHolger Schurig  * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
3177ce470613SHolger Schurig  */
3178ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
3179ce470613SHolger Schurig 	size_t len);
31806039f6d2SJouni Malinen 
3181a08c1c1aSKalle Valo /**
3182cf4e594eSJouni Malinen  * cfg80211_send_unprot_deauth - notification of unprotected deauthentication
3183cf4e594eSJouni Malinen  * @dev: network device
3184cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
3185cf4e594eSJouni Malinen  * @len: length of the frame data
3186cf4e594eSJouni Malinen  *
3187cf4e594eSJouni Malinen  * This function is called whenever a received Deauthentication frame has been
3188cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Deauthentication
3189cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3190cf4e594eSJouni Malinen  */
3191cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
3192cf4e594eSJouni Malinen 				 size_t len);
3193cf4e594eSJouni Malinen 
3194cf4e594eSJouni Malinen /**
3195cf4e594eSJouni Malinen  * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
3196cf4e594eSJouni Malinen  * @dev: network device
3197cf4e594eSJouni Malinen  * @buf: disassociation frame (header + body)
3198cf4e594eSJouni Malinen  * @len: length of the frame data
3199cf4e594eSJouni Malinen  *
3200cf4e594eSJouni Malinen  * This function is called whenever a received Disassociation frame has been
3201cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Disassociation
3202cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3203cf4e594eSJouni Malinen  */
3204cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
3205cf4e594eSJouni Malinen 				   size_t len);
3206cf4e594eSJouni Malinen 
3207cf4e594eSJouni Malinen /**
3208a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
3209a3b8b056SJouni Malinen  * @dev: network device
3210a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
3211a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
3212a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
3213a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
3214e6d6e342SJohannes Berg  * @gfp: allocation flags
3215a3b8b056SJouni Malinen  *
3216a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
3217a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
3218a3b8b056SJouni Malinen  * primitive.
3219a3b8b056SJouni Malinen  */
3220a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3221a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
3222e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
3223a3b8b056SJouni Malinen 
322404a773adSJohannes Berg /**
322504a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
322604a773adSJohannes Berg  *
322704a773adSJohannes Berg  * @dev: network device
322804a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
322904a773adSJohannes Berg  * @gfp: allocation flags
323004a773adSJohannes Berg  *
323104a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
323204a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
323304a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
323404a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
323504a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
323604a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
323704a773adSJohannes Berg  */
323804a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
323904a773adSJohannes Berg 
32401f87f7d3SJohannes Berg /**
3241c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
3242c93b5e71SJavier Cardona  *
3243c93b5e71SJavier Cardona  * @dev: network device
3244c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
3245c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
3246c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
3247c93b5e71SJavier Cardona  * @gfp: allocation flags
3248c93b5e71SJavier Cardona  *
3249c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
3250c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
3251c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
3252c93b5e71SJavier Cardona  */
3253c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
3254c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3255c93b5e71SJavier Cardona 
3256c93b5e71SJavier Cardona /**
3257d70e9693SJohannes Berg  * DOC: RFkill integration
3258d70e9693SJohannes Berg  *
3259d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
3260d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
3261d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
3262d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
3263d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
3264d70e9693SJohannes Berg  *
3265d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
3266d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
3267d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
3268d70e9693SJohannes Berg  */
3269d70e9693SJohannes Berg 
3270d70e9693SJohannes Berg /**
32711f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
32721f87f7d3SJohannes Berg  * @wiphy: the wiphy
32731f87f7d3SJohannes Berg  * @blocked: block status
32741f87f7d3SJohannes Berg  */
32751f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
32761f87f7d3SJohannes Berg 
32771f87f7d3SJohannes Berg /**
32781f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
32791f87f7d3SJohannes Berg  * @wiphy: the wiphy
32801f87f7d3SJohannes Berg  */
32811f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
32821f87f7d3SJohannes Berg 
32831f87f7d3SJohannes Berg /**
32841f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
32851f87f7d3SJohannes Berg  * @wiphy: the wiphy
32861f87f7d3SJohannes Berg  */
32871f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
32881f87f7d3SJohannes Berg 
3289aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3290aff89a9bSJohannes Berg /**
3291d70e9693SJohannes Berg  * DOC: Test mode
3292d70e9693SJohannes Berg  *
3293d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
3294d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
3295d70e9693SJohannes Berg  * factory programming.
3296d70e9693SJohannes Berg  *
3297d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
3298d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
3299d70e9693SJohannes Berg  */
3300d70e9693SJohannes Berg 
3301d70e9693SJohannes Berg /**
3302aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
3303aff89a9bSJohannes Berg  * @wiphy: the wiphy
3304aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3305aff89a9bSJohannes Berg  *	be put into the skb
3306aff89a9bSJohannes Berg  *
3307aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
3308aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
3309aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
3310aff89a9bSJohannes Berg  *
3311aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is pre-filled
3312aff89a9bSJohannes Berg  * with the wiphy index and set up in a way that any data that is
3313aff89a9bSJohannes Berg  * put into the skb (with skb_put(), nla_put() or similar) will end
3314aff89a9bSJohannes Berg  * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
3315aff89a9bSJohannes Berg  * needs to be done with the skb is adding data for the corresponding
3316aff89a9bSJohannes Berg  * userspace tool which can then read that data out of the testdata
3317aff89a9bSJohannes Berg  * attribute. You must not modify the skb in any other way.
3318aff89a9bSJohannes Berg  *
3319aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
3320aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
3321aff89a9bSJohannes Berg  */
3322aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3323aff89a9bSJohannes Berg 						  int approxlen);
3324aff89a9bSJohannes Berg 
3325aff89a9bSJohannes Berg /**
3326aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
3327aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3328aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
3329aff89a9bSJohannes Berg  *
3330aff89a9bSJohannes Berg  * Returns an error code or 0 on success, since calling this
3331aff89a9bSJohannes Berg  * function will usually be the last thing before returning
3332aff89a9bSJohannes Berg  * from the @testmode_cmd you should return the error code.
3333aff89a9bSJohannes Berg  * Note that this function consumes the skb regardless of the
3334aff89a9bSJohannes Berg  * return value.
3335aff89a9bSJohannes Berg  */
3336aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
3337aff89a9bSJohannes Berg 
3338aff89a9bSJohannes Berg /**
3339aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
3340aff89a9bSJohannes Berg  * @wiphy: the wiphy
3341aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3342aff89a9bSJohannes Berg  *	be put into the skb
3343aff89a9bSJohannes Berg  * @gfp: allocation flags
3344aff89a9bSJohannes Berg  *
3345aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
3346aff89a9bSJohannes Berg  * testmode multicast group.
3347aff89a9bSJohannes Berg  *
3348aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is set up in the
3349aff89a9bSJohannes Berg  * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
3350aff89a9bSJohannes Berg  * for an event. As there, you should simply add data to it that will
3351aff89a9bSJohannes Berg  * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
3352aff89a9bSJohannes Berg  * not modify the skb in any other way.
3353aff89a9bSJohannes Berg  *
3354aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
3355aff89a9bSJohannes Berg  * skb to send the event.
3356aff89a9bSJohannes Berg  */
3357aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3358aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
3359aff89a9bSJohannes Berg 
3360aff89a9bSJohannes Berg /**
3361aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
3362aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3363aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
3364aff89a9bSJohannes Berg  * @gfp: allocation flags
3365aff89a9bSJohannes Berg  *
3366aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
3367aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
3368aff89a9bSJohannes Berg  * consumes it.
3369aff89a9bSJohannes Berg  */
3370aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3371aff89a9bSJohannes Berg 
3372aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
337371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
3374aff89a9bSJohannes Berg #else
3375aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
337671063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
3377aff89a9bSJohannes Berg #endif
3378aff89a9bSJohannes Berg 
3379b23aa676SSamuel Ortiz /**
3380b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
3381b23aa676SSamuel Ortiz  *
3382b23aa676SSamuel Ortiz  * @dev: network device
3383b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
3384b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3385b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3386b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3387b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3388b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
3389b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
3390b23aa676SSamuel Ortiz  *	the real status code for failures.
3391b23aa676SSamuel Ortiz  * @gfp: allocation flags
3392b23aa676SSamuel Ortiz  *
3393b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
3394b23aa676SSamuel Ortiz  * succeeded.
3395b23aa676SSamuel Ortiz  */
3396b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3397b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
3398b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
3399b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
3400b23aa676SSamuel Ortiz 
3401b23aa676SSamuel Ortiz /**
3402b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
3403b23aa676SSamuel Ortiz  *
3404b23aa676SSamuel Ortiz  * @dev: network device
3405ed9d0102SJouni Malinen  * @channel: the channel of the new AP
3406b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
3407b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3408b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3409b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3410b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3411b23aa676SSamuel Ortiz  * @gfp: allocation flags
3412b23aa676SSamuel Ortiz  *
3413b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
3414b23aa676SSamuel Ortiz  * from one AP to another while connected.
3415b23aa676SSamuel Ortiz  */
3416ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
3417ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
3418ed9d0102SJouni Malinen 		     const u8 *bssid,
3419b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
3420b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3421b23aa676SSamuel Ortiz 
3422b23aa676SSamuel Ortiz /**
3423adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
3424adbde344SVasanthakumar Thiagarajan  *
3425adbde344SVasanthakumar Thiagarajan  * @dev: network device
3426adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
3427adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
3428adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
3429adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
3430adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
3431adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
3432adbde344SVasanthakumar Thiagarajan  *
3433adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
3434adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
3435adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
3436adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
3437adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
3438adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
3439adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
3440adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
3441adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3442adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
3443adbde344SVasanthakumar Thiagarajan  */
3444adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3445adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
3446adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3447adbde344SVasanthakumar Thiagarajan 
3448adbde344SVasanthakumar Thiagarajan /**
3449b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
3450b23aa676SSamuel Ortiz  *
3451b23aa676SSamuel Ortiz  * @dev: network device
3452b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
3453b23aa676SSamuel Ortiz  * @ie_len: length of IEs
3454b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
3455b23aa676SSamuel Ortiz  * @gfp: allocation flags
3456b23aa676SSamuel Ortiz  *
3457b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
3458b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
3459b23aa676SSamuel Ortiz  */
3460b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
3461b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
3462b23aa676SSamuel Ortiz 
34639588bbd5SJouni Malinen /**
34649588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
346571bbc994SJohannes Berg  * @wdev: wireless device
34669588bbd5SJouni Malinen  * @cookie: the request cookie
34679588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
34689588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
34699588bbd5SJouni Malinen  *	channel
34709588bbd5SJouni Malinen  * @gfp: allocation flags
34719588bbd5SJouni Malinen  */
347271bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
34739588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
34749588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
34759588bbd5SJouni Malinen 
34769588bbd5SJouni Malinen /**
34779588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
347871bbc994SJohannes Berg  * @wdev: wireless device
34799588bbd5SJouni Malinen  * @cookie: the request cookie
34809588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
34819588bbd5SJouni Malinen  * @gfp: allocation flags
34829588bbd5SJouni Malinen  */
348371bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
34849588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
34859588bbd5SJouni Malinen 					gfp_t gfp);
3486b23aa676SSamuel Ortiz 
348798b62183SJohannes Berg 
348898b62183SJohannes Berg /**
348998b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
349098b62183SJohannes Berg  *
349198b62183SJohannes Berg  * @dev: the netdev
349298b62183SJohannes Berg  * @mac_addr: the station's address
349398b62183SJohannes Berg  * @sinfo: the station information
349498b62183SJohannes Berg  * @gfp: allocation flags
349598b62183SJohannes Berg  */
349698b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
349798b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
349898b62183SJohannes Berg 
3499026331c4SJouni Malinen /**
3500ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
3501ec15e68bSJouni Malinen  *
3502ec15e68bSJouni Malinen  * @dev: the netdev
3503ec15e68bSJouni Malinen  * @mac_addr: the station's address
3504ec15e68bSJouni Malinen  * @gfp: allocation flags
3505ec15e68bSJouni Malinen  */
3506ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3507ec15e68bSJouni Malinen 
3508ec15e68bSJouni Malinen /**
3509ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
3510ed44a951SPandiyarajan Pitchaimuthu  *
3511ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
3512ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
3513ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
3514ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
3515ed44a951SPandiyarajan Pitchaimuthu  *
3516ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
3517ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
3518ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
3519ed44a951SPandiyarajan Pitchaimuthu  *
3520ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
3521ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
3522ed44a951SPandiyarajan Pitchaimuthu  */
3523ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
3524ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
3525ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
3526ed44a951SPandiyarajan Pitchaimuthu 
3527ed44a951SPandiyarajan Pitchaimuthu /**
35282e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
352971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
3530026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
3531804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
35322e161f78SJohannes Berg  * @buf: Management frame (header + body)
3533026331c4SJouni Malinen  * @len: length of the frame data
3534026331c4SJouni Malinen  * @gfp: context flags
35352e161f78SJohannes Berg  *
35362e161f78SJohannes Berg  * Returns %true if a user space application has registered for this frame.
35372e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
35382e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
35392e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
3540026331c4SJouni Malinen  *
3541026331c4SJouni Malinen  * This function is called whenever an Action frame is received for a station
3542026331c4SJouni Malinen  * mode interface, but is not processed in kernel.
3543026331c4SJouni Malinen  */
354471bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3545804483e9SJohannes Berg 		      const u8 *buf, size_t len, gfp_t gfp);
3546026331c4SJouni Malinen 
3547026331c4SJouni Malinen /**
35482e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
354971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
35502e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
35512e161f78SJohannes Berg  * @buf: Management frame (header + body)
3552026331c4SJouni Malinen  * @len: length of the frame data
3553026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
3554026331c4SJouni Malinen  * @gfp: context flags
3555026331c4SJouni Malinen  *
35562e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
35572e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3558026331c4SJouni Malinen  * transmission attempt.
3559026331c4SJouni Malinen  */
356071bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
3561026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
3562026331c4SJouni Malinen 
3563d6dc1a38SJuuso Oikarinen 
3564d6dc1a38SJuuso Oikarinen /**
3565d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
3566d6dc1a38SJuuso Oikarinen  * @dev: network device
3567d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
3568d6dc1a38SJuuso Oikarinen  * @gfp: context flags
3569d6dc1a38SJuuso Oikarinen  *
3570d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
3571d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
3572d6dc1a38SJuuso Oikarinen  */
3573d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
3574d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
3575d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
3576d6dc1a38SJuuso Oikarinen 
3577c063dbf5SJohannes Berg /**
3578c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
3579c063dbf5SJohannes Berg  * @dev: network device
3580c063dbf5SJohannes Berg  * @peer: peer's MAC address
3581c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
3582c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
3583c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
3584c063dbf5SJohannes Berg  * @gfp: context flags
3585c063dbf5SJohannes Berg  */
3586c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3587c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
3588c063dbf5SJohannes Berg 
3589e5497d76SJohannes Berg /**
359084f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
359184f10708SThomas Pedersen  * @dev: network device
359284f10708SThomas Pedersen  * @peer: peer's MAC address
359384f10708SThomas Pedersen  * @num_packets: how many packets were lost
359484f10708SThomas Pedersen  * @rate: % of packets which failed transmission
359584f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
359684f10708SThomas Pedersen  * @gfp: context flags
359784f10708SThomas Pedersen  *
359884f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
359984f10708SThomas Pedersen  * given interval is exceeded.
360084f10708SThomas Pedersen  */
360184f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
360284f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
360384f10708SThomas Pedersen 
360484f10708SThomas Pedersen /**
3605e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3606e5497d76SJohannes Berg  * @dev: network device
3607e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
3608e5497d76SJohannes Berg  * @replay_ctr: new replay counter
3609af71ff85SJohannes Berg  * @gfp: allocation flags
3610e5497d76SJohannes Berg  */
3611e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3612e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
3613e5497d76SJohannes Berg 
3614c9df56b4SJouni Malinen /**
3615c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
3616c9df56b4SJouni Malinen  * @dev: network device
3617c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
3618c9df56b4SJouni Malinen  * @bssid: BSSID of AP
3619c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
3620c9df56b4SJouni Malinen  * @gfp: allocation flags
3621c9df56b4SJouni Malinen  */
3622c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3623c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
3624c9df56b4SJouni Malinen 
362528946da7SJohannes Berg /**
362628946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
362728946da7SJohannes Berg  * @dev: The device the frame matched to
362828946da7SJohannes Berg  * @addr: the transmitter address
362928946da7SJohannes Berg  * @gfp: context flags
363028946da7SJohannes Berg  *
363128946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
363228946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
363328946da7SJohannes Berg  * sender.
363428946da7SJohannes Berg  * Returns %true if the frame was passed to userspace (or this failed
363528946da7SJohannes Berg  * for a reason other than not having a subscription.)
363628946da7SJohannes Berg  */
363728946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
363828946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
363928946da7SJohannes Berg 
36407f6cf311SJohannes Berg /**
3641b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
3642b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
3643b92ab5d8SJohannes Berg  * @addr: the transmitter address
3644b92ab5d8SJohannes Berg  * @gfp: context flags
3645b92ab5d8SJohannes Berg  *
3646b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
3647b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
3648b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
3649b92ab5d8SJohannes Berg  * station to avoid event flooding.
3650b92ab5d8SJohannes Berg  * Returns %true if the frame was passed to userspace (or this failed
3651b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
3652b92ab5d8SJohannes Berg  */
3653b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
3654b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
3655b92ab5d8SJohannes Berg 
3656b92ab5d8SJohannes Berg /**
36577f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
36587f6cf311SJohannes Berg  * @dev: the device the probe was sent on
36597f6cf311SJohannes Berg  * @addr: the address of the peer
36607f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
36617f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
36627f6cf311SJohannes Berg  * @gfp: allocation flags
36637f6cf311SJohannes Berg  */
36647f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
36657f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
36667f6cf311SJohannes Berg 
36675e760230SJohannes Berg /**
36685e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
36695e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
36705e760230SJohannes Berg  * @frame: the frame
36715e760230SJohannes Berg  * @len: length of the frame
36725e760230SJohannes Berg  * @freq: frequency the frame was received on
3673804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
36745e760230SJohannes Berg  *
36755e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
36765e760230SJohannes Berg  * received. It is not useful to call this when there is no
36775e760230SJohannes Berg  * netdev that is in AP/GO mode.
36785e760230SJohannes Berg  */
36795e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
36805e760230SJohannes Berg 				 const u8 *frame, size_t len,
368137c73b5fSBen Greear 				 int freq, int sig_dbm);
36825e760230SJohannes Berg 
3683d58e7e37SJohannes Berg /**
3684683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
368554858ee5SAlexander Simon  * @wiphy: the wiphy
3686683b6d3bSJohannes Berg  * @chandef: the channel definition
3687d58e7e37SJohannes Berg  *
3688d58e7e37SJohannes Berg  * This function returns true if there is no secondary channel or the secondary
3689683b6d3bSJohannes Berg  * channel(s) can be used for beaconing (i.e. is not a radar channel etc.)
369054858ee5SAlexander Simon  */
3691683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3692683b6d3bSJohannes Berg 			     struct cfg80211_chan_def *chandef);
369354858ee5SAlexander Simon 
36948097e149SThomas Pedersen /*
36955314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
36965314526bSThomas Pedersen  * @dev: the device which switched channels
3697683b6d3bSJohannes Berg  * @chandef: the new channel definition
36985314526bSThomas Pedersen  *
36995314526bSThomas Pedersen  * Acquires wdev_lock, so must only be called from sleepable driver context!
37005314526bSThomas Pedersen  */
3701683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
3702683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
37035314526bSThomas Pedersen 
37045314526bSThomas Pedersen /*
37053475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
37063475b094SJouni Malinen  * @dev: the device on which the operation is requested
37073475b094SJouni Malinen  * @peer: the MAC address of the peer device
37083475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
37093475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
37103475b094SJouni Malinen  * @reason_code: the reason code for teardown request
37113475b094SJouni Malinen  * @gfp: allocation flags
37123475b094SJouni Malinen  *
37133475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
37143475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
37153475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
37163475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
37173475b094SJouni Malinen  * based on traffic and signal strength for a peer).
37183475b094SJouni Malinen  */
37193475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
37203475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
37213475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
37223475b094SJouni Malinen 
37233475b094SJouni Malinen /*
37248097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
37258097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
37268097e149SThomas Pedersen  *
37278097e149SThomas Pedersen  * return 0 if MCS index >= 32
37288097e149SThomas Pedersen  */
37298eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
37308097e149SThomas Pedersen 
373198104fdeSJohannes Berg /**
373298104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
373398104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
373498104fdeSJohannes Berg  *
373598104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
373698104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
373798104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
373898104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
373998104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
374098104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
374198104fdeSJohannes Berg  * when the device is unbound from the driver.
374298104fdeSJohannes Berg  *
374398104fdeSJohannes Berg  * Requires the RTNL to be held.
374498104fdeSJohannes Berg  */
374598104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
374698104fdeSJohannes Berg 
37470ee45355SJohannes Berg /**
37480ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
37490ee45355SJohannes Berg  * @ies: the input IE buffer
37500ee45355SJohannes Berg  * @len: the input length
37510ee45355SJohannes Berg  * @attr: the attribute ID to find
37520ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
37530ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
37540ee45355SJohannes Berg  * @bufsize: size of the output buffer
37550ee45355SJohannes Berg  *
37560ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
37570ee45355SJohannes Berg  * copies its contents to the given buffer.
37580ee45355SJohannes Berg  *
37590ee45355SJohannes Berg  * The return value is a negative error code (-%EILSEQ or -%ENOENT) if
37600ee45355SJohannes Berg  * the data is malformed or the attribute can't be found (respectively),
37610ee45355SJohannes Berg  * or the length of the found attribute (which can be zero).
37620ee45355SJohannes Berg  */
3763c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
3764c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
3765c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
37660ee45355SJohannes Berg 
3767e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
3768e1db74fcSJoe Perches 
3769e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
3770e1db74fcSJoe Perches 
3771e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
37729c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
3773e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
37749c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
3775e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
37769c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
3777e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
37789c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
3779e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
37809c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
3781e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
37829c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
3783e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
37849c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
3785e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
37869c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
3787073730d7SJoe Perches 
37889c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
3789e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
37909c376639SJoe Perches 
3791e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
37929c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
3793e1db74fcSJoe Perches 
3794e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
3795e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
3796e1db74fcSJoe Perches #else
3797e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
3798e1db74fcSJoe Perches ({									\
3799e1db74fcSJoe Perches 	if (0)								\
3800e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
3801e1db74fcSJoe Perches 	0;								\
3802e1db74fcSJoe Perches })
3803e1db74fcSJoe Perches #endif
3804e1db74fcSJoe Perches 
3805e1db74fcSJoe Perches /*
3806e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
3807e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
3808e1db74fcSJoe Perches  * file/line information and a backtrace.
3809e1db74fcSJoe Perches  */
3810e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
3811e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
3812e1db74fcSJoe Perches 
3813704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
3814