xref: /linux/include/net/cfg80211.h (revision f4e583c8935c6f52f9385ee7cfbea8f65c66a737)
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 
61704232c2SJohannes Berg /*
62d3236553SJohannes Berg  * wireless hardware capability structures
63d3236553SJohannes Berg  */
64d3236553SJohannes Berg 
65d3236553SJohannes Berg /**
66d3236553SJohannes Berg  * enum ieee80211_band - supported frequency bands
67704232c2SJohannes Berg  *
68d3236553SJohannes Berg  * The bands are assigned this way because the supported
69d3236553SJohannes Berg  * bitrates differ in these bands.
70d3236553SJohannes Berg  *
71d3236553SJohannes Berg  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
72d3236553SJohannes Berg  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
733a0c52a6SVladimir Kondratiev  * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
74abe37c4bSJohannes Berg  * @IEEE80211_NUM_BANDS: number of defined bands
75d3236553SJohannes Berg  */
76d3236553SJohannes Berg enum ieee80211_band {
7713ae75b1SJouni Malinen 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
7813ae75b1SJouni Malinen 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
793a0c52a6SVladimir Kondratiev 	IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
80d3236553SJohannes Berg 
81d3236553SJohannes Berg 	/* keep last */
82d3236553SJohannes Berg 	IEEE80211_NUM_BANDS
83d3236553SJohannes Berg };
84d3236553SJohannes Berg 
85d3236553SJohannes Berg /**
86d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
87d3236553SJohannes Berg  *
88d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
89d3236553SJohannes Berg  *
90d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
91d3236553SJohannes Berg  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
92d3236553SJohannes Berg  *	on this channel.
93d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
94d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
95689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
96d3236553SJohannes Berg  * 	is not permitted.
97689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
98d3236553SJohannes Berg  * 	is not permitted.
9903f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
100d3236553SJohannes Berg  */
101d3236553SJohannes Berg enum ieee80211_channel_flags {
102d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
103d3236553SJohannes Berg 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
104d3236553SJohannes Berg 	IEEE80211_CHAN_NO_IBSS		= 1<<2,
105d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
106689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
107689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
10803f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
109d3236553SJohannes Berg };
110d3236553SJohannes Berg 
111038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
112689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
113038659e7SLuis R. Rodriguez 
114d3236553SJohannes Berg /**
115d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
116d3236553SJohannes Berg  *
117d3236553SJohannes Berg  * This structure describes a single channel for use
118d3236553SJohannes Berg  * with cfg80211.
119d3236553SJohannes Berg  *
120d3236553SJohannes Berg  * @center_freq: center frequency in MHz
121d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
122d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
123d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
124d3236553SJohannes Berg  *	code to support devices with additional restrictions
125d3236553SJohannes Berg  * @band: band this channel belongs to.
126d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
127d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
128eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
129d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
130d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
13177c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
132d3236553SJohannes Berg  * @orig_mag: internal use
133d3236553SJohannes Berg  * @orig_mpwr: internal use
134d3236553SJohannes Berg  */
135d3236553SJohannes Berg struct ieee80211_channel {
136d3236553SJohannes Berg 	enum ieee80211_band band;
137d3236553SJohannes Berg 	u16 center_freq;
138d3236553SJohannes Berg 	u16 hw_value;
139d3236553SJohannes Berg 	u32 flags;
140d3236553SJohannes Berg 	int max_antenna_gain;
141d3236553SJohannes Berg 	int max_power;
142eccc068eSHong Wu 	int max_reg_power;
143d3236553SJohannes Berg 	bool beacon_found;
144d3236553SJohannes Berg 	u32 orig_flags;
145d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
146d3236553SJohannes Berg };
147d3236553SJohannes Berg 
148d3236553SJohannes Berg /**
149d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
150d3236553SJohannes Berg  *
151d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
152d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
153d3236553SJohannes Berg  * different bands/PHY modes.
154d3236553SJohannes Berg  *
155d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
156d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
157d3236553SJohannes Berg  *	with CCK rates.
158d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
159d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
160d3236553SJohannes Berg  *	core code when registering the wiphy.
161d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
162d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
163d3236553SJohannes Berg  *	core code when registering the wiphy.
164d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
165d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
166d3236553SJohannes Berg  *	core code when registering the wiphy.
167d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
168d3236553SJohannes Berg  */
169d3236553SJohannes Berg enum ieee80211_rate_flags {
170d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
171d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
172d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
173d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
174d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
175d3236553SJohannes Berg };
176d3236553SJohannes Berg 
177d3236553SJohannes Berg /**
178d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
179d3236553SJohannes Berg  *
180d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
181d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
182d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
183d3236553SJohannes Berg  * passed around.
184d3236553SJohannes Berg  *
185d3236553SJohannes Berg  * @flags: rate-specific flags
186d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
187d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
188d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
189d3236553SJohannes Berg  *	short preamble is used
190d3236553SJohannes Berg  */
191d3236553SJohannes Berg struct ieee80211_rate {
192d3236553SJohannes Berg 	u32 flags;
193d3236553SJohannes Berg 	u16 bitrate;
194d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
195d3236553SJohannes Berg };
196d3236553SJohannes Berg 
197d3236553SJohannes Berg /**
198d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
199d3236553SJohannes Berg  *
200d3236553SJohannes Berg  * This structure describes most essential parameters needed
201d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
202d3236553SJohannes Berg  *
203d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
204d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
205d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
206d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
207d3236553SJohannes Berg  * @mcs: Supported MCS rates
208d3236553SJohannes Berg  */
209d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
210d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
211d3236553SJohannes Berg 	bool ht_supported;
212d3236553SJohannes Berg 	u8 ampdu_factor;
213d3236553SJohannes Berg 	u8 ampdu_density;
214d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
215d3236553SJohannes Berg };
216d3236553SJohannes Berg 
217d3236553SJohannes Berg /**
218bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
219bf0c111eSMahesh Palivela  *
220bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
221bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
222bf0c111eSMahesh Palivela  *
223bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
224bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
225bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
226bf0c111eSMahesh Palivela  */
227bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
228bf0c111eSMahesh Palivela 	bool vht_supported;
229bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
230bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
231bf0c111eSMahesh Palivela };
232bf0c111eSMahesh Palivela 
233bf0c111eSMahesh Palivela /**
234d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
235d3236553SJohannes Berg  *
236d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
237d3236553SJohannes Berg  * is able to operate in.
238d3236553SJohannes Berg  *
239d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
240d3236553SJohannes Berg  *	in this band.
241d3236553SJohannes Berg  * @band: the band this structure represents
242d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
243d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
244d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
245d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
246d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
247abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
248c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
249d3236553SJohannes Berg  */
250d3236553SJohannes Berg struct ieee80211_supported_band {
251d3236553SJohannes Berg 	struct ieee80211_channel *channels;
252d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
253d3236553SJohannes Berg 	enum ieee80211_band band;
254d3236553SJohannes Berg 	int n_channels;
255d3236553SJohannes Berg 	int n_bitrates;
256d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
257bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
258d3236553SJohannes Berg };
259d3236553SJohannes Berg 
260d3236553SJohannes Berg /*
261d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
262704232c2SJohannes Berg  */
263704232c2SJohannes Berg 
2642ec600d6SLuis Carlos Cobo /**
265d70e9693SJohannes Berg  * DOC: Actions and configuration
266d70e9693SJohannes Berg  *
267d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
268d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
269d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
270d70e9693SJohannes Berg  * operations use are described separately.
271d70e9693SJohannes Berg  *
272d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
273d70e9693SJohannes Berg  * information via some functions that drivers need to call.
274d70e9693SJohannes Berg  *
275d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
276d70e9693SJohannes Berg  * in a separate chapter.
277d70e9693SJohannes Berg  */
278d70e9693SJohannes Berg 
279d70e9693SJohannes Berg /**
2802ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
2818b787643SFelix Fietkau  * @use_4addr: use 4-address frames
2822ec600d6SLuis Carlos Cobo  */
2832ec600d6SLuis Carlos Cobo struct vif_params {
2848b787643SFelix Fietkau        int use_4addr;
2852ec600d6SLuis Carlos Cobo };
2862ec600d6SLuis Carlos Cobo 
28741ade00fSJohannes Berg /**
28841ade00fSJohannes Berg  * struct key_params - key information
28941ade00fSJohannes Berg  *
29041ade00fSJohannes Berg  * Information about a key
29141ade00fSJohannes Berg  *
29241ade00fSJohannes Berg  * @key: key material
29341ade00fSJohannes Berg  * @key_len: length of key material
29441ade00fSJohannes Berg  * @cipher: cipher suite selector
29541ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
29641ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
29741ade00fSJohannes Berg  *	length given by @seq_len.
298abe37c4bSJohannes Berg  * @seq_len: length of @seq.
29941ade00fSJohannes Berg  */
30041ade00fSJohannes Berg struct key_params {
30141ade00fSJohannes Berg 	u8 *key;
30241ade00fSJohannes Berg 	u8 *seq;
30341ade00fSJohannes Berg 	int key_len;
30441ade00fSJohannes Berg 	int seq_len;
30541ade00fSJohannes Berg 	u32 cipher;
30641ade00fSJohannes Berg };
30741ade00fSJohannes Berg 
308ed1b6cc7SJohannes Berg /**
30961fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
31061fa713cSHolger Schurig  *
311abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
31217e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
3138610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
3148610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
3158610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
3168610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
3178610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
318abe37c4bSJohannes Berg  *
31961fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
32061fa713cSHolger Schurig  * it has filled in during the get_survey().
32161fa713cSHolger Schurig  */
32261fa713cSHolger Schurig enum survey_info_flags {
32361fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
32417e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
3258610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
3268610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
3278610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
3288610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
3298610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
33061fa713cSHolger Schurig };
33161fa713cSHolger Schurig 
33261fa713cSHolger Schurig /**
33361fa713cSHolger Schurig  * struct survey_info - channel survey response
33461fa713cSHolger Schurig  *
33561fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
33661fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
33761fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
33861fa713cSHolger Schurig  *     optional
3398610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
3408610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
3418610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
3428610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
3438610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
34461fa713cSHolger Schurig  *
345abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
346abe37c4bSJohannes Berg  *
34761fa713cSHolger Schurig  * This structure can later be expanded with things like
34861fa713cSHolger Schurig  * channel duty cycle etc.
34961fa713cSHolger Schurig  */
35061fa713cSHolger Schurig struct survey_info {
35161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
3528610c29aSFelix Fietkau 	u64 channel_time;
3538610c29aSFelix Fietkau 	u64 channel_time_busy;
3548610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
3558610c29aSFelix Fietkau 	u64 channel_time_rx;
3568610c29aSFelix Fietkau 	u64 channel_time_tx;
35761fa713cSHolger Schurig 	u32 filled;
35861fa713cSHolger Schurig 	s8 noise;
35961fa713cSHolger Schurig };
36061fa713cSHolger Schurig 
36161fa713cSHolger Schurig /**
3625fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
3635fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
3645fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
3655fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
3665fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
3675fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
3685fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
3695fb628e9SJouni Malinen  * @akm_suites: AKM suites
3705fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
3715fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
3725fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
3735fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
3745fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
3755fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
3765fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
3775fb628e9SJouni Malinen  *	protocol frames.
3785fb628e9SJouni Malinen  */
3795fb628e9SJouni Malinen struct cfg80211_crypto_settings {
3805fb628e9SJouni Malinen 	u32 wpa_versions;
3815fb628e9SJouni Malinen 	u32 cipher_group;
3825fb628e9SJouni Malinen 	int n_ciphers_pairwise;
3835fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
3845fb628e9SJouni Malinen 	int n_akm_suites;
3855fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
3865fb628e9SJouni Malinen 	bool control_port;
3875fb628e9SJouni Malinen 	__be16 control_port_ethertype;
3885fb628e9SJouni Malinen 	bool control_port_no_encrypt;
3895fb628e9SJouni Malinen };
3905fb628e9SJouni Malinen 
3915fb628e9SJouni Malinen /**
3928860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
393ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
394ed1b6cc7SJohannes Berg  *     or %NULL if not changed
395ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
396ed1b6cc7SJohannes Berg  *     or %NULL if not changed
397ed1b6cc7SJohannes Berg  * @head_len: length of @head
398ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
3999946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
4009946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
4019946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
4029946ecfbSJouni Malinen  *	frames or %NULL
4039946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
4049946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
4059946ecfbSJouni Malinen  *	Response frames or %NULL
4069946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
40700f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
40800f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
409ed1b6cc7SJohannes Berg  */
4108860020eSJohannes Berg struct cfg80211_beacon_data {
4118860020eSJohannes Berg 	const u8 *head, *tail;
4128860020eSJohannes Berg 	const u8 *beacon_ies;
4138860020eSJohannes Berg 	const u8 *proberesp_ies;
4148860020eSJohannes Berg 	const u8 *assocresp_ies;
4158860020eSJohannes Berg 	const u8 *probe_resp;
4168860020eSJohannes Berg 
4178860020eSJohannes Berg 	size_t head_len, tail_len;
4188860020eSJohannes Berg 	size_t beacon_ies_len;
4198860020eSJohannes Berg 	size_t proberesp_ies_len;
4208860020eSJohannes Berg 	size_t assocresp_ies_len;
4218860020eSJohannes Berg 	size_t probe_resp_len;
4228860020eSJohannes Berg };
4238860020eSJohannes Berg 
4248860020eSJohannes Berg /**
4258860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
4268860020eSJohannes Berg  *
4278860020eSJohannes Berg  * Used to configure an AP interface.
4288860020eSJohannes Berg  *
429aa430da4SJohannes Berg  * @channel: the channel to start the AP on
430aa430da4SJohannes Berg  * @channel_type: the channel type to use
4318860020eSJohannes Berg  * @beacon: beacon data
4328860020eSJohannes Berg  * @beacon_interval: beacon interval
4338860020eSJohannes Berg  * @dtim_period: DTIM period
4348860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
4358860020eSJohannes Berg  *	user space)
4368860020eSJohannes Berg  * @ssid_len: length of @ssid
4378860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
4388860020eSJohannes Berg  * @crypto: crypto settings
4398860020eSJohannes Berg  * @privacy: the BSS uses privacy
4408860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
4411b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
4428860020eSJohannes Berg  */
4438860020eSJohannes Berg struct cfg80211_ap_settings {
444aa430da4SJohannes Berg 	struct ieee80211_channel *channel;
445aa430da4SJohannes Berg 	enum nl80211_channel_type channel_type;
446aa430da4SJohannes Berg 
4478860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
4488860020eSJohannes Berg 
4498860020eSJohannes Berg 	int beacon_interval, dtim_period;
45032e9de84SJouni Malinen 	const u8 *ssid;
45132e9de84SJouni Malinen 	size_t ssid_len;
45232e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
4535fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
4545fb628e9SJouni Malinen 	bool privacy;
4555fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
4561b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
457ed1b6cc7SJohannes Berg };
458ed1b6cc7SJohannes Berg 
4595727ef1bSJohannes Berg /**
4602ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
4612ec600d6SLuis Carlos Cobo  *
4622ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
4632ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
464abe37c4bSJohannes Berg  * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
4652ec600d6SLuis Carlos Cobo  */
4662ec600d6SLuis Carlos Cobo enum plink_actions {
4672ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
4682ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
4692ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
4702ec600d6SLuis Carlos Cobo };
4712ec600d6SLuis Carlos Cobo 
4722ec600d6SLuis Carlos Cobo /**
4733b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
4743b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
4753b9ce80cSJohannes Berg  *
4763b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
4773b9ce80cSJohannes Berg  * for those that don't these flags will are used.
4783b9ce80cSJohannes Berg  */
4793b9ce80cSJohannes Berg enum station_parameters_apply_mask {
4803b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
4813b9ce80cSJohannes Berg };
4823b9ce80cSJohannes Berg 
4833b9ce80cSJohannes Berg /**
4845727ef1bSJohannes Berg  * struct station_parameters - station parameters
4855727ef1bSJohannes Berg  *
4865727ef1bSJohannes Berg  * Used to change and create a new station.
4875727ef1bSJohannes Berg  *
4885727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
4895727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
4905727ef1bSJohannes Berg  *	(or NULL for no change)
4915727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
492eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
493eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
494eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
495eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
4965727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
4975727ef1bSJohannes Berg  * @aid: AID or zero for no change
498abe37c4bSJohannes Berg  * @plink_action: plink action to take
4999c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
500abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
501f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
502910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
503910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
504910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
505910868dbSEliad Peller  *	QoS info field (but already shifted down)
506c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
507c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
508c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
5095727ef1bSJohannes Berg  */
5105727ef1bSJohannes Berg struct station_parameters {
5115727ef1bSJohannes Berg 	u8 *supported_rates;
5125727ef1bSJohannes Berg 	struct net_device *vlan;
513eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
5143b9ce80cSJohannes Berg 	u32 sta_modify_mask;
5155727ef1bSJohannes Berg 	int listen_interval;
5165727ef1bSJohannes Berg 	u16 aid;
5175727ef1bSJohannes Berg 	u8 supported_rates_len;
5182ec600d6SLuis Carlos Cobo 	u8 plink_action;
5199c3990aaSJavier Cardona 	u8 plink_state;
52036aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
521f461be3eSMahesh Palivela 	struct ieee80211_vht_cap *vht_capa;
522c75786c9SEliad Peller 	u8 uapsd_queues;
523c75786c9SEliad Peller 	u8 max_sp;
5245727ef1bSJohannes Berg };
5255727ef1bSJohannes Berg 
526fd5b74dcSJohannes Berg /**
5272ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
528fd5b74dcSJohannes Berg  *
5292ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
5302ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
531fd5b74dcSJohannes Berg  *
5322ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
5332ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
5342ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
5352ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
5362ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
5372ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
538420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
539c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
540420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
54198c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
54298c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
543b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
544b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
5455a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
546541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
547c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
548f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
549ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
550040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
551bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
552a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
553d299a1f2SJavier Cardona  * @STATION_INFO_T_OFFSET: @t_offset filled
554fd5b74dcSJohannes Berg  */
5552ec600d6SLuis Carlos Cobo enum station_info_flags {
5562ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
5572ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
5582ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
5592ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
5602ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
5612ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
562420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
563420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
56498c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
56598c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
566b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
567b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
5685a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
569541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
570c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
571f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
572040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
573bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
574a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
575d299a1f2SJavier Cardona 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19,
576d299a1f2SJavier Cardona 	STATION_INFO_T_OFFSET		= 1<<20,
577420e7fabSHenning Rogge };
578420e7fabSHenning Rogge 
579420e7fabSHenning Rogge /**
580420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
581420e7fabSHenning Rogge  *
582420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
583420e7fabSHenning Rogge  * type for 802.11n transmissions.
584420e7fabSHenning Rogge  *
585420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
586420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
587420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
58895ddc1fcSVladimir Kondratiev  * @RATE_INFO_FLAGS_60G: 60gHz MCS
589420e7fabSHenning Rogge  */
590420e7fabSHenning Rogge enum rate_info_flags {
591420e7fabSHenning Rogge 	RATE_INFO_FLAGS_MCS		= 1<<0,
592420e7fabSHenning Rogge 	RATE_INFO_FLAGS_40_MHZ_WIDTH	= 1<<1,
593420e7fabSHenning Rogge 	RATE_INFO_FLAGS_SHORT_GI	= 1<<2,
59495ddc1fcSVladimir Kondratiev 	RATE_INFO_FLAGS_60G		= 1<<3,
595420e7fabSHenning Rogge };
596420e7fabSHenning Rogge 
597420e7fabSHenning Rogge /**
598420e7fabSHenning Rogge  * struct rate_info - bitrate information
599420e7fabSHenning Rogge  *
600420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
601420e7fabSHenning Rogge  *
602420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
603420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
604420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
605420e7fabSHenning Rogge  */
606420e7fabSHenning Rogge struct rate_info {
607420e7fabSHenning Rogge 	u8 flags;
608420e7fabSHenning Rogge 	u8 mcs;
609420e7fabSHenning Rogge 	u16 legacy;
610fd5b74dcSJohannes Berg };
611fd5b74dcSJohannes Berg 
612fd5b74dcSJohannes Berg /**
613f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
614f4263c98SPaul Stewart  *
615f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
616f4263c98SPaul Stewart  * type for 802.11n transmissions.
617f4263c98SPaul Stewart  *
618f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
619f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
620f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
621f4263c98SPaul Stewart  */
622f4263c98SPaul Stewart enum bss_param_flags {
623f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
624f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
625f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
626f4263c98SPaul Stewart };
627f4263c98SPaul Stewart 
628f4263c98SPaul Stewart /**
629f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
630f4263c98SPaul Stewart  *
631f4263c98SPaul Stewart  * Information about the currently associated BSS
632f4263c98SPaul Stewart  *
633f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
634f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
635f4263c98SPaul Stewart  * @beacon_interval: beacon interval
636f4263c98SPaul Stewart  */
637f4263c98SPaul Stewart struct sta_bss_parameters {
638f4263c98SPaul Stewart 	u8 flags;
639f4263c98SPaul Stewart 	u8 dtim_period;
640f4263c98SPaul Stewart 	u16 beacon_interval;
641f4263c98SPaul Stewart };
642f4263c98SPaul Stewart 
643f4263c98SPaul Stewart /**
6442ec600d6SLuis Carlos Cobo  * struct station_info - station information
645fd5b74dcSJohannes Berg  *
6462ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
647fd5b74dcSJohannes Berg  *
6482ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
649ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
650fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
651fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
652fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
6532ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
6542ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
6552ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
65673c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
65773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
65873c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
65973c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
660858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
661858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
66298c8a60aSJouni Malinen  * @rx_packets: packets received from this station
66398c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
664b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
665b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
6665a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
6671ba01458SRandy Dunlap  * @bss_param: current BSS parameters
668f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
669f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
670f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
671f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
67250d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
67350d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
67450d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
67550d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
67650d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
677c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
678a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
679d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
680fd5b74dcSJohannes Berg  */
6812ec600d6SLuis Carlos Cobo struct station_info {
682fd5b74dcSJohannes Berg 	u32 filled;
683ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
684fd5b74dcSJohannes Berg 	u32 inactive_time;
685fd5b74dcSJohannes Berg 	u32 rx_bytes;
686fd5b74dcSJohannes Berg 	u32 tx_bytes;
6872ec600d6SLuis Carlos Cobo 	u16 llid;
6882ec600d6SLuis Carlos Cobo 	u16 plid;
6892ec600d6SLuis Carlos Cobo 	u8 plink_state;
690420e7fabSHenning Rogge 	s8 signal;
691541a45a1SBruno Randolf 	s8 signal_avg;
692420e7fabSHenning Rogge 	struct rate_info txrate;
693c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
69498c8a60aSJouni Malinen 	u32 rx_packets;
69598c8a60aSJouni Malinen 	u32 tx_packets;
696b206b4efSBruno Randolf 	u32 tx_retries;
697b206b4efSBruno Randolf 	u32 tx_failed;
6985a5c731aSBen Greear 	u32 rx_dropped_misc;
699f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
700bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
701f5ea9120SJohannes Berg 
702f5ea9120SJohannes Berg 	int generation;
70350d3dfb7SJouni Malinen 
70450d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
70550d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
706f612cedfSJouni Malinen 
707a85e1d55SPaul Stewart 	u32 beacon_loss_count;
708d299a1f2SJavier Cardona 	s64 t_offset;
709a85e1d55SPaul Stewart 
710f612cedfSJouni Malinen 	/*
711f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
712f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
713f612cedfSJouni Malinen 	 */
714fd5b74dcSJohannes Berg };
715fd5b74dcSJohannes Berg 
71666f7ac50SMichael Wu /**
71766f7ac50SMichael Wu  * enum monitor_flags - monitor flags
71866f7ac50SMichael Wu  *
71966f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
72066f7ac50SMichael Wu  * according to the nl80211 flags.
72166f7ac50SMichael Wu  *
72266f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
72366f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
72466f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
72566f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
72666f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
72766f7ac50SMichael Wu  */
72866f7ac50SMichael Wu enum monitor_flags {
72966f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
73066f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
73166f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
73266f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
73366f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
73466f7ac50SMichael Wu };
73566f7ac50SMichael Wu 
7362ec600d6SLuis Carlos Cobo /**
7372ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
7382ec600d6SLuis Carlos Cobo  *
7392ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
7402ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
7412ec600d6SLuis Carlos Cobo  *
742abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
743abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
744abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
745abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
746abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
747abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
748abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
7492ec600d6SLuis Carlos Cobo  */
7502ec600d6SLuis Carlos Cobo enum mpath_info_flags {
7512ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
752d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
7532ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
7542ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
7552ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
7562ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
7572ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
7582ec600d6SLuis Carlos Cobo };
7592ec600d6SLuis Carlos Cobo 
7602ec600d6SLuis Carlos Cobo /**
7612ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
7622ec600d6SLuis Carlos Cobo  *
7632ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
7642ec600d6SLuis Carlos Cobo  *
7652ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
7662ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
767d19b3bf6SRui Paulo  * @sn: target sequence number
7682ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
7692ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
7702ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
7712ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
7722ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
773f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
774f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
775f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
776f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
7772ec600d6SLuis Carlos Cobo  */
7782ec600d6SLuis Carlos Cobo struct mpath_info {
7792ec600d6SLuis Carlos Cobo 	u32 filled;
7802ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
781d19b3bf6SRui Paulo 	u32 sn;
7822ec600d6SLuis Carlos Cobo 	u32 metric;
7832ec600d6SLuis Carlos Cobo 	u32 exptime;
7842ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
7852ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
7862ec600d6SLuis Carlos Cobo 	u8 flags;
787f5ea9120SJohannes Berg 
788f5ea9120SJohannes Berg 	int generation;
7892ec600d6SLuis Carlos Cobo };
7902ec600d6SLuis Carlos Cobo 
7919f1ba906SJouni Malinen /**
7929f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
7939f1ba906SJouni Malinen  *
7949f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
7959f1ba906SJouni Malinen  *
7969f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
7979f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
7989f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
7999f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
8009f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
8019f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
80290c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
80390c97a04SJouni Malinen  *	(or NULL for no change)
80490c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
805fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
80650b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
80750b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
8089f1ba906SJouni Malinen  */
8099f1ba906SJouni Malinen struct bss_parameters {
8109f1ba906SJouni Malinen 	int use_cts_prot;
8119f1ba906SJouni Malinen 	int use_short_preamble;
8129f1ba906SJouni Malinen 	int use_short_slot_time;
81390c97a04SJouni Malinen 	u8 *basic_rates;
81490c97a04SJouni Malinen 	u8 basic_rates_len;
815fd8aaaf3SFelix Fietkau 	int ap_isolate;
81650b12f59SHelmut Schaa 	int ht_opmode;
8179f1ba906SJouni Malinen };
8182ec600d6SLuis Carlos Cobo 
8193ddd53f3SChun-Yeow Yeoh /**
82029cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
82129cbe68cSJohannes Berg  *
82229cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
8233ddd53f3SChun-Yeow Yeoh  *
8243ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
8253ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
8263ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
8273ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
8283ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
8293ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
8303ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
8313ddd53f3SChun-Yeow Yeoh  *	mesh interface
8323ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
8333ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
8343ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
8353ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
8363ddd53f3SChun-Yeow Yeoh  *	elements
8373ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
8383ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
8393ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
8403ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
8413ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
8423ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
8433ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
8443ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
8453ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
8463ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
8473ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
8483ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
8493ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
8503ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
8513ddd53f3SChun-Yeow Yeoh  *	element
8523ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
8533ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
8543ddd53f3SChun-Yeow Yeoh  *	element
8553ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
8563ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
8573ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
8583ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
8593ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
8603ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
8613ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
8623ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
8633ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
8643ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
8653ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
8663ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
8673ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
8683ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
8693ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
8703ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
871ac1073a6SChun-Yeow Yeoh  *
872ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
873ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
874ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
875ac1073a6SChun-Yeow Yeoh  *
876ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
877ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
878728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
879728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
880728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
88129cbe68cSJohannes Berg  */
88293da9cc1Scolin@cozybit.com struct mesh_config {
88393da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
88493da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
88593da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
88693da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
88793da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
88893da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
88945904f21SJavier Cardona 	u8 element_ttl;
89093da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
891d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
89293da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
89393da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
89493da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
89593da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
89693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
897dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
89893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
89963c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
9000507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
90116dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
90294f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
90355335137SAshok Nagarajan 	s32 rssi_threshold;
90470c33eaaSAshok Nagarajan 	u16 ht_opmode;
905ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
906ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
907728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
90893da9cc1Scolin@cozybit.com };
90993da9cc1Scolin@cozybit.com 
91031888487SJouni Malinen /**
91129cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
912cc1d2806SJohannes Berg  * @channel: the channel to start the mesh network on
913cc1d2806SJohannes Berg  * @channel_type: the channel type to use
91429cbe68cSJohannes Berg  * @mesh_id: the mesh ID
91529cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
916d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
917c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
918c80d545dSJavier Cardona  * @path_metric: which metric to use
919581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
920581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
921b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
922b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
9234bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
92429cbe68cSJohannes Berg  *
92529cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
92629cbe68cSJohannes Berg  */
92729cbe68cSJohannes Berg struct mesh_setup {
928cc1d2806SJohannes Berg 	struct ieee80211_channel *channel;
929cc1d2806SJohannes Berg 	enum nl80211_channel_type channel_type;
93029cbe68cSJohannes Berg 	const u8 *mesh_id;
93129cbe68cSJohannes Berg 	u8 mesh_id_len;
932d299a1f2SJavier Cardona 	u8 sync_method;
933c80d545dSJavier Cardona 	u8 path_sel_proto;
934c80d545dSJavier Cardona 	u8 path_metric;
935581a8b0fSJavier Cardona 	const u8 *ie;
936581a8b0fSJavier Cardona 	u8 ie_len;
937b130e5ceSJavier Cardona 	bool is_authenticated;
93815d5dda6SJavier Cardona 	bool is_secure;
9394bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
94029cbe68cSJohannes Berg };
94129cbe68cSJohannes Berg 
94229cbe68cSJohannes Berg /**
94331888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
944a3304b0aSJohannes Berg  * @ac: AC identifier
94531888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
94631888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
94731888487SJouni Malinen  *	1..32767]
94831888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
94931888487SJouni Malinen  *	1..32767]
95031888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
95131888487SJouni Malinen  */
95231888487SJouni Malinen struct ieee80211_txq_params {
953a3304b0aSJohannes Berg 	enum nl80211_ac ac;
95431888487SJouni Malinen 	u16 txop;
95531888487SJouni Malinen 	u16 cwmin;
95631888487SJouni Malinen 	u16 cwmax;
95731888487SJouni Malinen 	u8 aifs;
95831888487SJouni Malinen };
95931888487SJouni Malinen 
960704232c2SJohannes Berg /* from net/wireless.h */
961704232c2SJohannes Berg struct wiphy;
962704232c2SJohannes Berg 
963d70e9693SJohannes Berg /**
964d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
965d70e9693SJohannes Berg  *
966d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
967d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
968d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
969d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
970d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
971d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
972d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
973d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
974d70e9693SJohannes Berg  * in the wiphy structure.
975d70e9693SJohannes Berg  *
976d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
977d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
978d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
979d70e9693SJohannes Berg  *
980d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
981d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
982d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
983d70e9693SJohannes Berg  * to userspace.
984d70e9693SJohannes Berg  */
98572bdcf34SJouni Malinen 
986704232c2SJohannes Berg /**
9872a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
9882a519311SJohannes Berg  * @ssid: the SSID
9892a519311SJohannes Berg  * @ssid_len: length of the ssid
9902a519311SJohannes Berg  */
9912a519311SJohannes Berg struct cfg80211_ssid {
9922a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
9932a519311SJohannes Berg 	u8 ssid_len;
9942a519311SJohannes Berg };
9952a519311SJohannes Berg 
9962a519311SJohannes Berg /**
9972a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
9982a519311SJohannes Berg  *
9992a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
10002a519311SJohannes Berg  * @n_ssids: number of SSIDs
10012a519311SJohannes Berg  * @channels: channels to scan on.
1002ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
100370692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
100470692ad2SJouni Malinen  * @ie_len: length of ie in octets
1005ed473771SSam Leffler  * @flags: bit field of flags controlling operation
100634850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
10072a519311SJohannes Berg  * @wiphy: the wiphy this was for
100815d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1009fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1010abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
1011e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
10122a519311SJohannes Berg  */
10132a519311SJohannes Berg struct cfg80211_scan_request {
10142a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
10152a519311SJohannes Berg 	int n_ssids;
10162a519311SJohannes Berg 	u32 n_channels;
1017de95a54bSJohannes Berg 	const u8 *ie;
101870692ad2SJouni Malinen 	size_t ie_len;
1019ed473771SSam Leffler 	u32 flags;
10202a519311SJohannes Berg 
102134850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
102234850ab2SJohannes Berg 
1023fd014284SJohannes Berg 	struct wireless_dev *wdev;
1024fd014284SJohannes Berg 
10252a519311SJohannes Berg 	/* internal */
10262a519311SJohannes Berg 	struct wiphy *wiphy;
102715d6030bSSam Leffler 	unsigned long scan_start;
1028667503ddSJohannes Berg 	bool aborted;
1029e9f935e3SRajkumar Manoharan 	bool no_cck;
10305ba63533SJohannes Berg 
10315ba63533SJohannes Berg 	/* keep last */
10325ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
10332a519311SJohannes Berg };
10342a519311SJohannes Berg 
10352a519311SJohannes Berg /**
1036a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1037a1f1c21cSLuciano Coelho  *
1038a1f1c21cSLuciano Coelho  * @ssid: SSID to be matched
1039a1f1c21cSLuciano Coelho  */
1040a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1041a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1042a1f1c21cSLuciano Coelho };
1043a1f1c21cSLuciano Coelho 
1044a1f1c21cSLuciano Coelho /**
1045807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1046807f8a8cSLuciano Coelho  *
1047807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1048807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1049807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1050bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1051807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1052807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1053ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1054a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1055a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1056a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1057a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1058a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1059807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1060807f8a8cSLuciano Coelho  * @dev: the interface
1061807f8a8cSLuciano Coelho  * @channels: channels to scan
106288e920b4SThomas Pedersen  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1063807f8a8cSLuciano Coelho  */
1064807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1065807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1066807f8a8cSLuciano Coelho 	int n_ssids;
1067807f8a8cSLuciano Coelho 	u32 n_channels;
1068bbe6ad6dSLuciano Coelho 	u32 interval;
1069807f8a8cSLuciano Coelho 	const u8 *ie;
1070807f8a8cSLuciano Coelho 	size_t ie_len;
1071ed473771SSam Leffler 	u32 flags;
1072a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1073a1f1c21cSLuciano Coelho 	int n_match_sets;
107488e920b4SThomas Pedersen 	s32 rssi_thold;
1075807f8a8cSLuciano Coelho 
1076807f8a8cSLuciano Coelho 	/* internal */
1077807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1078807f8a8cSLuciano Coelho 	struct net_device *dev;
107915d6030bSSam Leffler 	unsigned long scan_start;
1080807f8a8cSLuciano Coelho 
1081807f8a8cSLuciano Coelho 	/* keep last */
1082807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1083807f8a8cSLuciano Coelho };
1084807f8a8cSLuciano Coelho 
1085807f8a8cSLuciano Coelho /**
10862a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
10872a519311SJohannes Berg  *
10882a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
10892a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
10902a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
10912a519311SJohannes Berg  */
10922a519311SJohannes Berg enum cfg80211_signal_type {
10932a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
10942a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
10952a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
10962a519311SJohannes Berg };
10972a519311SJohannes Berg 
10982a519311SJohannes Berg /**
10992a519311SJohannes Berg  * struct cfg80211_bss - BSS description
11002a519311SJohannes Berg  *
11012a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
11022a519311SJohannes Berg  * for use in scan results and similar.
11032a519311SJohannes Berg  *
1104abe37c4bSJohannes Berg  * @channel: channel this BSS is on
11052a519311SJohannes Berg  * @bssid: BSSID of the BSS
11062a519311SJohannes Berg  * @tsf: timestamp of last received update
11072a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
11082a519311SJohannes Berg  * @capability: the capability field in host byte order
11092a519311SJohannes Berg  * @information_elements: the information elements (Note that there
111034a6eddbSJouni Malinen  *	is no guarantee that these are well-formed!); this is a pointer to
111134a6eddbSJouni Malinen  *	either the beacon_ies or proberesp_ies depending on whether Probe
111234a6eddbSJouni Malinen  *	Response frame has been received
11132a519311SJohannes Berg  * @len_information_elements: total length of the information elements
111434a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
111534a6eddbSJouni Malinen  * @len_beacon_ies: total length of the beacon_ies
111634a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
111734a6eddbSJouni Malinen  * @len_proberesp_ies: total length of the proberesp_ies
111877965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
111978c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
11202a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
11212a519311SJohannes Berg  */
11222a519311SJohannes Berg struct cfg80211_bss {
11232a519311SJohannes Berg 	struct ieee80211_channel *channel;
11242a519311SJohannes Berg 
11252a519311SJohannes Berg 	u8 bssid[ETH_ALEN];
11262a519311SJohannes Berg 	u64 tsf;
11272a519311SJohannes Berg 	u16 beacon_interval;
11282a519311SJohannes Berg 	u16 capability;
11292a519311SJohannes Berg 	u8 *information_elements;
11302a519311SJohannes Berg 	size_t len_information_elements;
113134a6eddbSJouni Malinen 	u8 *beacon_ies;
113234a6eddbSJouni Malinen 	size_t len_beacon_ies;
113334a6eddbSJouni Malinen 	u8 *proberesp_ies;
113434a6eddbSJouni Malinen 	size_t len_proberesp_ies;
11352a519311SJohannes Berg 
11362a519311SJohannes Berg 	s32 signal;
11372a519311SJohannes Berg 
113878c1c7e1SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
11392a519311SJohannes Berg 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
11402a519311SJohannes Berg };
11412a519311SJohannes Berg 
11422a519311SJohannes Berg /**
1143517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1144517357c6SJohannes Berg  * @bss: the bss to search
1145517357c6SJohannes Berg  * @ie: the IE ID
1146517357c6SJohannes Berg  * Returns %NULL if not found.
1147517357c6SJohannes Berg  */
1148517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1149517357c6SJohannes Berg 
1150517357c6SJohannes Berg 
1151517357c6SJohannes Berg /**
1152636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1153636a5d36SJouni Malinen  *
1154636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1155636a5d36SJouni Malinen  * authentication.
1156636a5d36SJouni Malinen  *
115719957bb3SJohannes Berg  * @bss: The BSS to authenticate with.
1158636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1159636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1160636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1161fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1162fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1163fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1164e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1165e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1166e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1167636a5d36SJouni Malinen  */
1168636a5d36SJouni Malinen struct cfg80211_auth_request {
116919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1170636a5d36SJouni Malinen 	const u8 *ie;
1171636a5d36SJouni Malinen 	size_t ie_len;
117219957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1173fffd0934SJohannes Berg 	const u8 *key;
1174fffd0934SJohannes Berg 	u8 key_len, key_idx;
1175e39e5b5eSJouni Malinen 	const u8 *sae_data;
1176e39e5b5eSJouni Malinen 	size_t sae_data_len;
1177636a5d36SJouni Malinen };
1178636a5d36SJouni Malinen 
1179636a5d36SJouni Malinen /**
11807e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
11817e7c8926SBen Greear  *
11827e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
11837e7c8926SBen Greear  */
11847e7c8926SBen Greear enum cfg80211_assoc_req_flags {
11857e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
11867e7c8926SBen Greear };
11877e7c8926SBen Greear 
11887e7c8926SBen Greear /**
1189636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1190636a5d36SJouni Malinen  *
1191636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1192636a5d36SJouni Malinen  * (re)association.
119395de817bSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver
119495de817bSJohannes Berg  *	is given a reference that it must release, normally via a call to
119595de817bSJohannes Berg  *	cfg80211_send_rx_assoc(), or, if association timed out, with a
119695de817bSJohannes Berg  *	call to cfg80211_put_bss() (in addition to calling
119795de817bSJohannes Berg  *	cfg80211_send_assoc_timeout())
1198636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1199636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1200dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1201b23aa676SSamuel Ortiz  * @crypto: crypto settings
12023e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
12037e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
12047e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
12057e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
12067e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1207636a5d36SJouni Malinen  */
1208636a5d36SJouni Malinen struct cfg80211_assoc_request {
120919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
12103e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1211636a5d36SJouni Malinen 	size_t ie_len;
1212b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
121319957bb3SJohannes Berg 	bool use_mfp;
12147e7c8926SBen Greear 	u32 flags;
12157e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
12167e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1217636a5d36SJouni Malinen };
1218636a5d36SJouni Malinen 
1219636a5d36SJouni Malinen /**
1220636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1221636a5d36SJouni Malinen  *
1222636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1223636a5d36SJouni Malinen  * deauthentication.
1224636a5d36SJouni Malinen  *
122595de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1226636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1227636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
122819957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1229636a5d36SJouni Malinen  */
1230636a5d36SJouni Malinen struct cfg80211_deauth_request {
123195de817bSJohannes Berg 	const u8 *bssid;
1232636a5d36SJouni Malinen 	const u8 *ie;
1233636a5d36SJouni Malinen 	size_t ie_len;
123419957bb3SJohannes Berg 	u16 reason_code;
12356863255bSStanislaw Gruszka 	bool local_state_change;
1236636a5d36SJouni Malinen };
1237636a5d36SJouni Malinen 
1238636a5d36SJouni Malinen /**
1239636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1240636a5d36SJouni Malinen  *
1241636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1242636a5d36SJouni Malinen  * disassocation.
1243636a5d36SJouni Malinen  *
124419957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1245636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1246636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
124719957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1248d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1249d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1250636a5d36SJouni Malinen  */
1251636a5d36SJouni Malinen struct cfg80211_disassoc_request {
125219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1253636a5d36SJouni Malinen 	const u8 *ie;
1254636a5d36SJouni Malinen 	size_t ie_len;
125519957bb3SJohannes Berg 	u16 reason_code;
1256d5cdfacbSJouni Malinen 	bool local_state_change;
1257636a5d36SJouni Malinen };
1258636a5d36SJouni Malinen 
1259636a5d36SJouni Malinen /**
126004a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
126104a773adSJohannes Berg  *
126204a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
126304a773adSJohannes Berg  * method.
126404a773adSJohannes Berg  *
126504a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
126604a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
126704a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
126804a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
126904a773adSJohannes Berg  * @channel: The channel to use if no IBSS can be found to join.
127015f0ebc2SRandy Dunlap  * @channel_type: channel type (HT mode)
127104a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
127204a773adSJohannes Berg  *	IBSSs to join on other channels.
127304a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
127404a773adSJohannes Berg  * @ie_len: length of that
12758e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1276fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1277fffd0934SJohannes Berg  *	after joining
1278267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1279267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1280267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1281267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
1282fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1283dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
128404a773adSJohannes Berg  */
128504a773adSJohannes Berg struct cfg80211_ibss_params {
128604a773adSJohannes Berg 	u8 *ssid;
128704a773adSJohannes Berg 	u8 *bssid;
128804a773adSJohannes Berg 	struct ieee80211_channel *channel;
128954858ee5SAlexander Simon 	enum nl80211_channel_type channel_type;
129004a773adSJohannes Berg 	u8 *ie;
129104a773adSJohannes Berg 	u8 ssid_len, ie_len;
12928e30bc55SJohannes Berg 	u16 beacon_interval;
1293fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
129404a773adSJohannes Berg 	bool channel_fixed;
1295fffd0934SJohannes Berg 	bool privacy;
1296267335d6SAntonio Quartulli 	bool control_port;
1297dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
129804a773adSJohannes Berg };
129904a773adSJohannes Berg 
130004a773adSJohannes Berg /**
1301b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1302b23aa676SSamuel Ortiz  *
1303b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1304b23aa676SSamuel Ortiz  * authentication and association.
1305b23aa676SSamuel Ortiz  *
1306b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1307b23aa676SSamuel Ortiz  *	on scan results)
1308b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1309b23aa676SSamuel Ortiz  *	results)
1310b23aa676SSamuel Ortiz  * @ssid: SSID
1311b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1312b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1313abe37c4bSJohannes Berg  * @ie: IEs for association request
1314abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1315b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1316b23aa676SSamuel Ortiz  * @crypto: crypto settings
1317fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1318fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1319fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
13207e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
13214486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
13224486ea98SBala Shanmugam  *   or -1 to indicate that default value is to be used.
13237e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
13247e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
13257e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1326b23aa676SSamuel Ortiz  */
1327b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1328b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1329b23aa676SSamuel Ortiz 	u8 *bssid;
1330b23aa676SSamuel Ortiz 	u8 *ssid;
1331b23aa676SSamuel Ortiz 	size_t ssid_len;
1332b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1333b23aa676SSamuel Ortiz 	u8 *ie;
1334b23aa676SSamuel Ortiz 	size_t ie_len;
1335b23aa676SSamuel Ortiz 	bool privacy;
1336b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1337fffd0934SJohannes Berg 	const u8 *key;
1338fffd0934SJohannes Berg 	u8 key_len, key_idx;
13397e7c8926SBen Greear 	u32 flags;
13404486ea98SBala Shanmugam 	int bg_scan_period;
13417e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
13427e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1343b23aa676SSamuel Ortiz };
1344b23aa676SSamuel Ortiz 
1345b23aa676SSamuel Ortiz /**
1346b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1347abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1348abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1349abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1350abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1351abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1352b9a5f8caSJouni Malinen  */
1353b9a5f8caSJouni Malinen enum wiphy_params_flags {
1354b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1355b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1356b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1357b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
135881077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1359b9a5f8caSJouni Malinen };
1360b9a5f8caSJouni Malinen 
13619930380fSJohannes Berg /*
13629930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
13639930380fSJohannes Berg  */
13649930380fSJohannes Berg struct cfg80211_bitrate_mask {
13659930380fSJohannes Berg 	struct {
13669930380fSJohannes Berg 		u32 legacy;
136724db78c0SSimon Wunderlich 		u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
13689930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
13699930380fSJohannes Berg };
137067fbb16bSSamuel Ortiz /**
137167fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
137267fbb16bSSamuel Ortiz  *
137367fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
137467fbb16bSSamuel Ortiz  * caching.
137567fbb16bSSamuel Ortiz  *
137667fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
137767fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
137867fbb16bSSamuel Ortiz  */
137967fbb16bSSamuel Ortiz struct cfg80211_pmksa {
138067fbb16bSSamuel Ortiz 	u8 *bssid;
138167fbb16bSSamuel Ortiz 	u8 *pmkid;
138267fbb16bSSamuel Ortiz };
13839930380fSJohannes Berg 
13847643a2c3SJohannes Berg /**
1385ff1b6e69SJohannes Berg  * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
1386ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1387ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1388ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1389ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1390ff1b6e69SJohannes Berg  *
1391ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1392ff1b6e69SJohannes Berg  * memory, free @mask only!
1393ff1b6e69SJohannes Berg  */
1394ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern {
1395ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1396ff1b6e69SJohannes Berg 	int pattern_len;
1397ff1b6e69SJohannes Berg };
1398ff1b6e69SJohannes Berg 
1399ff1b6e69SJohannes Berg /**
1400ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1401ff1b6e69SJohannes Berg  *
1402ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1403ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1404ff1b6e69SJohannes Berg  *	operating as normal during suspend
1405ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1406ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1407ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1408ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
140977dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
141077dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
141177dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
141277dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
1413ff1b6e69SJohannes Berg  */
1414ff1b6e69SJohannes Berg struct cfg80211_wowlan {
141577dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
141677dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
141777dbbb13SJohannes Berg 	     rfkill_release;
1418ff1b6e69SJohannes Berg 	struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1419ff1b6e69SJohannes Berg 	int n_patterns;
1420ff1b6e69SJohannes Berg };
1421ff1b6e69SJohannes Berg 
1422ff1b6e69SJohannes Berg /**
1423e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1424e5497d76SJohannes Berg  * @kek: key encryption key
1425e5497d76SJohannes Berg  * @kck: key confirmation key
1426e5497d76SJohannes Berg  * @replay_ctr: replay counter
1427e5497d76SJohannes Berg  */
1428e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1429e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1430e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1431e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1432e5497d76SJohannes Berg };
1433e5497d76SJohannes Berg 
1434e5497d76SJohannes Berg /**
1435704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1436704232c2SJohannes Berg  *
1437704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1438704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1439704232c2SJohannes Berg  *
1440704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1441704232c2SJohannes Berg  * on success or a negative error code.
1442704232c2SJohannes Berg  *
144343fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
144443fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
144543fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
144643fb45cbSJohannes Berg  *
1447ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1448ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1449ff1b6e69SJohannes Berg  *	configured for the device.
14500378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
14516d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
14526d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
14536d52563fSJohannes Berg  *	the device.
14540378b3f1SJohannes Berg  *
145560719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1456463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
145784efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
145898104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
145998104fdeSJohannes Berg  *	also set the address member in the wdev.
1460704232c2SJohannes Berg  *
146184efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
146255682965SJohannes Berg  *
146360719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
146460719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
146555682965SJohannes Berg  *
146641ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
146741ade00fSJohannes Berg  *	when adding a group key.
146841ade00fSJohannes Berg  *
146941ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
147041ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
147141ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1472e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1473e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
147441ade00fSJohannes Berg  *
147541ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1476e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
147741ade00fSJohannes Berg  *
147841ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1479ed1b6cc7SJohannes Berg  *
14803cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
14813cfcf6acSJouni Malinen  *
1482e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1483e5497d76SJohannes Berg  *
1484c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
1485c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
1486c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
1487c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
14885727ef1bSJohannes Berg  *
14895727ef1bSJohannes Berg  * @add_station: Add a new station.
14905727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
1491bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
1492bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
1493bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
1494bdd90d5eSJohannes Berg  *	them, also against the existing state! Also, supported_rates changes are
1495bdd90d5eSJohannes Berg  *	not checked in station mode -- drivers need to reject (or ignore) them
1496bdd90d5eSJohannes Berg  *	for anything but TDLS peers.
1497abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
1498abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
1499abe37c4bSJohannes Berg  *
1500abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
1501abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
1502abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
1503abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
1504abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1505f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
1506f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
15072ec600d6SLuis Carlos Cobo  *
150824bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
150993da9cc1Scolin@cozybit.com  *
151024bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
151193da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
151293da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
151393da9cc1Scolin@cozybit.com  *
15149f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
151531888487SJouni Malinen  *
151631888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
151772bdcf34SJouni Malinen  *
1518e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
1519e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
1520e8c9bd5bSJohannes Berg  *	join the mesh instead.
1521e8c9bd5bSJohannes Berg  *
1522e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
1523e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
1524e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
1525e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
15269aed3cc1SJouni Malinen  *
15272a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
15282a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
15292a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
15302a519311SJohannes Berg  *	the scan/scan_done bracket too.
1531636a5d36SJouni Malinen  *
1532636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
1533636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
1534636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
1535636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
153604a773adSJohannes Berg  *
1537b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
1538b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1539b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
1540b23aa676SSamuel Ortiz  *	with the status from the AP.
1541b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
1542b23aa676SSamuel Ortiz  *
154304a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
154404a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
154504a773adSJohannes Berg  *	to a merge.
154604a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
1547b9a5f8caSJouni Malinen  *
1548*f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1549*f4e583c8SAntonio Quartulli  *	MESH mode)
1550*f4e583c8SAntonio Quartulli  *
1551b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
1552b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
1553b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
1554b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
15557643a2c3SJohannes Berg  *
15561432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
1557c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
1558c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
1559c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
1560c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
15617643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
15621f87f7d3SJohannes Berg  *	return 0 if successful
15631f87f7d3SJohannes Berg  *
1564abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
1565abe37c4bSJohannes Berg  *
15661f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
15671f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
1568aff89a9bSJohannes Berg  *
156961fa713cSHolger Schurig  * @dump_survey: get site survey information.
157061fa713cSHolger Schurig  *
15719588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
15729588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
15739588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
15749588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
15759588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
15769588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
15779588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
15789588bbd5SJouni Malinen  *	the duration value.
1579f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
1580f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
1581f7ca38dfSJohannes Berg  *	frame on another channel
15829588bbd5SJouni Malinen  *
1583aff89a9bSJohannes Berg  * @testmode_cmd: run a test mode command
158471063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
158571063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
158671063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
158771063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
158871063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
158971063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
159067fbb16bSSamuel Ortiz  *
1591abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
1592abe37c4bSJohannes Berg  *
159367fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
159467fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
159567fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
159667fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
159767fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
15989043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
15999043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
1600d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
160184f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
160284f10708SThomas Pedersen  *	thresholds.
1603807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
160430d08a46SArend van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan.
160567fbb16bSSamuel Ortiz  *
1606271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
1607271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
1608271733cfSJohannes Berg  *	concurrently with itself.
1609547025d5SBruno Randolf  *
1610547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1611547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1612547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
1613547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1614547025d5SBruno Randolf  *
1615547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
16163677713bSJohn W. Linville  *
16173677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
16183677713bSJohn W. Linville  *
16193677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
1620109086ceSArik Nemtsov  *
1621109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
1622109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
16237f6cf311SJohannes Berg  *
16247f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
16257f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
16261d9d9213SSimon Wunderlich  *
16271d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
1628d6199218SBen Greear  *
1629d6199218SBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
1630d6199218SBen Greear  *	See @ethtool_ops.get_sset_count
1631d6199218SBen Greear  *
1632d6199218SBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
1633d6199218SBen Greear  *	See @ethtool_ops.get_ethtool_stats
1634d6199218SBen Greear  *
1635d6199218SBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
1636d6199218SBen Greear  *	and perhaps other supported types of ethtool data-sets.
1637d6199218SBen Greear  *	See @ethtool_ops.get_strings
16385b7ccaf3SJohannes Berg  *
16395b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
16405b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
16415b7ccaf3SJohannes Berg  *	current monitoring channel.
164298104fdeSJohannes Berg  *
164398104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
164498104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
1645704232c2SJohannes Berg  */
1646704232c2SJohannes Berg struct cfg80211_ops {
1647ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
16480378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
16496d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
16500378b3f1SJohannes Berg 
165184efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
1652552bff0cSJohannes Berg 						  const char *name,
1653f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
1654f9e10ce4SJohannes Berg 						  u32 *flags,
16552ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
165684efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
165784efbb84SJohannes Berg 				    struct wireless_dev *wdev);
1658e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
1659e36d56b6SJohannes Berg 				       struct net_device *dev,
16602ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
16612ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
166241ade00fSJohannes Berg 
166341ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1664e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
166541ade00fSJohannes Berg 			   struct key_params *params);
166641ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1667e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
1668e31b8213SJohannes Berg 			   void *cookie,
166941ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
167041ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1671e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
167241ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
167341ade00fSJohannes Berg 				   struct net_device *netdev,
1674dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
16753cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
16763cfcf6acSJouni Malinen 					struct net_device *netdev,
16773cfcf6acSJouni Malinen 					u8 key_index);
1678ed1b6cc7SJohannes Berg 
16798860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
16808860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
16818860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
16828860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
16838860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
16845727ef1bSJohannes Berg 
16855727ef1bSJohannes Berg 
16865727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
16875727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
16885727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
16895727ef1bSJohannes Berg 			       u8 *mac);
16905727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
16915727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
1692fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
16932ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
16942ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
16952ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
16962ec600d6SLuis Carlos Cobo 
16972ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
16982ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
16992ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
17002ec600d6SLuis Carlos Cobo 			       u8 *dst);
17012ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
17022ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
17032ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
17042ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
17052ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
17062ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
17072ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
17082ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
170924bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
171093da9cc1Scolin@cozybit.com 				struct net_device *dev,
171193da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
171224bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
171329cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
171429cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
171529cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
171629cbe68cSJohannes Berg 			     const struct mesh_config *conf,
171729cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
171829cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
171929cbe68cSJohannes Berg 
17209f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
17219f1ba906SJouni Malinen 			      struct bss_parameters *params);
172231888487SJouni Malinen 
1723f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
172431888487SJouni Malinen 				  struct ieee80211_txq_params *params);
172572bdcf34SJouni Malinen 
1726e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
1727e8c9bd5bSJohannes Berg 					     struct net_device *dev,
1728e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
1729e8c9bd5bSJohannes Berg 
1730e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
173172bdcf34SJouni Malinen 				       struct ieee80211_channel *chan,
1732094d05dcSSujith 				       enum nl80211_channel_type channel_type);
17339aed3cc1SJouni Malinen 
1734fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
17352a519311SJohannes Berg 			struct cfg80211_scan_request *request);
1736636a5d36SJouni Malinen 
1737636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
1738636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
1739636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
1740636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
1741636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
174263c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
1743636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
174463c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
174504a773adSJohannes Berg 
1746b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
1747b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
1748b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1749b23aa676SSamuel Ortiz 			      u16 reason_code);
1750b23aa676SSamuel Ortiz 
175104a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
175204a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
175304a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1754b9a5f8caSJouni Malinen 
1755*f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
1756*f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
1757*f4e583c8SAntonio Quartulli 
1758b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
17597643a2c3SJohannes Berg 
1760c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1761fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
1762c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1763c8442118SJohannes Berg 				int *dbm);
17641f87f7d3SJohannes Berg 
1765ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1766388ac775SJohannes Berg 				const u8 *addr);
1767ab737a4fSJohannes Berg 
17681f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
1769aff89a9bSJohannes Berg 
1770aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
1771aff89a9bSJohannes Berg 	int	(*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
177271063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
177371063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
177471063f0eSWey-Yi Guy 				 void *data, int len);
1775aff89a9bSJohannes Berg #endif
1776bc92afd9SJohannes Berg 
17779930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
17789930380fSJohannes Berg 				    struct net_device *dev,
17799930380fSJohannes Berg 				    const u8 *peer,
17809930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
17819930380fSJohannes Berg 
178261fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
178361fa713cSHolger Schurig 			int idx, struct survey_info *info);
178461fa713cSHolger Schurig 
178567fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
178667fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
178767fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
178867fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
178967fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
179067fbb16bSSamuel Ortiz 
17919588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
179271bbc994SJohannes Berg 				     struct wireless_dev *wdev,
17939588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
17949588bbd5SJouni Malinen 				     enum nl80211_channel_type channel_type,
17959588bbd5SJouni Malinen 				     unsigned int duration,
17969588bbd5SJouni Malinen 				     u64 *cookie);
17979588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
179871bbc994SJohannes Berg 					    struct wireless_dev *wdev,
17999588bbd5SJouni Malinen 					    u64 cookie);
18009588bbd5SJouni Malinen 
180171bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1802f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
1803026331c4SJouni Malinen 			  enum nl80211_channel_type channel_type,
1804f7ca38dfSJohannes Berg 			  bool channel_type_valid, unsigned int wait,
1805e9f935e3SRajkumar Manoharan 			  const u8 *buf, size_t len, bool no_cck,
1806e247bd90SJohannes Berg 			  bool dont_wait_for_ack, u64 *cookie);
1807f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
180871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
1809f7ca38dfSJohannes Berg 				       u64 cookie);
1810026331c4SJouni Malinen 
1811bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1812bc92afd9SJohannes Berg 				  bool enabled, int timeout);
1813d6dc1a38SJuuso Oikarinen 
1814d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
1815d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
1816d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
1817271733cfSJohannes Berg 
181884f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
181984f10708SThomas Pedersen 				      struct net_device *dev,
182084f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
182184f10708SThomas Pedersen 
1822271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
182371bbc994SJohannes Berg 				       struct wireless_dev *wdev,
1824271733cfSJohannes Berg 				       u16 frame_type, bool reg);
1825afe0cbf8SBruno Randolf 
1826afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1827afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
18283677713bSJohn W. Linville 
18293677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
18303677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
18313677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1832807f8a8cSLuciano Coelho 
1833807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
1834807f8a8cSLuciano Coelho 				struct net_device *dev,
1835807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
183685a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
1837e5497d76SJohannes Berg 
1838e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
1839e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
1840109086ceSArik Nemtsov 
1841109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1842109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
1843109086ceSArik Nemtsov 			     u16 status_code, const u8 *buf, size_t len);
1844109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1845109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
18467f6cf311SJohannes Berg 
18477f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
18487f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
1849e999882aSJohannes Berg 
18501d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
18511d9d9213SSimon Wunderlich 				  struct net_device *dev,
18521d9d9213SSimon Wunderlich 				  u16 noack_map);
18531d9d9213SSimon Wunderlich 
1854d6199218SBen Greear 	int	(*get_et_sset_count)(struct wiphy *wiphy,
1855d6199218SBen Greear 				     struct net_device *dev, int sset);
1856d6199218SBen Greear 	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
1857d6199218SBen Greear 				struct ethtool_stats *stats, u64 *data);
1858d6199218SBen Greear 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1859d6199218SBen Greear 				  u32 sset, u8 *data);
1860dbbae26aSMichal Kazior 
18615b7ccaf3SJohannes Berg 	struct ieee80211_channel *
18625b7ccaf3SJohannes Berg 		(*get_channel)(struct wiphy *wiphy,
18635b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
18645b7ccaf3SJohannes Berg 			       enum nl80211_channel_type *type);
186598104fdeSJohannes Berg 
186698104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
186798104fdeSJohannes Berg 				    struct wireless_dev *wdev);
186898104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
186998104fdeSJohannes Berg 				   struct wireless_dev *wdev);
1870704232c2SJohannes Berg };
1871704232c2SJohannes Berg 
1872d3236553SJohannes Berg /*
1873d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
1874d3236553SJohannes Berg  * and registration/helper functions
1875d3236553SJohannes Berg  */
1876d3236553SJohannes Berg 
1877d3236553SJohannes Berg /**
18785be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
18795be83de5SJohannes Berg  *
18805be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
1881d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
1882d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
1883d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
1884d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
18855be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
18865be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
1887749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
1888749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
1889749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
1890749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
1891749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
1892749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
1893749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
1894061acaaeSLuis R. Rodriguez  *	outside of its regulatory domain. If used in combination with
1895061acaaeSLuis R. Rodriguez  *	WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
1896061acaaeSLuis R. Rodriguez  *	will be followed.
18975be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
18985be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
18995be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
190037184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
19015be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
19025be83de5SJohannes Berg  *	wiphy at all
19035be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
19045be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
19055be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
19065be83de5SJohannes Berg  *	reason to override the default
19079bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
19089bc383deSJohannes Berg  *	on a VLAN interface)
19099bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
1910c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
1911c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
1912c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
1913e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
191415d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
191515d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
19161ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
1917f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
1918f4b34b55SVivek Natarajan  *	firmware.
1919cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
1920109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
1921109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
1922109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
1923109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
1924109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
1925109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
1926562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
19275e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
19285e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
19295e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
193087bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
193187bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
19327c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
19337c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
19345be83de5SJohannes Berg  */
19355be83de5SJohannes Berg enum wiphy_flags {
19365be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
19375be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
19385be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
19395be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
19405be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
19419bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
19429bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
1943c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
1944309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
194515d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
1946807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
19478e8b41f9SJohannes Berg 	/* use hole at 12 */
1948f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
1949cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
1950109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
1951109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
1952562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
19535e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
195487bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
19557c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
19567c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
19577527a782SJohannes Berg };
19587527a782SJohannes Berg 
19597527a782SJohannes Berg /**
19607527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
19617527a782SJohannes Berg  * @max: maximum number of interfaces of these types
19627527a782SJohannes Berg  * @types: interface types (bits)
19637527a782SJohannes Berg  */
19647527a782SJohannes Berg struct ieee80211_iface_limit {
19657527a782SJohannes Berg 	u16 max;
19667527a782SJohannes Berg 	u16 types;
19677527a782SJohannes Berg };
19687527a782SJohannes Berg 
19697527a782SJohannes Berg /**
19707527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
19717527a782SJohannes Berg  * @limits: limits for the given interface types
19727527a782SJohannes Berg  * @n_limits: number of limitations
19737527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
19747527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
19757527a782SJohannes Berg  *	group
19767527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
19777527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
19787527a782SJohannes Berg  *	only in special cases.
19797527a782SJohannes Berg  *
19807527a782SJohannes Berg  * These examples can be expressed as follows:
19817527a782SJohannes Berg  *
19827527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
19837527a782SJohannes Berg  *
19847527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
19857527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
19867527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
19877527a782SJohannes Berg  *  };
19887527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
19897527a782SJohannes Berg  *	.limits = limits1,
19907527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
19917527a782SJohannes Berg  *	.max_interfaces = 2,
19927527a782SJohannes Berg  *	.beacon_int_infra_match = true,
19937527a782SJohannes Berg  *  };
19947527a782SJohannes Berg  *
19957527a782SJohannes Berg  *
19967527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
19977527a782SJohannes Berg  *
19987527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
19997527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
20007527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
20017527a782SJohannes Berg  *  };
20027527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
20037527a782SJohannes Berg  *	.limits = limits2,
20047527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
20057527a782SJohannes Berg  *	.max_interfaces = 8,
20067527a782SJohannes Berg  *	.num_different_channels = 1,
20077527a782SJohannes Berg  *  };
20087527a782SJohannes Berg  *
20097527a782SJohannes Berg  *
20107527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
20117527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
20127527a782SJohannes Berg  *
20137527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
20147527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
20157527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
20167527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
20177527a782SJohannes Berg  *  };
20187527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
20197527a782SJohannes Berg  *	.limits = limits3,
20207527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
20217527a782SJohannes Berg  *	.max_interfaces = 4,
20227527a782SJohannes Berg  *	.num_different_channels = 2,
20237527a782SJohannes Berg  *  };
20247527a782SJohannes Berg  */
20257527a782SJohannes Berg struct ieee80211_iface_combination {
20267527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
20277527a782SJohannes Berg 	u32 num_different_channels;
20287527a782SJohannes Berg 	u16 max_interfaces;
20297527a782SJohannes Berg 	u8 n_limits;
20307527a782SJohannes Berg 	bool beacon_int_infra_match;
20315be83de5SJohannes Berg };
20325be83de5SJohannes Berg 
2033ef15aac6SJohannes Berg struct mac_address {
2034ef15aac6SJohannes Berg 	u8 addr[ETH_ALEN];
2035ef15aac6SJohannes Berg };
2036ef15aac6SJohannes Berg 
20372e161f78SJohannes Berg struct ieee80211_txrx_stypes {
20382e161f78SJohannes Berg 	u16 tx, rx;
20392e161f78SJohannes Berg };
20402e161f78SJohannes Berg 
20415be83de5SJohannes Berg /**
2042ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2043ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2044ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2045ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2046ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2047ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2048ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2049ff1b6e69SJohannes Berg  *	(see nl80211.h)
2050ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
205177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
205277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
205377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
205477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
205577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2056ff1b6e69SJohannes Berg  */
2057ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2058ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2059ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2060ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
206177dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
206277dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
206377dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
206477dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
206577dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
2066ff1b6e69SJohannes Berg };
2067ff1b6e69SJohannes Berg 
2068ff1b6e69SJohannes Berg /**
2069ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2070ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2071ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2072ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2073ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2074ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2075ff1b6e69SJohannes Berg  */
2076ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2077ff1b6e69SJohannes Berg 	u32 flags;
2078ff1b6e69SJohannes Berg 	int n_patterns;
2079ff1b6e69SJohannes Berg 	int pattern_max_len;
2080ff1b6e69SJohannes Berg 	int pattern_min_len;
2081ff1b6e69SJohannes Berg };
2082ff1b6e69SJohannes Berg 
2083ff1b6e69SJohannes Berg /**
20845be83de5SJohannes Berg  * struct wiphy - wireless hardware description
20852784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
20862784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
20872784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2088d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
2089d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
2090d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
2091d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
2092d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
2093d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
2094d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
2095b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
2096b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
2097b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
2098b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
2099b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
2100abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
2101ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
2102ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
2103ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
2104ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
2105ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
2106ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
2107ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
2108ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
2109ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
2110ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
2111ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
2112ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
2113fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
2114fd235913SRandy Dunlap  *	unregister hardware
2115abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
2116abe37c4bSJohannes Berg  *	automatically on wiphy renames
2117abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
21184a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
2119abe37c4bSJohannes Berg  * @wext: wireless extension handlers
2120abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
2121abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
2122abe37c4bSJohannes Berg  *	must be set by driver
21237527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
21247527a782SJohannes Berg  *	list single interface types.
21257527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
21267527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
21277527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
2128abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
21291f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
2130abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
2131abe37c4bSJohannes Berg  *	this variable determines its size
2132abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
2133abe37c4bSJohannes Berg  *	any given scan
213493b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
213593b6aa69SLuciano Coelho  *	for in any given scheduled scan
2136a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
2137a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
2138a1f1c21cSLuciano Coelho  *	supported.
2139abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
2140abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
2141abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
21425a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
21435a865badSLuciano Coelho  *	scans
2144abe37c4bSJohannes Berg  * @coverage_class: current coverage class
2145abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
2146abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
2147abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
2148abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
2149abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
2150abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
21512e161f78SJohannes Berg  *
21522e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
21532e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
21542e161f78SJohannes Berg  *	type
2155a7ffac95SBruno Randolf  *
21567f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
21577f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
21587f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
21597f531e03SBruno Randolf  *
21607f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
21617f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
21627f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
2163a293911dSJohannes Berg  *
216415f0ebc2SRandy Dunlap  * @probe_resp_offload:
216515f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
216615f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
216715f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
216815f0ebc2SRandy Dunlap  *
2169a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
2170a293911dSJohannes Berg  *	may request, if implemented.
2171ff1b6e69SJohannes Berg  *
2172ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
2173562a7480SJohannes Berg  *
2174562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
21757e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
21767e7c8926SBen Greear  *	If null, then none can be over-ridden.
2177d3236553SJohannes Berg  */
2178d3236553SJohannes Berg struct wiphy {
2179d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2180d3236553SJohannes Berg 
2181ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2182d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2183ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2184ef15aac6SJohannes Berg 
2185ef15aac6SJohannes Berg 	struct mac_address *addresses;
2186d3236553SJohannes Berg 
21872e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
21882e161f78SJohannes Berg 
21897527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
21907527a782SJohannes Berg 	int n_iface_combinations;
21917527a782SJohannes Berg 	u16 software_iftypes;
21927527a782SJohannes Berg 
21932e161f78SJohannes Berg 	u16 n_addresses;
21942e161f78SJohannes Berg 
2195d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2196d3236553SJohannes Berg 	u16 interface_modes;
2197d3236553SJohannes Berg 
21981f074bd8SJohannes Berg 	u32 flags, features;
2199463d0183SJohannes Berg 
2200562a7480SJohannes Berg 	u32 ap_sme_capa;
2201562a7480SJohannes Berg 
2202d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2203d3236553SJohannes Berg 
2204d3236553SJohannes Berg 	int bss_priv_size;
2205d3236553SJohannes Berg 	u8 max_scan_ssids;
220693b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2207a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2208d3236553SJohannes Berg 	u16 max_scan_ie_len;
22095a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2210d3236553SJohannes Berg 
2211d3236553SJohannes Berg 	int n_cipher_suites;
2212d3236553SJohannes Berg 	const u32 *cipher_suites;
2213d3236553SJohannes Berg 
2214b9a5f8caSJouni Malinen 	u8 retry_short;
2215b9a5f8caSJouni Malinen 	u8 retry_long;
2216b9a5f8caSJouni Malinen 	u32 frag_threshold;
2217b9a5f8caSJouni Malinen 	u32 rts_threshold;
221881077e82SLukáš Turek 	u8 coverage_class;
2219b9a5f8caSJouni Malinen 
2220dfce95f5SKalle Valo 	char fw_version[ETHTOOL_BUSINFO_LEN];
2221dfce95f5SKalle Valo 	u32 hw_version;
2222dfce95f5SKalle Valo 
2223dfb89c56SJohannes Berg #ifdef CONFIG_PM
2224ff1b6e69SJohannes Berg 	struct wiphy_wowlan_support wowlan;
2225dfb89c56SJohannes Berg #endif
2226ff1b6e69SJohannes Berg 
2227a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2228a293911dSJohannes Berg 
222967fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
223067fbb16bSSamuel Ortiz 
22317f531e03SBruno Randolf 	u32 available_antennas_tx;
22327f531e03SBruno Randolf 	u32 available_antennas_rx;
2233a7ffac95SBruno Randolf 
223487bbbe22SArik Nemtsov 	/*
223587bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
223687bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
223787bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
223887bbbe22SArik Nemtsov 	 */
223987bbbe22SArik Nemtsov 	u32 probe_resp_offload;
224087bbbe22SArik Nemtsov 
2241d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2242d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2243d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2244d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2245d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2246cf5aa2f1SDavid Kilroy 	const void *privid;
2247d3236553SJohannes Berg 
2248d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2249d3236553SJohannes Berg 
2250d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
2251d3236553SJohannes Berg 	int (*reg_notifier)(struct wiphy *wiphy,
2252d3236553SJohannes Berg 			    struct regulatory_request *request);
2253d3236553SJohannes Berg 
2254d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2255d3236553SJohannes Berg 
2256d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd;
2257d3236553SJohannes Berg 
2258d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
2259d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
2260d3236553SJohannes Berg 	struct device dev;
2261d3236553SJohannes Berg 
2262ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2263ecb44335SStanislaw Gruszka 	bool registered;
2264ecb44335SStanislaw Gruszka 
2265d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
2266d3236553SJohannes Berg 	struct dentry *debugfsdir;
2267d3236553SJohannes Berg 
22687e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
22697e7c8926SBen Greear 
2270463d0183SJohannes Berg #ifdef CONFIG_NET_NS
2271463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
2272463d0183SJohannes Berg 	struct net *_net;
2273463d0183SJohannes Berg #endif
2274463d0183SJohannes Berg 
22753d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
22763d23e349SJohannes Berg 	const struct iw_handler_def *wext;
22773d23e349SJohannes Berg #endif
22783d23e349SJohannes Berg 
2279d3236553SJohannes Berg 	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
2280d3236553SJohannes Berg };
2281d3236553SJohannes Berg 
2282463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
2283463d0183SJohannes Berg {
2284c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
2285463d0183SJohannes Berg }
2286463d0183SJohannes Berg 
2287463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2288463d0183SJohannes Berg {
2289c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
2290463d0183SJohannes Berg }
2291463d0183SJohannes Berg 
2292d3236553SJohannes Berg /**
2293d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
2294d3236553SJohannes Berg  *
2295d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
2296d3236553SJohannes Berg  */
2297d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
2298d3236553SJohannes Berg {
2299d3236553SJohannes Berg 	BUG_ON(!wiphy);
2300d3236553SJohannes Berg 	return &wiphy->priv;
2301d3236553SJohannes Berg }
2302d3236553SJohannes Berg 
2303d3236553SJohannes Berg /**
2304f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
2305f1f74825SDavid Kilroy  *
2306f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
2307f1f74825SDavid Kilroy  */
2308f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
2309f1f74825SDavid Kilroy {
2310f1f74825SDavid Kilroy 	BUG_ON(!priv);
2311f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
2312f1f74825SDavid Kilroy }
2313f1f74825SDavid Kilroy 
2314f1f74825SDavid Kilroy /**
2315d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
2316d3236553SJohannes Berg  *
2317d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
2318d3236553SJohannes Berg  * @dev: The device to parent it to
2319d3236553SJohannes Berg  */
2320d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2321d3236553SJohannes Berg {
2322d3236553SJohannes Berg 	wiphy->dev.parent = dev;
2323d3236553SJohannes Berg }
2324d3236553SJohannes Berg 
2325d3236553SJohannes Berg /**
2326d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
2327d3236553SJohannes Berg  *
2328d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
2329d3236553SJohannes Berg  */
2330d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
2331d3236553SJohannes Berg {
2332d3236553SJohannes Berg 	return wiphy->dev.parent;
2333d3236553SJohannes Berg }
2334d3236553SJohannes Berg 
2335d3236553SJohannes Berg /**
2336d3236553SJohannes Berg  * wiphy_name - get wiphy name
2337d3236553SJohannes Berg  *
2338d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
2339d3236553SJohannes Berg  */
2340e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
2341d3236553SJohannes Berg {
2342d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
2343d3236553SJohannes Berg }
2344d3236553SJohannes Berg 
2345d3236553SJohannes Berg /**
2346d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
2347d3236553SJohannes Berg  *
2348d3236553SJohannes Berg  * @ops: The configuration operations for this device
2349d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
2350d3236553SJohannes Berg  *
2351d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
2352d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
2353d3236553SJohannes Berg  *
2354d3236553SJohannes Berg  * The returned pointer must be assigned to each netdev's
2355d3236553SJohannes Berg  * ieee80211_ptr for proper operation.
2356d3236553SJohannes Berg  */
23573dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2358d3236553SJohannes Berg 
2359d3236553SJohannes Berg /**
2360d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
2361d3236553SJohannes Berg  *
2362d3236553SJohannes Berg  * @wiphy: The wiphy to register.
2363d3236553SJohannes Berg  *
2364d3236553SJohannes Berg  * Returns a non-negative wiphy index or a negative error code.
2365d3236553SJohannes Berg  */
2366d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
2367d3236553SJohannes Berg 
2368d3236553SJohannes Berg /**
2369d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
2370d3236553SJohannes Berg  *
2371d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
2372d3236553SJohannes Berg  *
2373d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
2374d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
2375d3236553SJohannes Berg  * request that is being handled.
2376d3236553SJohannes Berg  */
2377d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
2378d3236553SJohannes Berg 
2379d3236553SJohannes Berg /**
2380d3236553SJohannes Berg  * wiphy_free - free wiphy
2381d3236553SJohannes Berg  *
2382d3236553SJohannes Berg  * @wiphy: The wiphy to free
2383d3236553SJohannes Berg  */
2384d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
2385d3236553SJohannes Berg 
2386fffd0934SJohannes Berg /* internal structs */
23876829c878SJohannes Berg struct cfg80211_conn;
238819957bb3SJohannes Berg struct cfg80211_internal_bss;
2389fffd0934SJohannes Berg struct cfg80211_cached_keys;
239019957bb3SJohannes Berg 
2391d3236553SJohannes Berg /**
239289a54e48SJohannes Berg  * struct wireless_dev - wireless device state
2393d3236553SJohannes Berg  *
239489a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
239589a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
239689a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
239789a54e48SJohannes Berg  * It need not be registered then as netdev registration will
239889a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
239989a54e48SJohannes Berg  *
240089a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
240189a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
240289a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
240389a54e48SJohannes Berg  * allocated outside of callback operations that return it.
2404d3236553SJohannes Berg  *
2405d3236553SJohannes Berg  * @wiphy: pointer to hardware description
2406d3236553SJohannes Berg  * @iftype: interface type
2407d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
240889a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
240989a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
241089a54e48SJohannes Berg  *	wireless device if it has no netdev
2411d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
2412f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
2413aa430da4SJohannes Berg  *	the user-set AP, monitor and WDS channel
2414aa430da4SJohannes Berg  * @preset_chan: (private) Used by the internal configuration code to
2415aa430da4SJohannes Berg  *	track the channel to be used for AP later
2416aa430da4SJohannes Berg  * @preset_chantype: (private) the corresponding channel type
2417d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
2418d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
2419d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
242029cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
242129cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
2422d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
24239bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
24249bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
24259bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
24269bc383deSJohannes Berg  *	by cfg80211 on change_interface
24272e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
24282e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
2429abe37c4bSJohannes Berg  * @mtx: mutex used to lock data in this struct
2430abe37c4bSJohannes Berg  * @cleanup_work: work struct used for cleanup that can't be done directly
243156d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
243256d1893dSJohannes Berg  *	beacons, 0 when not valid
243398104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
243498104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
2435d3236553SJohannes Berg  */
2436d3236553SJohannes Berg struct wireless_dev {
2437d3236553SJohannes Berg 	struct wiphy *wiphy;
2438d3236553SJohannes Berg 	enum nl80211_iftype iftype;
2439d3236553SJohannes Berg 
2440667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
2441d3236553SJohannes Berg 	struct list_head list;
2442d3236553SJohannes Berg 	struct net_device *netdev;
2443d3236553SJohannes Berg 
244489a54e48SJohannes Berg 	u32 identifier;
244589a54e48SJohannes Berg 
24462e161f78SJohannes Berg 	struct list_head mgmt_registrations;
24472e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
2448026331c4SJouni Malinen 
2449667503ddSJohannes Berg 	struct mutex mtx;
2450667503ddSJohannes Berg 
2451ad002395SJohannes Berg 	struct work_struct cleanup_work;
2452ad002395SJohannes Berg 
245398104fdeSJohannes Berg 	bool use_4addr, p2p_started;
245498104fdeSJohannes Berg 
245598104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
24569bc383deSJohannes Berg 
2457b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
2458d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
245929cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
2460b23aa676SSamuel Ortiz 	enum {
2461b23aa676SSamuel Ortiz 		CFG80211_SME_IDLE,
24626829c878SJohannes Berg 		CFG80211_SME_CONNECTING,
2463b23aa676SSamuel Ortiz 		CFG80211_SME_CONNECTED,
2464b23aa676SSamuel Ortiz 	} sme_state;
24656829c878SJohannes Berg 	struct cfg80211_conn *conn;
2466fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
2467d3236553SJohannes Berg 
2468667503ddSJohannes Berg 	struct list_head event_list;
2469667503ddSJohannes Berg 	spinlock_t event_lock;
2470667503ddSJohannes Berg 
247119957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
2472aa430da4SJohannes Berg 	struct ieee80211_channel *preset_chan;
2473aa430da4SJohannes Berg 	enum nl80211_channel_type preset_chantype;
247419957bb3SJohannes Berg 
2475f4489ebeSMichal Kazior 	/* for AP and mesh channel tracking */
2476f4489ebeSMichal Kazior 	struct ieee80211_channel *channel;
2477f4489ebeSMichal Kazior 
2478c30a3d38SMichal Kazior 	bool ibss_fixed;
2479c30a3d38SMichal Kazior 
2480ffb9eb3dSKalle Valo 	bool ps;
2481ffb9eb3dSKalle Valo 	int ps_timeout;
2482ffb9eb3dSKalle Valo 
248356d1893dSJohannes Berg 	int beacon_interval;
248456d1893dSJohannes Berg 
248515e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
248628946da7SJohannes Berg 
24873d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
2488d3236553SJohannes Berg 	/* wext data */
2489cbe8fa9cSJohannes Berg 	struct {
2490cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
2491f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
2492fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
2493f2129354SJohannes Berg 		u8 *ie;
2494f2129354SJohannes Berg 		size_t ie_len;
2495f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
2496f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
249708645126SJohannes Berg 		s8 default_key, default_mgmt_key;
2498ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
2499cbe8fa9cSJohannes Berg 	} wext;
2500d3236553SJohannes Berg #endif
2501d3236553SJohannes Berg };
2502d3236553SJohannes Berg 
250398104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
250498104fdeSJohannes Berg {
250598104fdeSJohannes Berg 	if (wdev->netdev)
250698104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
250798104fdeSJohannes Berg 	return wdev->address;
250898104fdeSJohannes Berg }
250998104fdeSJohannes Berg 
2510d3236553SJohannes Berg /**
2511d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
2512d3236553SJohannes Berg  *
2513d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
2514d3236553SJohannes Berg  */
2515d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
2516d3236553SJohannes Berg {
2517d3236553SJohannes Berg 	BUG_ON(!wdev);
2518d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
2519d3236553SJohannes Berg }
2520d3236553SJohannes Berg 
2521d70e9693SJohannes Berg /**
2522d70e9693SJohannes Berg  * DOC: Utility functions
2523d70e9693SJohannes Berg  *
2524d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
2525d3236553SJohannes Berg  */
2526d3236553SJohannes Berg 
2527d3236553SJohannes Berg /**
2528d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
2529abe37c4bSJohannes Berg  * @chan: channel number
253059eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
2531d3236553SJohannes Berg  */
253259eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2533d3236553SJohannes Berg 
2534d3236553SJohannes Berg /**
2535d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
2536abe37c4bSJohannes Berg  * @freq: center frequency
2537d3236553SJohannes Berg  */
2538d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
2539d3236553SJohannes Berg 
2540d3236553SJohannes Berg /*
2541d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
2542d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
2543d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
2544d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
2545d3236553SJohannes Berg  * clash.
2546d3236553SJohannes Berg  */
2547d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2548d3236553SJohannes Berg 							 int freq);
2549d3236553SJohannes Berg /**
2550d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
2551abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
2552abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
2553d3236553SJohannes Berg  */
2554d3236553SJohannes Berg static inline struct ieee80211_channel *
2555d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
2556d3236553SJohannes Berg {
2557d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
2558d3236553SJohannes Berg }
2559d3236553SJohannes Berg 
2560d3236553SJohannes Berg /**
2561d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
2562d3236553SJohannes Berg  *
2563d3236553SJohannes Berg  * @sband: the band to look for rates in
2564d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
2565d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
2566d3236553SJohannes Berg  *
2567d3236553SJohannes Berg  * This function returns the basic rate corresponding to a given
2568d3236553SJohannes Berg  * bitrate, that is the next lower bitrate contained in the basic
2569d3236553SJohannes Berg  * rate map, which is, for this function, given as a bitmap of
2570d3236553SJohannes Berg  * indices of rates in the band's bitrate table.
2571d3236553SJohannes Berg  */
2572d3236553SJohannes Berg struct ieee80211_rate *
2573d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2574d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
2575d3236553SJohannes Berg 
2576d3236553SJohannes Berg /*
2577d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
2578d3236553SJohannes Berg  *
2579d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
2580d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
2581d3236553SJohannes Berg  */
2582d3236553SJohannes Berg 
258333e5a2f7SJohannes Berg struct radiotap_align_size {
258433e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
258533e5a2f7SJohannes Berg };
258633e5a2f7SJohannes Berg 
258733e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
258833e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
258933e5a2f7SJohannes Berg 	int n_bits;
259033e5a2f7SJohannes Berg 	uint32_t oui;
259133e5a2f7SJohannes Berg 	uint8_t subns;
259233e5a2f7SJohannes Berg };
259333e5a2f7SJohannes Berg 
259433e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
259533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
259633e5a2f7SJohannes Berg 	int n_ns;
259733e5a2f7SJohannes Berg };
259833e5a2f7SJohannes Berg 
2599d3236553SJohannes Berg /**
2600d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
260133e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
260233e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
260333e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
260433e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
260533e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
260633e5a2f7SJohannes Berg  *	the beginning of the actual data portion
260733e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
260833e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
260933e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
261033e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
261133e5a2f7SJohannes Berg  *	radiotap namespace or not
261233e5a2f7SJohannes Berg  *
261333e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
261433e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
261533e5a2f7SJohannes Berg  * @_arg_index: next argument index
261633e5a2f7SJohannes Berg  * @_arg: next argument pointer
261733e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
261833e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
261933e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
262033e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
262133e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
262233e5a2f7SJohannes Berg  *	next bitmap word
262333e5a2f7SJohannes Berg  *
262433e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
262533e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
2626d3236553SJohannes Berg  */
2627d3236553SJohannes Berg 
2628d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
262933e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
263033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
263133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
2632d3236553SJohannes Berg 
263333e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
263467272440SJohannes Berg 	__le32 *_next_bitmap;
263533e5a2f7SJohannes Berg 
263633e5a2f7SJohannes Berg 	unsigned char *this_arg;
263733e5a2f7SJohannes Berg 	int this_arg_index;
263833e5a2f7SJohannes Berg 	int this_arg_size;
263933e5a2f7SJohannes Berg 
264033e5a2f7SJohannes Berg 	int is_radiotap_ns;
264133e5a2f7SJohannes Berg 
264233e5a2f7SJohannes Berg 	int _max_length;
264333e5a2f7SJohannes Berg 	int _arg_index;
264433e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
264533e5a2f7SJohannes Berg 	int _reset_on_ext;
2646d3236553SJohannes Berg };
2647d3236553SJohannes Berg 
2648d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
2649d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator,
2650d3236553SJohannes Berg 	struct ieee80211_radiotap_header *radiotap_header,
265133e5a2f7SJohannes Berg 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
2652d3236553SJohannes Berg 
2653d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
2654d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator);
2655d3236553SJohannes Berg 
265633e5a2f7SJohannes Berg 
2657e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
2658e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
2659e31a16d6SZhu Yi 
2660e31a16d6SZhu Yi /**
2661e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
2662e31a16d6SZhu Yi  *
2663e31a16d6SZhu Yi  * Given an skb with a raw 802.11 header at the data pointer this function
2664e31a16d6SZhu Yi  * returns the 802.11 header length in bytes (not including encryption
2665e31a16d6SZhu Yi  * headers). If the data in the sk_buff is too short to contain a valid 802.11
2666e31a16d6SZhu Yi  * header the function returns 0.
2667e31a16d6SZhu Yi  *
2668e31a16d6SZhu Yi  * @skb: the frame
2669e31a16d6SZhu Yi  */
2670e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2671e31a16d6SZhu Yi 
2672e31a16d6SZhu Yi /**
2673e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
2674e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
2675e31a16d6SZhu Yi  */
2676633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2677e31a16d6SZhu Yi 
2678e31a16d6SZhu Yi /**
26799b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
26809b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
26819b395bc3SJohannes Berg  *	(first byte) will be accessed
26829b395bc3SJohannes Berg  * Returns the length of the extension header, which is always at
26839b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
26849b395bc3SJohannes Berg  */
26859b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
26869b395bc3SJohannes Berg 
26879b395bc3SJohannes Berg /**
2688d70e9693SJohannes Berg  * DOC: Data path helpers
2689d70e9693SJohannes Berg  *
2690d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
2691d70e9693SJohannes Berg  * functions that help implement the data path for devices
2692d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
2693d70e9693SJohannes Berg  */
2694d70e9693SJohannes Berg 
2695d70e9693SJohannes Berg /**
2696e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
2697e31a16d6SZhu Yi  * @skb: the 802.11 data frame
2698e31a16d6SZhu Yi  * @addr: the device MAC address
2699e31a16d6SZhu Yi  * @iftype: the virtual interface type
2700e31a16d6SZhu Yi  */
2701eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2702e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
2703e31a16d6SZhu Yi 
2704e31a16d6SZhu Yi /**
2705e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
2706e31a16d6SZhu Yi  * @skb: the 802.3 frame
2707e31a16d6SZhu Yi  * @addr: the device MAC address
2708e31a16d6SZhu Yi  * @iftype: the virtual interface type
2709e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
2710e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
2711e31a16d6SZhu Yi  */
2712eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2713e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
2714e31a16d6SZhu Yi 
2715e31a16d6SZhu Yi /**
2716eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
2717eaf85ca7SZhu Yi  *
2718eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
2719eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
2720eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
2721eaf85ca7SZhu Yi  *
2722eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
2723eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
2724eaf85ca7SZhu Yi  *	initialized by by the caller.
2725eaf85ca7SZhu Yi  * @addr: The device MAC address.
2726eaf85ca7SZhu Yi  * @iftype: The device interface type.
2727eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
27288b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
2729eaf85ca7SZhu Yi  */
2730eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2731eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
27328b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
27338b3becadSYogesh Ashok Powar 			      bool has_80211_header);
2734eaf85ca7SZhu Yi 
2735eaf85ca7SZhu Yi /**
2736e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
2737e31a16d6SZhu Yi  * @skb: the data frame
2738e31a16d6SZhu Yi  */
2739e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2740e31a16d6SZhu Yi 
2741c21dbf92SJohannes Berg /**
2742c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
2743c21dbf92SJohannes Berg  *
2744c21dbf92SJohannes Berg  * @eid: element ID
2745c21dbf92SJohannes Berg  * @ies: data consisting of IEs
2746c21dbf92SJohannes Berg  * @len: length of data
2747c21dbf92SJohannes Berg  *
2748c21dbf92SJohannes Berg  * This function will return %NULL if the element ID could
2749c21dbf92SJohannes Berg  * not be found or if the element is invalid (claims to be
2750c21dbf92SJohannes Berg  * longer than the given data), or a pointer to the first byte
2751c21dbf92SJohannes Berg  * of the requested element, that is the byte containing the
2752c21dbf92SJohannes Berg  * element ID. There are no checks on the element length
2753c21dbf92SJohannes Berg  * other than having to fit into the given data.
2754c21dbf92SJohannes Berg  */
2755c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2756c21dbf92SJohannes Berg 
2757d70e9693SJohannes Berg /**
27580c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
27590c28ec58SEliad Peller  *
27600c28ec58SEliad Peller  * @oui: vendor OUI
27610c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
27620c28ec58SEliad Peller  * @ies: data consisting of IEs
27630c28ec58SEliad Peller  * @len: length of data
27640c28ec58SEliad Peller  *
27650c28ec58SEliad Peller  * This function will return %NULL if the vendor specific element ID
27660c28ec58SEliad Peller  * could not be found or if the element is invalid (claims to be
27670c28ec58SEliad Peller  * longer than the given data), or a pointer to the first byte
27680c28ec58SEliad Peller  * of the requested element, that is the byte containing the
27690c28ec58SEliad Peller  * element ID. There are no checks on the element length
27700c28ec58SEliad Peller  * other than having to fit into the given data.
27710c28ec58SEliad Peller  */
27720c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
27730c28ec58SEliad Peller 				  const u8 *ies, int len);
27740c28ec58SEliad Peller 
27750c28ec58SEliad Peller /**
2776d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
2777d70e9693SJohannes Berg  *
2778d70e9693SJohannes Berg  * TODO
2779d3236553SJohannes Berg  */
2780d3236553SJohannes Berg 
2781d3236553SJohannes Berg /**
2782d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
2783d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
2784d3236553SJohannes Berg  *	conflicts)
2785d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
2786d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
2787d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
2788d3236553SJohannes Berg  * 	alpha2.
2789d3236553SJohannes Berg  *
2790d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
2791d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
2792d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
2793d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
2794d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
2795d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
2796d3236553SJohannes Berg  *
2797d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
2798d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
2799d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
2800d3236553SJohannes Berg  *
2801d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
2802d3236553SJohannes Berg  * an -ENOMEM.
2803d3236553SJohannes Berg  */
2804d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2805d3236553SJohannes Berg 
2806d3236553SJohannes Berg /**
2807d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
2808d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
2809d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
2810d3236553SJohannes Berg  *
2811d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
2812d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
2813d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
2814d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
2815d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
2816d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
2817d3236553SJohannes Berg  */
2818d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
2819d3236553SJohannes Berg 	struct wiphy *wiphy,
2820d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
2821d3236553SJohannes Berg 
2822d3236553SJohannes Berg /**
2823d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
2824d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
2825d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
2826038659e7SLuis R. Rodriguez  * @desired_bw_khz: the desired max bandwidth you want to use per
2827038659e7SLuis R. Rodriguez  *	channel. Note that this is still 20 MHz if you want to use HT40
2828038659e7SLuis R. Rodriguez  *	as HT40 makes use of two channels for its 40 MHz width bandwidth.
2829038659e7SLuis R. Rodriguez  *	If set to 0 we'll assume you want the standard 20 MHz.
2830d3236553SJohannes Berg  * @reg_rule: the regulatory rule which we have for this frequency
2831d3236553SJohannes Berg  *
2832d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
2833d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
2834d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
2835d3236553SJohannes Berg  * and processed already.
2836d3236553SJohannes Berg  *
2837d3236553SJohannes Berg  * Returns 0 if it was able to find a valid regulatory rule which does
2838d3236553SJohannes Berg  * apply to the given center_freq otherwise it returns non-zero. It will
2839d3236553SJohannes Berg  * also return -ERANGE if we determine the given center_freq does not even have
2840d3236553SJohannes Berg  * a regulatory rule for a frequency range in the center_freq's band. See
2841d3236553SJohannes Berg  * freq_in_rule_band() for our current definition of a band -- this is purely
2842d3236553SJohannes Berg  * subjective and right now its 802.11 specific.
2843d3236553SJohannes Berg  */
2844038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy,
2845038659e7SLuis R. Rodriguez 			 u32 center_freq,
2846038659e7SLuis R. Rodriguez 			 u32 desired_bw_khz,
2847d3236553SJohannes Berg 			 const struct ieee80211_reg_rule **reg_rule);
2848d3236553SJohannes Berg 
2849d3236553SJohannes Berg /*
2850d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
2851d3236553SJohannes Berg  * functions and BSS handling helpers
2852d3236553SJohannes Berg  */
2853d3236553SJohannes Berg 
28542a519311SJohannes Berg /**
28552a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
28562a519311SJohannes Berg  *
28572a519311SJohannes Berg  * @request: the corresponding scan request
28582a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
28592a519311SJohannes Berg  *	userspace will be notified of that
28602a519311SJohannes Berg  */
28612a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
28622a519311SJohannes Berg 
28632a519311SJohannes Berg /**
2864807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
2865807f8a8cSLuciano Coelho  *
2866807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
2867807f8a8cSLuciano Coelho  */
2868807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
2869807f8a8cSLuciano Coelho 
2870807f8a8cSLuciano Coelho /**
2871807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
2872807f8a8cSLuciano Coelho  *
2873807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
2874807f8a8cSLuciano Coelho  *
2875807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
2876807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
2877807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
2878807f8a8cSLuciano Coelho  */
2879807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
2880807f8a8cSLuciano Coelho 
2881807f8a8cSLuciano Coelho /**
2882abe37c4bSJohannes Berg  * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
28832a519311SJohannes Berg  *
28842a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
2885abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
2886abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
2887abe37c4bSJohannes Berg  * @len: length of the management frame
288877965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
28892a519311SJohannes Berg  * @gfp: context flags
28902a519311SJohannes Berg  *
28912a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
28922a519311SJohannes Berg  * the BSS should be updated/added.
2893ef100682SJohannes Berg  *
2894ef100682SJohannes Berg  * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
28952a519311SJohannes Berg  */
2896ef100682SJohannes Berg struct cfg80211_bss * __must_check
28972a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
28982a519311SJohannes Berg 			  struct ieee80211_channel *channel,
28992a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
290077965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
29012a519311SJohannes Berg 
2902abe37c4bSJohannes Berg /**
2903abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
2904abe37c4bSJohannes Berg  *
2905abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
2906abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
2907abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
29087b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
2909abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
2910abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
2911abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
2912abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
2913abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
2914abe37c4bSJohannes Berg  * @gfp: context flags
2915abe37c4bSJohannes Berg  *
2916abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
2917abe37c4bSJohannes Berg  * the BSS should be updated/added.
2918ef100682SJohannes Berg  *
2919ef100682SJohannes Berg  * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
2920abe37c4bSJohannes Berg  */
2921ef100682SJohannes Berg struct cfg80211_bss * __must_check
292206aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
292306aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
29247b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
29257b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
292606aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
292706aa7afaSJussi Kivilinna 
29282a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
29292a519311SJohannes Berg 				      struct ieee80211_channel *channel,
29302a519311SJohannes Berg 				      const u8 *bssid,
293179420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
293279420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
293379420f09SJohannes Berg static inline struct cfg80211_bss *
293479420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
293579420f09SJohannes Berg 		  struct ieee80211_channel *channel,
293679420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
293779420f09SJohannes Berg {
293879420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
293979420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
294079420f09SJohannes Berg }
294179420f09SJohannes Berg 
29422a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
29432a519311SJohannes Berg 				       struct ieee80211_channel *channel,
29442a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
29452a519311SJohannes Berg 				       const u8 *meshcfg);
29464c0c0b75SJohannes Berg /**
29474c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
29484c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
29494c0c0b75SJohannes Berg  *
29504c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
29514c0c0b75SJohannes Berg  */
29524c0c0b75SJohannes Berg void cfg80211_ref_bss(struct cfg80211_bss *bss);
29534c0c0b75SJohannes Berg 
29544c0c0b75SJohannes Berg /**
29554c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
29564c0c0b75SJohannes Berg  * @bss: the BSS struct
29574c0c0b75SJohannes Berg  *
29584c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
29594c0c0b75SJohannes Berg  */
29602a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
2961d3236553SJohannes Berg 
2962d491af19SJohannes Berg /**
2963d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
2964d491af19SJohannes Berg  * @wiphy: the wiphy
2965d491af19SJohannes Berg  * @bss: the bss to remove
2966d491af19SJohannes Berg  *
2967d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
2968d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
2969d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
2970d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
2971d491af19SJohannes Berg  */
2972d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
2973fee52678SJohannes Berg 
29746039f6d2SJouni Malinen /**
29756039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
29766039f6d2SJouni Malinen  * @dev: network device
29776039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
29786039f6d2SJouni Malinen  * @len: length of the frame data
29796039f6d2SJouni Malinen  *
29806039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
29811965c853SJouni Malinen  * station mode. The driver is required to call either this function or
29821965c853SJouni Malinen  * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
2983cb0b4bebSJohannes Berg  * call. This function may sleep.
29846039f6d2SJouni Malinen  */
2985cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
29866039f6d2SJouni Malinen 
29876039f6d2SJouni Malinen /**
29881965c853SJouni Malinen  * cfg80211_send_auth_timeout - notification of timed out authentication
29891965c853SJouni Malinen  * @dev: network device
29901965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
2991cb0b4bebSJohannes Berg  *
2992cb0b4bebSJohannes Berg  * This function may sleep.
29931965c853SJouni Malinen  */
2994cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
29951965c853SJouni Malinen 
29961965c853SJouni Malinen /**
29976039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
29986039f6d2SJouni Malinen  * @dev: network device
299995de817bSJohannes Berg  * @bss: the BSS struct association was requested for, the struct reference
300095de817bSJohannes Berg  *	is owned by cfg80211 after this call
30016039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
30026039f6d2SJouni Malinen  * @len: length of the frame data
30036039f6d2SJouni Malinen  *
30046039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
30051965c853SJouni Malinen  * processed in station mode. The driver is required to call either this
30061965c853SJouni Malinen  * function or cfg80211_send_assoc_timeout() to indicate the result of
3007cb0b4bebSJohannes Berg  * cfg80211_ops::assoc() call. This function may sleep.
30086039f6d2SJouni Malinen  */
300995de817bSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
301095de817bSJohannes Berg 			    const u8 *buf, size_t len);
30116039f6d2SJouni Malinen 
30126039f6d2SJouni Malinen /**
30131965c853SJouni Malinen  * cfg80211_send_assoc_timeout - notification of timed out association
30141965c853SJouni Malinen  * @dev: network device
30151965c853SJouni Malinen  * @addr: The MAC address of the device with which the association timed out
3016cb0b4bebSJohannes Berg  *
3017cb0b4bebSJohannes Berg  * This function may sleep.
30181965c853SJouni Malinen  */
3019cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
30201965c853SJouni Malinen 
30211965c853SJouni Malinen /**
302253b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
30236039f6d2SJouni Malinen  * @dev: network device
30246039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
30256039f6d2SJouni Malinen  * @len: length of the frame data
30266039f6d2SJouni Malinen  *
30276039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
302853b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
3029cb0b4bebSJohannes Berg  * locally generated ones. This function may sleep.
30306039f6d2SJouni Malinen  */
3031ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3032ce470613SHolger Schurig 
3033ce470613SHolger Schurig /**
3034ce470613SHolger Schurig  * __cfg80211_send_deauth - notification of processed deauthentication
3035ce470613SHolger Schurig  * @dev: network device
3036ce470613SHolger Schurig  * @buf: deauthentication frame (header + body)
3037ce470613SHolger Schurig  * @len: length of the frame data
3038ce470613SHolger Schurig  *
3039ce470613SHolger Schurig  * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
3040ce470613SHolger Schurig  */
3041ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
30426039f6d2SJouni Malinen 
30436039f6d2SJouni Malinen /**
304453b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
30456039f6d2SJouni Malinen  * @dev: network device
30466039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
30476039f6d2SJouni Malinen  * @len: length of the frame data
30486039f6d2SJouni Malinen  *
30496039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
305053b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
3051cb0b4bebSJohannes Berg  * generated ones. This function may sleep.
30526039f6d2SJouni Malinen  */
3053ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
3054ce470613SHolger Schurig 
3055ce470613SHolger Schurig /**
3056ce470613SHolger Schurig  * __cfg80211_send_disassoc - notification of processed disassociation
3057ce470613SHolger Schurig  * @dev: network device
3058ce470613SHolger Schurig  * @buf: disassociation response frame (header + body)
3059ce470613SHolger Schurig  * @len: length of the frame data
3060ce470613SHolger Schurig  *
3061ce470613SHolger Schurig  * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
3062ce470613SHolger Schurig  */
3063ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
3064ce470613SHolger Schurig 	size_t len);
30656039f6d2SJouni Malinen 
3066a08c1c1aSKalle Valo /**
3067cf4e594eSJouni Malinen  * cfg80211_send_unprot_deauth - notification of unprotected deauthentication
3068cf4e594eSJouni Malinen  * @dev: network device
3069cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
3070cf4e594eSJouni Malinen  * @len: length of the frame data
3071cf4e594eSJouni Malinen  *
3072cf4e594eSJouni Malinen  * This function is called whenever a received Deauthentication frame has been
3073cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Deauthentication
3074cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3075cf4e594eSJouni Malinen  */
3076cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
3077cf4e594eSJouni Malinen 				 size_t len);
3078cf4e594eSJouni Malinen 
3079cf4e594eSJouni Malinen /**
3080cf4e594eSJouni Malinen  * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
3081cf4e594eSJouni Malinen  * @dev: network device
3082cf4e594eSJouni Malinen  * @buf: disassociation frame (header + body)
3083cf4e594eSJouni Malinen  * @len: length of the frame data
3084cf4e594eSJouni Malinen  *
3085cf4e594eSJouni Malinen  * This function is called whenever a received Disassociation frame has been
3086cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Disassociation
3087cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3088cf4e594eSJouni Malinen  */
3089cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
3090cf4e594eSJouni Malinen 				   size_t len);
3091cf4e594eSJouni Malinen 
3092cf4e594eSJouni Malinen /**
3093a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
3094a3b8b056SJouni Malinen  * @dev: network device
3095a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
3096a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
3097a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
3098a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
3099e6d6e342SJohannes Berg  * @gfp: allocation flags
3100a3b8b056SJouni Malinen  *
3101a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
3102a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
3103a3b8b056SJouni Malinen  * primitive.
3104a3b8b056SJouni Malinen  */
3105a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3106a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
3107e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
3108a3b8b056SJouni Malinen 
310904a773adSJohannes Berg /**
311004a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
311104a773adSJohannes Berg  *
311204a773adSJohannes Berg  * @dev: network device
311304a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
311404a773adSJohannes Berg  * @gfp: allocation flags
311504a773adSJohannes Berg  *
311604a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
311704a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
311804a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
311904a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
312004a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
312104a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
312204a773adSJohannes Berg  */
312304a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
312404a773adSJohannes Berg 
31251f87f7d3SJohannes Berg /**
3126c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
3127c93b5e71SJavier Cardona  *
3128c93b5e71SJavier Cardona  * @dev: network device
3129c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
3130c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
3131c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
3132c93b5e71SJavier Cardona  * @gfp: allocation flags
3133c93b5e71SJavier Cardona  *
3134c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
3135c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
3136c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
3137c93b5e71SJavier Cardona  */
3138c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
3139c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3140c93b5e71SJavier Cardona 
3141c93b5e71SJavier Cardona /**
3142d70e9693SJohannes Berg  * DOC: RFkill integration
3143d70e9693SJohannes Berg  *
3144d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
3145d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
3146d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
3147d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
3148d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
3149d70e9693SJohannes Berg  *
3150d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
3151d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
3152d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
3153d70e9693SJohannes Berg  */
3154d70e9693SJohannes Berg 
3155d70e9693SJohannes Berg /**
31561f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
31571f87f7d3SJohannes Berg  * @wiphy: the wiphy
31581f87f7d3SJohannes Berg  * @blocked: block status
31591f87f7d3SJohannes Berg  */
31601f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
31611f87f7d3SJohannes Berg 
31621f87f7d3SJohannes Berg /**
31631f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
31641f87f7d3SJohannes Berg  * @wiphy: the wiphy
31651f87f7d3SJohannes Berg  */
31661f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
31671f87f7d3SJohannes Berg 
31681f87f7d3SJohannes Berg /**
31691f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
31701f87f7d3SJohannes Berg  * @wiphy: the wiphy
31711f87f7d3SJohannes Berg  */
31721f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
31731f87f7d3SJohannes Berg 
3174aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3175aff89a9bSJohannes Berg /**
3176d70e9693SJohannes Berg  * DOC: Test mode
3177d70e9693SJohannes Berg  *
3178d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
3179d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
3180d70e9693SJohannes Berg  * factory programming.
3181d70e9693SJohannes Berg  *
3182d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
3183d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
3184d70e9693SJohannes Berg  */
3185d70e9693SJohannes Berg 
3186d70e9693SJohannes Berg /**
3187aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
3188aff89a9bSJohannes Berg  * @wiphy: the wiphy
3189aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3190aff89a9bSJohannes Berg  *	be put into the skb
3191aff89a9bSJohannes Berg  *
3192aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
3193aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
3194aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
3195aff89a9bSJohannes Berg  *
3196aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is pre-filled
3197aff89a9bSJohannes Berg  * with the wiphy index and set up in a way that any data that is
3198aff89a9bSJohannes Berg  * put into the skb (with skb_put(), nla_put() or similar) will end
3199aff89a9bSJohannes Berg  * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
3200aff89a9bSJohannes Berg  * needs to be done with the skb is adding data for the corresponding
3201aff89a9bSJohannes Berg  * userspace tool which can then read that data out of the testdata
3202aff89a9bSJohannes Berg  * attribute. You must not modify the skb in any other way.
3203aff89a9bSJohannes Berg  *
3204aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
3205aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
3206aff89a9bSJohannes Berg  */
3207aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3208aff89a9bSJohannes Berg 						  int approxlen);
3209aff89a9bSJohannes Berg 
3210aff89a9bSJohannes Berg /**
3211aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
3212aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3213aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
3214aff89a9bSJohannes Berg  *
3215aff89a9bSJohannes Berg  * Returns an error code or 0 on success, since calling this
3216aff89a9bSJohannes Berg  * function will usually be the last thing before returning
3217aff89a9bSJohannes Berg  * from the @testmode_cmd you should return the error code.
3218aff89a9bSJohannes Berg  * Note that this function consumes the skb regardless of the
3219aff89a9bSJohannes Berg  * return value.
3220aff89a9bSJohannes Berg  */
3221aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
3222aff89a9bSJohannes Berg 
3223aff89a9bSJohannes Berg /**
3224aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
3225aff89a9bSJohannes Berg  * @wiphy: the wiphy
3226aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3227aff89a9bSJohannes Berg  *	be put into the skb
3228aff89a9bSJohannes Berg  * @gfp: allocation flags
3229aff89a9bSJohannes Berg  *
3230aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
3231aff89a9bSJohannes Berg  * testmode multicast group.
3232aff89a9bSJohannes Berg  *
3233aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is set up in the
3234aff89a9bSJohannes Berg  * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
3235aff89a9bSJohannes Berg  * for an event. As there, you should simply add data to it that will
3236aff89a9bSJohannes Berg  * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
3237aff89a9bSJohannes Berg  * not modify the skb in any other way.
3238aff89a9bSJohannes Berg  *
3239aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
3240aff89a9bSJohannes Berg  * skb to send the event.
3241aff89a9bSJohannes Berg  */
3242aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3243aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
3244aff89a9bSJohannes Berg 
3245aff89a9bSJohannes Berg /**
3246aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
3247aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3248aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
3249aff89a9bSJohannes Berg  * @gfp: allocation flags
3250aff89a9bSJohannes Berg  *
3251aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
3252aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
3253aff89a9bSJohannes Berg  * consumes it.
3254aff89a9bSJohannes Berg  */
3255aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3256aff89a9bSJohannes Berg 
3257aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
325871063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
3259aff89a9bSJohannes Berg #else
3260aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
326171063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
3262aff89a9bSJohannes Berg #endif
3263aff89a9bSJohannes Berg 
3264b23aa676SSamuel Ortiz /**
3265b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
3266b23aa676SSamuel Ortiz  *
3267b23aa676SSamuel Ortiz  * @dev: network device
3268b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
3269b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3270b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3271b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3272b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3273b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
3274b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
3275b23aa676SSamuel Ortiz  *	the real status code for failures.
3276b23aa676SSamuel Ortiz  * @gfp: allocation flags
3277b23aa676SSamuel Ortiz  *
3278b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
3279b23aa676SSamuel Ortiz  * succeeded.
3280b23aa676SSamuel Ortiz  */
3281b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3282b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
3283b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
3284b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
3285b23aa676SSamuel Ortiz 
3286b23aa676SSamuel Ortiz /**
3287b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
3288b23aa676SSamuel Ortiz  *
3289b23aa676SSamuel Ortiz  * @dev: network device
3290ed9d0102SJouni Malinen  * @channel: the channel of the new AP
3291b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
3292b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3293b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3294b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3295b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3296b23aa676SSamuel Ortiz  * @gfp: allocation flags
3297b23aa676SSamuel Ortiz  *
3298b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
3299b23aa676SSamuel Ortiz  * from one AP to another while connected.
3300b23aa676SSamuel Ortiz  */
3301ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
3302ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
3303ed9d0102SJouni Malinen 		     const u8 *bssid,
3304b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
3305b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3306b23aa676SSamuel Ortiz 
3307b23aa676SSamuel Ortiz /**
3308adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
3309adbde344SVasanthakumar Thiagarajan  *
3310adbde344SVasanthakumar Thiagarajan  * @dev: network device
3311adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
3312adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
3313adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
3314adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
3315adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
3316adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
3317adbde344SVasanthakumar Thiagarajan  *
3318adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
3319adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
3320adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
3321adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
3322adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
3323adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
3324adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
3325adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
3326adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3327adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
3328adbde344SVasanthakumar Thiagarajan  */
3329adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3330adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
3331adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3332adbde344SVasanthakumar Thiagarajan 
3333adbde344SVasanthakumar Thiagarajan /**
3334b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
3335b23aa676SSamuel Ortiz  *
3336b23aa676SSamuel Ortiz  * @dev: network device
3337b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
3338b23aa676SSamuel Ortiz  * @ie_len: length of IEs
3339b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
3340b23aa676SSamuel Ortiz  * @gfp: allocation flags
3341b23aa676SSamuel Ortiz  *
3342b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
3343b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
3344b23aa676SSamuel Ortiz  */
3345b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
3346b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
3347b23aa676SSamuel Ortiz 
33489588bbd5SJouni Malinen /**
33499588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
335071bbc994SJohannes Berg  * @wdev: wireless device
33519588bbd5SJouni Malinen  * @cookie: the request cookie
33529588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
33539588bbd5SJouni Malinen  * @channel_type: Channel type
33549588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
33559588bbd5SJouni Malinen  *	channel
33569588bbd5SJouni Malinen  * @gfp: allocation flags
33579588bbd5SJouni Malinen  */
335871bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
33599588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
33609588bbd5SJouni Malinen 			       enum nl80211_channel_type channel_type,
33619588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
33629588bbd5SJouni Malinen 
33639588bbd5SJouni Malinen /**
33649588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
336571bbc994SJohannes Berg  * @wdev: wireless device
33669588bbd5SJouni Malinen  * @cookie: the request cookie
33679588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
33689588bbd5SJouni Malinen  * @channel_type: Channel type
33699588bbd5SJouni Malinen  * @gfp: allocation flags
33709588bbd5SJouni Malinen  */
337171bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
33729588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
33739588bbd5SJouni Malinen 					enum nl80211_channel_type channel_type,
33749588bbd5SJouni Malinen 					gfp_t gfp);
3375b23aa676SSamuel Ortiz 
337698b62183SJohannes Berg 
337798b62183SJohannes Berg /**
337898b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
337998b62183SJohannes Berg  *
338098b62183SJohannes Berg  * @dev: the netdev
338198b62183SJohannes Berg  * @mac_addr: the station's address
338298b62183SJohannes Berg  * @sinfo: the station information
338398b62183SJohannes Berg  * @gfp: allocation flags
338498b62183SJohannes Berg  */
338598b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
338698b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
338798b62183SJohannes Berg 
3388026331c4SJouni Malinen /**
3389ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
3390ec15e68bSJouni Malinen  *
3391ec15e68bSJouni Malinen  * @dev: the netdev
3392ec15e68bSJouni Malinen  * @mac_addr: the station's address
3393ec15e68bSJouni Malinen  * @gfp: allocation flags
3394ec15e68bSJouni Malinen  */
3395ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3396ec15e68bSJouni Malinen 
3397ec15e68bSJouni Malinen /**
3398ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
3399ed44a951SPandiyarajan Pitchaimuthu  *
3400ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
3401ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
3402ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
3403ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
3404ed44a951SPandiyarajan Pitchaimuthu  *
3405ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
3406ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
3407ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
3408ed44a951SPandiyarajan Pitchaimuthu  *
3409ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
3410ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
3411ed44a951SPandiyarajan Pitchaimuthu  */
3412ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
3413ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
3414ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
3415ed44a951SPandiyarajan Pitchaimuthu 
3416ed44a951SPandiyarajan Pitchaimuthu /**
34172e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
341871bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
3419026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
3420804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
34212e161f78SJohannes Berg  * @buf: Management frame (header + body)
3422026331c4SJouni Malinen  * @len: length of the frame data
3423026331c4SJouni Malinen  * @gfp: context flags
34242e161f78SJohannes Berg  *
34252e161f78SJohannes Berg  * Returns %true if a user space application has registered for this frame.
34262e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
34272e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
34282e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
3429026331c4SJouni Malinen  *
3430026331c4SJouni Malinen  * This function is called whenever an Action frame is received for a station
3431026331c4SJouni Malinen  * mode interface, but is not processed in kernel.
3432026331c4SJouni Malinen  */
343371bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3434804483e9SJohannes Berg 		      const u8 *buf, size_t len, gfp_t gfp);
3435026331c4SJouni Malinen 
3436026331c4SJouni Malinen /**
34372e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
343871bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
34392e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
34402e161f78SJohannes Berg  * @buf: Management frame (header + body)
3441026331c4SJouni Malinen  * @len: length of the frame data
3442026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
3443026331c4SJouni Malinen  * @gfp: context flags
3444026331c4SJouni Malinen  *
34452e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
34462e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3447026331c4SJouni Malinen  * transmission attempt.
3448026331c4SJouni Malinen  */
344971bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
3450026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
3451026331c4SJouni Malinen 
3452d6dc1a38SJuuso Oikarinen 
3453d6dc1a38SJuuso Oikarinen /**
3454d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
3455d6dc1a38SJuuso Oikarinen  * @dev: network device
3456d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
3457d6dc1a38SJuuso Oikarinen  * @gfp: context flags
3458d6dc1a38SJuuso Oikarinen  *
3459d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
3460d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
3461d6dc1a38SJuuso Oikarinen  */
3462d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
3463d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
3464d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
3465d6dc1a38SJuuso Oikarinen 
3466c063dbf5SJohannes Berg /**
3467c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
3468c063dbf5SJohannes Berg  * @dev: network device
3469c063dbf5SJohannes Berg  * @peer: peer's MAC address
3470c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
3471c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
3472c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
3473c063dbf5SJohannes Berg  * @gfp: context flags
3474c063dbf5SJohannes Berg  */
3475c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3476c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
3477c063dbf5SJohannes Berg 
3478e5497d76SJohannes Berg /**
347984f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
348084f10708SThomas Pedersen  * @dev: network device
348184f10708SThomas Pedersen  * @peer: peer's MAC address
348284f10708SThomas Pedersen  * @num_packets: how many packets were lost
348384f10708SThomas Pedersen  * @rate: % of packets which failed transmission
348484f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
348584f10708SThomas Pedersen  * @gfp: context flags
348684f10708SThomas Pedersen  *
348784f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
348884f10708SThomas Pedersen  * given interval is exceeded.
348984f10708SThomas Pedersen  */
349084f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
349184f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
349284f10708SThomas Pedersen 
349384f10708SThomas Pedersen /**
3494e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3495e5497d76SJohannes Berg  * @dev: network device
3496e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
3497e5497d76SJohannes Berg  * @replay_ctr: new replay counter
3498af71ff85SJohannes Berg  * @gfp: allocation flags
3499e5497d76SJohannes Berg  */
3500e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3501e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
3502e5497d76SJohannes Berg 
3503c9df56b4SJouni Malinen /**
3504c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
3505c9df56b4SJouni Malinen  * @dev: network device
3506c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
3507c9df56b4SJouni Malinen  * @bssid: BSSID of AP
3508c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
3509c9df56b4SJouni Malinen  * @gfp: allocation flags
3510c9df56b4SJouni Malinen  */
3511c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3512c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
3513c9df56b4SJouni Malinen 
351428946da7SJohannes Berg /**
351528946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
351628946da7SJohannes Berg  * @dev: The device the frame matched to
351728946da7SJohannes Berg  * @addr: the transmitter address
351828946da7SJohannes Berg  * @gfp: context flags
351928946da7SJohannes Berg  *
352028946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
352128946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
352228946da7SJohannes Berg  * sender.
352328946da7SJohannes Berg  * Returns %true if the frame was passed to userspace (or this failed
352428946da7SJohannes Berg  * for a reason other than not having a subscription.)
352528946da7SJohannes Berg  */
352628946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
352728946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
352828946da7SJohannes Berg 
35297f6cf311SJohannes Berg /**
3530b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
3531b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
3532b92ab5d8SJohannes Berg  * @addr: the transmitter address
3533b92ab5d8SJohannes Berg  * @gfp: context flags
3534b92ab5d8SJohannes Berg  *
3535b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
3536b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
3537b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
3538b92ab5d8SJohannes Berg  * station to avoid event flooding.
3539b92ab5d8SJohannes Berg  * Returns %true if the frame was passed to userspace (or this failed
3540b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
3541b92ab5d8SJohannes Berg  */
3542b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
3543b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
3544b92ab5d8SJohannes Berg 
3545b92ab5d8SJohannes Berg /**
35467f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
35477f6cf311SJohannes Berg  * @dev: the device the probe was sent on
35487f6cf311SJohannes Berg  * @addr: the address of the peer
35497f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
35507f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
35517f6cf311SJohannes Berg  * @gfp: allocation flags
35527f6cf311SJohannes Berg  */
35537f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
35547f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
35557f6cf311SJohannes Berg 
35565e760230SJohannes Berg /**
35575e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
35585e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
35595e760230SJohannes Berg  * @frame: the frame
35605e760230SJohannes Berg  * @len: length of the frame
35615e760230SJohannes Berg  * @freq: frequency the frame was received on
3562804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
35635e760230SJohannes Berg  * @gfp: allocation flags
35645e760230SJohannes Berg  *
35655e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
35665e760230SJohannes Berg  * received. It is not useful to call this when there is no
35675e760230SJohannes Berg  * netdev that is in AP/GO mode.
35685e760230SJohannes Berg  */
35695e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
35705e760230SJohannes Berg 				 const u8 *frame, size_t len,
3571804483e9SJohannes Berg 				 int freq, int sig_dbm, gfp_t gfp);
35725e760230SJohannes Berg 
3573d58e7e37SJohannes Berg /**
357454858ee5SAlexander Simon  * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
357554858ee5SAlexander Simon  * @wiphy: the wiphy
357654858ee5SAlexander Simon  * @chan: main channel
357754858ee5SAlexander Simon  * @channel_type: HT mode
3578d58e7e37SJohannes Berg  *
3579d58e7e37SJohannes Berg  * This function returns true if there is no secondary channel or the secondary
3580d58e7e37SJohannes Berg  * channel can be used for beaconing (i.e. is not a radar channel etc.)
358154858ee5SAlexander Simon  */
3582294a20e0SJohannes Berg bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
358354858ee5SAlexander Simon 				  struct ieee80211_channel *chan,
358454858ee5SAlexander Simon 				  enum nl80211_channel_type channel_type);
358554858ee5SAlexander Simon 
35868097e149SThomas Pedersen /*
35875314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
35885314526bSThomas Pedersen  * @dev: the device which switched channels
35895314526bSThomas Pedersen  * @freq: new channel frequency (in MHz)
35905314526bSThomas Pedersen  * @type: channel type
35915314526bSThomas Pedersen  *
35925314526bSThomas Pedersen  * Acquires wdev_lock, so must only be called from sleepable driver context!
35935314526bSThomas Pedersen  */
35945314526bSThomas Pedersen void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
35955314526bSThomas Pedersen 			       enum nl80211_channel_type type);
35965314526bSThomas Pedersen 
35975314526bSThomas Pedersen /*
35988097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
35998097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
36008097e149SThomas Pedersen  *
36018097e149SThomas Pedersen  * return 0 if MCS index >= 32
36028097e149SThomas Pedersen  */
36038eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
36048097e149SThomas Pedersen 
360598104fdeSJohannes Berg /**
360698104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
360798104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
360898104fdeSJohannes Berg  *
360998104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
361098104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
361198104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
361298104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
361398104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
361498104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
361598104fdeSJohannes Berg  * when the device is unbound from the driver.
361698104fdeSJohannes Berg  *
361798104fdeSJohannes Berg  * Requires the RTNL to be held.
361898104fdeSJohannes Berg  */
361998104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
362098104fdeSJohannes Berg 
3621e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
3622e1db74fcSJoe Perches 
3623e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
3624e1db74fcSJoe Perches 
3625e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
36269c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
3627e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
36289c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
3629e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
36309c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
3631e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
36329c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
3633e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
36349c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
3635e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
36369c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
3637e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
36389c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
3639e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
36409c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
3641073730d7SJoe Perches 
36429c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
3643e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
36449c376639SJoe Perches 
3645e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
36469c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
3647e1db74fcSJoe Perches 
3648e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
3649e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
3650e1db74fcSJoe Perches #else
3651e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
3652e1db74fcSJoe Perches ({									\
3653e1db74fcSJoe Perches 	if (0)								\
3654e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
3655e1db74fcSJoe Perches 	0;								\
3656e1db74fcSJoe Perches })
3657e1db74fcSJoe Perches #endif
3658e1db74fcSJoe Perches 
3659e1db74fcSJoe Perches /*
3660e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
3661e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
3662e1db74fcSJoe Perches  * file/line information and a backtrace.
3663e1db74fcSJoe Perches  */
3664e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
3665e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
3666e1db74fcSJoe Perches 
3667704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
3668