xref: /linux/include/net/cfg80211.h (revision 24db78c05b1e3ccb5a78aedd17aa1008c91dab5a)
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>
16704232c2SJohannes Berg #include <linux/netlink.h>
17704232c2SJohannes Berg #include <linux/skbuff.h>
1855682965SJohannes Berg #include <linux/nl80211.h>
192a519311SJohannes Berg #include <linux/if_ether.h>
202a519311SJohannes Berg #include <linux/ieee80211.h>
21d3236553SJohannes Berg #include <net/regulatory.h>
22d3236553SJohannes Berg 
23d70e9693SJohannes Berg /**
24d70e9693SJohannes Berg  * DOC: Introduction
25d70e9693SJohannes Berg  *
26d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
27d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
28d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
29d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
30d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
31d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
32d70e9693SJohannes Berg  *
33d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
34d70e9693SJohannes Berg  * use restrictions.
35d70e9693SJohannes Berg  */
36d70e9693SJohannes Berg 
37d70e9693SJohannes Berg 
38d70e9693SJohannes Berg /**
39d70e9693SJohannes Berg  * DOC: Device registration
40d70e9693SJohannes Berg  *
41d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
42d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
43d70e9693SJohannes Berg  * described below.
44d70e9693SJohannes Berg  *
45d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
46d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
47d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
48d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
49d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
50d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
51d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
52d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
53d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
54d70e9693SJohannes Berg  *
55d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
56d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
57d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
58d70e9693SJohannes Berg  */
59d70e9693SJohannes Berg 
60704232c2SJohannes Berg /*
61d3236553SJohannes Berg  * wireless hardware capability structures
62d3236553SJohannes Berg  */
63d3236553SJohannes Berg 
64d3236553SJohannes Berg /**
65d3236553SJohannes Berg  * enum ieee80211_band - supported frequency bands
66704232c2SJohannes Berg  *
67d3236553SJohannes Berg  * The bands are assigned this way because the supported
68d3236553SJohannes Berg  * bitrates differ in these bands.
69d3236553SJohannes Berg  *
70d3236553SJohannes Berg  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
71d3236553SJohannes Berg  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
72abe37c4bSJohannes Berg  * @IEEE80211_NUM_BANDS: number of defined bands
73d3236553SJohannes Berg  */
74d3236553SJohannes Berg enum ieee80211_band {
7513ae75b1SJouni Malinen 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
7613ae75b1SJouni Malinen 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
77d3236553SJohannes Berg 
78d3236553SJohannes Berg 	/* keep last */
79d3236553SJohannes Berg 	IEEE80211_NUM_BANDS
80d3236553SJohannes Berg };
81d3236553SJohannes Berg 
82d3236553SJohannes Berg /**
83d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
84d3236553SJohannes Berg  *
85d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
86d3236553SJohannes Berg  *
87d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
88d3236553SJohannes Berg  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
89d3236553SJohannes Berg  *	on this channel.
90d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
91d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
92689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
93d3236553SJohannes Berg  * 	is not permitted.
94689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
95d3236553SJohannes Berg  * 	is not permitted.
96d3236553SJohannes Berg  */
97d3236553SJohannes Berg enum ieee80211_channel_flags {
98d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
99d3236553SJohannes Berg 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
100d3236553SJohannes Berg 	IEEE80211_CHAN_NO_IBSS		= 1<<2,
101d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
102689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
103689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
104d3236553SJohannes Berg };
105d3236553SJohannes Berg 
106038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
107689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
108038659e7SLuis R. Rodriguez 
109d3236553SJohannes Berg /**
110d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
111d3236553SJohannes Berg  *
112d3236553SJohannes Berg  * This structure describes a single channel for use
113d3236553SJohannes Berg  * with cfg80211.
114d3236553SJohannes Berg  *
115d3236553SJohannes Berg  * @center_freq: center frequency in MHz
116d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
117d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
118d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
119d3236553SJohannes Berg  *	code to support devices with additional restrictions
120d3236553SJohannes Berg  * @band: band this channel belongs to.
121d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
122d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
123eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
124d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
125d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
12677c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
127d3236553SJohannes Berg  * @orig_mag: internal use
128d3236553SJohannes Berg  * @orig_mpwr: internal use
129d3236553SJohannes Berg  */
130d3236553SJohannes Berg struct ieee80211_channel {
131d3236553SJohannes Berg 	enum ieee80211_band band;
132d3236553SJohannes Berg 	u16 center_freq;
133d3236553SJohannes Berg 	u16 hw_value;
134d3236553SJohannes Berg 	u32 flags;
135d3236553SJohannes Berg 	int max_antenna_gain;
136d3236553SJohannes Berg 	int max_power;
137eccc068eSHong Wu 	int max_reg_power;
138d3236553SJohannes Berg 	bool beacon_found;
139d3236553SJohannes Berg 	u32 orig_flags;
140d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
141d3236553SJohannes Berg };
142d3236553SJohannes Berg 
143d3236553SJohannes Berg /**
144d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
145d3236553SJohannes Berg  *
146d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
147d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
148d3236553SJohannes Berg  * different bands/PHY modes.
149d3236553SJohannes Berg  *
150d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
151d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
152d3236553SJohannes Berg  *	with CCK rates.
153d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
154d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
155d3236553SJohannes Berg  *	core code when registering the wiphy.
156d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
157d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
158d3236553SJohannes Berg  *	core code when registering the wiphy.
159d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
160d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
161d3236553SJohannes Berg  *	core code when registering the wiphy.
162d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
163d3236553SJohannes Berg  */
164d3236553SJohannes Berg enum ieee80211_rate_flags {
165d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
166d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
167d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
168d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
169d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
170d3236553SJohannes Berg };
171d3236553SJohannes Berg 
172d3236553SJohannes Berg /**
173d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
174d3236553SJohannes Berg  *
175d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
176d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
177d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
178d3236553SJohannes Berg  * passed around.
179d3236553SJohannes Berg  *
180d3236553SJohannes Berg  * @flags: rate-specific flags
181d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
182d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
183d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
184d3236553SJohannes Berg  *	short preamble is used
185d3236553SJohannes Berg  */
186d3236553SJohannes Berg struct ieee80211_rate {
187d3236553SJohannes Berg 	u32 flags;
188d3236553SJohannes Berg 	u16 bitrate;
189d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
190d3236553SJohannes Berg };
191d3236553SJohannes Berg 
192d3236553SJohannes Berg /**
193d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
194d3236553SJohannes Berg  *
195d3236553SJohannes Berg  * This structure describes most essential parameters needed
196d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
197d3236553SJohannes Berg  *
198d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
199d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
200d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
201d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
202d3236553SJohannes Berg  * @mcs: Supported MCS rates
203d3236553SJohannes Berg  */
204d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
205d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
206d3236553SJohannes Berg 	bool ht_supported;
207d3236553SJohannes Berg 	u8 ampdu_factor;
208d3236553SJohannes Berg 	u8 ampdu_density;
209d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
210d3236553SJohannes Berg };
211d3236553SJohannes Berg 
212d3236553SJohannes Berg /**
213d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
214d3236553SJohannes Berg  *
215d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
216d3236553SJohannes Berg  * is able to operate in.
217d3236553SJohannes Berg  *
218d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
219d3236553SJohannes Berg  *	in this band.
220d3236553SJohannes Berg  * @band: the band this structure represents
221d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
222d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
223d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
224d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
225d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
226abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
227d3236553SJohannes Berg  */
228d3236553SJohannes Berg struct ieee80211_supported_band {
229d3236553SJohannes Berg 	struct ieee80211_channel *channels;
230d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
231d3236553SJohannes Berg 	enum ieee80211_band band;
232d3236553SJohannes Berg 	int n_channels;
233d3236553SJohannes Berg 	int n_bitrates;
234d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
235d3236553SJohannes Berg };
236d3236553SJohannes Berg 
237d3236553SJohannes Berg /*
238d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
239704232c2SJohannes Berg  */
240704232c2SJohannes Berg 
2412ec600d6SLuis Carlos Cobo /**
242d70e9693SJohannes Berg  * DOC: Actions and configuration
243d70e9693SJohannes Berg  *
244d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
245d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
246d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
247d70e9693SJohannes Berg  * operations use are described separately.
248d70e9693SJohannes Berg  *
249d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
250d70e9693SJohannes Berg  * information via some functions that drivers need to call.
251d70e9693SJohannes Berg  *
252d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
253d70e9693SJohannes Berg  * in a separate chapter.
254d70e9693SJohannes Berg  */
255d70e9693SJohannes Berg 
256d70e9693SJohannes Berg /**
2572ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
2588b787643SFelix Fietkau  * @use_4addr: use 4-address frames
2592ec600d6SLuis Carlos Cobo  */
2602ec600d6SLuis Carlos Cobo struct vif_params {
2618b787643SFelix Fietkau        int use_4addr;
2622ec600d6SLuis Carlos Cobo };
2632ec600d6SLuis Carlos Cobo 
26441ade00fSJohannes Berg /**
26541ade00fSJohannes Berg  * struct key_params - key information
26641ade00fSJohannes Berg  *
26741ade00fSJohannes Berg  * Information about a key
26841ade00fSJohannes Berg  *
26941ade00fSJohannes Berg  * @key: key material
27041ade00fSJohannes Berg  * @key_len: length of key material
27141ade00fSJohannes Berg  * @cipher: cipher suite selector
27241ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
27341ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
27441ade00fSJohannes Berg  *	length given by @seq_len.
275abe37c4bSJohannes Berg  * @seq_len: length of @seq.
27641ade00fSJohannes Berg  */
27741ade00fSJohannes Berg struct key_params {
27841ade00fSJohannes Berg 	u8 *key;
27941ade00fSJohannes Berg 	u8 *seq;
28041ade00fSJohannes Berg 	int key_len;
28141ade00fSJohannes Berg 	int seq_len;
28241ade00fSJohannes Berg 	u32 cipher;
28341ade00fSJohannes Berg };
28441ade00fSJohannes Berg 
285ed1b6cc7SJohannes Berg /**
28661fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
28761fa713cSHolger Schurig  *
288abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
28917e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
2908610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
2918610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
2928610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
2938610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
2948610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
295abe37c4bSJohannes Berg  *
29661fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
29761fa713cSHolger Schurig  * it has filled in during the get_survey().
29861fa713cSHolger Schurig  */
29961fa713cSHolger Schurig enum survey_info_flags {
30061fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
30117e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
3028610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
3038610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
3048610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
3058610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
3068610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
30761fa713cSHolger Schurig };
30861fa713cSHolger Schurig 
30961fa713cSHolger Schurig /**
31061fa713cSHolger Schurig  * struct survey_info - channel survey response
31161fa713cSHolger Schurig  *
31261fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
31361fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
31461fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
31561fa713cSHolger Schurig  *     optional
3168610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
3178610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
3188610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
3198610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
3208610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
32161fa713cSHolger Schurig  *
322abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
323abe37c4bSJohannes Berg  *
32461fa713cSHolger Schurig  * This structure can later be expanded with things like
32561fa713cSHolger Schurig  * channel duty cycle etc.
32661fa713cSHolger Schurig  */
32761fa713cSHolger Schurig struct survey_info {
32861fa713cSHolger Schurig 	struct ieee80211_channel *channel;
3298610c29aSFelix Fietkau 	u64 channel_time;
3308610c29aSFelix Fietkau 	u64 channel_time_busy;
3318610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
3328610c29aSFelix Fietkau 	u64 channel_time_rx;
3338610c29aSFelix Fietkau 	u64 channel_time_tx;
33461fa713cSHolger Schurig 	u32 filled;
33561fa713cSHolger Schurig 	s8 noise;
33661fa713cSHolger Schurig };
33761fa713cSHolger Schurig 
33861fa713cSHolger Schurig /**
3395fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
3405fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
3415fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
3425fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
3435fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
3445fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
3455fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
3465fb628e9SJouni Malinen  * @akm_suites: AKM suites
3475fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
3485fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
3495fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
3505fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
3515fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
3525fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
3535fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
3545fb628e9SJouni Malinen  *	protocol frames.
3555fb628e9SJouni Malinen  */
3565fb628e9SJouni Malinen struct cfg80211_crypto_settings {
3575fb628e9SJouni Malinen 	u32 wpa_versions;
3585fb628e9SJouni Malinen 	u32 cipher_group;
3595fb628e9SJouni Malinen 	int n_ciphers_pairwise;
3605fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
3615fb628e9SJouni Malinen 	int n_akm_suites;
3625fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
3635fb628e9SJouni Malinen 	bool control_port;
3645fb628e9SJouni Malinen 	__be16 control_port_ethertype;
3655fb628e9SJouni Malinen 	bool control_port_no_encrypt;
3665fb628e9SJouni Malinen };
3675fb628e9SJouni Malinen 
3685fb628e9SJouni Malinen /**
369ed1b6cc7SJohannes Berg  * struct beacon_parameters - beacon parameters
370ed1b6cc7SJohannes Berg  *
371ed1b6cc7SJohannes Berg  * Used to configure the beacon for an interface.
372ed1b6cc7SJohannes Berg  *
373ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
374ed1b6cc7SJohannes Berg  *     or %NULL if not changed
375ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
376ed1b6cc7SJohannes Berg  *     or %NULL if not changed
377ed1b6cc7SJohannes Berg  * @interval: beacon interval or zero if not changed
378ed1b6cc7SJohannes Berg  * @dtim_period: DTIM period or zero if not changed
379ed1b6cc7SJohannes Berg  * @head_len: length of @head
380ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
38132e9de84SJouni Malinen  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
38232e9de84SJouni Malinen  *	user space)
38332e9de84SJouni Malinen  * @ssid_len: length of @ssid
38432e9de84SJouni Malinen  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
3855fb628e9SJouni Malinen  * @crypto: crypto settings
3865fb628e9SJouni Malinen  * @privacy: the BSS uses privacy
3875fb628e9SJouni Malinen  * @auth_type: Authentication type (algorithm)
3889946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
3899946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
3909946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
3919946ecfbSJouni Malinen  *	frames or %NULL
3929946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
3939946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
3949946ecfbSJouni Malinen  *	Response frames or %NULL
3959946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
39600f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
39700f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
398ed1b6cc7SJohannes Berg  */
399ed1b6cc7SJohannes Berg struct beacon_parameters {
400ed1b6cc7SJohannes Berg 	u8 *head, *tail;
401ed1b6cc7SJohannes Berg 	int interval, dtim_period;
402ed1b6cc7SJohannes Berg 	int head_len, tail_len;
40332e9de84SJouni Malinen 	const u8 *ssid;
40432e9de84SJouni Malinen 	size_t ssid_len;
40532e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
4065fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
4075fb628e9SJouni Malinen 	bool privacy;
4085fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
4099946ecfbSJouni Malinen 	const u8 *beacon_ies;
4109946ecfbSJouni Malinen 	size_t beacon_ies_len;
4119946ecfbSJouni Malinen 	const u8 *proberesp_ies;
4129946ecfbSJouni Malinen 	size_t proberesp_ies_len;
4139946ecfbSJouni Malinen 	const u8 *assocresp_ies;
4149946ecfbSJouni Malinen 	size_t assocresp_ies_len;
41500f740e1SArik Nemtsov 	int probe_resp_len;
41600f740e1SArik Nemtsov 	u8 *probe_resp;
417ed1b6cc7SJohannes Berg };
418ed1b6cc7SJohannes Berg 
4195727ef1bSJohannes Berg /**
4202ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
4212ec600d6SLuis Carlos Cobo  *
4222ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
4232ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
424abe37c4bSJohannes Berg  * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
4252ec600d6SLuis Carlos Cobo  */
4262ec600d6SLuis Carlos Cobo enum plink_actions {
4272ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
4282ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
4292ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
4302ec600d6SLuis Carlos Cobo };
4312ec600d6SLuis Carlos Cobo 
4322ec600d6SLuis Carlos Cobo /**
4333b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
4343b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
4353b9ce80cSJohannes Berg  *
4363b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
4373b9ce80cSJohannes Berg  * for those that don't these flags will are used.
4383b9ce80cSJohannes Berg  */
4393b9ce80cSJohannes Berg enum station_parameters_apply_mask {
4403b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
4413b9ce80cSJohannes Berg };
4423b9ce80cSJohannes Berg 
4433b9ce80cSJohannes Berg /**
4445727ef1bSJohannes Berg  * struct station_parameters - station parameters
4455727ef1bSJohannes Berg  *
4465727ef1bSJohannes Berg  * Used to change and create a new station.
4475727ef1bSJohannes Berg  *
4485727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
4495727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
4505727ef1bSJohannes Berg  *	(or NULL for no change)
4515727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
452eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
453eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
454eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
455eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
4565727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
4575727ef1bSJohannes Berg  * @aid: AID or zero for no change
458abe37c4bSJohannes Berg  * @plink_action: plink action to take
4599c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
460abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
461910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
462910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
463910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
464910868dbSEliad Peller  *	QoS info field (but already shifted down)
465c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
466c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
467c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
4685727ef1bSJohannes Berg  */
4695727ef1bSJohannes Berg struct station_parameters {
4705727ef1bSJohannes Berg 	u8 *supported_rates;
4715727ef1bSJohannes Berg 	struct net_device *vlan;
472eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
4733b9ce80cSJohannes Berg 	u32 sta_modify_mask;
4745727ef1bSJohannes Berg 	int listen_interval;
4755727ef1bSJohannes Berg 	u16 aid;
4765727ef1bSJohannes Berg 	u8 supported_rates_len;
4772ec600d6SLuis Carlos Cobo 	u8 plink_action;
4789c3990aaSJavier Cardona 	u8 plink_state;
47936aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
480c75786c9SEliad Peller 	u8 uapsd_queues;
481c75786c9SEliad Peller 	u8 max_sp;
4825727ef1bSJohannes Berg };
4835727ef1bSJohannes Berg 
484fd5b74dcSJohannes Berg /**
4852ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
486fd5b74dcSJohannes Berg  *
4872ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
4882ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
489fd5b74dcSJohannes Berg  *
4902ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
4912ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
4922ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
4932ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
4942ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
4952ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
496420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
497c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
498420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
49998c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
50098c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
501b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
502b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
5035a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
504541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
505c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
506f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
507ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
508040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
509bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
510a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
511fd5b74dcSJohannes Berg  */
5122ec600d6SLuis Carlos Cobo enum station_info_flags {
5132ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
5142ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
5152ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
5162ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
5172ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
5182ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
519420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
520420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
52198c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
52298c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
523b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
524b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
5255a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
526541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
527c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
528f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
529040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
530bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
531a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
532a85e1d55SPaul Stewart 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19
533420e7fabSHenning Rogge };
534420e7fabSHenning Rogge 
535420e7fabSHenning Rogge /**
536420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
537420e7fabSHenning Rogge  *
538420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
539420e7fabSHenning Rogge  * type for 802.11n transmissions.
540420e7fabSHenning Rogge  *
541420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
542420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
543420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
544420e7fabSHenning Rogge  */
545420e7fabSHenning Rogge enum rate_info_flags {
546420e7fabSHenning Rogge 	RATE_INFO_FLAGS_MCS		= 1<<0,
547420e7fabSHenning Rogge 	RATE_INFO_FLAGS_40_MHZ_WIDTH	= 1<<1,
548420e7fabSHenning Rogge 	RATE_INFO_FLAGS_SHORT_GI	= 1<<2,
549420e7fabSHenning Rogge };
550420e7fabSHenning Rogge 
551420e7fabSHenning Rogge /**
552420e7fabSHenning Rogge  * struct rate_info - bitrate information
553420e7fabSHenning Rogge  *
554420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
555420e7fabSHenning Rogge  *
556420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
557420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
558420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
559420e7fabSHenning Rogge  */
560420e7fabSHenning Rogge struct rate_info {
561420e7fabSHenning Rogge 	u8 flags;
562420e7fabSHenning Rogge 	u8 mcs;
563420e7fabSHenning Rogge 	u16 legacy;
564fd5b74dcSJohannes Berg };
565fd5b74dcSJohannes Berg 
566fd5b74dcSJohannes Berg /**
567f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
568f4263c98SPaul Stewart  *
569f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
570f4263c98SPaul Stewart  * type for 802.11n transmissions.
571f4263c98SPaul Stewart  *
572f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
573f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
574f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
575f4263c98SPaul Stewart  */
576f4263c98SPaul Stewart enum bss_param_flags {
577f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
578f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
579f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
580f4263c98SPaul Stewart };
581f4263c98SPaul Stewart 
582f4263c98SPaul Stewart /**
583f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
584f4263c98SPaul Stewart  *
585f4263c98SPaul Stewart  * Information about the currently associated BSS
586f4263c98SPaul Stewart  *
587f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
588f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
589f4263c98SPaul Stewart  * @beacon_interval: beacon interval
590f4263c98SPaul Stewart  */
591f4263c98SPaul Stewart struct sta_bss_parameters {
592f4263c98SPaul Stewart 	u8 flags;
593f4263c98SPaul Stewart 	u8 dtim_period;
594f4263c98SPaul Stewart 	u16 beacon_interval;
595f4263c98SPaul Stewart };
596f4263c98SPaul Stewart 
597f4263c98SPaul Stewart /**
5982ec600d6SLuis Carlos Cobo  * struct station_info - station information
599fd5b74dcSJohannes Berg  *
6002ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
601fd5b74dcSJohannes Berg  *
6022ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
603ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
604fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
605fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
606fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
6072ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
6082ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
6092ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
610420e7fabSHenning Rogge  * @signal: signal strength of last received packet in dBm
611541a45a1SBruno Randolf  * @signal_avg: signal strength average in dBm
612858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
613858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
61498c8a60aSJouni Malinen  * @rx_packets: packets received from this station
61598c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
616b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
617b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
6185a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
6191ba01458SRandy Dunlap  * @bss_param: current BSS parameters
620f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
621f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
622f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
623f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
62450d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
62550d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
62650d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
62750d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
62850d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
629c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
630a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
631fd5b74dcSJohannes Berg  */
6322ec600d6SLuis Carlos Cobo struct station_info {
633fd5b74dcSJohannes Berg 	u32 filled;
634ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
635fd5b74dcSJohannes Berg 	u32 inactive_time;
636fd5b74dcSJohannes Berg 	u32 rx_bytes;
637fd5b74dcSJohannes Berg 	u32 tx_bytes;
6382ec600d6SLuis Carlos Cobo 	u16 llid;
6392ec600d6SLuis Carlos Cobo 	u16 plid;
6402ec600d6SLuis Carlos Cobo 	u8 plink_state;
641420e7fabSHenning Rogge 	s8 signal;
642541a45a1SBruno Randolf 	s8 signal_avg;
643420e7fabSHenning Rogge 	struct rate_info txrate;
644c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
64598c8a60aSJouni Malinen 	u32 rx_packets;
64698c8a60aSJouni Malinen 	u32 tx_packets;
647b206b4efSBruno Randolf 	u32 tx_retries;
648b206b4efSBruno Randolf 	u32 tx_failed;
6495a5c731aSBen Greear 	u32 rx_dropped_misc;
650f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
651bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
652f5ea9120SJohannes Berg 
653f5ea9120SJohannes Berg 	int generation;
65450d3dfb7SJouni Malinen 
65550d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
65650d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
657f612cedfSJouni Malinen 
658a85e1d55SPaul Stewart 	u32 beacon_loss_count;
659a85e1d55SPaul Stewart 
660f612cedfSJouni Malinen 	/*
661f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
662f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
663f612cedfSJouni Malinen 	 */
664fd5b74dcSJohannes Berg };
665fd5b74dcSJohannes Berg 
66666f7ac50SMichael Wu /**
66766f7ac50SMichael Wu  * enum monitor_flags - monitor flags
66866f7ac50SMichael Wu  *
66966f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
67066f7ac50SMichael Wu  * according to the nl80211 flags.
67166f7ac50SMichael Wu  *
67266f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
67366f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
67466f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
67566f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
67666f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
67766f7ac50SMichael Wu  */
67866f7ac50SMichael Wu enum monitor_flags {
67966f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
68066f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
68166f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
68266f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
68366f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
68466f7ac50SMichael Wu };
68566f7ac50SMichael Wu 
6862ec600d6SLuis Carlos Cobo /**
6872ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
6882ec600d6SLuis Carlos Cobo  *
6892ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
6902ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
6912ec600d6SLuis Carlos Cobo  *
692abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
693abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
694abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
695abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
696abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
697abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
698abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
6992ec600d6SLuis Carlos Cobo  */
7002ec600d6SLuis Carlos Cobo enum mpath_info_flags {
7012ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
702d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
7032ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
7042ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
7052ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
7062ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
7072ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
7082ec600d6SLuis Carlos Cobo };
7092ec600d6SLuis Carlos Cobo 
7102ec600d6SLuis Carlos Cobo /**
7112ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
7122ec600d6SLuis Carlos Cobo  *
7132ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
7142ec600d6SLuis Carlos Cobo  *
7152ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
7162ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
717d19b3bf6SRui Paulo  * @sn: target sequence number
7182ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
7192ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
7202ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
7212ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
7222ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
723f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
724f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
725f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
726f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
7272ec600d6SLuis Carlos Cobo  */
7282ec600d6SLuis Carlos Cobo struct mpath_info {
7292ec600d6SLuis Carlos Cobo 	u32 filled;
7302ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
731d19b3bf6SRui Paulo 	u32 sn;
7322ec600d6SLuis Carlos Cobo 	u32 metric;
7332ec600d6SLuis Carlos Cobo 	u32 exptime;
7342ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
7352ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
7362ec600d6SLuis Carlos Cobo 	u8 flags;
737f5ea9120SJohannes Berg 
738f5ea9120SJohannes Berg 	int generation;
7392ec600d6SLuis Carlos Cobo };
7402ec600d6SLuis Carlos Cobo 
7419f1ba906SJouni Malinen /**
7429f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
7439f1ba906SJouni Malinen  *
7449f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
7459f1ba906SJouni Malinen  *
7469f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
7479f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
7489f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
7499f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
7509f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
7519f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
75290c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
75390c97a04SJouni Malinen  *	(or NULL for no change)
75490c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
755fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
75650b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
75750b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
7589f1ba906SJouni Malinen  */
7599f1ba906SJouni Malinen struct bss_parameters {
7609f1ba906SJouni Malinen 	int use_cts_prot;
7619f1ba906SJouni Malinen 	int use_short_preamble;
7629f1ba906SJouni Malinen 	int use_short_slot_time;
76390c97a04SJouni Malinen 	u8 *basic_rates;
76490c97a04SJouni Malinen 	u8 basic_rates_len;
765fd8aaaf3SFelix Fietkau 	int ap_isolate;
76650b12f59SHelmut Schaa 	int ht_opmode;
7679f1ba906SJouni Malinen };
7682ec600d6SLuis Carlos Cobo 
76929cbe68cSJohannes Berg /*
77029cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
77129cbe68cSJohannes Berg  *
77229cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
77329cbe68cSJohannes Berg  */
77493da9cc1Scolin@cozybit.com struct mesh_config {
77593da9cc1Scolin@cozybit.com 	/* Timeouts in ms */
77693da9cc1Scolin@cozybit.com 	/* Mesh plink management parameters */
77793da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
77893da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
77993da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
78093da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
78193da9cc1Scolin@cozybit.com 	u8  dot11MeshMaxRetries;
78293da9cc1Scolin@cozybit.com 	u8  dot11MeshTTL;
78345904f21SJavier Cardona 	/* ttl used in path selection information elements */
78445904f21SJavier Cardona 	u8  element_ttl;
78593da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
78693da9cc1Scolin@cozybit.com 	/* HWMP parameters */
78793da9cc1Scolin@cozybit.com 	u8  dot11MeshHWMPmaxPREQretries;
78893da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
78993da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
79093da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
79193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
792dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
79393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
79463c5723bSRui Paulo 	u8  dot11MeshHWMPRootMode;
7950507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
79616dd7267SJavier Cardona 	/* This is missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol
79716dd7267SJavier Cardona 	 * set to true only means that the station will announce others it's a
79816dd7267SJavier Cardona 	 * mesh gate, but not necessarily using the gate announcement protocol.
79916dd7267SJavier Cardona 	 * Still keeping the same nomenclature to be in sync with the spec. */
80016dd7267SJavier Cardona 	bool  dot11MeshGateAnnouncementProtocol;
80194f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
80293da9cc1Scolin@cozybit.com };
80393da9cc1Scolin@cozybit.com 
80431888487SJouni Malinen /**
80529cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
80629cbe68cSJohannes Berg  * @mesh_id: the mesh ID
80729cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
808c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
809c80d545dSJavier Cardona  * @path_metric: which metric to use
810581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
811581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
812b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
813b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
8144bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
81529cbe68cSJohannes Berg  *
81629cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
81729cbe68cSJohannes Berg  */
81829cbe68cSJohannes Berg struct mesh_setup {
81929cbe68cSJohannes Berg 	const u8 *mesh_id;
82029cbe68cSJohannes Berg 	u8 mesh_id_len;
821c80d545dSJavier Cardona 	u8  path_sel_proto;
822c80d545dSJavier Cardona 	u8  path_metric;
823581a8b0fSJavier Cardona 	const u8 *ie;
824581a8b0fSJavier Cardona 	u8 ie_len;
825b130e5ceSJavier Cardona 	bool is_authenticated;
82615d5dda6SJavier Cardona 	bool is_secure;
8274bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
82829cbe68cSJohannes Berg };
82929cbe68cSJohannes Berg 
83029cbe68cSJohannes Berg /**
83131888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
83231888487SJouni Malinen  * @queue: TX queue identifier (NL80211_TXQ_Q_*)
83331888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
83431888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
83531888487SJouni Malinen  *	1..32767]
83631888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
83731888487SJouni Malinen  *	1..32767]
83831888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
83931888487SJouni Malinen  */
84031888487SJouni Malinen struct ieee80211_txq_params {
84131888487SJouni Malinen 	enum nl80211_txq_q queue;
84231888487SJouni Malinen 	u16 txop;
84331888487SJouni Malinen 	u16 cwmin;
84431888487SJouni Malinen 	u16 cwmax;
84531888487SJouni Malinen 	u8 aifs;
84631888487SJouni Malinen };
84731888487SJouni Malinen 
848704232c2SJohannes Berg /* from net/wireless.h */
849704232c2SJohannes Berg struct wiphy;
850704232c2SJohannes Berg 
851d70e9693SJohannes Berg /**
852d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
853d70e9693SJohannes Berg  *
854d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
855d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
856d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
857d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
858d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
859d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
860d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
861d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
862d70e9693SJohannes Berg  * in the wiphy structure.
863d70e9693SJohannes Berg  *
864d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
865d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
866d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
867d70e9693SJohannes Berg  *
868d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
869d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
870d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
871d70e9693SJohannes Berg  * to userspace.
872d70e9693SJohannes Berg  */
87372bdcf34SJouni Malinen 
874704232c2SJohannes Berg /**
8752a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
8762a519311SJohannes Berg  * @ssid: the SSID
8772a519311SJohannes Berg  * @ssid_len: length of the ssid
8782a519311SJohannes Berg  */
8792a519311SJohannes Berg struct cfg80211_ssid {
8802a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
8812a519311SJohannes Berg 	u8 ssid_len;
8822a519311SJohannes Berg };
8832a519311SJohannes Berg 
8842a519311SJohannes Berg /**
8852a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
8862a519311SJohannes Berg  *
8872a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
8882a519311SJohannes Berg  * @n_ssids: number of SSIDs
8892a519311SJohannes Berg  * @channels: channels to scan on.
890ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
89170692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
89270692ad2SJouni Malinen  * @ie_len: length of ie in octets
89334850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
8942a519311SJohannes Berg  * @wiphy: the wiphy this was for
895463d0183SJohannes Berg  * @dev: the interface
896abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
897e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
8982a519311SJohannes Berg  */
8992a519311SJohannes Berg struct cfg80211_scan_request {
9002a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
9012a519311SJohannes Berg 	int n_ssids;
9022a519311SJohannes Berg 	u32 n_channels;
903de95a54bSJohannes Berg 	const u8 *ie;
90470692ad2SJouni Malinen 	size_t ie_len;
9052a519311SJohannes Berg 
90634850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
90734850ab2SJohannes Berg 
9082a519311SJohannes Berg 	/* internal */
9092a519311SJohannes Berg 	struct wiphy *wiphy;
910463d0183SJohannes Berg 	struct net_device *dev;
911667503ddSJohannes Berg 	bool aborted;
912e9f935e3SRajkumar Manoharan 	bool no_cck;
9135ba63533SJohannes Berg 
9145ba63533SJohannes Berg 	/* keep last */
9155ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
9162a519311SJohannes Berg };
9172a519311SJohannes Berg 
9182a519311SJohannes Berg /**
919a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
920a1f1c21cSLuciano Coelho  *
921a1f1c21cSLuciano Coelho  * @ssid: SSID to be matched
922a1f1c21cSLuciano Coelho  */
923a1f1c21cSLuciano Coelho struct cfg80211_match_set {
924a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
925a1f1c21cSLuciano Coelho };
926a1f1c21cSLuciano Coelho 
927a1f1c21cSLuciano Coelho /**
928807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
929807f8a8cSLuciano Coelho  *
930807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
931807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
932807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
933bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
934807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
935807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
936a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
937a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
938a1f1c21cSLuciano Coelho  * 	(others are filtered out).
939a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
940a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
941807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
942807f8a8cSLuciano Coelho  * @dev: the interface
943807f8a8cSLuciano Coelho  * @channels: channels to scan
944807f8a8cSLuciano Coelho  */
945807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
946807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
947807f8a8cSLuciano Coelho 	int n_ssids;
948807f8a8cSLuciano Coelho 	u32 n_channels;
949bbe6ad6dSLuciano Coelho 	u32 interval;
950807f8a8cSLuciano Coelho 	const u8 *ie;
951807f8a8cSLuciano Coelho 	size_t ie_len;
952a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
953a1f1c21cSLuciano Coelho 	int n_match_sets;
954807f8a8cSLuciano Coelho 
955807f8a8cSLuciano Coelho 	/* internal */
956807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
957807f8a8cSLuciano Coelho 	struct net_device *dev;
958807f8a8cSLuciano Coelho 
959807f8a8cSLuciano Coelho 	/* keep last */
960807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
961807f8a8cSLuciano Coelho };
962807f8a8cSLuciano Coelho 
963807f8a8cSLuciano Coelho /**
9642a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
9652a519311SJohannes Berg  *
9662a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
9672a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
9682a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
9692a519311SJohannes Berg  */
9702a519311SJohannes Berg enum cfg80211_signal_type {
9712a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
9722a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
9732a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
9742a519311SJohannes Berg };
9752a519311SJohannes Berg 
9762a519311SJohannes Berg /**
9772a519311SJohannes Berg  * struct cfg80211_bss - BSS description
9782a519311SJohannes Berg  *
9792a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
9802a519311SJohannes Berg  * for use in scan results and similar.
9812a519311SJohannes Berg  *
982abe37c4bSJohannes Berg  * @channel: channel this BSS is on
9832a519311SJohannes Berg  * @bssid: BSSID of the BSS
9842a519311SJohannes Berg  * @tsf: timestamp of last received update
9852a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
9862a519311SJohannes Berg  * @capability: the capability field in host byte order
9872a519311SJohannes Berg  * @information_elements: the information elements (Note that there
98834a6eddbSJouni Malinen  *	is no guarantee that these are well-formed!); this is a pointer to
98934a6eddbSJouni Malinen  *	either the beacon_ies or proberesp_ies depending on whether Probe
99034a6eddbSJouni Malinen  *	Response frame has been received
9912a519311SJohannes Berg  * @len_information_elements: total length of the information elements
99234a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
99334a6eddbSJouni Malinen  * @len_beacon_ies: total length of the beacon_ies
99434a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
99534a6eddbSJouni Malinen  * @len_proberesp_ies: total length of the proberesp_ies
99677965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
99778c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
9982a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
9992a519311SJohannes Berg  */
10002a519311SJohannes Berg struct cfg80211_bss {
10012a519311SJohannes Berg 	struct ieee80211_channel *channel;
10022a519311SJohannes Berg 
10032a519311SJohannes Berg 	u8 bssid[ETH_ALEN];
10042a519311SJohannes Berg 	u64 tsf;
10052a519311SJohannes Berg 	u16 beacon_interval;
10062a519311SJohannes Berg 	u16 capability;
10072a519311SJohannes Berg 	u8 *information_elements;
10082a519311SJohannes Berg 	size_t len_information_elements;
100934a6eddbSJouni Malinen 	u8 *beacon_ies;
101034a6eddbSJouni Malinen 	size_t len_beacon_ies;
101134a6eddbSJouni Malinen 	u8 *proberesp_ies;
101234a6eddbSJouni Malinen 	size_t len_proberesp_ies;
10132a519311SJohannes Berg 
10142a519311SJohannes Berg 	s32 signal;
10152a519311SJohannes Berg 
101678c1c7e1SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
10172a519311SJohannes Berg 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
10182a519311SJohannes Berg };
10192a519311SJohannes Berg 
10202a519311SJohannes Berg /**
1021517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1022517357c6SJohannes Berg  * @bss: the bss to search
1023517357c6SJohannes Berg  * @ie: the IE ID
1024517357c6SJohannes Berg  * Returns %NULL if not found.
1025517357c6SJohannes Berg  */
1026517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1027517357c6SJohannes Berg 
1028517357c6SJohannes Berg 
1029517357c6SJohannes Berg /**
1030636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1031636a5d36SJouni Malinen  *
1032636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1033636a5d36SJouni Malinen  * authentication.
1034636a5d36SJouni Malinen  *
103519957bb3SJohannes Berg  * @bss: The BSS to authenticate with.
1036636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1037636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1038636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1039fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1040fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1041fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1042d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1043d5cdfacbSJouni Malinen  *	Authentication frame is to be transmitted and authentication state is
1044d5cdfacbSJouni Malinen  *	to be changed without having to wait for a response from the peer STA
1045d5cdfacbSJouni Malinen  *	(AP).
1046636a5d36SJouni Malinen  */
1047636a5d36SJouni Malinen struct cfg80211_auth_request {
104819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1049636a5d36SJouni Malinen 	const u8 *ie;
1050636a5d36SJouni Malinen 	size_t ie_len;
105119957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1052fffd0934SJohannes Berg 	const u8 *key;
1053fffd0934SJohannes Berg 	u8 key_len, key_idx;
1054d5cdfacbSJouni Malinen 	bool local_state_change;
1055636a5d36SJouni Malinen };
1056636a5d36SJouni Malinen 
1057636a5d36SJouni Malinen /**
10587e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
10597e7c8926SBen Greear  *
10607e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
10617e7c8926SBen Greear  */
10627e7c8926SBen Greear enum cfg80211_assoc_req_flags {
10637e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
10647e7c8926SBen Greear };
10657e7c8926SBen Greear 
10667e7c8926SBen Greear /**
1067636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1068636a5d36SJouni Malinen  *
1069636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1070636a5d36SJouni Malinen  * (re)association.
107119957bb3SJohannes Berg  * @bss: The BSS to associate with.
1072636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1073636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1074dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1075b23aa676SSamuel Ortiz  * @crypto: crypto settings
10763e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
10777e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
10787e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
10797e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
10807e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1081636a5d36SJouni Malinen  */
1082636a5d36SJouni Malinen struct cfg80211_assoc_request {
108319957bb3SJohannes Berg 	struct cfg80211_bss *bss;
10843e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1085636a5d36SJouni Malinen 	size_t ie_len;
1086b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
108719957bb3SJohannes Berg 	bool use_mfp;
10887e7c8926SBen Greear 	u32 flags;
10897e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
10907e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1091636a5d36SJouni Malinen };
1092636a5d36SJouni Malinen 
1093636a5d36SJouni Malinen /**
1094636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1095636a5d36SJouni Malinen  *
1096636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1097636a5d36SJouni Malinen  * deauthentication.
1098636a5d36SJouni Malinen  *
109919957bb3SJohannes Berg  * @bss: the BSS to deauthenticate from
1100636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1101636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
110219957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1103d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1104d5cdfacbSJouni Malinen  *	Deauthentication frame is to be transmitted.
1105636a5d36SJouni Malinen  */
1106636a5d36SJouni Malinen struct cfg80211_deauth_request {
110719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1108636a5d36SJouni Malinen 	const u8 *ie;
1109636a5d36SJouni Malinen 	size_t ie_len;
111019957bb3SJohannes Berg 	u16 reason_code;
1111d5cdfacbSJouni Malinen 	bool local_state_change;
1112636a5d36SJouni Malinen };
1113636a5d36SJouni Malinen 
1114636a5d36SJouni Malinen /**
1115636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1116636a5d36SJouni Malinen  *
1117636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1118636a5d36SJouni Malinen  * disassocation.
1119636a5d36SJouni Malinen  *
112019957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1121636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1122636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
112319957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1124d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1125d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1126636a5d36SJouni Malinen  */
1127636a5d36SJouni Malinen struct cfg80211_disassoc_request {
112819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1129636a5d36SJouni Malinen 	const u8 *ie;
1130636a5d36SJouni Malinen 	size_t ie_len;
113119957bb3SJohannes Berg 	u16 reason_code;
1132d5cdfacbSJouni Malinen 	bool local_state_change;
1133636a5d36SJouni Malinen };
1134636a5d36SJouni Malinen 
1135636a5d36SJouni Malinen /**
113604a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
113704a773adSJohannes Berg  *
113804a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
113904a773adSJohannes Berg  * method.
114004a773adSJohannes Berg  *
114104a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
114204a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
114304a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
114404a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
114504a773adSJohannes Berg  * @channel: The channel to use if no IBSS can be found to join.
114615f0ebc2SRandy Dunlap  * @channel_type: channel type (HT mode)
114704a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
114804a773adSJohannes Berg  *	IBSSs to join on other channels.
114904a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
115004a773adSJohannes Berg  * @ie_len: length of that
11518e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1152fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1153fffd0934SJohannes Berg  *	after joining
1154fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1155dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
115604a773adSJohannes Berg  */
115704a773adSJohannes Berg struct cfg80211_ibss_params {
115804a773adSJohannes Berg 	u8 *ssid;
115904a773adSJohannes Berg 	u8 *bssid;
116004a773adSJohannes Berg 	struct ieee80211_channel *channel;
116154858ee5SAlexander Simon 	enum nl80211_channel_type channel_type;
116204a773adSJohannes Berg 	u8 *ie;
116304a773adSJohannes Berg 	u8 ssid_len, ie_len;
11648e30bc55SJohannes Berg 	u16 beacon_interval;
1165fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
116604a773adSJohannes Berg 	bool channel_fixed;
1167fffd0934SJohannes Berg 	bool privacy;
1168dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
116904a773adSJohannes Berg };
117004a773adSJohannes Berg 
117104a773adSJohannes Berg /**
1172b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1173b23aa676SSamuel Ortiz  *
1174b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1175b23aa676SSamuel Ortiz  * authentication and association.
1176b23aa676SSamuel Ortiz  *
1177b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1178b23aa676SSamuel Ortiz  *	on scan results)
1179b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1180b23aa676SSamuel Ortiz  *	results)
1181b23aa676SSamuel Ortiz  * @ssid: SSID
1182b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1183b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1184abe37c4bSJohannes Berg  * @ie: IEs for association request
1185abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1186b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1187b23aa676SSamuel Ortiz  * @crypto: crypto settings
1188fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1189fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1190fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
11917e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
11927e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
11937e7c8926SBen Greear  *   will be used in ht_capa.  Un-supported values will be ignored.
11947e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1195b23aa676SSamuel Ortiz  */
1196b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1197b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1198b23aa676SSamuel Ortiz 	u8 *bssid;
1199b23aa676SSamuel Ortiz 	u8 *ssid;
1200b23aa676SSamuel Ortiz 	size_t ssid_len;
1201b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1202b23aa676SSamuel Ortiz 	u8 *ie;
1203b23aa676SSamuel Ortiz 	size_t ie_len;
1204b23aa676SSamuel Ortiz 	bool privacy;
1205b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1206fffd0934SJohannes Berg 	const u8 *key;
1207fffd0934SJohannes Berg 	u8 key_len, key_idx;
12087e7c8926SBen Greear 	u32 flags;
12097e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
12107e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1211b23aa676SSamuel Ortiz };
1212b23aa676SSamuel Ortiz 
1213b23aa676SSamuel Ortiz /**
1214b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1215abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1216abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1217abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1218abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1219abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1220b9a5f8caSJouni Malinen  */
1221b9a5f8caSJouni Malinen enum wiphy_params_flags {
1222b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1223b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1224b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1225b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
122681077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1227b9a5f8caSJouni Malinen };
1228b9a5f8caSJouni Malinen 
12299930380fSJohannes Berg /*
12309930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
12319930380fSJohannes Berg  */
12329930380fSJohannes Berg struct cfg80211_bitrate_mask {
12339930380fSJohannes Berg 	struct {
12349930380fSJohannes Berg 		u32 legacy;
1235*24db78c0SSimon Wunderlich 		u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
12369930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
12379930380fSJohannes Berg };
123867fbb16bSSamuel Ortiz /**
123967fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
124067fbb16bSSamuel Ortiz  *
124167fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
124267fbb16bSSamuel Ortiz  * caching.
124367fbb16bSSamuel Ortiz  *
124467fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
124567fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
124667fbb16bSSamuel Ortiz  */
124767fbb16bSSamuel Ortiz struct cfg80211_pmksa {
124867fbb16bSSamuel Ortiz 	u8 *bssid;
124967fbb16bSSamuel Ortiz 	u8 *pmkid;
125067fbb16bSSamuel Ortiz };
12519930380fSJohannes Berg 
12527643a2c3SJohannes Berg /**
1253ff1b6e69SJohannes Berg  * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
1254ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1255ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1256ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1257ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1258ff1b6e69SJohannes Berg  *
1259ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1260ff1b6e69SJohannes Berg  * memory, free @mask only!
1261ff1b6e69SJohannes Berg  */
1262ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern {
1263ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1264ff1b6e69SJohannes Berg 	int pattern_len;
1265ff1b6e69SJohannes Berg };
1266ff1b6e69SJohannes Berg 
1267ff1b6e69SJohannes Berg /**
1268ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1269ff1b6e69SJohannes Berg  *
1270ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1271ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1272ff1b6e69SJohannes Berg  *	operating as normal during suspend
1273ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1274ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1275ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1276ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
127777dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
127877dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
127977dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
128077dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
1281ff1b6e69SJohannes Berg  */
1282ff1b6e69SJohannes Berg struct cfg80211_wowlan {
128377dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
128477dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
128577dbbb13SJohannes Berg 	     rfkill_release;
1286ff1b6e69SJohannes Berg 	struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1287ff1b6e69SJohannes Berg 	int n_patterns;
1288ff1b6e69SJohannes Berg };
1289ff1b6e69SJohannes Berg 
1290ff1b6e69SJohannes Berg /**
1291e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1292e5497d76SJohannes Berg  * @kek: key encryption key
1293e5497d76SJohannes Berg  * @kck: key confirmation key
1294e5497d76SJohannes Berg  * @replay_ctr: replay counter
1295e5497d76SJohannes Berg  */
1296e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1297e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1298e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1299e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1300e5497d76SJohannes Berg };
1301e5497d76SJohannes Berg 
1302e5497d76SJohannes Berg /**
1303704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1304704232c2SJohannes Berg  *
1305704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1306704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1307704232c2SJohannes Berg  *
1308704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1309704232c2SJohannes Berg  * on success or a negative error code.
1310704232c2SJohannes Berg  *
131143fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
131243fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
131343fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
131443fb45cbSJohannes Berg  *
1315ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1316ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1317ff1b6e69SJohannes Berg  *	configured for the device.
13180378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
13190378b3f1SJohannes Berg  *
132060719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1321463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
1322f9e10ce4SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the netdev,
1323f9e10ce4SJohannes Berg  *	or an ERR_PTR.
1324704232c2SJohannes Berg  *
1325704232c2SJohannes Berg  * @del_virtual_intf: remove the virtual interface determined by ifindex.
132655682965SJohannes Berg  *
132760719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
132860719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
132955682965SJohannes Berg  *
133041ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
133141ade00fSJohannes Berg  *	when adding a group key.
133241ade00fSJohannes Berg  *
133341ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
133441ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
133541ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1336e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1337e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
133841ade00fSJohannes Berg  *
133941ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1340e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
134141ade00fSJohannes Berg  *
134241ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1343ed1b6cc7SJohannes Berg  *
13443cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
13453cfcf6acSJouni Malinen  *
1346e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1347e5497d76SJohannes Berg  *
1348ed1b6cc7SJohannes Berg  * @add_beacon: Add a beacon with given parameters, @head, @interval
1349ed1b6cc7SJohannes Berg  *	and @dtim_period will be valid, @tail is optional.
1350ed1b6cc7SJohannes Berg  * @set_beacon: Change the beacon parameters for an access point mode
1351ed1b6cc7SJohannes Berg  *	interface. This should reject the call when no beacon has been
1352ed1b6cc7SJohannes Berg  *	configured.
1353ed1b6cc7SJohannes Berg  * @del_beacon: Remove beacon configuration and stop sending the beacon.
13545727ef1bSJohannes Berg  *
13555727ef1bSJohannes Berg  * @add_station: Add a new station.
13565727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
1357bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
1358bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
1359bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
1360bdd90d5eSJohannes Berg  *	them, also against the existing state! Also, supported_rates changes are
1361bdd90d5eSJohannes Berg  *	not checked in station mode -- drivers need to reject (or ignore) them
1362bdd90d5eSJohannes Berg  *	for anything but TDLS peers.
1363abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
1364abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
1365abe37c4bSJohannes Berg  *
1366abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
1367abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
1368abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
1369abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
1370abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1371f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
1372f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
13732ec600d6SLuis Carlos Cobo  *
137424bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
137593da9cc1Scolin@cozybit.com  *
137624bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
137793da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
137893da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
137993da9cc1Scolin@cozybit.com  *
13809f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
138131888487SJouni Malinen  *
138231888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
138372bdcf34SJouni Malinen  *
1384f444de05SJohannes Berg  * @set_channel: Set channel for a given wireless interface. Some devices
1385f444de05SJohannes Berg  *	may support multi-channel operation (by channel hopping) so cfg80211
1386f444de05SJohannes Berg  *	doesn't verify much. Note, however, that the passed netdev may be
1387f444de05SJohannes Berg  *	%NULL as well if the user requested changing the channel for the
1388f444de05SJohannes Berg  *	device itself, or for a monitor interface.
1389e999882aSJohannes Berg  * @get_channel: Get the current operating channel, should return %NULL if
1390e999882aSJohannes Berg  *	there's no single defined operating channel if for example the
1391e999882aSJohannes Berg  *	device implements channel hopping for multi-channel virtual interfaces.
13929aed3cc1SJouni Malinen  *
13932a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
13942a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
13952a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
13962a519311SJohannes Berg  *	the scan/scan_done bracket too.
1397636a5d36SJouni Malinen  *
1398636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
1399636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
1400636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
1401636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
140204a773adSJohannes Berg  *
1403b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
1404b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1405b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
1406b23aa676SSamuel Ortiz  *	with the status from the AP.
1407b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
1408b23aa676SSamuel Ortiz  *
140904a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
141004a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
141104a773adSJohannes Berg  *	to a merge.
141204a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
1413b9a5f8caSJouni Malinen  *
1414b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
1415b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
1416b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
1417b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
14187643a2c3SJohannes Berg  *
14191432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
14201432de07SLuis R. Rodriguez  *	the power passed is in mBm, to get dBm use MBM_TO_DBM().
14217643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
14221f87f7d3SJohannes Berg  *	return 0 if successful
14231f87f7d3SJohannes Berg  *
1424abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
1425abe37c4bSJohannes Berg  *
14261f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
14271f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
1428aff89a9bSJohannes Berg  *
142961fa713cSHolger Schurig  * @dump_survey: get site survey information.
143061fa713cSHolger Schurig  *
14319588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
14329588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
14339588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
14349588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
14359588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
14369588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
14379588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
14389588bbd5SJouni Malinen  *	the duration value.
1439f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
1440f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
1441f7ca38dfSJohannes Berg  *	frame on another channel
14429588bbd5SJouni Malinen  *
1443aff89a9bSJohannes Berg  * @testmode_cmd: run a test mode command
144471063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
144571063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
144671063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
144771063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
144871063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
144971063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
145067fbb16bSSamuel Ortiz  *
1451abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
1452abe37c4bSJohannes Berg  *
145367fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
145467fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
145567fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
145667fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
145767fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
14589043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
14599043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
1460d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1461807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
1462807f8a8cSLuciano Coelho  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled
1463807f8a8cSLuciano Coelho  *	scan.  The driver_initiated flag specifies whether the driver
1464807f8a8cSLuciano Coelho  *	itself has informed that the scan has stopped.
146567fbb16bSSamuel Ortiz  *
1466271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
1467271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
1468271733cfSJohannes Berg  *	concurrently with itself.
1469547025d5SBruno Randolf  *
1470547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1471547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1472547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
1473547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1474547025d5SBruno Randolf  *
1475547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
14763677713bSJohn W. Linville  *
14773677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
14783677713bSJohn W. Linville  *
14793677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
1480109086ceSArik Nemtsov  *
1481109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
1482109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
14837f6cf311SJohannes Berg  *
14847f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
14857f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
14861d9d9213SSimon Wunderlich  *
14871d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
1488704232c2SJohannes Berg  */
1489704232c2SJohannes Berg struct cfg80211_ops {
1490ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
14910378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
14920378b3f1SJohannes Berg 
1493f9e10ce4SJohannes Berg 	struct net_device * (*add_virtual_intf)(struct wiphy *wiphy,
1494f9e10ce4SJohannes Berg 						char *name,
1495f9e10ce4SJohannes Berg 						enum nl80211_iftype type,
1496f9e10ce4SJohannes Berg 						u32 *flags,
14972ec600d6SLuis Carlos Cobo 						struct vif_params *params);
1498463d0183SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);
1499e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
1500e36d56b6SJohannes Berg 				       struct net_device *dev,
15012ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
15022ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
150341ade00fSJohannes Berg 
150441ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1505e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
150641ade00fSJohannes Berg 			   struct key_params *params);
150741ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1508e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
1509e31b8213SJohannes Berg 			   void *cookie,
151041ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
151141ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1512e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
151341ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
151441ade00fSJohannes Berg 				   struct net_device *netdev,
1515dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
15163cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
15173cfcf6acSJouni Malinen 					struct net_device *netdev,
15183cfcf6acSJouni Malinen 					u8 key_index);
1519ed1b6cc7SJohannes Berg 
1520ed1b6cc7SJohannes Berg 	int	(*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
1521ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
1522ed1b6cc7SJohannes Berg 	int	(*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
1523ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
1524ed1b6cc7SJohannes Berg 	int	(*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
15255727ef1bSJohannes Berg 
15265727ef1bSJohannes Berg 
15275727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
15285727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
15295727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
15305727ef1bSJohannes Berg 			       u8 *mac);
15315727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
15325727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
1533fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
15342ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
15352ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
15362ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
15372ec600d6SLuis Carlos Cobo 
15382ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
15392ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
15402ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
15412ec600d6SLuis Carlos Cobo 			       u8 *dst);
15422ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
15432ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
15442ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
15452ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
15462ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
15472ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
15482ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
15492ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
155024bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
155193da9cc1Scolin@cozybit.com 				struct net_device *dev,
155293da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
155324bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
155429cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
155529cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
155629cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
155729cbe68cSJohannes Berg 			     const struct mesh_config *conf,
155829cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
155929cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
156029cbe68cSJohannes Berg 
15619f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
15629f1ba906SJouni Malinen 			      struct bss_parameters *params);
156331888487SJouni Malinen 
1564f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
156531888487SJouni Malinen 				  struct ieee80211_txq_params *params);
156672bdcf34SJouni Malinen 
1567f444de05SJohannes Berg 	int	(*set_channel)(struct wiphy *wiphy, struct net_device *dev,
156872bdcf34SJouni Malinen 			       struct ieee80211_channel *chan,
1569094d05dcSSujith 			       enum nl80211_channel_type channel_type);
15709aed3cc1SJouni Malinen 
15712a519311SJohannes Berg 	int	(*scan)(struct wiphy *wiphy, struct net_device *dev,
15722a519311SJohannes Berg 			struct cfg80211_scan_request *request);
1573636a5d36SJouni Malinen 
1574636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
1575636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
1576636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
1577636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
1578636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
1579667503ddSJohannes Berg 			  struct cfg80211_deauth_request *req,
1580667503ddSJohannes Berg 			  void *cookie);
1581636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1582667503ddSJohannes Berg 			    struct cfg80211_disassoc_request *req,
1583667503ddSJohannes Berg 			    void *cookie);
158404a773adSJohannes Berg 
1585b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
1586b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
1587b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1588b23aa676SSamuel Ortiz 			      u16 reason_code);
1589b23aa676SSamuel Ortiz 
159004a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
159104a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
159204a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1593b9a5f8caSJouni Malinen 
1594b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
15957643a2c3SJohannes Berg 
15967643a2c3SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy,
1597fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
15987643a2c3SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, int *dbm);
15991f87f7d3SJohannes Berg 
1600ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1601388ac775SJohannes Berg 				const u8 *addr);
1602ab737a4fSJohannes Berg 
16031f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
1604aff89a9bSJohannes Berg 
1605aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
1606aff89a9bSJohannes Berg 	int	(*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
160771063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
160871063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
160971063f0eSWey-Yi Guy 				 void *data, int len);
1610aff89a9bSJohannes Berg #endif
1611bc92afd9SJohannes Berg 
16129930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
16139930380fSJohannes Berg 				    struct net_device *dev,
16149930380fSJohannes Berg 				    const u8 *peer,
16159930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
16169930380fSJohannes Berg 
161761fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
161861fa713cSHolger Schurig 			int idx, struct survey_info *info);
161961fa713cSHolger Schurig 
162067fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
162167fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
162267fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
162367fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
162467fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
162567fbb16bSSamuel Ortiz 
16269588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
16279588bbd5SJouni Malinen 				     struct net_device *dev,
16289588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
16299588bbd5SJouni Malinen 				     enum nl80211_channel_type channel_type,
16309588bbd5SJouni Malinen 				     unsigned int duration,
16319588bbd5SJouni Malinen 				     u64 *cookie);
16329588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
16339588bbd5SJouni Malinen 					    struct net_device *dev,
16349588bbd5SJouni Malinen 					    u64 cookie);
16359588bbd5SJouni Malinen 
16362e161f78SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev,
1637f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
1638026331c4SJouni Malinen 			  enum nl80211_channel_type channel_type,
1639f7ca38dfSJohannes Berg 			  bool channel_type_valid, unsigned int wait,
1640e9f935e3SRajkumar Manoharan 			  const u8 *buf, size_t len, bool no_cck,
1641e247bd90SJohannes Berg 			  bool dont_wait_for_ack, u64 *cookie);
1642f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1643f7ca38dfSJohannes Berg 				       struct net_device *dev,
1644f7ca38dfSJohannes Berg 				       u64 cookie);
1645026331c4SJouni Malinen 
1646bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1647bc92afd9SJohannes Berg 				  bool enabled, int timeout);
1648d6dc1a38SJuuso Oikarinen 
1649d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
1650d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
1651d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
1652271733cfSJohannes Berg 
1653271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
1654271733cfSJohannes Berg 				       struct net_device *dev,
1655271733cfSJohannes Berg 				       u16 frame_type, bool reg);
1656afe0cbf8SBruno Randolf 
1657afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1658afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
16593677713bSJohn W. Linville 
16603677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
16613677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
16623677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1663807f8a8cSLuciano Coelho 
1664807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
1665807f8a8cSLuciano Coelho 				struct net_device *dev,
1666807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
166785a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
1668e5497d76SJohannes Berg 
1669e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
1670e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
1671109086ceSArik Nemtsov 
1672109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1673109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
1674109086ceSArik Nemtsov 			     u16 status_code, const u8 *buf, size_t len);
1675109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1676109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
16777f6cf311SJohannes Berg 
16787f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
16797f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
1680e999882aSJohannes Berg 
16811d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
16821d9d9213SSimon Wunderlich 				  struct net_device *dev,
16831d9d9213SSimon Wunderlich 				  u16 noack_map);
16841d9d9213SSimon Wunderlich 
1685e999882aSJohannes Berg 	struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
1686704232c2SJohannes Berg };
1687704232c2SJohannes Berg 
1688d3236553SJohannes Berg /*
1689d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
1690d3236553SJohannes Berg  * and registration/helper functions
1691d3236553SJohannes Berg  */
1692d3236553SJohannes Berg 
1693d3236553SJohannes Berg /**
16945be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
16955be83de5SJohannes Berg  *
16965be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
1697d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
1698d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
1699d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
1700d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
17015be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
17025be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
1703749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
1704749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
1705749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
1706749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
1707749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
1708749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
1709749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
1710061acaaeSLuis R. Rodriguez  *	outside of its regulatory domain. If used in combination with
1711061acaaeSLuis R. Rodriguez  *	WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
1712061acaaeSLuis R. Rodriguez  *	will be followed.
17135be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
17145be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
17155be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
171637184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
17175be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
17185be83de5SJohannes Berg  *	wiphy at all
17197527a782SJohannes Berg  * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface
17207527a782SJohannes Berg  *	combinations for this device. This flag is used for backward
17217527a782SJohannes Berg  *	compatibility only until all drivers advertise combinations and
17227527a782SJohannes Berg  *	they will always be enforced.
17235be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
17245be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
17255be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
17265be83de5SJohannes Berg  *	reason to override the default
17279bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
17289bc383deSJohannes Berg  *	on a VLAN interface)
17299bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
1730c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
1731c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
1732c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
1733e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
173415d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
173515d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
17361ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
1737f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
1738f4b34b55SVivek Natarajan  *	firmware.
1739cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
1740109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
1741109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
1742109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
1743109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
1744109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
1745109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
1746562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
17475e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
17485e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
17495e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
175087bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
175187bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
17527c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
17537c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
17545be83de5SJohannes Berg  */
17555be83de5SJohannes Berg enum wiphy_flags {
17565be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
17575be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
17585be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
17595be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
17605be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
17619bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
17629bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
1763c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
1764309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
176515d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
1766807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
17677527a782SJohannes Berg 	WIPHY_FLAG_ENFORCE_COMBINATIONS		= BIT(12),
1768f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
1769cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
1770109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
1771109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
1772562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
17735e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
177487bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
17757c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
17767c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
17777527a782SJohannes Berg };
17787527a782SJohannes Berg 
17797527a782SJohannes Berg /**
17807527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
17817527a782SJohannes Berg  * @max: maximum number of interfaces of these types
17827527a782SJohannes Berg  * @types: interface types (bits)
17837527a782SJohannes Berg  */
17847527a782SJohannes Berg struct ieee80211_iface_limit {
17857527a782SJohannes Berg 	u16 max;
17867527a782SJohannes Berg 	u16 types;
17877527a782SJohannes Berg };
17887527a782SJohannes Berg 
17897527a782SJohannes Berg /**
17907527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
17917527a782SJohannes Berg  * @limits: limits for the given interface types
17927527a782SJohannes Berg  * @n_limits: number of limitations
17937527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
17947527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
17957527a782SJohannes Berg  *	group
17967527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
17977527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
17987527a782SJohannes Berg  *	only in special cases.
17997527a782SJohannes Berg  *
18007527a782SJohannes Berg  * These examples can be expressed as follows:
18017527a782SJohannes Berg  *
18027527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
18037527a782SJohannes Berg  *
18047527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
18057527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
18067527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
18077527a782SJohannes Berg  *  };
18087527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
18097527a782SJohannes Berg  *	.limits = limits1,
18107527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
18117527a782SJohannes Berg  *	.max_interfaces = 2,
18127527a782SJohannes Berg  *	.beacon_int_infra_match = true,
18137527a782SJohannes Berg  *  };
18147527a782SJohannes Berg  *
18157527a782SJohannes Berg  *
18167527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
18177527a782SJohannes Berg  *
18187527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
18197527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
18207527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
18217527a782SJohannes Berg  *  };
18227527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
18237527a782SJohannes Berg  *	.limits = limits2,
18247527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
18257527a782SJohannes Berg  *	.max_interfaces = 8,
18267527a782SJohannes Berg  *	.num_different_channels = 1,
18277527a782SJohannes Berg  *  };
18287527a782SJohannes Berg  *
18297527a782SJohannes Berg  *
18307527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
18317527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
18327527a782SJohannes Berg  *
18337527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
18347527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
18357527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
18367527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
18377527a782SJohannes Berg  *  };
18387527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
18397527a782SJohannes Berg  *	.limits = limits3,
18407527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
18417527a782SJohannes Berg  *	.max_interfaces = 4,
18427527a782SJohannes Berg  *	.num_different_channels = 2,
18437527a782SJohannes Berg  *  };
18447527a782SJohannes Berg  */
18457527a782SJohannes Berg struct ieee80211_iface_combination {
18467527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
18477527a782SJohannes Berg 	u32 num_different_channels;
18487527a782SJohannes Berg 	u16 max_interfaces;
18497527a782SJohannes Berg 	u8 n_limits;
18507527a782SJohannes Berg 	bool beacon_int_infra_match;
18515be83de5SJohannes Berg };
18525be83de5SJohannes Berg 
1853ef15aac6SJohannes Berg struct mac_address {
1854ef15aac6SJohannes Berg 	u8 addr[ETH_ALEN];
1855ef15aac6SJohannes Berg };
1856ef15aac6SJohannes Berg 
18572e161f78SJohannes Berg struct ieee80211_txrx_stypes {
18582e161f78SJohannes Berg 	u16 tx, rx;
18592e161f78SJohannes Berg };
18602e161f78SJohannes Berg 
18615be83de5SJohannes Berg /**
1862ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
1863ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
1864ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
1865ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
1866ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
1867ff1b6e69SJohannes Berg  *	packet should be preserved in that case
1868ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
1869ff1b6e69SJohannes Berg  *	(see nl80211.h)
1870ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
187177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
187277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
187377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
187477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
187577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
1876ff1b6e69SJohannes Berg  */
1877ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
1878ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
1879ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
1880ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
188177dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
188277dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
188377dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
188477dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
188577dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
1886ff1b6e69SJohannes Berg };
1887ff1b6e69SJohannes Berg 
1888ff1b6e69SJohannes Berg /**
1889ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
1890ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
1891ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
1892ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
1893ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
1894ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
1895ff1b6e69SJohannes Berg  */
1896ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
1897ff1b6e69SJohannes Berg 	u32 flags;
1898ff1b6e69SJohannes Berg 	int n_patterns;
1899ff1b6e69SJohannes Berg 	int pattern_max_len;
1900ff1b6e69SJohannes Berg 	int pattern_min_len;
1901ff1b6e69SJohannes Berg };
1902ff1b6e69SJohannes Berg 
1903ff1b6e69SJohannes Berg /**
19045be83de5SJohannes Berg  * struct wiphy - wireless hardware description
19052784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
19062784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
19072784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
1908d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
1909d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
1910d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
1911d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
1912d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
1913d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
1914d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
1915b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
1916b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
1917b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
1918b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
1919b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1920abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
1921ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
1922ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
1923ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
1924ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
1925ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
1926ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
1927ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
1928ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
1929ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
1930ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
1931ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
1932ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
1933fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
1934fd235913SRandy Dunlap  *	unregister hardware
1935abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
1936abe37c4bSJohannes Berg  *	automatically on wiphy renames
1937abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
19384a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
1939abe37c4bSJohannes Berg  * @wext: wireless extension handlers
1940abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
1941abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
1942abe37c4bSJohannes Berg  *	must be set by driver
19437527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
19447527a782SJohannes Berg  *	list single interface types.
19457527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
19467527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
19477527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
1948abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
19491f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
1950abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
1951abe37c4bSJohannes Berg  *	this variable determines its size
1952abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
1953abe37c4bSJohannes Berg  *	any given scan
195493b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
195593b6aa69SLuciano Coelho  *	for in any given scheduled scan
1956a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
1957a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
1958a1f1c21cSLuciano Coelho  *	supported.
1959abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
1960abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
1961abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
19625a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
19635a865badSLuciano Coelho  *	scans
1964abe37c4bSJohannes Berg  * @coverage_class: current coverage class
1965abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
1966abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
1967abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
1968abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
1969abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
1970abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
19712e161f78SJohannes Berg  *
19722e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
19732e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
19742e161f78SJohannes Berg  *	type
1975a7ffac95SBruno Randolf  *
19767f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
19777f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
19787f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
19797f531e03SBruno Randolf  *
19807f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
19817f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
19827f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
1983a293911dSJohannes Berg  *
198415f0ebc2SRandy Dunlap  * @probe_resp_offload:
198515f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
198615f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
198715f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
198815f0ebc2SRandy Dunlap  *
1989a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
1990a293911dSJohannes Berg  *	may request, if implemented.
1991ff1b6e69SJohannes Berg  *
1992ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
1993562a7480SJohannes Berg  *
1994562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
19957e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
19967e7c8926SBen Greear  *	If null, then none can be over-ridden.
1997d3236553SJohannes Berg  */
1998d3236553SJohannes Berg struct wiphy {
1999d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2000d3236553SJohannes Berg 
2001ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2002d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2003ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2004ef15aac6SJohannes Berg 
2005ef15aac6SJohannes Berg 	struct mac_address *addresses;
2006d3236553SJohannes Berg 
20072e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
20082e161f78SJohannes Berg 
20097527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
20107527a782SJohannes Berg 	int n_iface_combinations;
20117527a782SJohannes Berg 	u16 software_iftypes;
20127527a782SJohannes Berg 
20132e161f78SJohannes Berg 	u16 n_addresses;
20142e161f78SJohannes Berg 
2015d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2016d3236553SJohannes Berg 	u16 interface_modes;
2017d3236553SJohannes Berg 
20181f074bd8SJohannes Berg 	u32 flags, features;
2019463d0183SJohannes Berg 
2020562a7480SJohannes Berg 	u32 ap_sme_capa;
2021562a7480SJohannes Berg 
2022d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2023d3236553SJohannes Berg 
2024d3236553SJohannes Berg 	int bss_priv_size;
2025d3236553SJohannes Berg 	u8 max_scan_ssids;
202693b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2027a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2028d3236553SJohannes Berg 	u16 max_scan_ie_len;
20295a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2030d3236553SJohannes Berg 
2031d3236553SJohannes Berg 	int n_cipher_suites;
2032d3236553SJohannes Berg 	const u32 *cipher_suites;
2033d3236553SJohannes Berg 
2034b9a5f8caSJouni Malinen 	u8 retry_short;
2035b9a5f8caSJouni Malinen 	u8 retry_long;
2036b9a5f8caSJouni Malinen 	u32 frag_threshold;
2037b9a5f8caSJouni Malinen 	u32 rts_threshold;
203881077e82SLukáš Turek 	u8 coverage_class;
2039b9a5f8caSJouni Malinen 
2040dfce95f5SKalle Valo 	char fw_version[ETHTOOL_BUSINFO_LEN];
2041dfce95f5SKalle Valo 	u32 hw_version;
2042dfce95f5SKalle Valo 
2043ff1b6e69SJohannes Berg 	struct wiphy_wowlan_support wowlan;
2044ff1b6e69SJohannes Berg 
2045a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2046a293911dSJohannes Berg 
204767fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
204867fbb16bSSamuel Ortiz 
20497f531e03SBruno Randolf 	u32 available_antennas_tx;
20507f531e03SBruno Randolf 	u32 available_antennas_rx;
2051a7ffac95SBruno Randolf 
205287bbbe22SArik Nemtsov 	/*
205387bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
205487bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
205587bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
205687bbbe22SArik Nemtsov 	 */
205787bbbe22SArik Nemtsov 	u32 probe_resp_offload;
205887bbbe22SArik Nemtsov 
2059d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2060d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2061d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2062d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2063d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2064cf5aa2f1SDavid Kilroy 	const void *privid;
2065d3236553SJohannes Berg 
2066d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2067d3236553SJohannes Berg 
2068d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
2069d3236553SJohannes Berg 	int (*reg_notifier)(struct wiphy *wiphy,
2070d3236553SJohannes Berg 			    struct regulatory_request *request);
2071d3236553SJohannes Berg 
2072d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2073d3236553SJohannes Berg 
2074d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd;
2075d3236553SJohannes Berg 
2076d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
2077d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
2078d3236553SJohannes Berg 	struct device dev;
2079d3236553SJohannes Berg 
2080ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2081ecb44335SStanislaw Gruszka 	bool registered;
2082ecb44335SStanislaw Gruszka 
2083d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
2084d3236553SJohannes Berg 	struct dentry *debugfsdir;
2085d3236553SJohannes Berg 
20867e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
20877e7c8926SBen Greear 
2088463d0183SJohannes Berg #ifdef CONFIG_NET_NS
2089463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
2090463d0183SJohannes Berg 	struct net *_net;
2091463d0183SJohannes Berg #endif
2092463d0183SJohannes Berg 
20933d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
20943d23e349SJohannes Berg 	const struct iw_handler_def *wext;
20953d23e349SJohannes Berg #endif
20963d23e349SJohannes Berg 
2097d3236553SJohannes Berg 	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
2098d3236553SJohannes Berg };
2099d3236553SJohannes Berg 
2100463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
2101463d0183SJohannes Berg {
2102c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
2103463d0183SJohannes Berg }
2104463d0183SJohannes Berg 
2105463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2106463d0183SJohannes Berg {
2107c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
2108463d0183SJohannes Berg }
2109463d0183SJohannes Berg 
2110d3236553SJohannes Berg /**
2111d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
2112d3236553SJohannes Berg  *
2113d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
2114d3236553SJohannes Berg  */
2115d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
2116d3236553SJohannes Berg {
2117d3236553SJohannes Berg 	BUG_ON(!wiphy);
2118d3236553SJohannes Berg 	return &wiphy->priv;
2119d3236553SJohannes Berg }
2120d3236553SJohannes Berg 
2121d3236553SJohannes Berg /**
2122f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
2123f1f74825SDavid Kilroy  *
2124f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
2125f1f74825SDavid Kilroy  */
2126f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
2127f1f74825SDavid Kilroy {
2128f1f74825SDavid Kilroy 	BUG_ON(!priv);
2129f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
2130f1f74825SDavid Kilroy }
2131f1f74825SDavid Kilroy 
2132f1f74825SDavid Kilroy /**
2133d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
2134d3236553SJohannes Berg  *
2135d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
2136d3236553SJohannes Berg  * @dev: The device to parent it to
2137d3236553SJohannes Berg  */
2138d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2139d3236553SJohannes Berg {
2140d3236553SJohannes Berg 	wiphy->dev.parent = dev;
2141d3236553SJohannes Berg }
2142d3236553SJohannes Berg 
2143d3236553SJohannes Berg /**
2144d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
2145d3236553SJohannes Berg  *
2146d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
2147d3236553SJohannes Berg  */
2148d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
2149d3236553SJohannes Berg {
2150d3236553SJohannes Berg 	return wiphy->dev.parent;
2151d3236553SJohannes Berg }
2152d3236553SJohannes Berg 
2153d3236553SJohannes Berg /**
2154d3236553SJohannes Berg  * wiphy_name - get wiphy name
2155d3236553SJohannes Berg  *
2156d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
2157d3236553SJohannes Berg  */
2158e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
2159d3236553SJohannes Berg {
2160d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
2161d3236553SJohannes Berg }
2162d3236553SJohannes Berg 
2163d3236553SJohannes Berg /**
2164d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
2165d3236553SJohannes Berg  *
2166d3236553SJohannes Berg  * @ops: The configuration operations for this device
2167d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
2168d3236553SJohannes Berg  *
2169d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
2170d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
2171d3236553SJohannes Berg  *
2172d3236553SJohannes Berg  * The returned pointer must be assigned to each netdev's
2173d3236553SJohannes Berg  * ieee80211_ptr for proper operation.
2174d3236553SJohannes Berg  */
21753dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2176d3236553SJohannes Berg 
2177d3236553SJohannes Berg /**
2178d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
2179d3236553SJohannes Berg  *
2180d3236553SJohannes Berg  * @wiphy: The wiphy to register.
2181d3236553SJohannes Berg  *
2182d3236553SJohannes Berg  * Returns a non-negative wiphy index or a negative error code.
2183d3236553SJohannes Berg  */
2184d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
2185d3236553SJohannes Berg 
2186d3236553SJohannes Berg /**
2187d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
2188d3236553SJohannes Berg  *
2189d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
2190d3236553SJohannes Berg  *
2191d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
2192d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
2193d3236553SJohannes Berg  * request that is being handled.
2194d3236553SJohannes Berg  */
2195d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
2196d3236553SJohannes Berg 
2197d3236553SJohannes Berg /**
2198d3236553SJohannes Berg  * wiphy_free - free wiphy
2199d3236553SJohannes Berg  *
2200d3236553SJohannes Berg  * @wiphy: The wiphy to free
2201d3236553SJohannes Berg  */
2202d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
2203d3236553SJohannes Berg 
2204fffd0934SJohannes Berg /* internal structs */
22056829c878SJohannes Berg struct cfg80211_conn;
220619957bb3SJohannes Berg struct cfg80211_internal_bss;
2207fffd0934SJohannes Berg struct cfg80211_cached_keys;
220819957bb3SJohannes Berg 
220919957bb3SJohannes Berg #define MAX_AUTH_BSSES		4
22106829c878SJohannes Berg 
2211d3236553SJohannes Berg /**
2212d3236553SJohannes Berg  * struct wireless_dev - wireless per-netdev state
2213d3236553SJohannes Berg  *
2214d3236553SJohannes Berg  * This structure must be allocated by the driver/stack
2215d3236553SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device
2216d3236553SJohannes Berg  * (this is intentional so it can be allocated along with
2217d3236553SJohannes Berg  * the netdev.)
2218d3236553SJohannes Berg  *
2219d3236553SJohannes Berg  * @wiphy: pointer to hardware description
2220d3236553SJohannes Berg  * @iftype: interface type
2221d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
2222d3236553SJohannes Berg  * @netdev: (private) Used to reference back to the netdev
2223d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
2224f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
2225f444de05SJohannes Berg  *	user-set AP, monitor and WDS channels for wireless extensions
2226d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
2227d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
2228d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
222929cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
223029cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
2231d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
22329bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
22339bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
22349bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
22359bc383deSJohannes Berg  *	by cfg80211 on change_interface
22362e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
22372e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
2238abe37c4bSJohannes Berg  * @mtx: mutex used to lock data in this struct
2239abe37c4bSJohannes Berg  * @cleanup_work: work struct used for cleanup that can't be done directly
224056d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
224156d1893dSJohannes Berg  *	beacons, 0 when not valid
2242d3236553SJohannes Berg  */
2243d3236553SJohannes Berg struct wireless_dev {
2244d3236553SJohannes Berg 	struct wiphy *wiphy;
2245d3236553SJohannes Berg 	enum nl80211_iftype iftype;
2246d3236553SJohannes Berg 
2247667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
2248d3236553SJohannes Berg 	struct list_head list;
2249d3236553SJohannes Berg 	struct net_device *netdev;
2250d3236553SJohannes Berg 
22512e161f78SJohannes Berg 	struct list_head mgmt_registrations;
22522e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
2253026331c4SJouni Malinen 
2254667503ddSJohannes Berg 	struct mutex mtx;
2255667503ddSJohannes Berg 
2256ad002395SJohannes Berg 	struct work_struct cleanup_work;
2257ad002395SJohannes Berg 
22589bc383deSJohannes Berg 	bool use_4addr;
22599bc383deSJohannes Berg 
2260b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
2261d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
226229cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
2263b23aa676SSamuel Ortiz 	enum {
2264b23aa676SSamuel Ortiz 		CFG80211_SME_IDLE,
22656829c878SJohannes Berg 		CFG80211_SME_CONNECTING,
2266b23aa676SSamuel Ortiz 		CFG80211_SME_CONNECTED,
2267b23aa676SSamuel Ortiz 	} sme_state;
22686829c878SJohannes Berg 	struct cfg80211_conn *conn;
2269fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
2270d3236553SJohannes Berg 
2271667503ddSJohannes Berg 	struct list_head event_list;
2272667503ddSJohannes Berg 	spinlock_t event_lock;
2273667503ddSJohannes Berg 
227419957bb3SJohannes Berg 	struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
227519957bb3SJohannes Berg 	struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
227619957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
2277f444de05SJohannes Berg 	struct ieee80211_channel *channel;
227819957bb3SJohannes Berg 
2279ffb9eb3dSKalle Valo 	bool ps;
2280ffb9eb3dSKalle Valo 	int ps_timeout;
2281ffb9eb3dSKalle Valo 
228256d1893dSJohannes Berg 	int beacon_interval;
228356d1893dSJohannes Berg 
228428946da7SJohannes Berg 	u32 ap_unexpected_nlpid;
228528946da7SJohannes Berg 
22863d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
2287d3236553SJohannes Berg 	/* wext data */
2288cbe8fa9cSJohannes Berg 	struct {
2289cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
2290f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
2291fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
2292f2129354SJohannes Berg 		u8 *ie;
2293f2129354SJohannes Berg 		size_t ie_len;
2294f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
2295f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
229608645126SJohannes Berg 		s8 default_key, default_mgmt_key;
2297ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
2298cbe8fa9cSJohannes Berg 	} wext;
2299d3236553SJohannes Berg #endif
2300d3236553SJohannes Berg };
2301d3236553SJohannes Berg 
2302d3236553SJohannes Berg /**
2303d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
2304d3236553SJohannes Berg  *
2305d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
2306d3236553SJohannes Berg  */
2307d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
2308d3236553SJohannes Berg {
2309d3236553SJohannes Berg 	BUG_ON(!wdev);
2310d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
2311d3236553SJohannes Berg }
2312d3236553SJohannes Berg 
2313d70e9693SJohannes Berg /**
2314d70e9693SJohannes Berg  * DOC: Utility functions
2315d70e9693SJohannes Berg  *
2316d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
2317d3236553SJohannes Berg  */
2318d3236553SJohannes Berg 
2319d3236553SJohannes Berg /**
2320d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
2321abe37c4bSJohannes Berg  * @chan: channel number
232259eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
2323d3236553SJohannes Berg  */
232459eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2325d3236553SJohannes Berg 
2326d3236553SJohannes Berg /**
2327d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
2328abe37c4bSJohannes Berg  * @freq: center frequency
2329d3236553SJohannes Berg  */
2330d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
2331d3236553SJohannes Berg 
2332d3236553SJohannes Berg /*
2333d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
2334d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
2335d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
2336d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
2337d3236553SJohannes Berg  * clash.
2338d3236553SJohannes Berg  */
2339d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2340d3236553SJohannes Berg 							 int freq);
2341d3236553SJohannes Berg /**
2342d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
2343abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
2344abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
2345d3236553SJohannes Berg  */
2346d3236553SJohannes Berg static inline struct ieee80211_channel *
2347d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
2348d3236553SJohannes Berg {
2349d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
2350d3236553SJohannes Berg }
2351d3236553SJohannes Berg 
2352d3236553SJohannes Berg /**
2353d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
2354d3236553SJohannes Berg  *
2355d3236553SJohannes Berg  * @sband: the band to look for rates in
2356d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
2357d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
2358d3236553SJohannes Berg  *
2359d3236553SJohannes Berg  * This function returns the basic rate corresponding to a given
2360d3236553SJohannes Berg  * bitrate, that is the next lower bitrate contained in the basic
2361d3236553SJohannes Berg  * rate map, which is, for this function, given as a bitmap of
2362d3236553SJohannes Berg  * indices of rates in the band's bitrate table.
2363d3236553SJohannes Berg  */
2364d3236553SJohannes Berg struct ieee80211_rate *
2365d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2366d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
2367d3236553SJohannes Berg 
2368d3236553SJohannes Berg /*
2369d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
2370d3236553SJohannes Berg  *
2371d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
2372d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
2373d3236553SJohannes Berg  */
2374d3236553SJohannes Berg 
237533e5a2f7SJohannes Berg struct radiotap_align_size {
237633e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
237733e5a2f7SJohannes Berg };
237833e5a2f7SJohannes Berg 
237933e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
238033e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
238133e5a2f7SJohannes Berg 	int n_bits;
238233e5a2f7SJohannes Berg 	uint32_t oui;
238333e5a2f7SJohannes Berg 	uint8_t subns;
238433e5a2f7SJohannes Berg };
238533e5a2f7SJohannes Berg 
238633e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
238733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
238833e5a2f7SJohannes Berg 	int n_ns;
238933e5a2f7SJohannes Berg };
239033e5a2f7SJohannes Berg 
2391d3236553SJohannes Berg /**
2392d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
239333e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
239433e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
239533e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
239633e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
239733e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
239833e5a2f7SJohannes Berg  *	the beginning of the actual data portion
239933e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
240033e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
240133e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
240233e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
240333e5a2f7SJohannes Berg  *	radiotap namespace or not
240433e5a2f7SJohannes Berg  *
240533e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
240633e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
240733e5a2f7SJohannes Berg  * @_arg_index: next argument index
240833e5a2f7SJohannes Berg  * @_arg: next argument pointer
240933e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
241033e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
241133e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
241233e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
241333e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
241433e5a2f7SJohannes Berg  *	next bitmap word
241533e5a2f7SJohannes Berg  *
241633e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
241733e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
2418d3236553SJohannes Berg  */
2419d3236553SJohannes Berg 
2420d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
242133e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
242233e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
242333e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
2424d3236553SJohannes Berg 
242533e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
242667272440SJohannes Berg 	__le32 *_next_bitmap;
242733e5a2f7SJohannes Berg 
242833e5a2f7SJohannes Berg 	unsigned char *this_arg;
242933e5a2f7SJohannes Berg 	int this_arg_index;
243033e5a2f7SJohannes Berg 	int this_arg_size;
243133e5a2f7SJohannes Berg 
243233e5a2f7SJohannes Berg 	int is_radiotap_ns;
243333e5a2f7SJohannes Berg 
243433e5a2f7SJohannes Berg 	int _max_length;
243533e5a2f7SJohannes Berg 	int _arg_index;
243633e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
243733e5a2f7SJohannes Berg 	int _reset_on_ext;
2438d3236553SJohannes Berg };
2439d3236553SJohannes Berg 
2440d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
2441d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator,
2442d3236553SJohannes Berg 	struct ieee80211_radiotap_header *radiotap_header,
244333e5a2f7SJohannes Berg 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
2444d3236553SJohannes Berg 
2445d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
2446d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator);
2447d3236553SJohannes Berg 
244833e5a2f7SJohannes Berg 
2449e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
2450e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
2451e31a16d6SZhu Yi 
2452e31a16d6SZhu Yi /**
2453e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
2454e31a16d6SZhu Yi  *
2455e31a16d6SZhu Yi  * Given an skb with a raw 802.11 header at the data pointer this function
2456e31a16d6SZhu Yi  * returns the 802.11 header length in bytes (not including encryption
2457e31a16d6SZhu Yi  * headers). If the data in the sk_buff is too short to contain a valid 802.11
2458e31a16d6SZhu Yi  * header the function returns 0.
2459e31a16d6SZhu Yi  *
2460e31a16d6SZhu Yi  * @skb: the frame
2461e31a16d6SZhu Yi  */
2462e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2463e31a16d6SZhu Yi 
2464e31a16d6SZhu Yi /**
2465e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
2466e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
2467e31a16d6SZhu Yi  */
2468633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2469e31a16d6SZhu Yi 
2470e31a16d6SZhu Yi /**
2471d70e9693SJohannes Berg  * DOC: Data path helpers
2472d70e9693SJohannes Berg  *
2473d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
2474d70e9693SJohannes Berg  * functions that help implement the data path for devices
2475d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
2476d70e9693SJohannes Berg  */
2477d70e9693SJohannes Berg 
2478d70e9693SJohannes Berg /**
2479e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
2480e31a16d6SZhu Yi  * @skb: the 802.11 data frame
2481e31a16d6SZhu Yi  * @addr: the device MAC address
2482e31a16d6SZhu Yi  * @iftype: the virtual interface type
2483e31a16d6SZhu Yi  */
2484eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2485e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
2486e31a16d6SZhu Yi 
2487e31a16d6SZhu Yi /**
2488e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
2489e31a16d6SZhu Yi  * @skb: the 802.3 frame
2490e31a16d6SZhu Yi  * @addr: the device MAC address
2491e31a16d6SZhu Yi  * @iftype: the virtual interface type
2492e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
2493e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
2494e31a16d6SZhu Yi  */
2495eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2496e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
2497e31a16d6SZhu Yi 
2498e31a16d6SZhu Yi /**
2499eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
2500eaf85ca7SZhu Yi  *
2501eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
2502eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
2503eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
2504eaf85ca7SZhu Yi  *
2505eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
2506eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
2507eaf85ca7SZhu Yi  *	initialized by by the caller.
2508eaf85ca7SZhu Yi  * @addr: The device MAC address.
2509eaf85ca7SZhu Yi  * @iftype: The device interface type.
2510eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
25118b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
2512eaf85ca7SZhu Yi  */
2513eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2514eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
25158b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
25168b3becadSYogesh Ashok Powar 			      bool has_80211_header);
2517eaf85ca7SZhu Yi 
2518eaf85ca7SZhu Yi /**
2519e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
2520e31a16d6SZhu Yi  * @skb: the data frame
2521e31a16d6SZhu Yi  */
2522e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2523e31a16d6SZhu Yi 
2524c21dbf92SJohannes Berg /**
2525c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
2526c21dbf92SJohannes Berg  *
2527c21dbf92SJohannes Berg  * @eid: element ID
2528c21dbf92SJohannes Berg  * @ies: data consisting of IEs
2529c21dbf92SJohannes Berg  * @len: length of data
2530c21dbf92SJohannes Berg  *
2531c21dbf92SJohannes Berg  * This function will return %NULL if the element ID could
2532c21dbf92SJohannes Berg  * not be found or if the element is invalid (claims to be
2533c21dbf92SJohannes Berg  * longer than the given data), or a pointer to the first byte
2534c21dbf92SJohannes Berg  * of the requested element, that is the byte containing the
2535c21dbf92SJohannes Berg  * element ID. There are no checks on the element length
2536c21dbf92SJohannes Berg  * other than having to fit into the given data.
2537c21dbf92SJohannes Berg  */
2538c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2539c21dbf92SJohannes Berg 
2540d70e9693SJohannes Berg /**
25410c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
25420c28ec58SEliad Peller  *
25430c28ec58SEliad Peller  * @oui: vendor OUI
25440c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
25450c28ec58SEliad Peller  * @ies: data consisting of IEs
25460c28ec58SEliad Peller  * @len: length of data
25470c28ec58SEliad Peller  *
25480c28ec58SEliad Peller  * This function will return %NULL if the vendor specific element ID
25490c28ec58SEliad Peller  * could not be found or if the element is invalid (claims to be
25500c28ec58SEliad Peller  * longer than the given data), or a pointer to the first byte
25510c28ec58SEliad Peller  * of the requested element, that is the byte containing the
25520c28ec58SEliad Peller  * element ID. There are no checks on the element length
25530c28ec58SEliad Peller  * other than having to fit into the given data.
25540c28ec58SEliad Peller  */
25550c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
25560c28ec58SEliad Peller 				  const u8 *ies, int len);
25570c28ec58SEliad Peller 
25580c28ec58SEliad Peller /**
2559d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
2560d70e9693SJohannes Berg  *
2561d70e9693SJohannes Berg  * TODO
2562d3236553SJohannes Berg  */
2563d3236553SJohannes Berg 
2564d3236553SJohannes Berg /**
2565d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
2566d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
2567d3236553SJohannes Berg  *	conflicts)
2568d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
2569d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
2570d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
2571d3236553SJohannes Berg  * 	alpha2.
2572d3236553SJohannes Berg  *
2573d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
2574d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
2575d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
2576d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
2577d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
2578d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
2579d3236553SJohannes Berg  *
2580d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
2581d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
2582d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
2583d3236553SJohannes Berg  *
2584d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
2585d3236553SJohannes Berg  * an -ENOMEM.
2586d3236553SJohannes Berg  */
2587d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2588d3236553SJohannes Berg 
2589d3236553SJohannes Berg /**
2590d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
2591d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
2592d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
2593d3236553SJohannes Berg  *
2594d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
2595d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
2596d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
2597d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
2598d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
2599d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
2600d3236553SJohannes Berg  */
2601d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
2602d3236553SJohannes Berg 	struct wiphy *wiphy,
2603d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
2604d3236553SJohannes Berg 
2605d3236553SJohannes Berg /**
2606d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
2607d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
2608d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
2609038659e7SLuis R. Rodriguez  * @desired_bw_khz: the desired max bandwidth you want to use per
2610038659e7SLuis R. Rodriguez  *	channel. Note that this is still 20 MHz if you want to use HT40
2611038659e7SLuis R. Rodriguez  *	as HT40 makes use of two channels for its 40 MHz width bandwidth.
2612038659e7SLuis R. Rodriguez  *	If set to 0 we'll assume you want the standard 20 MHz.
2613d3236553SJohannes Berg  * @reg_rule: the regulatory rule which we have for this frequency
2614d3236553SJohannes Berg  *
2615d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
2616d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
2617d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
2618d3236553SJohannes Berg  * and processed already.
2619d3236553SJohannes Berg  *
2620d3236553SJohannes Berg  * Returns 0 if it was able to find a valid regulatory rule which does
2621d3236553SJohannes Berg  * apply to the given center_freq otherwise it returns non-zero. It will
2622d3236553SJohannes Berg  * also return -ERANGE if we determine the given center_freq does not even have
2623d3236553SJohannes Berg  * a regulatory rule for a frequency range in the center_freq's band. See
2624d3236553SJohannes Berg  * freq_in_rule_band() for our current definition of a band -- this is purely
2625d3236553SJohannes Berg  * subjective and right now its 802.11 specific.
2626d3236553SJohannes Berg  */
2627038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy,
2628038659e7SLuis R. Rodriguez 			 u32 center_freq,
2629038659e7SLuis R. Rodriguez 			 u32 desired_bw_khz,
2630d3236553SJohannes Berg 			 const struct ieee80211_reg_rule **reg_rule);
2631d3236553SJohannes Berg 
2632d3236553SJohannes Berg /*
2633d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
2634d3236553SJohannes Berg  * functions and BSS handling helpers
2635d3236553SJohannes Berg  */
2636d3236553SJohannes Berg 
26372a519311SJohannes Berg /**
26382a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
26392a519311SJohannes Berg  *
26402a519311SJohannes Berg  * @request: the corresponding scan request
26412a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
26422a519311SJohannes Berg  *	userspace will be notified of that
26432a519311SJohannes Berg  */
26442a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
26452a519311SJohannes Berg 
26462a519311SJohannes Berg /**
2647807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
2648807f8a8cSLuciano Coelho  *
2649807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
2650807f8a8cSLuciano Coelho  */
2651807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
2652807f8a8cSLuciano Coelho 
2653807f8a8cSLuciano Coelho /**
2654807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
2655807f8a8cSLuciano Coelho  *
2656807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
2657807f8a8cSLuciano Coelho  *
2658807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
2659807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
2660807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
2661807f8a8cSLuciano Coelho  */
2662807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
2663807f8a8cSLuciano Coelho 
2664807f8a8cSLuciano Coelho /**
2665abe37c4bSJohannes Berg  * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
26662a519311SJohannes Berg  *
26672a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
2668abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
2669abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
2670abe37c4bSJohannes Berg  * @len: length of the management frame
267177965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
26722a519311SJohannes Berg  * @gfp: context flags
26732a519311SJohannes Berg  *
26742a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
26752a519311SJohannes Berg  * the BSS should be updated/added.
2676ef100682SJohannes Berg  *
2677ef100682SJohannes Berg  * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
26782a519311SJohannes Berg  */
2679ef100682SJohannes Berg struct cfg80211_bss * __must_check
26802a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
26812a519311SJohannes Berg 			  struct ieee80211_channel *channel,
26822a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
268377965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
26842a519311SJohannes Berg 
2685abe37c4bSJohannes Berg /**
2686abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
2687abe37c4bSJohannes Berg  *
2688abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
2689abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
2690abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
2691abe37c4bSJohannes Berg  * @timestamp: the TSF timestamp sent by the peer
2692abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
2693abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
2694abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
2695abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
2696abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
2697abe37c4bSJohannes Berg  * @gfp: context flags
2698abe37c4bSJohannes Berg  *
2699abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
2700abe37c4bSJohannes Berg  * the BSS should be updated/added.
2701ef100682SJohannes Berg  *
2702ef100682SJohannes Berg  * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
2703abe37c4bSJohannes Berg  */
2704ef100682SJohannes Berg struct cfg80211_bss * __must_check
270506aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
270606aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
270706aa7afaSJussi Kivilinna 		    const u8 *bssid,
270806aa7afaSJussi Kivilinna 		    u64 timestamp, u16 capability, u16 beacon_interval,
270906aa7afaSJussi Kivilinna 		    const u8 *ie, size_t ielen,
271006aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
271106aa7afaSJussi Kivilinna 
27122a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
27132a519311SJohannes Berg 				      struct ieee80211_channel *channel,
27142a519311SJohannes Berg 				      const u8 *bssid,
271579420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
271679420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
271779420f09SJohannes Berg static inline struct cfg80211_bss *
271879420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
271979420f09SJohannes Berg 		  struct ieee80211_channel *channel,
272079420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
272179420f09SJohannes Berg {
272279420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
272379420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
272479420f09SJohannes Berg }
272579420f09SJohannes Berg 
27262a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
27272a519311SJohannes Berg 				       struct ieee80211_channel *channel,
27282a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
27292a519311SJohannes Berg 				       const u8 *meshcfg);
27302a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
2731d3236553SJohannes Berg 
2732d491af19SJohannes Berg /**
2733d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
2734d491af19SJohannes Berg  * @wiphy: the wiphy
2735d491af19SJohannes Berg  * @bss: the bss to remove
2736d491af19SJohannes Berg  *
2737d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
2738d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
2739d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
2740d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
2741d491af19SJohannes Berg  */
2742d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
2743fee52678SJohannes Berg 
27446039f6d2SJouni Malinen /**
27456039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
27466039f6d2SJouni Malinen  * @dev: network device
27476039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
27486039f6d2SJouni Malinen  * @len: length of the frame data
27496039f6d2SJouni Malinen  *
27506039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
27511965c853SJouni Malinen  * station mode. The driver is required to call either this function or
27521965c853SJouni Malinen  * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
2753cb0b4bebSJohannes Berg  * call. This function may sleep.
27546039f6d2SJouni Malinen  */
2755cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
27566039f6d2SJouni Malinen 
27576039f6d2SJouni Malinen /**
27581965c853SJouni Malinen  * cfg80211_send_auth_timeout - notification of timed out authentication
27591965c853SJouni Malinen  * @dev: network device
27601965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
2761cb0b4bebSJohannes Berg  *
2762cb0b4bebSJohannes Berg  * This function may sleep.
27631965c853SJouni Malinen  */
2764cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
27651965c853SJouni Malinen 
27661965c853SJouni Malinen /**
2767a58ce43fSJohannes Berg  * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2768a58ce43fSJohannes Berg  * @dev: network device
2769a58ce43fSJohannes Berg  * @addr: The MAC address of the device with which the authentication timed out
2770a58ce43fSJohannes Berg  *
2771a58ce43fSJohannes Berg  * When a pending authentication had no action yet, the driver may decide
2772a58ce43fSJohannes Berg  * to not send a deauth frame, but in that case must calls this function
2773a58ce43fSJohannes Berg  * to tell cfg80211 about this decision. It is only valid to call this
2774a58ce43fSJohannes Berg  * function within the deauth() callback.
2775a58ce43fSJohannes Berg  */
2776a58ce43fSJohannes Berg void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2777a58ce43fSJohannes Berg 
2778a58ce43fSJohannes Berg /**
27796039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
27806039f6d2SJouni Malinen  * @dev: network device
27816039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
27826039f6d2SJouni Malinen  * @len: length of the frame data
27836039f6d2SJouni Malinen  *
27846039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
27851965c853SJouni Malinen  * processed in station mode. The driver is required to call either this
27861965c853SJouni Malinen  * function or cfg80211_send_assoc_timeout() to indicate the result of
2787cb0b4bebSJohannes Berg  * cfg80211_ops::assoc() call. This function may sleep.
27886039f6d2SJouni Malinen  */
2789cb0b4bebSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
27906039f6d2SJouni Malinen 
27916039f6d2SJouni Malinen /**
27921965c853SJouni Malinen  * cfg80211_send_assoc_timeout - notification of timed out association
27931965c853SJouni Malinen  * @dev: network device
27941965c853SJouni Malinen  * @addr: The MAC address of the device with which the association timed out
2795cb0b4bebSJohannes Berg  *
2796cb0b4bebSJohannes Berg  * This function may sleep.
27971965c853SJouni Malinen  */
2798cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
27991965c853SJouni Malinen 
28001965c853SJouni Malinen /**
280153b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
28026039f6d2SJouni Malinen  * @dev: network device
28036039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
28046039f6d2SJouni Malinen  * @len: length of the frame data
28056039f6d2SJouni Malinen  *
28066039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
280753b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
2808cb0b4bebSJohannes Berg  * locally generated ones. This function may sleep.
28096039f6d2SJouni Malinen  */
2810ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
2811ce470613SHolger Schurig 
2812ce470613SHolger Schurig /**
2813ce470613SHolger Schurig  * __cfg80211_send_deauth - notification of processed deauthentication
2814ce470613SHolger Schurig  * @dev: network device
2815ce470613SHolger Schurig  * @buf: deauthentication frame (header + body)
2816ce470613SHolger Schurig  * @len: length of the frame data
2817ce470613SHolger Schurig  *
2818ce470613SHolger Schurig  * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
2819ce470613SHolger Schurig  */
2820ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
28216039f6d2SJouni Malinen 
28226039f6d2SJouni Malinen /**
282353b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
28246039f6d2SJouni Malinen  * @dev: network device
28256039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
28266039f6d2SJouni Malinen  * @len: length of the frame data
28276039f6d2SJouni Malinen  *
28286039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
282953b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
2830cb0b4bebSJohannes Berg  * generated ones. This function may sleep.
28316039f6d2SJouni Malinen  */
2832ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
2833ce470613SHolger Schurig 
2834ce470613SHolger Schurig /**
2835ce470613SHolger Schurig  * __cfg80211_send_disassoc - notification of processed disassociation
2836ce470613SHolger Schurig  * @dev: network device
2837ce470613SHolger Schurig  * @buf: disassociation response frame (header + body)
2838ce470613SHolger Schurig  * @len: length of the frame data
2839ce470613SHolger Schurig  *
2840ce470613SHolger Schurig  * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
2841ce470613SHolger Schurig  */
2842ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
2843ce470613SHolger Schurig 	size_t len);
28446039f6d2SJouni Malinen 
2845a08c1c1aSKalle Valo /**
2846cf4e594eSJouni Malinen  * cfg80211_send_unprot_deauth - notification of unprotected deauthentication
2847cf4e594eSJouni Malinen  * @dev: network device
2848cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
2849cf4e594eSJouni Malinen  * @len: length of the frame data
2850cf4e594eSJouni Malinen  *
2851cf4e594eSJouni Malinen  * This function is called whenever a received Deauthentication frame has been
2852cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Deauthentication
2853cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
2854cf4e594eSJouni Malinen  */
2855cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
2856cf4e594eSJouni Malinen 				 size_t len);
2857cf4e594eSJouni Malinen 
2858cf4e594eSJouni Malinen /**
2859cf4e594eSJouni Malinen  * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
2860cf4e594eSJouni Malinen  * @dev: network device
2861cf4e594eSJouni Malinen  * @buf: disassociation frame (header + body)
2862cf4e594eSJouni Malinen  * @len: length of the frame data
2863cf4e594eSJouni Malinen  *
2864cf4e594eSJouni Malinen  * This function is called whenever a received Disassociation frame has been
2865cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Disassociation
2866cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
2867cf4e594eSJouni Malinen  */
2868cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
2869cf4e594eSJouni Malinen 				   size_t len);
2870cf4e594eSJouni Malinen 
2871cf4e594eSJouni Malinen /**
2872a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
2873a3b8b056SJouni Malinen  * @dev: network device
2874a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
2875a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
2876a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
2877a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
2878e6d6e342SJohannes Berg  * @gfp: allocation flags
2879a3b8b056SJouni Malinen  *
2880a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
2881a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
2882a3b8b056SJouni Malinen  * primitive.
2883a3b8b056SJouni Malinen  */
2884a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
2885a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
2886e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
2887a3b8b056SJouni Malinen 
288804a773adSJohannes Berg /**
288904a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
289004a773adSJohannes Berg  *
289104a773adSJohannes Berg  * @dev: network device
289204a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
289304a773adSJohannes Berg  * @gfp: allocation flags
289404a773adSJohannes Berg  *
289504a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
289604a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
289704a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
289804a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
289904a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
290004a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
290104a773adSJohannes Berg  */
290204a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
290304a773adSJohannes Berg 
29041f87f7d3SJohannes Berg /**
2905c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
2906c93b5e71SJavier Cardona  *
2907c93b5e71SJavier Cardona  * @dev: network device
2908c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
2909c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
2910c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
2911c93b5e71SJavier Cardona  * @gfp: allocation flags
2912c93b5e71SJavier Cardona  *
2913c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
2914c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
2915c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
2916c93b5e71SJavier Cardona  */
2917c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
2918c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
2919c93b5e71SJavier Cardona 
2920c93b5e71SJavier Cardona /**
2921d70e9693SJohannes Berg  * DOC: RFkill integration
2922d70e9693SJohannes Berg  *
2923d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
2924d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
2925d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
2926d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
2927d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
2928d70e9693SJohannes Berg  *
2929d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
2930d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
2931d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
2932d70e9693SJohannes Berg  */
2933d70e9693SJohannes Berg 
2934d70e9693SJohannes Berg /**
29351f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
29361f87f7d3SJohannes Berg  * @wiphy: the wiphy
29371f87f7d3SJohannes Berg  * @blocked: block status
29381f87f7d3SJohannes Berg  */
29391f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
29401f87f7d3SJohannes Berg 
29411f87f7d3SJohannes Berg /**
29421f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
29431f87f7d3SJohannes Berg  * @wiphy: the wiphy
29441f87f7d3SJohannes Berg  */
29451f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
29461f87f7d3SJohannes Berg 
29471f87f7d3SJohannes Berg /**
29481f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
29491f87f7d3SJohannes Berg  * @wiphy: the wiphy
29501f87f7d3SJohannes Berg  */
29511f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
29521f87f7d3SJohannes Berg 
2953aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
2954aff89a9bSJohannes Berg /**
2955d70e9693SJohannes Berg  * DOC: Test mode
2956d70e9693SJohannes Berg  *
2957d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
2958d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
2959d70e9693SJohannes Berg  * factory programming.
2960d70e9693SJohannes Berg  *
2961d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
2962d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
2963d70e9693SJohannes Berg  */
2964d70e9693SJohannes Berg 
2965d70e9693SJohannes Berg /**
2966aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
2967aff89a9bSJohannes Berg  * @wiphy: the wiphy
2968aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
2969aff89a9bSJohannes Berg  *	be put into the skb
2970aff89a9bSJohannes Berg  *
2971aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
2972aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
2973aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
2974aff89a9bSJohannes Berg  *
2975aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is pre-filled
2976aff89a9bSJohannes Berg  * with the wiphy index and set up in a way that any data that is
2977aff89a9bSJohannes Berg  * put into the skb (with skb_put(), nla_put() or similar) will end
2978aff89a9bSJohannes Berg  * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
2979aff89a9bSJohannes Berg  * needs to be done with the skb is adding data for the corresponding
2980aff89a9bSJohannes Berg  * userspace tool which can then read that data out of the testdata
2981aff89a9bSJohannes Berg  * attribute. You must not modify the skb in any other way.
2982aff89a9bSJohannes Berg  *
2983aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
2984aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
2985aff89a9bSJohannes Berg  */
2986aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
2987aff89a9bSJohannes Berg 						  int approxlen);
2988aff89a9bSJohannes Berg 
2989aff89a9bSJohannes Berg /**
2990aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
2991aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
2992aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
2993aff89a9bSJohannes Berg  *
2994aff89a9bSJohannes Berg  * Returns an error code or 0 on success, since calling this
2995aff89a9bSJohannes Berg  * function will usually be the last thing before returning
2996aff89a9bSJohannes Berg  * from the @testmode_cmd you should return the error code.
2997aff89a9bSJohannes Berg  * Note that this function consumes the skb regardless of the
2998aff89a9bSJohannes Berg  * return value.
2999aff89a9bSJohannes Berg  */
3000aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
3001aff89a9bSJohannes Berg 
3002aff89a9bSJohannes Berg /**
3003aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
3004aff89a9bSJohannes Berg  * @wiphy: the wiphy
3005aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3006aff89a9bSJohannes Berg  *	be put into the skb
3007aff89a9bSJohannes Berg  * @gfp: allocation flags
3008aff89a9bSJohannes Berg  *
3009aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
3010aff89a9bSJohannes Berg  * testmode multicast group.
3011aff89a9bSJohannes Berg  *
3012aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is set up in the
3013aff89a9bSJohannes Berg  * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
3014aff89a9bSJohannes Berg  * for an event. As there, you should simply add data to it that will
3015aff89a9bSJohannes Berg  * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
3016aff89a9bSJohannes Berg  * not modify the skb in any other way.
3017aff89a9bSJohannes Berg  *
3018aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
3019aff89a9bSJohannes Berg  * skb to send the event.
3020aff89a9bSJohannes Berg  */
3021aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3022aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
3023aff89a9bSJohannes Berg 
3024aff89a9bSJohannes Berg /**
3025aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
3026aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3027aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
3028aff89a9bSJohannes Berg  * @gfp: allocation flags
3029aff89a9bSJohannes Berg  *
3030aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
3031aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
3032aff89a9bSJohannes Berg  * consumes it.
3033aff89a9bSJohannes Berg  */
3034aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3035aff89a9bSJohannes Berg 
3036aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
303771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
3038aff89a9bSJohannes Berg #else
3039aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
304071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
3041aff89a9bSJohannes Berg #endif
3042aff89a9bSJohannes Berg 
3043b23aa676SSamuel Ortiz /**
3044b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
3045b23aa676SSamuel Ortiz  *
3046b23aa676SSamuel Ortiz  * @dev: network device
3047b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
3048b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3049b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3050b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3051b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3052b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
3053b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
3054b23aa676SSamuel Ortiz  *	the real status code for failures.
3055b23aa676SSamuel Ortiz  * @gfp: allocation flags
3056b23aa676SSamuel Ortiz  *
3057b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
3058b23aa676SSamuel Ortiz  * succeeded.
3059b23aa676SSamuel Ortiz  */
3060b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3061b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
3062b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
3063b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
3064b23aa676SSamuel Ortiz 
3065b23aa676SSamuel Ortiz /**
3066b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
3067b23aa676SSamuel Ortiz  *
3068b23aa676SSamuel Ortiz  * @dev: network device
3069ed9d0102SJouni Malinen  * @channel: the channel of the new AP
3070b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
3071b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3072b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3073b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3074b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3075b23aa676SSamuel Ortiz  * @gfp: allocation flags
3076b23aa676SSamuel Ortiz  *
3077b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
3078b23aa676SSamuel Ortiz  * from one AP to another while connected.
3079b23aa676SSamuel Ortiz  */
3080ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
3081ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
3082ed9d0102SJouni Malinen 		     const u8 *bssid,
3083b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
3084b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3085b23aa676SSamuel Ortiz 
3086b23aa676SSamuel Ortiz /**
3087adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
3088adbde344SVasanthakumar Thiagarajan  *
3089adbde344SVasanthakumar Thiagarajan  * @dev: network device
3090adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
3091adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
3092adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
3093adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
3094adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
3095adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
3096adbde344SVasanthakumar Thiagarajan  *
3097adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
3098adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
3099adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
3100adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
3101adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
3102adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
3103adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
3104adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
3105adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3106adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
3107adbde344SVasanthakumar Thiagarajan  */
3108adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3109adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
3110adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3111adbde344SVasanthakumar Thiagarajan 
3112adbde344SVasanthakumar Thiagarajan /**
3113b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
3114b23aa676SSamuel Ortiz  *
3115b23aa676SSamuel Ortiz  * @dev: network device
3116b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
3117b23aa676SSamuel Ortiz  * @ie_len: length of IEs
3118b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
3119b23aa676SSamuel Ortiz  * @gfp: allocation flags
3120b23aa676SSamuel Ortiz  *
3121b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
3122b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
3123b23aa676SSamuel Ortiz  */
3124b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
3125b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
3126b23aa676SSamuel Ortiz 
31279588bbd5SJouni Malinen /**
31289588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
31299588bbd5SJouni Malinen  * @dev: network device
31309588bbd5SJouni Malinen  * @cookie: the request cookie
31319588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
31329588bbd5SJouni Malinen  * @channel_type: Channel type
31339588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
31349588bbd5SJouni Malinen  *	channel
31359588bbd5SJouni Malinen  * @gfp: allocation flags
31369588bbd5SJouni Malinen  */
31379588bbd5SJouni Malinen void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie,
31389588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
31399588bbd5SJouni Malinen 			       enum nl80211_channel_type channel_type,
31409588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
31419588bbd5SJouni Malinen 
31429588bbd5SJouni Malinen /**
31439588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
31449588bbd5SJouni Malinen  * @dev: network device
31459588bbd5SJouni Malinen  * @cookie: the request cookie
31469588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
31479588bbd5SJouni Malinen  * @channel_type: Channel type
31489588bbd5SJouni Malinen  * @gfp: allocation flags
31499588bbd5SJouni Malinen  */
31509588bbd5SJouni Malinen void cfg80211_remain_on_channel_expired(struct net_device *dev,
31519588bbd5SJouni Malinen 					u64 cookie,
31529588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
31539588bbd5SJouni Malinen 					enum nl80211_channel_type channel_type,
31549588bbd5SJouni Malinen 					gfp_t gfp);
3155b23aa676SSamuel Ortiz 
315698b62183SJohannes Berg 
315798b62183SJohannes Berg /**
315898b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
315998b62183SJohannes Berg  *
316098b62183SJohannes Berg  * @dev: the netdev
316198b62183SJohannes Berg  * @mac_addr: the station's address
316298b62183SJohannes Berg  * @sinfo: the station information
316398b62183SJohannes Berg  * @gfp: allocation flags
316498b62183SJohannes Berg  */
316598b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
316698b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
316798b62183SJohannes Berg 
3168026331c4SJouni Malinen /**
3169ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
3170ec15e68bSJouni Malinen  *
3171ec15e68bSJouni Malinen  * @dev: the netdev
3172ec15e68bSJouni Malinen  * @mac_addr: the station's address
3173ec15e68bSJouni Malinen  * @gfp: allocation flags
3174ec15e68bSJouni Malinen  */
3175ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3176ec15e68bSJouni Malinen 
3177ec15e68bSJouni Malinen /**
31782e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3179026331c4SJouni Malinen  * @dev: network device
3180026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
31812e161f78SJohannes Berg  * @buf: Management frame (header + body)
3182026331c4SJouni Malinen  * @len: length of the frame data
3183026331c4SJouni Malinen  * @gfp: context flags
31842e161f78SJohannes Berg  *
31852e161f78SJohannes Berg  * Returns %true if a user space application has registered for this frame.
31862e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
31872e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
31882e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
3189026331c4SJouni Malinen  *
3190026331c4SJouni Malinen  * This function is called whenever an Action frame is received for a station
3191026331c4SJouni Malinen  * mode interface, but is not processed in kernel.
3192026331c4SJouni Malinen  */
31932e161f78SJohannes Berg bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
3194026331c4SJouni Malinen 		      size_t len, gfp_t gfp);
3195026331c4SJouni Malinen 
3196026331c4SJouni Malinen /**
31972e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
3198026331c4SJouni Malinen  * @dev: network device
31992e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
32002e161f78SJohannes Berg  * @buf: Management frame (header + body)
3201026331c4SJouni Malinen  * @len: length of the frame data
3202026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
3203026331c4SJouni Malinen  * @gfp: context flags
3204026331c4SJouni Malinen  *
32052e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
32062e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3207026331c4SJouni Malinen  * transmission attempt.
3208026331c4SJouni Malinen  */
32092e161f78SJohannes Berg void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie,
3210026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
3211026331c4SJouni Malinen 
3212d6dc1a38SJuuso Oikarinen 
3213d6dc1a38SJuuso Oikarinen /**
3214d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
3215d6dc1a38SJuuso Oikarinen  * @dev: network device
3216d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
3217d6dc1a38SJuuso Oikarinen  * @gfp: context flags
3218d6dc1a38SJuuso Oikarinen  *
3219d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
3220d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
3221d6dc1a38SJuuso Oikarinen  */
3222d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
3223d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
3224d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
3225d6dc1a38SJuuso Oikarinen 
3226c063dbf5SJohannes Berg /**
3227c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
3228c063dbf5SJohannes Berg  * @dev: network device
3229c063dbf5SJohannes Berg  * @peer: peer's MAC address
3230c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
3231c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
3232c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
3233c063dbf5SJohannes Berg  * @gfp: context flags
3234c063dbf5SJohannes Berg  */
3235c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3236c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
3237c063dbf5SJohannes Berg 
3238e5497d76SJohannes Berg /**
3239e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3240e5497d76SJohannes Berg  * @dev: network device
3241e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
3242e5497d76SJohannes Berg  * @replay_ctr: new replay counter
3243af71ff85SJohannes Berg  * @gfp: allocation flags
3244e5497d76SJohannes Berg  */
3245e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3246e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
3247e5497d76SJohannes Berg 
3248c9df56b4SJouni Malinen /**
3249c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
3250c9df56b4SJouni Malinen  * @dev: network device
3251c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
3252c9df56b4SJouni Malinen  * @bssid: BSSID of AP
3253c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
3254c9df56b4SJouni Malinen  * @gfp: allocation flags
3255c9df56b4SJouni Malinen  */
3256c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3257c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
3258c9df56b4SJouni Malinen 
325928946da7SJohannes Berg /**
326028946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
326128946da7SJohannes Berg  * @dev: The device the frame matched to
326228946da7SJohannes Berg  * @addr: the transmitter address
326328946da7SJohannes Berg  * @gfp: context flags
326428946da7SJohannes Berg  *
326528946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
326628946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
326728946da7SJohannes Berg  * sender.
326828946da7SJohannes Berg  * Returns %true if the frame was passed to userspace (or this failed
326928946da7SJohannes Berg  * for a reason other than not having a subscription.)
327028946da7SJohannes Berg  */
327128946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
327228946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
327328946da7SJohannes Berg 
32747f6cf311SJohannes Berg /**
3275b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
3276b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
3277b92ab5d8SJohannes Berg  * @addr: the transmitter address
3278b92ab5d8SJohannes Berg  * @gfp: context flags
3279b92ab5d8SJohannes Berg  *
3280b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
3281b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
3282b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
3283b92ab5d8SJohannes Berg  * station to avoid event flooding.
3284b92ab5d8SJohannes Berg  * Returns %true if the frame was passed to userspace (or this failed
3285b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
3286b92ab5d8SJohannes Berg  */
3287b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
3288b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
3289b92ab5d8SJohannes Berg 
3290b92ab5d8SJohannes Berg /**
32917f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
32927f6cf311SJohannes Berg  * @dev: the device the probe was sent on
32937f6cf311SJohannes Berg  * @addr: the address of the peer
32947f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
32957f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
32967f6cf311SJohannes Berg  * @gfp: allocation flags
32977f6cf311SJohannes Berg  */
32987f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
32997f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
33007f6cf311SJohannes Berg 
33015e760230SJohannes Berg /**
33025e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
33035e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
33045e760230SJohannes Berg  * @frame: the frame
33055e760230SJohannes Berg  * @len: length of the frame
33065e760230SJohannes Berg  * @freq: frequency the frame was received on
33075e760230SJohannes Berg  * @gfp: allocation flags
33085e760230SJohannes Berg  *
33095e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
33105e760230SJohannes Berg  * received. It is not useful to call this when there is no
33115e760230SJohannes Berg  * netdev that is in AP/GO mode.
33125e760230SJohannes Berg  */
33135e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
33145e760230SJohannes Berg 				 const u8 *frame, size_t len,
33155e760230SJohannes Berg 				 int freq, gfp_t gfp);
33165e760230SJohannes Berg 
331754858ee5SAlexander Simon /*
331854858ee5SAlexander Simon  * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
331954858ee5SAlexander Simon  * @wiphy: the wiphy
332054858ee5SAlexander Simon  * @chan: main channel
332154858ee5SAlexander Simon  * @channel_type: HT mode
332254858ee5SAlexander Simon  */
332354858ee5SAlexander Simon int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
332454858ee5SAlexander Simon 				 struct ieee80211_channel *chan,
332554858ee5SAlexander Simon 				 enum nl80211_channel_type channel_type);
332654858ee5SAlexander Simon 
3327e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
3328e1db74fcSJoe Perches 
3329e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
3330e1db74fcSJoe Perches 
3331e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
33329c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
3333e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
33349c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
3335e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
33369c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
3337e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
33389c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
3339e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
33409c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
3341e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
33429c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
3343e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
33449c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
3345e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
33469c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
3347073730d7SJoe Perches 
33489c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
3349e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
33509c376639SJoe Perches 
3351e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
33529c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
3353e1db74fcSJoe Perches 
3354e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
3355e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
3356e1db74fcSJoe Perches #else
3357e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
3358e1db74fcSJoe Perches ({									\
3359e1db74fcSJoe Perches 	if (0)								\
3360e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
3361e1db74fcSJoe Perches 	0;								\
3362e1db74fcSJoe Perches })
3363e1db74fcSJoe Perches #endif
3364e1db74fcSJoe Perches 
3365e1db74fcSJoe Perches /*
3366e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
3367e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
3368e1db74fcSJoe Perches  * file/line information and a backtrace.
3369e1db74fcSJoe Perches  */
3370e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
3371e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
3372e1db74fcSJoe Perches 
3373704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
3374