xref: /linux/include/net/cfg80211.h (revision 0879fa44b54101c9955123582018cb511047a2b6)
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)
123d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
124d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
12577c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
126d3236553SJohannes Berg  * @orig_mag: internal use
127d3236553SJohannes Berg  * @orig_mpwr: internal use
128d3236553SJohannes Berg  */
129d3236553SJohannes Berg struct ieee80211_channel {
130d3236553SJohannes Berg 	enum ieee80211_band band;
131d3236553SJohannes Berg 	u16 center_freq;
132d3236553SJohannes Berg 	u16 hw_value;
133d3236553SJohannes Berg 	u32 flags;
134d3236553SJohannes Berg 	int max_antenna_gain;
135d3236553SJohannes Berg 	int max_power;
136d3236553SJohannes Berg 	bool beacon_found;
137d3236553SJohannes Berg 	u32 orig_flags;
138d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
139d3236553SJohannes Berg };
140d3236553SJohannes Berg 
141d3236553SJohannes Berg /**
142d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
143d3236553SJohannes Berg  *
144d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
145d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
146d3236553SJohannes Berg  * different bands/PHY modes.
147d3236553SJohannes Berg  *
148d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
149d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
150d3236553SJohannes Berg  *	with CCK rates.
151d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
152d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
153d3236553SJohannes Berg  *	core code when registering the wiphy.
154d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
155d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
156d3236553SJohannes Berg  *	core code when registering the wiphy.
157d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
158d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
159d3236553SJohannes Berg  *	core code when registering the wiphy.
160d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
161d3236553SJohannes Berg  */
162d3236553SJohannes Berg enum ieee80211_rate_flags {
163d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
164d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
165d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
166d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
167d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
168d3236553SJohannes Berg };
169d3236553SJohannes Berg 
170d3236553SJohannes Berg /**
171d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
172d3236553SJohannes Berg  *
173d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
174d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
175d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
176d3236553SJohannes Berg  * passed around.
177d3236553SJohannes Berg  *
178d3236553SJohannes Berg  * @flags: rate-specific flags
179d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
180d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
181d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
182d3236553SJohannes Berg  *	short preamble is used
183d3236553SJohannes Berg  */
184d3236553SJohannes Berg struct ieee80211_rate {
185d3236553SJohannes Berg 	u32 flags;
186d3236553SJohannes Berg 	u16 bitrate;
187d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
188d3236553SJohannes Berg };
189d3236553SJohannes Berg 
190d3236553SJohannes Berg /**
191d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
192d3236553SJohannes Berg  *
193d3236553SJohannes Berg  * This structure describes most essential parameters needed
194d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
195d3236553SJohannes Berg  *
196d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
197d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
198d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
199d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
200d3236553SJohannes Berg  * @mcs: Supported MCS rates
201d3236553SJohannes Berg  */
202d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
203d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
204d3236553SJohannes Berg 	bool ht_supported;
205d3236553SJohannes Berg 	u8 ampdu_factor;
206d3236553SJohannes Berg 	u8 ampdu_density;
207d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
208d3236553SJohannes Berg };
209d3236553SJohannes Berg 
210d3236553SJohannes Berg /**
211d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
212d3236553SJohannes Berg  *
213d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
214d3236553SJohannes Berg  * is able to operate in.
215d3236553SJohannes Berg  *
216d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
217d3236553SJohannes Berg  *	in this band.
218d3236553SJohannes Berg  * @band: the band this structure represents
219d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
220d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
221d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
222d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
223d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
224abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
225d3236553SJohannes Berg  */
226d3236553SJohannes Berg struct ieee80211_supported_band {
227d3236553SJohannes Berg 	struct ieee80211_channel *channels;
228d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
229d3236553SJohannes Berg 	enum ieee80211_band band;
230d3236553SJohannes Berg 	int n_channels;
231d3236553SJohannes Berg 	int n_bitrates;
232d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
233d3236553SJohannes Berg };
234d3236553SJohannes Berg 
235d3236553SJohannes Berg /*
236d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
237704232c2SJohannes Berg  */
238704232c2SJohannes Berg 
2392ec600d6SLuis Carlos Cobo /**
240d70e9693SJohannes Berg  * DOC: Actions and configuration
241d70e9693SJohannes Berg  *
242d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
243d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
244d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
245d70e9693SJohannes Berg  * operations use are described separately.
246d70e9693SJohannes Berg  *
247d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
248d70e9693SJohannes Berg  * information via some functions that drivers need to call.
249d70e9693SJohannes Berg  *
250d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
251d70e9693SJohannes Berg  * in a separate chapter.
252d70e9693SJohannes Berg  */
253d70e9693SJohannes Berg 
254d70e9693SJohannes Berg /**
2552ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
2568b787643SFelix Fietkau  * @use_4addr: use 4-address frames
2572ec600d6SLuis Carlos Cobo  */
2582ec600d6SLuis Carlos Cobo struct vif_params {
2598b787643SFelix Fietkau        int use_4addr;
2602ec600d6SLuis Carlos Cobo };
2612ec600d6SLuis Carlos Cobo 
26241ade00fSJohannes Berg /**
26341ade00fSJohannes Berg  * struct key_params - key information
26441ade00fSJohannes Berg  *
26541ade00fSJohannes Berg  * Information about a key
26641ade00fSJohannes Berg  *
26741ade00fSJohannes Berg  * @key: key material
26841ade00fSJohannes Berg  * @key_len: length of key material
26941ade00fSJohannes Berg  * @cipher: cipher suite selector
27041ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
27141ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
27241ade00fSJohannes Berg  *	length given by @seq_len.
273abe37c4bSJohannes Berg  * @seq_len: length of @seq.
27441ade00fSJohannes Berg  */
27541ade00fSJohannes Berg struct key_params {
27641ade00fSJohannes Berg 	u8 *key;
27741ade00fSJohannes Berg 	u8 *seq;
27841ade00fSJohannes Berg 	int key_len;
27941ade00fSJohannes Berg 	int seq_len;
28041ade00fSJohannes Berg 	u32 cipher;
28141ade00fSJohannes Berg };
28241ade00fSJohannes Berg 
283ed1b6cc7SJohannes Berg /**
28461fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
28561fa713cSHolger Schurig  *
286abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
28717e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
2888610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
2898610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
2908610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
2918610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
2928610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
293abe37c4bSJohannes Berg  *
29461fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
29561fa713cSHolger Schurig  * it has filled in during the get_survey().
29661fa713cSHolger Schurig  */
29761fa713cSHolger Schurig enum survey_info_flags {
29861fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
29917e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
3008610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
3018610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
3028610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
3038610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
3048610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
30561fa713cSHolger Schurig };
30661fa713cSHolger Schurig 
30761fa713cSHolger Schurig /**
30861fa713cSHolger Schurig  * struct survey_info - channel survey response
30961fa713cSHolger Schurig  *
31061fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
31161fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
31261fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
31361fa713cSHolger Schurig  *     optional
3148610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
3158610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
3168610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
3178610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
3188610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
31961fa713cSHolger Schurig  *
320abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
321abe37c4bSJohannes Berg  *
32261fa713cSHolger Schurig  * This structure can later be expanded with things like
32361fa713cSHolger Schurig  * channel duty cycle etc.
32461fa713cSHolger Schurig  */
32561fa713cSHolger Schurig struct survey_info {
32661fa713cSHolger Schurig 	struct ieee80211_channel *channel;
3278610c29aSFelix Fietkau 	u64 channel_time;
3288610c29aSFelix Fietkau 	u64 channel_time_busy;
3298610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
3308610c29aSFelix Fietkau 	u64 channel_time_rx;
3318610c29aSFelix Fietkau 	u64 channel_time_tx;
33261fa713cSHolger Schurig 	u32 filled;
33361fa713cSHolger Schurig 	s8 noise;
33461fa713cSHolger Schurig };
33561fa713cSHolger Schurig 
33661fa713cSHolger Schurig /**
337ed1b6cc7SJohannes Berg  * struct beacon_parameters - beacon parameters
338ed1b6cc7SJohannes Berg  *
339ed1b6cc7SJohannes Berg  * Used to configure the beacon for an interface.
340ed1b6cc7SJohannes Berg  *
341ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
342ed1b6cc7SJohannes Berg  *     or %NULL if not changed
343ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
344ed1b6cc7SJohannes Berg  *     or %NULL if not changed
345ed1b6cc7SJohannes Berg  * @interval: beacon interval or zero if not changed
346ed1b6cc7SJohannes Berg  * @dtim_period: DTIM period or zero if not changed
347ed1b6cc7SJohannes Berg  * @head_len: length of @head
348ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
349ed1b6cc7SJohannes Berg  */
350ed1b6cc7SJohannes Berg struct beacon_parameters {
351ed1b6cc7SJohannes Berg 	u8 *head, *tail;
352ed1b6cc7SJohannes Berg 	int interval, dtim_period;
353ed1b6cc7SJohannes Berg 	int head_len, tail_len;
354ed1b6cc7SJohannes Berg };
355ed1b6cc7SJohannes Berg 
3565727ef1bSJohannes Berg /**
3572ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
3582ec600d6SLuis Carlos Cobo  *
3592ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
3602ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
361abe37c4bSJohannes Berg  * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
3622ec600d6SLuis Carlos Cobo  */
3632ec600d6SLuis Carlos Cobo enum plink_actions {
3642ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
3652ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
3662ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
3672ec600d6SLuis Carlos Cobo };
3682ec600d6SLuis Carlos Cobo 
3692ec600d6SLuis Carlos Cobo /**
3705727ef1bSJohannes Berg  * struct station_parameters - station parameters
3715727ef1bSJohannes Berg  *
3725727ef1bSJohannes Berg  * Used to change and create a new station.
3735727ef1bSJohannes Berg  *
3745727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
3755727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
3765727ef1bSJohannes Berg  *	(or NULL for no change)
3775727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
378eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
379eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
380eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
381eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
3825727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
3835727ef1bSJohannes Berg  * @aid: AID or zero for no change
384abe37c4bSJohannes Berg  * @plink_action: plink action to take
3859c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
386abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
3875727ef1bSJohannes Berg  */
3885727ef1bSJohannes Berg struct station_parameters {
3895727ef1bSJohannes Berg 	u8 *supported_rates;
3905727ef1bSJohannes Berg 	struct net_device *vlan;
391eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
3925727ef1bSJohannes Berg 	int listen_interval;
3935727ef1bSJohannes Berg 	u16 aid;
3945727ef1bSJohannes Berg 	u8 supported_rates_len;
3952ec600d6SLuis Carlos Cobo 	u8 plink_action;
3969c3990aaSJavier Cardona 	u8 plink_state;
39736aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
3985727ef1bSJohannes Berg };
3995727ef1bSJohannes Berg 
400fd5b74dcSJohannes Berg /**
4012ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
402fd5b74dcSJohannes Berg  *
4032ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
4042ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
405fd5b74dcSJohannes Berg  *
4062ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
4072ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
4082ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
4092ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
4102ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
4112ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
412420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
413c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
414420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
41598c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
41698c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
417b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
418b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
4195a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
420541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
421c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
422f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
423ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
424040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
425fd5b74dcSJohannes Berg  */
4262ec600d6SLuis Carlos Cobo enum station_info_flags {
4272ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
4282ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
4292ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
4302ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
4312ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
4322ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
433420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
434420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
43598c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
43698c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
437b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
438b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
4395a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
440541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
441c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
442f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
443040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
444040bdf71SFelix Fietkau 	STATION_INFO_ASSOC_REQ_IES	= 1<<17
445420e7fabSHenning Rogge };
446420e7fabSHenning Rogge 
447420e7fabSHenning Rogge /**
448420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
449420e7fabSHenning Rogge  *
450420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
451420e7fabSHenning Rogge  * type for 802.11n transmissions.
452420e7fabSHenning Rogge  *
453420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
454420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
455420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
456420e7fabSHenning Rogge  */
457420e7fabSHenning Rogge enum rate_info_flags {
458420e7fabSHenning Rogge 	RATE_INFO_FLAGS_MCS		= 1<<0,
459420e7fabSHenning Rogge 	RATE_INFO_FLAGS_40_MHZ_WIDTH	= 1<<1,
460420e7fabSHenning Rogge 	RATE_INFO_FLAGS_SHORT_GI	= 1<<2,
461420e7fabSHenning Rogge };
462420e7fabSHenning Rogge 
463420e7fabSHenning Rogge /**
464420e7fabSHenning Rogge  * struct rate_info - bitrate information
465420e7fabSHenning Rogge  *
466420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
467420e7fabSHenning Rogge  *
468420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
469420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
470420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
471420e7fabSHenning Rogge  */
472420e7fabSHenning Rogge struct rate_info {
473420e7fabSHenning Rogge 	u8 flags;
474420e7fabSHenning Rogge 	u8 mcs;
475420e7fabSHenning Rogge 	u16 legacy;
476fd5b74dcSJohannes Berg };
477fd5b74dcSJohannes Berg 
478fd5b74dcSJohannes Berg /**
479f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
480f4263c98SPaul Stewart  *
481f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
482f4263c98SPaul Stewart  * type for 802.11n transmissions.
483f4263c98SPaul Stewart  *
484f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
485f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
486f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
487f4263c98SPaul Stewart  */
488f4263c98SPaul Stewart enum bss_param_flags {
489f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
490f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
491f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
492f4263c98SPaul Stewart };
493f4263c98SPaul Stewart 
494f4263c98SPaul Stewart /**
495f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
496f4263c98SPaul Stewart  *
497f4263c98SPaul Stewart  * Information about the currently associated BSS
498f4263c98SPaul Stewart  *
499f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
500f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
501f4263c98SPaul Stewart  * @beacon_interval: beacon interval
502f4263c98SPaul Stewart  */
503f4263c98SPaul Stewart struct sta_bss_parameters {
504f4263c98SPaul Stewart 	u8 flags;
505f4263c98SPaul Stewart 	u8 dtim_period;
506f4263c98SPaul Stewart 	u16 beacon_interval;
507f4263c98SPaul Stewart };
508f4263c98SPaul Stewart 
509f4263c98SPaul Stewart /**
5102ec600d6SLuis Carlos Cobo  * struct station_info - station information
511fd5b74dcSJohannes Berg  *
5122ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
513fd5b74dcSJohannes Berg  *
5142ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
515ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
516fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
517fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
518fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
5192ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
5202ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
5212ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
522420e7fabSHenning Rogge  * @signal: signal strength of last received packet in dBm
523541a45a1SBruno Randolf  * @signal_avg: signal strength average in dBm
524858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
525858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
52698c8a60aSJouni Malinen  * @rx_packets: packets received from this station
52798c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
528b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
529b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
5305a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
5311ba01458SRandy Dunlap  * @bss_param: current BSS parameters
532f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
533f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
534f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
535f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
53650d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
53750d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
53850d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
53950d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
54050d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
541fd5b74dcSJohannes Berg  */
5422ec600d6SLuis Carlos Cobo struct station_info {
543fd5b74dcSJohannes Berg 	u32 filled;
544ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
545fd5b74dcSJohannes Berg 	u32 inactive_time;
546fd5b74dcSJohannes Berg 	u32 rx_bytes;
547fd5b74dcSJohannes Berg 	u32 tx_bytes;
5482ec600d6SLuis Carlos Cobo 	u16 llid;
5492ec600d6SLuis Carlos Cobo 	u16 plid;
5502ec600d6SLuis Carlos Cobo 	u8 plink_state;
551420e7fabSHenning Rogge 	s8 signal;
552541a45a1SBruno Randolf 	s8 signal_avg;
553420e7fabSHenning Rogge 	struct rate_info txrate;
554c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
55598c8a60aSJouni Malinen 	u32 rx_packets;
55698c8a60aSJouni Malinen 	u32 tx_packets;
557b206b4efSBruno Randolf 	u32 tx_retries;
558b206b4efSBruno Randolf 	u32 tx_failed;
5595a5c731aSBen Greear 	u32 rx_dropped_misc;
560f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
561f5ea9120SJohannes Berg 
562f5ea9120SJohannes Berg 	int generation;
56350d3dfb7SJouni Malinen 
56450d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
56550d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
566f612cedfSJouni Malinen 
567f612cedfSJouni Malinen 	/*
568f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
569f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
570f612cedfSJouni Malinen 	 */
571fd5b74dcSJohannes Berg };
572fd5b74dcSJohannes Berg 
57366f7ac50SMichael Wu /**
57466f7ac50SMichael Wu  * enum monitor_flags - monitor flags
57566f7ac50SMichael Wu  *
57666f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
57766f7ac50SMichael Wu  * according to the nl80211 flags.
57866f7ac50SMichael Wu  *
57966f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
58066f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
58166f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
58266f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
58366f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
58466f7ac50SMichael Wu  */
58566f7ac50SMichael Wu enum monitor_flags {
58666f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
58766f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
58866f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
58966f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
59066f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
59166f7ac50SMichael Wu };
59266f7ac50SMichael Wu 
5932ec600d6SLuis Carlos Cobo /**
5942ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
5952ec600d6SLuis Carlos Cobo  *
5962ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
5972ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
5982ec600d6SLuis Carlos Cobo  *
599abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
600abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
601abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
602abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
603abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
604abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
605abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
6062ec600d6SLuis Carlos Cobo  */
6072ec600d6SLuis Carlos Cobo enum mpath_info_flags {
6082ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
609d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
6102ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
6112ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
6122ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
6132ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
6142ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
6152ec600d6SLuis Carlos Cobo };
6162ec600d6SLuis Carlos Cobo 
6172ec600d6SLuis Carlos Cobo /**
6182ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
6192ec600d6SLuis Carlos Cobo  *
6202ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
6212ec600d6SLuis Carlos Cobo  *
6222ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
6232ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
624d19b3bf6SRui Paulo  * @sn: target sequence number
6252ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
6262ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
6272ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
6282ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
6292ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
630f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
631f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
632f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
633f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
6342ec600d6SLuis Carlos Cobo  */
6352ec600d6SLuis Carlos Cobo struct mpath_info {
6362ec600d6SLuis Carlos Cobo 	u32 filled;
6372ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
638d19b3bf6SRui Paulo 	u32 sn;
6392ec600d6SLuis Carlos Cobo 	u32 metric;
6402ec600d6SLuis Carlos Cobo 	u32 exptime;
6412ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
6422ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
6432ec600d6SLuis Carlos Cobo 	u8 flags;
644f5ea9120SJohannes Berg 
645f5ea9120SJohannes Berg 	int generation;
6462ec600d6SLuis Carlos Cobo };
6472ec600d6SLuis Carlos Cobo 
6489f1ba906SJouni Malinen /**
6499f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
6509f1ba906SJouni Malinen  *
6519f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
6529f1ba906SJouni Malinen  *
6539f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
6549f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
6559f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
6569f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
6579f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
6589f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
65990c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
66090c97a04SJouni Malinen  *	(or NULL for no change)
66190c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
662fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
66350b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
66450b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
6659f1ba906SJouni Malinen  */
6669f1ba906SJouni Malinen struct bss_parameters {
6679f1ba906SJouni Malinen 	int use_cts_prot;
6689f1ba906SJouni Malinen 	int use_short_preamble;
6699f1ba906SJouni Malinen 	int use_short_slot_time;
67090c97a04SJouni Malinen 	u8 *basic_rates;
67190c97a04SJouni Malinen 	u8 basic_rates_len;
672fd8aaaf3SFelix Fietkau 	int ap_isolate;
67350b12f59SHelmut Schaa 	int ht_opmode;
6749f1ba906SJouni Malinen };
6752ec600d6SLuis Carlos Cobo 
67629cbe68cSJohannes Berg /*
67729cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
67829cbe68cSJohannes Berg  *
67929cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
68029cbe68cSJohannes Berg  */
68193da9cc1Scolin@cozybit.com struct mesh_config {
68293da9cc1Scolin@cozybit.com 	/* Timeouts in ms */
68393da9cc1Scolin@cozybit.com 	/* Mesh plink management parameters */
68493da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
68593da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
68693da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
68793da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
68893da9cc1Scolin@cozybit.com 	u8  dot11MeshMaxRetries;
68993da9cc1Scolin@cozybit.com 	u8  dot11MeshTTL;
69045904f21SJavier Cardona 	/* ttl used in path selection information elements */
69145904f21SJavier Cardona 	u8  element_ttl;
69293da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
69393da9cc1Scolin@cozybit.com 	/* HWMP parameters */
69493da9cc1Scolin@cozybit.com 	u8  dot11MeshHWMPmaxPREQretries;
69593da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
69693da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
69793da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
69893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
69993da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
70063c5723bSRui Paulo 	u8  dot11MeshHWMPRootMode;
70193da9cc1Scolin@cozybit.com };
70293da9cc1Scolin@cozybit.com 
70331888487SJouni Malinen /**
70429cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
70529cbe68cSJohannes Berg  * @mesh_id: the mesh ID
70629cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
707c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
708c80d545dSJavier Cardona  * @path_metric: which metric to use
709581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
710581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
711b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
712b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
71329cbe68cSJohannes Berg  *
71429cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
71529cbe68cSJohannes Berg  */
71629cbe68cSJohannes Berg struct mesh_setup {
71729cbe68cSJohannes Berg 	const u8 *mesh_id;
71829cbe68cSJohannes Berg 	u8 mesh_id_len;
719c80d545dSJavier Cardona 	u8  path_sel_proto;
720c80d545dSJavier Cardona 	u8  path_metric;
721581a8b0fSJavier Cardona 	const u8 *ie;
722581a8b0fSJavier Cardona 	u8 ie_len;
723b130e5ceSJavier Cardona 	bool is_authenticated;
72415d5dda6SJavier Cardona 	bool is_secure;
72529cbe68cSJohannes Berg };
72629cbe68cSJohannes Berg 
72729cbe68cSJohannes Berg /**
72831888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
72931888487SJouni Malinen  * @queue: TX queue identifier (NL80211_TXQ_Q_*)
73031888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
73131888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
73231888487SJouni Malinen  *	1..32767]
73331888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
73431888487SJouni Malinen  *	1..32767]
73531888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
73631888487SJouni Malinen  */
73731888487SJouni Malinen struct ieee80211_txq_params {
73831888487SJouni Malinen 	enum nl80211_txq_q queue;
73931888487SJouni Malinen 	u16 txop;
74031888487SJouni Malinen 	u16 cwmin;
74131888487SJouni Malinen 	u16 cwmax;
74231888487SJouni Malinen 	u8 aifs;
74331888487SJouni Malinen };
74431888487SJouni Malinen 
745704232c2SJohannes Berg /* from net/wireless.h */
746704232c2SJohannes Berg struct wiphy;
747704232c2SJohannes Berg 
748d70e9693SJohannes Berg /**
749d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
750d70e9693SJohannes Berg  *
751d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
752d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
753d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
754d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
755d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
756d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
757d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
758d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
759d70e9693SJohannes Berg  * in the wiphy structure.
760d70e9693SJohannes Berg  *
761d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
762d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
763d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
764d70e9693SJohannes Berg  *
765d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
766d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
767d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
768d70e9693SJohannes Berg  * to userspace.
769d70e9693SJohannes Berg  */
77072bdcf34SJouni Malinen 
771704232c2SJohannes Berg /**
7722a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
7732a519311SJohannes Berg  * @ssid: the SSID
7742a519311SJohannes Berg  * @ssid_len: length of the ssid
7752a519311SJohannes Berg  */
7762a519311SJohannes Berg struct cfg80211_ssid {
7772a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
7782a519311SJohannes Berg 	u8 ssid_len;
7792a519311SJohannes Berg };
7802a519311SJohannes Berg 
7812a519311SJohannes Berg /**
7822a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
7832a519311SJohannes Berg  *
7842a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
7852a519311SJohannes Berg  * @n_ssids: number of SSIDs
7862a519311SJohannes Berg  * @channels: channels to scan on.
787ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
78870692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
78970692ad2SJouni Malinen  * @ie_len: length of ie in octets
79034850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
7912a519311SJohannes Berg  * @wiphy: the wiphy this was for
792463d0183SJohannes Berg  * @dev: the interface
793abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
7942a519311SJohannes Berg  */
7952a519311SJohannes Berg struct cfg80211_scan_request {
7962a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
7972a519311SJohannes Berg 	int n_ssids;
7982a519311SJohannes Berg 	u32 n_channels;
799de95a54bSJohannes Berg 	const u8 *ie;
80070692ad2SJouni Malinen 	size_t ie_len;
8012a519311SJohannes Berg 
80234850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
80334850ab2SJohannes Berg 
8042a519311SJohannes Berg 	/* internal */
8052a519311SJohannes Berg 	struct wiphy *wiphy;
806463d0183SJohannes Berg 	struct net_device *dev;
807667503ddSJohannes Berg 	bool aborted;
8085ba63533SJohannes Berg 
8095ba63533SJohannes Berg 	/* keep last */
8105ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
8112a519311SJohannes Berg };
8122a519311SJohannes Berg 
8132a519311SJohannes Berg /**
814807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
815807f8a8cSLuciano Coelho  *
816807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
817807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
818807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
819bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
820807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
821807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
822807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
823807f8a8cSLuciano Coelho  * @dev: the interface
824807f8a8cSLuciano Coelho  * @channels: channels to scan
825807f8a8cSLuciano Coelho  */
826807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
827807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
828807f8a8cSLuciano Coelho 	int n_ssids;
829807f8a8cSLuciano Coelho 	u32 n_channels;
830bbe6ad6dSLuciano Coelho 	u32 interval;
831807f8a8cSLuciano Coelho 	const u8 *ie;
832807f8a8cSLuciano Coelho 	size_t ie_len;
833807f8a8cSLuciano Coelho 
834807f8a8cSLuciano Coelho 	/* internal */
835807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
836807f8a8cSLuciano Coelho 	struct net_device *dev;
837807f8a8cSLuciano Coelho 
838807f8a8cSLuciano Coelho 	/* keep last */
839807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
840807f8a8cSLuciano Coelho };
841807f8a8cSLuciano Coelho 
842807f8a8cSLuciano Coelho /**
8432a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
8442a519311SJohannes Berg  *
8452a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
8462a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
8472a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
8482a519311SJohannes Berg  */
8492a519311SJohannes Berg enum cfg80211_signal_type {
8502a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
8512a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
8522a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
8532a519311SJohannes Berg };
8542a519311SJohannes Berg 
8552a519311SJohannes Berg /**
8562a519311SJohannes Berg  * struct cfg80211_bss - BSS description
8572a519311SJohannes Berg  *
8582a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
8592a519311SJohannes Berg  * for use in scan results and similar.
8602a519311SJohannes Berg  *
861abe37c4bSJohannes Berg  * @channel: channel this BSS is on
8622a519311SJohannes Berg  * @bssid: BSSID of the BSS
8632a519311SJohannes Berg  * @tsf: timestamp of last received update
8642a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
8652a519311SJohannes Berg  * @capability: the capability field in host byte order
8662a519311SJohannes Berg  * @information_elements: the information elements (Note that there
86734a6eddbSJouni Malinen  *	is no guarantee that these are well-formed!); this is a pointer to
86834a6eddbSJouni Malinen  *	either the beacon_ies or proberesp_ies depending on whether Probe
86934a6eddbSJouni Malinen  *	Response frame has been received
8702a519311SJohannes Berg  * @len_information_elements: total length of the information elements
87134a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
87234a6eddbSJouni Malinen  * @len_beacon_ies: total length of the beacon_ies
87334a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
87434a6eddbSJouni Malinen  * @len_proberesp_ies: total length of the proberesp_ies
87577965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
87678c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
8772a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
8782a519311SJohannes Berg  */
8792a519311SJohannes Berg struct cfg80211_bss {
8802a519311SJohannes Berg 	struct ieee80211_channel *channel;
8812a519311SJohannes Berg 
8822a519311SJohannes Berg 	u8 bssid[ETH_ALEN];
8832a519311SJohannes Berg 	u64 tsf;
8842a519311SJohannes Berg 	u16 beacon_interval;
8852a519311SJohannes Berg 	u16 capability;
8862a519311SJohannes Berg 	u8 *information_elements;
8872a519311SJohannes Berg 	size_t len_information_elements;
88834a6eddbSJouni Malinen 	u8 *beacon_ies;
88934a6eddbSJouni Malinen 	size_t len_beacon_ies;
89034a6eddbSJouni Malinen 	u8 *proberesp_ies;
89134a6eddbSJouni Malinen 	size_t len_proberesp_ies;
8922a519311SJohannes Berg 
8932a519311SJohannes Berg 	s32 signal;
8942a519311SJohannes Berg 
89578c1c7e1SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
8962a519311SJohannes Berg 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
8972a519311SJohannes Berg };
8982a519311SJohannes Berg 
8992a519311SJohannes Berg /**
900517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
901517357c6SJohannes Berg  * @bss: the bss to search
902517357c6SJohannes Berg  * @ie: the IE ID
903517357c6SJohannes Berg  * Returns %NULL if not found.
904517357c6SJohannes Berg  */
905517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
906517357c6SJohannes Berg 
907517357c6SJohannes Berg 
908517357c6SJohannes Berg /**
909b23aa676SSamuel Ortiz  * struct cfg80211_crypto_settings - Crypto settings
910b23aa676SSamuel Ortiz  * @wpa_versions: indicates which, if any, WPA versions are enabled
911b23aa676SSamuel Ortiz  *	(from enum nl80211_wpa_versions)
912b23aa676SSamuel Ortiz  * @cipher_group: group key cipher suite (or 0 if unset)
913b23aa676SSamuel Ortiz  * @n_ciphers_pairwise: number of AP supported unicast ciphers
914b23aa676SSamuel Ortiz  * @ciphers_pairwise: unicast key cipher suites
915b23aa676SSamuel Ortiz  * @n_akm_suites: number of AKM suites
916b23aa676SSamuel Ortiz  * @akm_suites: AKM suites
917b23aa676SSamuel Ortiz  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
918b23aa676SSamuel Ortiz  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
919b23aa676SSamuel Ortiz  *	required to assume that the port is unauthorized until authorized by
920b23aa676SSamuel Ortiz  *	user space. Otherwise, port is marked authorized by default.
921c0692b8fSJohannes Berg  * @control_port_ethertype: the control port protocol that should be
922c0692b8fSJohannes Berg  *	allowed through even on unauthorized ports
923c0692b8fSJohannes Berg  * @control_port_no_encrypt: TRUE to prevent encryption of control port
924c0692b8fSJohannes Berg  *	protocol frames.
925b23aa676SSamuel Ortiz  */
926b23aa676SSamuel Ortiz struct cfg80211_crypto_settings {
927b23aa676SSamuel Ortiz 	u32 wpa_versions;
928b23aa676SSamuel Ortiz 	u32 cipher_group;
929b23aa676SSamuel Ortiz 	int n_ciphers_pairwise;
930b23aa676SSamuel Ortiz 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
931b23aa676SSamuel Ortiz 	int n_akm_suites;
932b23aa676SSamuel Ortiz 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
933b23aa676SSamuel Ortiz 	bool control_port;
934c0692b8fSJohannes Berg 	__be16 control_port_ethertype;
935c0692b8fSJohannes Berg 	bool control_port_no_encrypt;
936b23aa676SSamuel Ortiz };
937b23aa676SSamuel Ortiz 
938b23aa676SSamuel Ortiz /**
939636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
940636a5d36SJouni Malinen  *
941636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
942636a5d36SJouni Malinen  * authentication.
943636a5d36SJouni Malinen  *
94419957bb3SJohannes Berg  * @bss: The BSS to authenticate with.
945636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
946636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
947636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
948fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
949fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
950fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
951d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
952d5cdfacbSJouni Malinen  *	Authentication frame is to be transmitted and authentication state is
953d5cdfacbSJouni Malinen  *	to be changed without having to wait for a response from the peer STA
954d5cdfacbSJouni Malinen  *	(AP).
955636a5d36SJouni Malinen  */
956636a5d36SJouni Malinen struct cfg80211_auth_request {
95719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
958636a5d36SJouni Malinen 	const u8 *ie;
959636a5d36SJouni Malinen 	size_t ie_len;
96019957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
961fffd0934SJohannes Berg 	const u8 *key;
962fffd0934SJohannes Berg 	u8 key_len, key_idx;
963d5cdfacbSJouni Malinen 	bool local_state_change;
964636a5d36SJouni Malinen };
965636a5d36SJouni Malinen 
966636a5d36SJouni Malinen /**
967636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
968636a5d36SJouni Malinen  *
969636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
970636a5d36SJouni Malinen  * (re)association.
97119957bb3SJohannes Berg  * @bss: The BSS to associate with.
972636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
973636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
974dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
975b23aa676SSamuel Ortiz  * @crypto: crypto settings
9763e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
977636a5d36SJouni Malinen  */
978636a5d36SJouni Malinen struct cfg80211_assoc_request {
97919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
9803e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
981636a5d36SJouni Malinen 	size_t ie_len;
982b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
98319957bb3SJohannes Berg 	bool use_mfp;
984636a5d36SJouni Malinen };
985636a5d36SJouni Malinen 
986636a5d36SJouni Malinen /**
987636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
988636a5d36SJouni Malinen  *
989636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
990636a5d36SJouni Malinen  * deauthentication.
991636a5d36SJouni Malinen  *
99219957bb3SJohannes Berg  * @bss: the BSS to deauthenticate from
993636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
994636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
99519957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
996d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
997d5cdfacbSJouni Malinen  *	Deauthentication frame is to be transmitted.
998636a5d36SJouni Malinen  */
999636a5d36SJouni Malinen struct cfg80211_deauth_request {
100019957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1001636a5d36SJouni Malinen 	const u8 *ie;
1002636a5d36SJouni Malinen 	size_t ie_len;
100319957bb3SJohannes Berg 	u16 reason_code;
1004d5cdfacbSJouni Malinen 	bool local_state_change;
1005636a5d36SJouni Malinen };
1006636a5d36SJouni Malinen 
1007636a5d36SJouni Malinen /**
1008636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1009636a5d36SJouni Malinen  *
1010636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1011636a5d36SJouni Malinen  * disassocation.
1012636a5d36SJouni Malinen  *
101319957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1014636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1015636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
101619957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1017d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1018d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1019636a5d36SJouni Malinen  */
1020636a5d36SJouni Malinen struct cfg80211_disassoc_request {
102119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1022636a5d36SJouni Malinen 	const u8 *ie;
1023636a5d36SJouni Malinen 	size_t ie_len;
102419957bb3SJohannes Berg 	u16 reason_code;
1025d5cdfacbSJouni Malinen 	bool local_state_change;
1026636a5d36SJouni Malinen };
1027636a5d36SJouni Malinen 
1028636a5d36SJouni Malinen /**
102904a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
103004a773adSJohannes Berg  *
103104a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
103204a773adSJohannes Berg  * method.
103304a773adSJohannes Berg  *
103404a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
103504a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
103604a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
103704a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
103804a773adSJohannes Berg  * @channel: The channel to use if no IBSS can be found to join.
103904a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
104004a773adSJohannes Berg  *	IBSSs to join on other channels.
104104a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
104204a773adSJohannes Berg  * @ie_len: length of that
10438e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1044fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1045fffd0934SJohannes Berg  *	after joining
1046fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1047dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
104804a773adSJohannes Berg  */
104904a773adSJohannes Berg struct cfg80211_ibss_params {
105004a773adSJohannes Berg 	u8 *ssid;
105104a773adSJohannes Berg 	u8 *bssid;
105204a773adSJohannes Berg 	struct ieee80211_channel *channel;
105304a773adSJohannes Berg 	u8 *ie;
105404a773adSJohannes Berg 	u8 ssid_len, ie_len;
10558e30bc55SJohannes Berg 	u16 beacon_interval;
1056fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
105704a773adSJohannes Berg 	bool channel_fixed;
1058fffd0934SJohannes Berg 	bool privacy;
1059dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
106004a773adSJohannes Berg };
106104a773adSJohannes Berg 
106204a773adSJohannes Berg /**
1063b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1064b23aa676SSamuel Ortiz  *
1065b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1066b23aa676SSamuel Ortiz  * authentication and association.
1067b23aa676SSamuel Ortiz  *
1068b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1069b23aa676SSamuel Ortiz  *	on scan results)
1070b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1071b23aa676SSamuel Ortiz  *	results)
1072b23aa676SSamuel Ortiz  * @ssid: SSID
1073b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1074b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1075abe37c4bSJohannes Berg  * @ie: IEs for association request
1076abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1077b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1078b23aa676SSamuel Ortiz  * @crypto: crypto settings
1079fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1080fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1081fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1082b23aa676SSamuel Ortiz  */
1083b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1084b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1085b23aa676SSamuel Ortiz 	u8 *bssid;
1086b23aa676SSamuel Ortiz 	u8 *ssid;
1087b23aa676SSamuel Ortiz 	size_t ssid_len;
1088b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1089b23aa676SSamuel Ortiz 	u8 *ie;
1090b23aa676SSamuel Ortiz 	size_t ie_len;
1091b23aa676SSamuel Ortiz 	bool privacy;
1092b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1093fffd0934SJohannes Berg 	const u8 *key;
1094fffd0934SJohannes Berg 	u8 key_len, key_idx;
1095b23aa676SSamuel Ortiz };
1096b23aa676SSamuel Ortiz 
1097b23aa676SSamuel Ortiz /**
1098b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1099abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1100abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1101abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1102abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1103abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1104b9a5f8caSJouni Malinen  */
1105b9a5f8caSJouni Malinen enum wiphy_params_flags {
1106b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1107b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1108b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1109b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
111081077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1111b9a5f8caSJouni Malinen };
1112b9a5f8caSJouni Malinen 
11139930380fSJohannes Berg /*
11149930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
11159930380fSJohannes Berg  */
11169930380fSJohannes Berg struct cfg80211_bitrate_mask {
11179930380fSJohannes Berg 	struct {
11189930380fSJohannes Berg 		u32 legacy;
111937eb0b16SJouni Malinen 		/* TODO: add support for masking MCS rates; e.g.: */
112037eb0b16SJouni Malinen 		/* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
11219930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
11229930380fSJohannes Berg };
112367fbb16bSSamuel Ortiz /**
112467fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
112567fbb16bSSamuel Ortiz  *
112667fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
112767fbb16bSSamuel Ortiz  * caching.
112867fbb16bSSamuel Ortiz  *
112967fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
113067fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
113167fbb16bSSamuel Ortiz  */
113267fbb16bSSamuel Ortiz struct cfg80211_pmksa {
113367fbb16bSSamuel Ortiz 	u8 *bssid;
113467fbb16bSSamuel Ortiz 	u8 *pmkid;
113567fbb16bSSamuel Ortiz };
11369930380fSJohannes Berg 
11377643a2c3SJohannes Berg /**
1138ff1b6e69SJohannes Berg  * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
1139ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1140ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1141ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1142ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1143ff1b6e69SJohannes Berg  *
1144ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1145ff1b6e69SJohannes Berg  * memory, free @mask only!
1146ff1b6e69SJohannes Berg  */
1147ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern {
1148ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1149ff1b6e69SJohannes Berg 	int pattern_len;
1150ff1b6e69SJohannes Berg };
1151ff1b6e69SJohannes Berg 
1152ff1b6e69SJohannes Berg /**
1153ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1154ff1b6e69SJohannes Berg  *
1155ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1156ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1157ff1b6e69SJohannes Berg  *	operating as normal during suspend
1158ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1159ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1160ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1161ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
116277dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
116377dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
116477dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
116577dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
1166ff1b6e69SJohannes Berg  */
1167ff1b6e69SJohannes Berg struct cfg80211_wowlan {
116877dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
116977dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
117077dbbb13SJohannes Berg 	     rfkill_release;
1171ff1b6e69SJohannes Berg 	struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1172ff1b6e69SJohannes Berg 	int n_patterns;
1173ff1b6e69SJohannes Berg };
1174ff1b6e69SJohannes Berg 
1175ff1b6e69SJohannes Berg /**
1176e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1177e5497d76SJohannes Berg  * @kek: key encryption key
1178e5497d76SJohannes Berg  * @kck: key confirmation key
1179e5497d76SJohannes Berg  * @replay_ctr: replay counter
1180e5497d76SJohannes Berg  */
1181e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1182e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1183e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1184e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1185e5497d76SJohannes Berg };
1186e5497d76SJohannes Berg 
1187e5497d76SJohannes Berg /**
1188704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1189704232c2SJohannes Berg  *
1190704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1191704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1192704232c2SJohannes Berg  *
1193704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1194704232c2SJohannes Berg  * on success or a negative error code.
1195704232c2SJohannes Berg  *
119643fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
119743fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
119843fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
119943fb45cbSJohannes Berg  *
1200ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1201ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1202ff1b6e69SJohannes Berg  *	configured for the device.
12030378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
12040378b3f1SJohannes Berg  *
120560719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1206463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
1207f9e10ce4SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the netdev,
1208f9e10ce4SJohannes Berg  *	or an ERR_PTR.
1209704232c2SJohannes Berg  *
1210704232c2SJohannes Berg  * @del_virtual_intf: remove the virtual interface determined by ifindex.
121155682965SJohannes Berg  *
121260719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
121360719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
121455682965SJohannes Berg  *
121541ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
121641ade00fSJohannes Berg  *	when adding a group key.
121741ade00fSJohannes Berg  *
121841ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
121941ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
122041ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1221e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1222e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
122341ade00fSJohannes Berg  *
122441ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1225e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
122641ade00fSJohannes Berg  *
122741ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1228ed1b6cc7SJohannes Berg  *
12293cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
12303cfcf6acSJouni Malinen  *
1231e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1232e5497d76SJohannes Berg  *
1233ed1b6cc7SJohannes Berg  * @add_beacon: Add a beacon with given parameters, @head, @interval
1234ed1b6cc7SJohannes Berg  *	and @dtim_period will be valid, @tail is optional.
1235ed1b6cc7SJohannes Berg  * @set_beacon: Change the beacon parameters for an access point mode
1236ed1b6cc7SJohannes Berg  *	interface. This should reject the call when no beacon has been
1237ed1b6cc7SJohannes Berg  *	configured.
1238ed1b6cc7SJohannes Berg  * @del_beacon: Remove beacon configuration and stop sending the beacon.
12395727ef1bSJohannes Berg  *
12405727ef1bSJohannes Berg  * @add_station: Add a new station.
12415727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
12425727ef1bSJohannes Berg  * @change_station: Modify a given station.
1243abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
1244abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
1245abe37c4bSJohannes Berg  *
1246abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
1247abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
1248abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
1249abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
1250abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1251f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
1252f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
12532ec600d6SLuis Carlos Cobo  *
125424bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
125593da9cc1Scolin@cozybit.com  *
125624bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
125793da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
125893da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
125993da9cc1Scolin@cozybit.com  *
12609f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
126131888487SJouni Malinen  *
126231888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
126372bdcf34SJouni Malinen  *
1264f444de05SJohannes Berg  * @set_channel: Set channel for a given wireless interface. Some devices
1265f444de05SJohannes Berg  *	may support multi-channel operation (by channel hopping) so cfg80211
1266f444de05SJohannes Berg  *	doesn't verify much. Note, however, that the passed netdev may be
1267f444de05SJohannes Berg  *	%NULL as well if the user requested changing the channel for the
1268f444de05SJohannes Berg  *	device itself, or for a monitor interface.
12699aed3cc1SJouni Malinen  *
12702a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
12712a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
12722a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
12732a519311SJohannes Berg  *	the scan/scan_done bracket too.
1274636a5d36SJouni Malinen  *
1275636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
1276636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
1277636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
1278636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
127904a773adSJohannes Berg  *
1280b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
1281b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1282b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
1283b23aa676SSamuel Ortiz  *	with the status from the AP.
1284b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
1285b23aa676SSamuel Ortiz  *
128604a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
128704a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
128804a773adSJohannes Berg  *	to a merge.
128904a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
1290b9a5f8caSJouni Malinen  *
1291b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
1292b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
1293b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
1294b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
12957643a2c3SJohannes Berg  *
12967643a2c3SJohannes Berg  * @set_tx_power: set the transmit power according to the parameters
12977643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
12981f87f7d3SJohannes Berg  *	return 0 if successful
12991f87f7d3SJohannes Berg  *
1300abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
1301abe37c4bSJohannes Berg  *
13021f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
13031f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
1304aff89a9bSJohannes Berg  *
130561fa713cSHolger Schurig  * @dump_survey: get site survey information.
130661fa713cSHolger Schurig  *
13079588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
13089588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
13099588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
13109588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
13119588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
13129588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
13139588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
13149588bbd5SJouni Malinen  *	the duration value.
1315f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
1316f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
1317f7ca38dfSJohannes Berg  *	frame on another channel
13189588bbd5SJouni Malinen  *
1319aff89a9bSJohannes Berg  * @testmode_cmd: run a test mode command
132071063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
132171063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
132271063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
132371063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
132471063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
132571063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
132667fbb16bSSamuel Ortiz  *
1327abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
1328abe37c4bSJohannes Berg  *
132967fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
133067fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
133167fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
133267fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
133367fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
13349043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
13359043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
1336d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1337807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
1338807f8a8cSLuciano Coelho  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled
1339807f8a8cSLuciano Coelho  *	scan.  The driver_initiated flag specifies whether the driver
1340807f8a8cSLuciano Coelho  *	itself has informed that the scan has stopped.
134167fbb16bSSamuel Ortiz  *
1342271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
1343271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
1344271733cfSJohannes Berg  *	concurrently with itself.
1345547025d5SBruno Randolf  *
1346547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1347547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1348547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
1349547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1350547025d5SBruno Randolf  *
1351547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
13523677713bSJohn W. Linville  *
13533677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
13543677713bSJohn W. Linville  *
13553677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
1356704232c2SJohannes Berg  */
1357704232c2SJohannes Berg struct cfg80211_ops {
1358ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
13590378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
13600378b3f1SJohannes Berg 
1361f9e10ce4SJohannes Berg 	struct net_device * (*add_virtual_intf)(struct wiphy *wiphy,
1362f9e10ce4SJohannes Berg 						char *name,
1363f9e10ce4SJohannes Berg 						enum nl80211_iftype type,
1364f9e10ce4SJohannes Berg 						u32 *flags,
13652ec600d6SLuis Carlos Cobo 						struct vif_params *params);
1366463d0183SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);
1367e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
1368e36d56b6SJohannes Berg 				       struct net_device *dev,
13692ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
13702ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
137141ade00fSJohannes Berg 
137241ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
1373e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
137441ade00fSJohannes Berg 			   struct key_params *params);
137541ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
1376e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
1377e31b8213SJohannes Berg 			   void *cookie,
137841ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
137941ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
1380e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
138141ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
138241ade00fSJohannes Berg 				   struct net_device *netdev,
1383dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
13843cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
13853cfcf6acSJouni Malinen 					struct net_device *netdev,
13863cfcf6acSJouni Malinen 					u8 key_index);
1387ed1b6cc7SJohannes Berg 
1388ed1b6cc7SJohannes Berg 	int	(*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
1389ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
1390ed1b6cc7SJohannes Berg 	int	(*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
1391ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
1392ed1b6cc7SJohannes Berg 	int	(*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
13935727ef1bSJohannes Berg 
13945727ef1bSJohannes Berg 
13955727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
13965727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
13975727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
13985727ef1bSJohannes Berg 			       u8 *mac);
13995727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
14005727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
1401fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
14022ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
14032ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
14042ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
14052ec600d6SLuis Carlos Cobo 
14062ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
14072ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
14082ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
14092ec600d6SLuis Carlos Cobo 			       u8 *dst);
14102ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
14112ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
14122ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
14132ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
14142ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
14152ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
14162ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
14172ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
141824bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
141993da9cc1Scolin@cozybit.com 				struct net_device *dev,
142093da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
142124bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
142229cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
142329cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
142429cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
142529cbe68cSJohannes Berg 			     const struct mesh_config *conf,
142629cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
142729cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
142829cbe68cSJohannes Berg 
14299f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
14309f1ba906SJouni Malinen 			      struct bss_parameters *params);
143131888487SJouni Malinen 
143231888487SJouni Malinen 	int	(*set_txq_params)(struct wiphy *wiphy,
143331888487SJouni Malinen 				  struct ieee80211_txq_params *params);
143472bdcf34SJouni Malinen 
1435f444de05SJohannes Berg 	int	(*set_channel)(struct wiphy *wiphy, struct net_device *dev,
143672bdcf34SJouni Malinen 			       struct ieee80211_channel *chan,
1437094d05dcSSujith 			       enum nl80211_channel_type channel_type);
14389aed3cc1SJouni Malinen 
14392a519311SJohannes Berg 	int	(*scan)(struct wiphy *wiphy, struct net_device *dev,
14402a519311SJohannes Berg 			struct cfg80211_scan_request *request);
1441636a5d36SJouni Malinen 
1442636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
1443636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
1444636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
1445636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
1446636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
1447667503ddSJohannes Berg 			  struct cfg80211_deauth_request *req,
1448667503ddSJohannes Berg 			  void *cookie);
1449636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1450667503ddSJohannes Berg 			    struct cfg80211_disassoc_request *req,
1451667503ddSJohannes Berg 			    void *cookie);
145204a773adSJohannes Berg 
1453b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
1454b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
1455b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1456b23aa676SSamuel Ortiz 			      u16 reason_code);
1457b23aa676SSamuel Ortiz 
145804a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
145904a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
146004a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1461b9a5f8caSJouni Malinen 
1462b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
14637643a2c3SJohannes Berg 
14647643a2c3SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy,
1465fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
14667643a2c3SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, int *dbm);
14671f87f7d3SJohannes Berg 
1468ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1469388ac775SJohannes Berg 				const u8 *addr);
1470ab737a4fSJohannes Berg 
14711f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
1472aff89a9bSJohannes Berg 
1473aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
1474aff89a9bSJohannes Berg 	int	(*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
147571063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
147671063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
147771063f0eSWey-Yi Guy 				 void *data, int len);
1478aff89a9bSJohannes Berg #endif
1479bc92afd9SJohannes Berg 
14809930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
14819930380fSJohannes Berg 				    struct net_device *dev,
14829930380fSJohannes Berg 				    const u8 *peer,
14839930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
14849930380fSJohannes Berg 
148561fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
148661fa713cSHolger Schurig 			int idx, struct survey_info *info);
148761fa713cSHolger Schurig 
148867fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
148967fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
149067fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
149167fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
149267fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
149367fbb16bSSamuel Ortiz 
14949588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
14959588bbd5SJouni Malinen 				     struct net_device *dev,
14969588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
14979588bbd5SJouni Malinen 				     enum nl80211_channel_type channel_type,
14989588bbd5SJouni Malinen 				     unsigned int duration,
14999588bbd5SJouni Malinen 				     u64 *cookie);
15009588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
15019588bbd5SJouni Malinen 					    struct net_device *dev,
15029588bbd5SJouni Malinen 					    u64 cookie);
15039588bbd5SJouni Malinen 
15042e161f78SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev,
1505f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
1506026331c4SJouni Malinen 			  enum nl80211_channel_type channel_type,
1507f7ca38dfSJohannes Berg 			  bool channel_type_valid, unsigned int wait,
1508026331c4SJouni Malinen 			  const u8 *buf, size_t len, u64 *cookie);
1509f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1510f7ca38dfSJohannes Berg 				       struct net_device *dev,
1511f7ca38dfSJohannes Berg 				       u64 cookie);
1512026331c4SJouni Malinen 
1513bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1514bc92afd9SJohannes Berg 				  bool enabled, int timeout);
1515d6dc1a38SJuuso Oikarinen 
1516d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
1517d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
1518d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
1519271733cfSJohannes Berg 
1520271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
1521271733cfSJohannes Berg 				       struct net_device *dev,
1522271733cfSJohannes Berg 				       u16 frame_type, bool reg);
1523afe0cbf8SBruno Randolf 
1524afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1525afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
15263677713bSJohn W. Linville 
15273677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
15283677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
15293677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1530807f8a8cSLuciano Coelho 
1531807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
1532807f8a8cSLuciano Coelho 				struct net_device *dev,
1533807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
153485a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
1535e5497d76SJohannes Berg 
1536e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
1537e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
1538704232c2SJohannes Berg };
1539704232c2SJohannes Berg 
1540d3236553SJohannes Berg /*
1541d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
1542d3236553SJohannes Berg  * and registration/helper functions
1543d3236553SJohannes Berg  */
1544d3236553SJohannes Berg 
1545d3236553SJohannes Berg /**
15465be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
15475be83de5SJohannes Berg  *
15485be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
1549d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
1550d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
1551d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
1552d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
15535be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
15545be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
1555749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
1556749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
1557749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
1558749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
1559749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
1560749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
1561749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
1562749b527bSLuis R. Rodriguez  *	outside of its regulatory domain.
15635be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
15645be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
15655be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
156637184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
15675be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
15685be83de5SJohannes Berg  *	wiphy at all
15697527a782SJohannes Berg  * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface
15707527a782SJohannes Berg  *	combinations for this device. This flag is used for backward
15717527a782SJohannes Berg  *	compatibility only until all drivers advertise combinations and
15727527a782SJohannes Berg  *	they will always be enforced.
15735be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
15745be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
15755be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
15765be83de5SJohannes Berg  *	reason to override the default
15779bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
15789bc383deSJohannes Berg  *	on a VLAN interface)
15799bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
1580c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
1581c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
1582c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
1583e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
158415d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
158515d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
15861ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
15875be83de5SJohannes Berg  */
15885be83de5SJohannes Berg enum wiphy_flags {
15895be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
15905be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
15915be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
15925be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
15935be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
15949bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
15959bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
1596c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
1597309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
159815d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
1599807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
16007527a782SJohannes Berg 	WIPHY_FLAG_ENFORCE_COMBINATIONS		= BIT(12),
16017527a782SJohannes Berg };
16027527a782SJohannes Berg 
16037527a782SJohannes Berg /**
16047527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
16057527a782SJohannes Berg  * @max: maximum number of interfaces of these types
16067527a782SJohannes Berg  * @types: interface types (bits)
16077527a782SJohannes Berg  */
16087527a782SJohannes Berg struct ieee80211_iface_limit {
16097527a782SJohannes Berg 	u16 max;
16107527a782SJohannes Berg 	u16 types;
16117527a782SJohannes Berg };
16127527a782SJohannes Berg 
16137527a782SJohannes Berg /**
16147527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
16157527a782SJohannes Berg  * @limits: limits for the given interface types
16167527a782SJohannes Berg  * @n_limits: number of limitations
16177527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
16187527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
16197527a782SJohannes Berg  *	group
16207527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
16217527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
16227527a782SJohannes Berg  *	only in special cases.
16237527a782SJohannes Berg  *
16247527a782SJohannes Berg  * These examples can be expressed as follows:
16257527a782SJohannes Berg  *
16267527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
16277527a782SJohannes Berg  *
16287527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
16297527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
16307527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
16317527a782SJohannes Berg  *  };
16327527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
16337527a782SJohannes Berg  *	.limits = limits1,
16347527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
16357527a782SJohannes Berg  *	.max_interfaces = 2,
16367527a782SJohannes Berg  *	.beacon_int_infra_match = true,
16377527a782SJohannes Berg  *  };
16387527a782SJohannes Berg  *
16397527a782SJohannes Berg  *
16407527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
16417527a782SJohannes Berg  *
16427527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
16437527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
16447527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
16457527a782SJohannes Berg  *  };
16467527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
16477527a782SJohannes Berg  *	.limits = limits2,
16487527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
16497527a782SJohannes Berg  *	.max_interfaces = 8,
16507527a782SJohannes Berg  *	.num_different_channels = 1,
16517527a782SJohannes Berg  *  };
16527527a782SJohannes Berg  *
16537527a782SJohannes Berg  *
16547527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
16557527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
16567527a782SJohannes Berg  *
16577527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
16587527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
16597527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
16607527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
16617527a782SJohannes Berg  *  };
16627527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
16637527a782SJohannes Berg  *	.limits = limits3,
16647527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
16657527a782SJohannes Berg  *	.max_interfaces = 4,
16667527a782SJohannes Berg  *	.num_different_channels = 2,
16677527a782SJohannes Berg  *  };
16687527a782SJohannes Berg  */
16697527a782SJohannes Berg struct ieee80211_iface_combination {
16707527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
16717527a782SJohannes Berg 	u32 num_different_channels;
16727527a782SJohannes Berg 	u16 max_interfaces;
16737527a782SJohannes Berg 	u8 n_limits;
16747527a782SJohannes Berg 	bool beacon_int_infra_match;
16755be83de5SJohannes Berg };
16765be83de5SJohannes Berg 
1677ef15aac6SJohannes Berg struct mac_address {
1678ef15aac6SJohannes Berg 	u8 addr[ETH_ALEN];
1679ef15aac6SJohannes Berg };
1680ef15aac6SJohannes Berg 
16812e161f78SJohannes Berg struct ieee80211_txrx_stypes {
16822e161f78SJohannes Berg 	u16 tx, rx;
16832e161f78SJohannes Berg };
16842e161f78SJohannes Berg 
16855be83de5SJohannes Berg /**
1686ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
1687ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
1688ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
1689ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
1690ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
1691ff1b6e69SJohannes Berg  *	packet should be preserved in that case
1692ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
1693ff1b6e69SJohannes Berg  *	(see nl80211.h)
1694ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
169577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
169677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
169777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
169877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
169977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
1700ff1b6e69SJohannes Berg  */
1701ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
1702ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
1703ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
1704ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
170577dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
170677dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
170777dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
170877dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
170977dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
1710ff1b6e69SJohannes Berg };
1711ff1b6e69SJohannes Berg 
1712ff1b6e69SJohannes Berg /**
1713ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
1714ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
1715ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
1716ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
1717ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
1718ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
1719ff1b6e69SJohannes Berg  */
1720ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
1721ff1b6e69SJohannes Berg 	u32 flags;
1722ff1b6e69SJohannes Berg 	int n_patterns;
1723ff1b6e69SJohannes Berg 	int pattern_max_len;
1724ff1b6e69SJohannes Berg 	int pattern_min_len;
1725ff1b6e69SJohannes Berg };
1726ff1b6e69SJohannes Berg 
1727ff1b6e69SJohannes Berg /**
17285be83de5SJohannes Berg  * struct wiphy - wireless hardware description
17292784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
17302784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
17312784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
1732d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
1733d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
1734d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
1735d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
1736d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
1737d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
1738d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
1739b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
1740b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
1741b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
1742b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
1743b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1744abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
1745ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
1746ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
1747ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
1748ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
1749ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
1750ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
1751ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
1752ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
1753ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
1754ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
1755ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
1756ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
1757abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
1758abe37c4bSJohannes Berg  *	automatically on wiphy renames
1759abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
1760abe37c4bSJohannes Berg  * @wext: wireless extension handlers
1761abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
1762abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
1763abe37c4bSJohannes Berg  *	must be set by driver
17647527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
17657527a782SJohannes Berg  *	list single interface types.
17667527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
17677527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
17687527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
1769abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
1770abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
1771abe37c4bSJohannes Berg  *	this variable determines its size
1772abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
1773abe37c4bSJohannes Berg  *	any given scan
177493b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
177593b6aa69SLuciano Coelho  *	for in any given scheduled scan
1776abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
1777abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
1778abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
17795a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
17805a865badSLuciano Coelho  *	scans
1781abe37c4bSJohannes Berg  * @coverage_class: current coverage class
1782abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
1783abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
1784abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
1785abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
1786abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
1787abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
17882e161f78SJohannes Berg  *
17892e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
17902e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
17912e161f78SJohannes Berg  *	type
1792a7ffac95SBruno Randolf  *
17937f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
17947f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
17957f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
17967f531e03SBruno Randolf  *
17977f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
17987f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
17997f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
1800a293911dSJohannes Berg  *
1801a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
1802a293911dSJohannes Berg  *	may request, if implemented.
1803ff1b6e69SJohannes Berg  *
1804ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
1805d3236553SJohannes Berg  */
1806d3236553SJohannes Berg struct wiphy {
1807d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
1808d3236553SJohannes Berg 
1809ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
1810d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
1811ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
1812ef15aac6SJohannes Berg 
1813ef15aac6SJohannes Berg 	struct mac_address *addresses;
1814d3236553SJohannes Berg 
18152e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
18162e161f78SJohannes Berg 
18177527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
18187527a782SJohannes Berg 	int n_iface_combinations;
18197527a782SJohannes Berg 	u16 software_iftypes;
18207527a782SJohannes Berg 
18212e161f78SJohannes Berg 	u16 n_addresses;
18222e161f78SJohannes Berg 
1823d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1824d3236553SJohannes Berg 	u16 interface_modes;
1825d3236553SJohannes Berg 
18265be83de5SJohannes Berg 	u32 flags;
1827463d0183SJohannes Berg 
1828d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
1829d3236553SJohannes Berg 
1830d3236553SJohannes Berg 	int bss_priv_size;
1831d3236553SJohannes Berg 	u8 max_scan_ssids;
183293b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
1833d3236553SJohannes Berg 	u16 max_scan_ie_len;
18345a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
1835d3236553SJohannes Berg 
1836d3236553SJohannes Berg 	int n_cipher_suites;
1837d3236553SJohannes Berg 	const u32 *cipher_suites;
1838d3236553SJohannes Berg 
1839b9a5f8caSJouni Malinen 	u8 retry_short;
1840b9a5f8caSJouni Malinen 	u8 retry_long;
1841b9a5f8caSJouni Malinen 	u32 frag_threshold;
1842b9a5f8caSJouni Malinen 	u32 rts_threshold;
184381077e82SLukáš Turek 	u8 coverage_class;
1844b9a5f8caSJouni Malinen 
1845dfce95f5SKalle Valo 	char fw_version[ETHTOOL_BUSINFO_LEN];
1846dfce95f5SKalle Valo 	u32 hw_version;
1847dfce95f5SKalle Valo 
1848ff1b6e69SJohannes Berg 	struct wiphy_wowlan_support wowlan;
1849ff1b6e69SJohannes Berg 
1850a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
1851a293911dSJohannes Berg 
185267fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
185367fbb16bSSamuel Ortiz 
18547f531e03SBruno Randolf 	u32 available_antennas_tx;
18557f531e03SBruno Randolf 	u32 available_antennas_rx;
1856a7ffac95SBruno Randolf 
1857d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
1858d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
1859d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
1860d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
1861d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
1862cf5aa2f1SDavid Kilroy 	const void *privid;
1863d3236553SJohannes Berg 
1864d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
1865d3236553SJohannes Berg 
1866d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
1867d3236553SJohannes Berg 	int (*reg_notifier)(struct wiphy *wiphy,
1868d3236553SJohannes Berg 			    struct regulatory_request *request);
1869d3236553SJohannes Berg 
1870d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
1871d3236553SJohannes Berg 
1872d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd;
1873d3236553SJohannes Berg 
1874d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
1875d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
1876d3236553SJohannes Berg 	struct device dev;
1877d3236553SJohannes Berg 
1878d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
1879d3236553SJohannes Berg 	struct dentry *debugfsdir;
1880d3236553SJohannes Berg 
1881463d0183SJohannes Berg #ifdef CONFIG_NET_NS
1882463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
1883463d0183SJohannes Berg 	struct net *_net;
1884463d0183SJohannes Berg #endif
1885463d0183SJohannes Berg 
18863d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
18873d23e349SJohannes Berg 	const struct iw_handler_def *wext;
18883d23e349SJohannes Berg #endif
18893d23e349SJohannes Berg 
1890d3236553SJohannes Berg 	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1891d3236553SJohannes Berg };
1892d3236553SJohannes Berg 
1893463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
1894463d0183SJohannes Berg {
1895c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
1896463d0183SJohannes Berg }
1897463d0183SJohannes Berg 
1898463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1899463d0183SJohannes Berg {
1900c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
1901463d0183SJohannes Berg }
1902463d0183SJohannes Berg 
1903d3236553SJohannes Berg /**
1904d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
1905d3236553SJohannes Berg  *
1906d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
1907d3236553SJohannes Berg  */
1908d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
1909d3236553SJohannes Berg {
1910d3236553SJohannes Berg 	BUG_ON(!wiphy);
1911d3236553SJohannes Berg 	return &wiphy->priv;
1912d3236553SJohannes Berg }
1913d3236553SJohannes Berg 
1914d3236553SJohannes Berg /**
1915f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
1916f1f74825SDavid Kilroy  *
1917f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
1918f1f74825SDavid Kilroy  */
1919f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
1920f1f74825SDavid Kilroy {
1921f1f74825SDavid Kilroy 	BUG_ON(!priv);
1922f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
1923f1f74825SDavid Kilroy }
1924f1f74825SDavid Kilroy 
1925f1f74825SDavid Kilroy /**
1926d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
1927d3236553SJohannes Berg  *
1928d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
1929d3236553SJohannes Berg  * @dev: The device to parent it to
1930d3236553SJohannes Berg  */
1931d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1932d3236553SJohannes Berg {
1933d3236553SJohannes Berg 	wiphy->dev.parent = dev;
1934d3236553SJohannes Berg }
1935d3236553SJohannes Berg 
1936d3236553SJohannes Berg /**
1937d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
1938d3236553SJohannes Berg  *
1939d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
1940d3236553SJohannes Berg  */
1941d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
1942d3236553SJohannes Berg {
1943d3236553SJohannes Berg 	return wiphy->dev.parent;
1944d3236553SJohannes Berg }
1945d3236553SJohannes Berg 
1946d3236553SJohannes Berg /**
1947d3236553SJohannes Berg  * wiphy_name - get wiphy name
1948d3236553SJohannes Berg  *
1949d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
1950d3236553SJohannes Berg  */
1951e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
1952d3236553SJohannes Berg {
1953d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
1954d3236553SJohannes Berg }
1955d3236553SJohannes Berg 
1956d3236553SJohannes Berg /**
1957d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
1958d3236553SJohannes Berg  *
1959d3236553SJohannes Berg  * @ops: The configuration operations for this device
1960d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
1961d3236553SJohannes Berg  *
1962d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
1963d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
1964d3236553SJohannes Berg  *
1965d3236553SJohannes Berg  * The returned pointer must be assigned to each netdev's
1966d3236553SJohannes Berg  * ieee80211_ptr for proper operation.
1967d3236553SJohannes Berg  */
19683dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
1969d3236553SJohannes Berg 
1970d3236553SJohannes Berg /**
1971d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
1972d3236553SJohannes Berg  *
1973d3236553SJohannes Berg  * @wiphy: The wiphy to register.
1974d3236553SJohannes Berg  *
1975d3236553SJohannes Berg  * Returns a non-negative wiphy index or a negative error code.
1976d3236553SJohannes Berg  */
1977d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
1978d3236553SJohannes Berg 
1979d3236553SJohannes Berg /**
1980d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
1981d3236553SJohannes Berg  *
1982d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
1983d3236553SJohannes Berg  *
1984d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
1985d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
1986d3236553SJohannes Berg  * request that is being handled.
1987d3236553SJohannes Berg  */
1988d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
1989d3236553SJohannes Berg 
1990d3236553SJohannes Berg /**
1991d3236553SJohannes Berg  * wiphy_free - free wiphy
1992d3236553SJohannes Berg  *
1993d3236553SJohannes Berg  * @wiphy: The wiphy to free
1994d3236553SJohannes Berg  */
1995d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
1996d3236553SJohannes Berg 
1997fffd0934SJohannes Berg /* internal structs */
19986829c878SJohannes Berg struct cfg80211_conn;
199919957bb3SJohannes Berg struct cfg80211_internal_bss;
2000fffd0934SJohannes Berg struct cfg80211_cached_keys;
200119957bb3SJohannes Berg 
200219957bb3SJohannes Berg #define MAX_AUTH_BSSES		4
20036829c878SJohannes Berg 
2004d3236553SJohannes Berg /**
2005d3236553SJohannes Berg  * struct wireless_dev - wireless per-netdev state
2006d3236553SJohannes Berg  *
2007d3236553SJohannes Berg  * This structure must be allocated by the driver/stack
2008d3236553SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device
2009d3236553SJohannes Berg  * (this is intentional so it can be allocated along with
2010d3236553SJohannes Berg  * the netdev.)
2011d3236553SJohannes Berg  *
2012d3236553SJohannes Berg  * @wiphy: pointer to hardware description
2013d3236553SJohannes Berg  * @iftype: interface type
2014d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
2015d3236553SJohannes Berg  * @netdev: (private) Used to reference back to the netdev
2016d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
2017f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
2018f444de05SJohannes Berg  *	user-set AP, monitor and WDS channels for wireless extensions
2019d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
2020d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
2021d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
202229cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
202329cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
2024d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
20259bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
20269bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
20279bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
20289bc383deSJohannes Berg  *	by cfg80211 on change_interface
20292e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
20302e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
2031abe37c4bSJohannes Berg  * @mtx: mutex used to lock data in this struct
2032abe37c4bSJohannes Berg  * @cleanup_work: work struct used for cleanup that can't be done directly
203356d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
203456d1893dSJohannes Berg  *	beacons, 0 when not valid
2035d3236553SJohannes Berg  */
2036d3236553SJohannes Berg struct wireless_dev {
2037d3236553SJohannes Berg 	struct wiphy *wiphy;
2038d3236553SJohannes Berg 	enum nl80211_iftype iftype;
2039d3236553SJohannes Berg 
2040667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
2041d3236553SJohannes Berg 	struct list_head list;
2042d3236553SJohannes Berg 	struct net_device *netdev;
2043d3236553SJohannes Berg 
20442e161f78SJohannes Berg 	struct list_head mgmt_registrations;
20452e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
2046026331c4SJouni Malinen 
2047667503ddSJohannes Berg 	struct mutex mtx;
2048667503ddSJohannes Berg 
2049ad002395SJohannes Berg 	struct work_struct cleanup_work;
2050ad002395SJohannes Berg 
20519bc383deSJohannes Berg 	bool use_4addr;
20529bc383deSJohannes Berg 
2053b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
2054d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
205529cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
2056b23aa676SSamuel Ortiz 	enum {
2057b23aa676SSamuel Ortiz 		CFG80211_SME_IDLE,
20586829c878SJohannes Berg 		CFG80211_SME_CONNECTING,
2059b23aa676SSamuel Ortiz 		CFG80211_SME_CONNECTED,
2060b23aa676SSamuel Ortiz 	} sme_state;
20616829c878SJohannes Berg 	struct cfg80211_conn *conn;
2062fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
2063d3236553SJohannes Berg 
2064667503ddSJohannes Berg 	struct list_head event_list;
2065667503ddSJohannes Berg 	spinlock_t event_lock;
2066667503ddSJohannes Berg 
206719957bb3SJohannes Berg 	struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
206819957bb3SJohannes Berg 	struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
206919957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
2070f444de05SJohannes Berg 	struct ieee80211_channel *channel;
207119957bb3SJohannes Berg 
2072ffb9eb3dSKalle Valo 	bool ps;
2073ffb9eb3dSKalle Valo 	int ps_timeout;
2074ffb9eb3dSKalle Valo 
207556d1893dSJohannes Berg 	int beacon_interval;
207656d1893dSJohannes Berg 
20773d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
2078d3236553SJohannes Berg 	/* wext data */
2079cbe8fa9cSJohannes Berg 	struct {
2080cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
2081f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
2082fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
2083f2129354SJohannes Berg 		u8 *ie;
2084f2129354SJohannes Berg 		size_t ie_len;
2085f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
2086f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
208708645126SJohannes Berg 		s8 default_key, default_mgmt_key;
2088ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
2089cbe8fa9cSJohannes Berg 	} wext;
2090d3236553SJohannes Berg #endif
2091d3236553SJohannes Berg };
2092d3236553SJohannes Berg 
2093d3236553SJohannes Berg /**
2094d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
2095d3236553SJohannes Berg  *
2096d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
2097d3236553SJohannes Berg  */
2098d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
2099d3236553SJohannes Berg {
2100d3236553SJohannes Berg 	BUG_ON(!wdev);
2101d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
2102d3236553SJohannes Berg }
2103d3236553SJohannes Berg 
2104d70e9693SJohannes Berg /**
2105d70e9693SJohannes Berg  * DOC: Utility functions
2106d70e9693SJohannes Berg  *
2107d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
2108d3236553SJohannes Berg  */
2109d3236553SJohannes Berg 
2110d3236553SJohannes Berg /**
2111d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
2112abe37c4bSJohannes Berg  * @chan: channel number
211359eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
2114d3236553SJohannes Berg  */
211559eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
2116d3236553SJohannes Berg 
2117d3236553SJohannes Berg /**
2118d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
2119abe37c4bSJohannes Berg  * @freq: center frequency
2120d3236553SJohannes Berg  */
2121d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
2122d3236553SJohannes Berg 
2123d3236553SJohannes Berg /*
2124d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
2125d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
2126d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
2127d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
2128d3236553SJohannes Berg  * clash.
2129d3236553SJohannes Berg  */
2130d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
2131d3236553SJohannes Berg 							 int freq);
2132d3236553SJohannes Berg /**
2133d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
2134abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
2135abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
2136d3236553SJohannes Berg  */
2137d3236553SJohannes Berg static inline struct ieee80211_channel *
2138d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
2139d3236553SJohannes Berg {
2140d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
2141d3236553SJohannes Berg }
2142d3236553SJohannes Berg 
2143d3236553SJohannes Berg /**
2144d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
2145d3236553SJohannes Berg  *
2146d3236553SJohannes Berg  * @sband: the band to look for rates in
2147d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
2148d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
2149d3236553SJohannes Berg  *
2150d3236553SJohannes Berg  * This function returns the basic rate corresponding to a given
2151d3236553SJohannes Berg  * bitrate, that is the next lower bitrate contained in the basic
2152d3236553SJohannes Berg  * rate map, which is, for this function, given as a bitmap of
2153d3236553SJohannes Berg  * indices of rates in the band's bitrate table.
2154d3236553SJohannes Berg  */
2155d3236553SJohannes Berg struct ieee80211_rate *
2156d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2157d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
2158d3236553SJohannes Berg 
2159d3236553SJohannes Berg /*
2160d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
2161d3236553SJohannes Berg  *
2162d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
2163d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
2164d3236553SJohannes Berg  */
2165d3236553SJohannes Berg 
216633e5a2f7SJohannes Berg struct radiotap_align_size {
216733e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
216833e5a2f7SJohannes Berg };
216933e5a2f7SJohannes Berg 
217033e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
217133e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
217233e5a2f7SJohannes Berg 	int n_bits;
217333e5a2f7SJohannes Berg 	uint32_t oui;
217433e5a2f7SJohannes Berg 	uint8_t subns;
217533e5a2f7SJohannes Berg };
217633e5a2f7SJohannes Berg 
217733e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
217833e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
217933e5a2f7SJohannes Berg 	int n_ns;
218033e5a2f7SJohannes Berg };
218133e5a2f7SJohannes Berg 
2182d3236553SJohannes Berg /**
2183d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
218433e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
218533e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
218633e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
218733e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
218833e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
218933e5a2f7SJohannes Berg  *	the beginning of the actual data portion
219033e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
219133e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
219233e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
219333e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
219433e5a2f7SJohannes Berg  *	radiotap namespace or not
219533e5a2f7SJohannes Berg  *
219633e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
219733e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
219833e5a2f7SJohannes Berg  * @_arg_index: next argument index
219933e5a2f7SJohannes Berg  * @_arg: next argument pointer
220033e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
220133e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
220233e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
220333e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
220433e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
220533e5a2f7SJohannes Berg  *	next bitmap word
220633e5a2f7SJohannes Berg  *
220733e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
220833e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
2209d3236553SJohannes Berg  */
2210d3236553SJohannes Berg 
2211d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
221233e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
221333e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
221433e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
2215d3236553SJohannes Berg 
221633e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
221767272440SJohannes Berg 	__le32 *_next_bitmap;
221833e5a2f7SJohannes Berg 
221933e5a2f7SJohannes Berg 	unsigned char *this_arg;
222033e5a2f7SJohannes Berg 	int this_arg_index;
222133e5a2f7SJohannes Berg 	int this_arg_size;
222233e5a2f7SJohannes Berg 
222333e5a2f7SJohannes Berg 	int is_radiotap_ns;
222433e5a2f7SJohannes Berg 
222533e5a2f7SJohannes Berg 	int _max_length;
222633e5a2f7SJohannes Berg 	int _arg_index;
222733e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
222833e5a2f7SJohannes Berg 	int _reset_on_ext;
2229d3236553SJohannes Berg };
2230d3236553SJohannes Berg 
2231d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
2232d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator,
2233d3236553SJohannes Berg 	struct ieee80211_radiotap_header *radiotap_header,
223433e5a2f7SJohannes Berg 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
2235d3236553SJohannes Berg 
2236d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
2237d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator);
2238d3236553SJohannes Berg 
223933e5a2f7SJohannes Berg 
2240e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
2241e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
2242e31a16d6SZhu Yi 
2243*0879fa44SYogesh Ashok Powar /* Parsed Information Elements */
2244*0879fa44SYogesh Ashok Powar struct ieee802_11_elems {
2245*0879fa44SYogesh Ashok Powar 	u8 *ie_start;
2246*0879fa44SYogesh Ashok Powar 	size_t total_len;
2247*0879fa44SYogesh Ashok Powar 
2248*0879fa44SYogesh Ashok Powar 	/* pointers to IEs */
2249*0879fa44SYogesh Ashok Powar 	u8 *ssid;
2250*0879fa44SYogesh Ashok Powar 	u8 *supp_rates;
2251*0879fa44SYogesh Ashok Powar 	u8 *fh_params;
2252*0879fa44SYogesh Ashok Powar 	u8 *ds_params;
2253*0879fa44SYogesh Ashok Powar 	u8 *cf_params;
2254*0879fa44SYogesh Ashok Powar 	struct ieee80211_tim_ie *tim;
2255*0879fa44SYogesh Ashok Powar 	u8 *ibss_params;
2256*0879fa44SYogesh Ashok Powar 	u8 *challenge;
2257*0879fa44SYogesh Ashok Powar 	u8 *wpa;
2258*0879fa44SYogesh Ashok Powar 	u8 *rsn;
2259*0879fa44SYogesh Ashok Powar 	u8 *erp_info;
2260*0879fa44SYogesh Ashok Powar 	u8 *ext_supp_rates;
2261*0879fa44SYogesh Ashok Powar 	u8 *wmm_info;
2262*0879fa44SYogesh Ashok Powar 	u8 *wmm_param;
2263*0879fa44SYogesh Ashok Powar 	struct ieee80211_ht_cap *ht_cap_elem;
2264*0879fa44SYogesh Ashok Powar 	struct ieee80211_ht_info *ht_info_elem;
2265*0879fa44SYogesh Ashok Powar 	struct ieee80211_meshconf_ie *mesh_config;
2266*0879fa44SYogesh Ashok Powar 	u8 *mesh_id;
2267*0879fa44SYogesh Ashok Powar 	u8 *peer_link;
2268*0879fa44SYogesh Ashok Powar 	u8 *preq;
2269*0879fa44SYogesh Ashok Powar 	u8 *prep;
2270*0879fa44SYogesh Ashok Powar 	u8 *perr;
2271*0879fa44SYogesh Ashok Powar 	struct ieee80211_rann_ie *rann;
2272*0879fa44SYogesh Ashok Powar 	u8 *ch_switch_elem;
2273*0879fa44SYogesh Ashok Powar 	u8 *country_elem;
2274*0879fa44SYogesh Ashok Powar 	u8 *pwr_constr_elem;
2275*0879fa44SYogesh Ashok Powar 	u8 *quiet_elem;	/* first quite element */
2276*0879fa44SYogesh Ashok Powar 	u8 *timeout_int;
2277*0879fa44SYogesh Ashok Powar 
2278*0879fa44SYogesh Ashok Powar 	/* length of them, respectively */
2279*0879fa44SYogesh Ashok Powar 	u8 ssid_len;
2280*0879fa44SYogesh Ashok Powar 	u8 supp_rates_len;
2281*0879fa44SYogesh Ashok Powar 	u8 fh_params_len;
2282*0879fa44SYogesh Ashok Powar 	u8 ds_params_len;
2283*0879fa44SYogesh Ashok Powar 	u8 cf_params_len;
2284*0879fa44SYogesh Ashok Powar 	u8 tim_len;
2285*0879fa44SYogesh Ashok Powar 	u8 ibss_params_len;
2286*0879fa44SYogesh Ashok Powar 	u8 challenge_len;
2287*0879fa44SYogesh Ashok Powar 	u8 wpa_len;
2288*0879fa44SYogesh Ashok Powar 	u8 rsn_len;
2289*0879fa44SYogesh Ashok Powar 	u8 erp_info_len;
2290*0879fa44SYogesh Ashok Powar 	u8 ext_supp_rates_len;
2291*0879fa44SYogesh Ashok Powar 	u8 wmm_info_len;
2292*0879fa44SYogesh Ashok Powar 	u8 wmm_param_len;
2293*0879fa44SYogesh Ashok Powar 	u8 mesh_id_len;
2294*0879fa44SYogesh Ashok Powar 	u8 peer_link_len;
2295*0879fa44SYogesh Ashok Powar 	u8 preq_len;
2296*0879fa44SYogesh Ashok Powar 	u8 prep_len;
2297*0879fa44SYogesh Ashok Powar 	u8 perr_len;
2298*0879fa44SYogesh Ashok Powar 	u8 ch_switch_elem_len;
2299*0879fa44SYogesh Ashok Powar 	u8 country_elem_len;
2300*0879fa44SYogesh Ashok Powar 	u8 pwr_constr_elem_len;
2301*0879fa44SYogesh Ashok Powar 	u8 quiet_elem_len;
2302*0879fa44SYogesh Ashok Powar 	u8 num_of_quiet_elem;	/* can be more the one */
2303*0879fa44SYogesh Ashok Powar 	u8 timeout_int_len;
2304*0879fa44SYogesh Ashok Powar };
2305*0879fa44SYogesh Ashok Powar 
2306e31a16d6SZhu Yi /**
2307e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
2308e31a16d6SZhu Yi  *
2309e31a16d6SZhu Yi  * Given an skb with a raw 802.11 header at the data pointer this function
2310e31a16d6SZhu Yi  * returns the 802.11 header length in bytes (not including encryption
2311e31a16d6SZhu Yi  * headers). If the data in the sk_buff is too short to contain a valid 802.11
2312e31a16d6SZhu Yi  * header the function returns 0.
2313e31a16d6SZhu Yi  *
2314e31a16d6SZhu Yi  * @skb: the frame
2315e31a16d6SZhu Yi  */
2316e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
2317e31a16d6SZhu Yi 
2318e31a16d6SZhu Yi /**
2319e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
2320e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
2321e31a16d6SZhu Yi  */
2322633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
2323e31a16d6SZhu Yi 
2324e31a16d6SZhu Yi /**
2325d70e9693SJohannes Berg  * DOC: Data path helpers
2326d70e9693SJohannes Berg  *
2327d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
2328d70e9693SJohannes Berg  * functions that help implement the data path for devices
2329d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
2330d70e9693SJohannes Berg  */
2331d70e9693SJohannes Berg 
2332d70e9693SJohannes Berg /**
2333e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
2334e31a16d6SZhu Yi  * @skb: the 802.11 data frame
2335e31a16d6SZhu Yi  * @addr: the device MAC address
2336e31a16d6SZhu Yi  * @iftype: the virtual interface type
2337e31a16d6SZhu Yi  */
2338eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
2339e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
2340e31a16d6SZhu Yi 
2341e31a16d6SZhu Yi /**
2342e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
2343e31a16d6SZhu Yi  * @skb: the 802.3 frame
2344e31a16d6SZhu Yi  * @addr: the device MAC address
2345e31a16d6SZhu Yi  * @iftype: the virtual interface type
2346e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
2347e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
2348e31a16d6SZhu Yi  */
2349eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
2350e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
2351e31a16d6SZhu Yi 
2352e31a16d6SZhu Yi /**
2353eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
2354eaf85ca7SZhu Yi  *
2355eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
2356eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
2357eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
2358eaf85ca7SZhu Yi  *
2359eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
2360eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
2361eaf85ca7SZhu Yi  *	initialized by by the caller.
2362eaf85ca7SZhu Yi  * @addr: The device MAC address.
2363eaf85ca7SZhu Yi  * @iftype: The device interface type.
2364eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
23658b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
2366eaf85ca7SZhu Yi  */
2367eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
2368eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
23698b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
23708b3becadSYogesh Ashok Powar 			      bool has_80211_header);
2371eaf85ca7SZhu Yi 
2372eaf85ca7SZhu Yi /**
2373e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
2374e31a16d6SZhu Yi  * @skb: the data frame
2375e31a16d6SZhu Yi  */
2376e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
2377e31a16d6SZhu Yi 
2378c21dbf92SJohannes Berg /**
2379c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
2380c21dbf92SJohannes Berg  *
2381c21dbf92SJohannes Berg  * @eid: element ID
2382c21dbf92SJohannes Berg  * @ies: data consisting of IEs
2383c21dbf92SJohannes Berg  * @len: length of data
2384c21dbf92SJohannes Berg  *
2385c21dbf92SJohannes Berg  * This function will return %NULL if the element ID could
2386c21dbf92SJohannes Berg  * not be found or if the element is invalid (claims to be
2387c21dbf92SJohannes Berg  * longer than the given data), or a pointer to the first byte
2388c21dbf92SJohannes Berg  * of the requested element, that is the byte containing the
2389c21dbf92SJohannes Berg  * element ID. There are no checks on the element length
2390c21dbf92SJohannes Berg  * other than having to fit into the given data.
2391c21dbf92SJohannes Berg  */
2392c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
2393c21dbf92SJohannes Berg 
2394d70e9693SJohannes Berg /**
2395d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
2396d70e9693SJohannes Berg  *
2397d70e9693SJohannes Berg  * TODO
2398d3236553SJohannes Berg  */
2399d3236553SJohannes Berg 
2400d3236553SJohannes Berg /**
2401d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
2402d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
2403d3236553SJohannes Berg  *	conflicts)
2404d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
2405d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
2406d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
2407d3236553SJohannes Berg  * 	alpha2.
2408d3236553SJohannes Berg  *
2409d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
2410d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
2411d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
2412d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
2413d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
2414d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
2415d3236553SJohannes Berg  *
2416d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
2417d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
2418d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
2419d3236553SJohannes Berg  *
2420d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
2421d3236553SJohannes Berg  * an -ENOMEM.
2422d3236553SJohannes Berg  */
2423d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
2424d3236553SJohannes Berg 
2425d3236553SJohannes Berg /**
2426d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
2427d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
2428d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
2429d3236553SJohannes Berg  *
2430d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
2431d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
2432d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
2433d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
2434d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
2435d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
2436d3236553SJohannes Berg  */
2437d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
2438d3236553SJohannes Berg 	struct wiphy *wiphy,
2439d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
2440d3236553SJohannes Berg 
2441d3236553SJohannes Berg /**
2442d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
2443d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
2444d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
2445038659e7SLuis R. Rodriguez  * @desired_bw_khz: the desired max bandwidth you want to use per
2446038659e7SLuis R. Rodriguez  *	channel. Note that this is still 20 MHz if you want to use HT40
2447038659e7SLuis R. Rodriguez  *	as HT40 makes use of two channels for its 40 MHz width bandwidth.
2448038659e7SLuis R. Rodriguez  *	If set to 0 we'll assume you want the standard 20 MHz.
2449d3236553SJohannes Berg  * @reg_rule: the regulatory rule which we have for this frequency
2450d3236553SJohannes Berg  *
2451d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
2452d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
2453d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
2454d3236553SJohannes Berg  * and processed already.
2455d3236553SJohannes Berg  *
2456d3236553SJohannes Berg  * Returns 0 if it was able to find a valid regulatory rule which does
2457d3236553SJohannes Berg  * apply to the given center_freq otherwise it returns non-zero. It will
2458d3236553SJohannes Berg  * also return -ERANGE if we determine the given center_freq does not even have
2459d3236553SJohannes Berg  * a regulatory rule for a frequency range in the center_freq's band. See
2460d3236553SJohannes Berg  * freq_in_rule_band() for our current definition of a band -- this is purely
2461d3236553SJohannes Berg  * subjective and right now its 802.11 specific.
2462d3236553SJohannes Berg  */
2463038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy,
2464038659e7SLuis R. Rodriguez 			 u32 center_freq,
2465038659e7SLuis R. Rodriguez 			 u32 desired_bw_khz,
2466d3236553SJohannes Berg 			 const struct ieee80211_reg_rule **reg_rule);
2467d3236553SJohannes Berg 
2468d3236553SJohannes Berg /*
2469d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
2470d3236553SJohannes Berg  * functions and BSS handling helpers
2471d3236553SJohannes Berg  */
2472d3236553SJohannes Berg 
24732a519311SJohannes Berg /**
24742a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
24752a519311SJohannes Berg  *
24762a519311SJohannes Berg  * @request: the corresponding scan request
24772a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
24782a519311SJohannes Berg  *	userspace will be notified of that
24792a519311SJohannes Berg  */
24802a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
24812a519311SJohannes Berg 
24822a519311SJohannes Berg /**
2483807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
2484807f8a8cSLuciano Coelho  *
2485807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
2486807f8a8cSLuciano Coelho  */
2487807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
2488807f8a8cSLuciano Coelho 
2489807f8a8cSLuciano Coelho /**
2490807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
2491807f8a8cSLuciano Coelho  *
2492807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
2493807f8a8cSLuciano Coelho  *
2494807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
2495807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
2496807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
2497807f8a8cSLuciano Coelho  */
2498807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
2499807f8a8cSLuciano Coelho 
2500807f8a8cSLuciano Coelho /**
2501abe37c4bSJohannes Berg  * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
25022a519311SJohannes Berg  *
25032a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
2504abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
2505abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
2506abe37c4bSJohannes Berg  * @len: length of the management frame
250777965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
25082a519311SJohannes Berg  * @gfp: context flags
25092a519311SJohannes Berg  *
25102a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
25112a519311SJohannes Berg  * the BSS should be updated/added.
25122a519311SJohannes Berg  */
25132a519311SJohannes Berg struct cfg80211_bss*
25142a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
25152a519311SJohannes Berg 			  struct ieee80211_channel *channel,
25162a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
251777965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
25182a519311SJohannes Berg 
2519abe37c4bSJohannes Berg /**
2520abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
2521abe37c4bSJohannes Berg  *
2522abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
2523abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
2524abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
2525abe37c4bSJohannes Berg  * @timestamp: the TSF timestamp sent by the peer
2526abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
2527abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
2528abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
2529abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
2530abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
2531abe37c4bSJohannes Berg  * @gfp: context flags
2532abe37c4bSJohannes Berg  *
2533abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
2534abe37c4bSJohannes Berg  * the BSS should be updated/added.
2535abe37c4bSJohannes Berg  */
253606aa7afaSJussi Kivilinna struct cfg80211_bss*
253706aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
253806aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
253906aa7afaSJussi Kivilinna 		    const u8 *bssid,
254006aa7afaSJussi Kivilinna 		    u64 timestamp, u16 capability, u16 beacon_interval,
254106aa7afaSJussi Kivilinna 		    const u8 *ie, size_t ielen,
254206aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
254306aa7afaSJussi Kivilinna 
25442a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
25452a519311SJohannes Berg 				      struct ieee80211_channel *channel,
25462a519311SJohannes Berg 				      const u8 *bssid,
254779420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
254879420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
254979420f09SJohannes Berg static inline struct cfg80211_bss *
255079420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
255179420f09SJohannes Berg 		  struct ieee80211_channel *channel,
255279420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
255379420f09SJohannes Berg {
255479420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
255579420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
255679420f09SJohannes Berg }
255779420f09SJohannes Berg 
25582a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
25592a519311SJohannes Berg 				       struct ieee80211_channel *channel,
25602a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
25612a519311SJohannes Berg 				       const u8 *meshcfg);
25622a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
2563d3236553SJohannes Berg 
2564d491af19SJohannes Berg /**
2565d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
2566d491af19SJohannes Berg  * @wiphy: the wiphy
2567d491af19SJohannes Berg  * @bss: the bss to remove
2568d491af19SJohannes Berg  *
2569d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
2570d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
2571d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
2572d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
2573d491af19SJohannes Berg  */
2574d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
2575fee52678SJohannes Berg 
25766039f6d2SJouni Malinen /**
25776039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
25786039f6d2SJouni Malinen  * @dev: network device
25796039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
25806039f6d2SJouni Malinen  * @len: length of the frame data
25816039f6d2SJouni Malinen  *
25826039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
25831965c853SJouni Malinen  * station mode. The driver is required to call either this function or
25841965c853SJouni Malinen  * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
2585cb0b4bebSJohannes Berg  * call. This function may sleep.
25866039f6d2SJouni Malinen  */
2587cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
25886039f6d2SJouni Malinen 
25896039f6d2SJouni Malinen /**
25901965c853SJouni Malinen  * cfg80211_send_auth_timeout - notification of timed out authentication
25911965c853SJouni Malinen  * @dev: network device
25921965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
2593cb0b4bebSJohannes Berg  *
2594cb0b4bebSJohannes Berg  * This function may sleep.
25951965c853SJouni Malinen  */
2596cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
25971965c853SJouni Malinen 
25981965c853SJouni Malinen /**
2599a58ce43fSJohannes Berg  * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2600a58ce43fSJohannes Berg  * @dev: network device
2601a58ce43fSJohannes Berg  * @addr: The MAC address of the device with which the authentication timed out
2602a58ce43fSJohannes Berg  *
2603a58ce43fSJohannes Berg  * When a pending authentication had no action yet, the driver may decide
2604a58ce43fSJohannes Berg  * to not send a deauth frame, but in that case must calls this function
2605a58ce43fSJohannes Berg  * to tell cfg80211 about this decision. It is only valid to call this
2606a58ce43fSJohannes Berg  * function within the deauth() callback.
2607a58ce43fSJohannes Berg  */
2608a58ce43fSJohannes Berg void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2609a58ce43fSJohannes Berg 
2610a58ce43fSJohannes Berg /**
26116039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
26126039f6d2SJouni Malinen  * @dev: network device
26136039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
26146039f6d2SJouni Malinen  * @len: length of the frame data
26156039f6d2SJouni Malinen  *
26166039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
26171965c853SJouni Malinen  * processed in station mode. The driver is required to call either this
26181965c853SJouni Malinen  * function or cfg80211_send_assoc_timeout() to indicate the result of
2619cb0b4bebSJohannes Berg  * cfg80211_ops::assoc() call. This function may sleep.
26206039f6d2SJouni Malinen  */
2621cb0b4bebSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
26226039f6d2SJouni Malinen 
26236039f6d2SJouni Malinen /**
26241965c853SJouni Malinen  * cfg80211_send_assoc_timeout - notification of timed out association
26251965c853SJouni Malinen  * @dev: network device
26261965c853SJouni Malinen  * @addr: The MAC address of the device with which the association timed out
2627cb0b4bebSJohannes Berg  *
2628cb0b4bebSJohannes Berg  * This function may sleep.
26291965c853SJouni Malinen  */
2630cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
26311965c853SJouni Malinen 
26321965c853SJouni Malinen /**
263353b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
26346039f6d2SJouni Malinen  * @dev: network device
26356039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
26366039f6d2SJouni Malinen  * @len: length of the frame data
26376039f6d2SJouni Malinen  *
26386039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
263953b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
2640cb0b4bebSJohannes Berg  * locally generated ones. This function may sleep.
26416039f6d2SJouni Malinen  */
2642ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
2643ce470613SHolger Schurig 
2644ce470613SHolger Schurig /**
2645ce470613SHolger Schurig  * __cfg80211_send_deauth - notification of processed deauthentication
2646ce470613SHolger Schurig  * @dev: network device
2647ce470613SHolger Schurig  * @buf: deauthentication frame (header + body)
2648ce470613SHolger Schurig  * @len: length of the frame data
2649ce470613SHolger Schurig  *
2650ce470613SHolger Schurig  * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
2651ce470613SHolger Schurig  */
2652ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
26536039f6d2SJouni Malinen 
26546039f6d2SJouni Malinen /**
265553b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
26566039f6d2SJouni Malinen  * @dev: network device
26576039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
26586039f6d2SJouni Malinen  * @len: length of the frame data
26596039f6d2SJouni Malinen  *
26606039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
266153b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
2662cb0b4bebSJohannes Berg  * generated ones. This function may sleep.
26636039f6d2SJouni Malinen  */
2664ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
2665ce470613SHolger Schurig 
2666ce470613SHolger Schurig /**
2667ce470613SHolger Schurig  * __cfg80211_send_disassoc - notification of processed disassociation
2668ce470613SHolger Schurig  * @dev: network device
2669ce470613SHolger Schurig  * @buf: disassociation response frame (header + body)
2670ce470613SHolger Schurig  * @len: length of the frame data
2671ce470613SHolger Schurig  *
2672ce470613SHolger Schurig  * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
2673ce470613SHolger Schurig  */
2674ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
2675ce470613SHolger Schurig 	size_t len);
26766039f6d2SJouni Malinen 
2677a08c1c1aSKalle Valo /**
2678cf4e594eSJouni Malinen  * cfg80211_send_unprot_deauth - notification of unprotected deauthentication
2679cf4e594eSJouni Malinen  * @dev: network device
2680cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
2681cf4e594eSJouni Malinen  * @len: length of the frame data
2682cf4e594eSJouni Malinen  *
2683cf4e594eSJouni Malinen  * This function is called whenever a received Deauthentication frame has been
2684cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Deauthentication
2685cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
2686cf4e594eSJouni Malinen  */
2687cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
2688cf4e594eSJouni Malinen 				 size_t len);
2689cf4e594eSJouni Malinen 
2690cf4e594eSJouni Malinen /**
2691cf4e594eSJouni Malinen  * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
2692cf4e594eSJouni Malinen  * @dev: network device
2693cf4e594eSJouni Malinen  * @buf: disassociation frame (header + body)
2694cf4e594eSJouni Malinen  * @len: length of the frame data
2695cf4e594eSJouni Malinen  *
2696cf4e594eSJouni Malinen  * This function is called whenever a received Disassociation frame has been
2697cf4e594eSJouni Malinen  * dropped in station mode because of MFP being used but the Disassociation
2698cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
2699cf4e594eSJouni Malinen  */
2700cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
2701cf4e594eSJouni Malinen 				   size_t len);
2702cf4e594eSJouni Malinen 
2703cf4e594eSJouni Malinen /**
2704a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
2705a3b8b056SJouni Malinen  * @dev: network device
2706a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
2707a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
2708a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
2709a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
2710e6d6e342SJohannes Berg  * @gfp: allocation flags
2711a3b8b056SJouni Malinen  *
2712a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
2713a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
2714a3b8b056SJouni Malinen  * primitive.
2715a3b8b056SJouni Malinen  */
2716a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
2717a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
2718e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
2719a3b8b056SJouni Malinen 
272004a773adSJohannes Berg /**
272104a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
272204a773adSJohannes Berg  *
272304a773adSJohannes Berg  * @dev: network device
272404a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
272504a773adSJohannes Berg  * @gfp: allocation flags
272604a773adSJohannes Berg  *
272704a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
272804a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
272904a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
273004a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
273104a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
273204a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
273304a773adSJohannes Berg  */
273404a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
273504a773adSJohannes Berg 
27361f87f7d3SJohannes Berg /**
2737c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
2738c93b5e71SJavier Cardona  *
2739c93b5e71SJavier Cardona  * @dev: network device
2740c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
2741c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
2742c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
2743c93b5e71SJavier Cardona  * @gfp: allocation flags
2744c93b5e71SJavier Cardona  *
2745c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
2746c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
2747c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
2748c93b5e71SJavier Cardona  */
2749c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
2750c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
2751c93b5e71SJavier Cardona 
2752c93b5e71SJavier Cardona /**
2753d70e9693SJohannes Berg  * DOC: RFkill integration
2754d70e9693SJohannes Berg  *
2755d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
2756d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
2757d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
2758d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
2759d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
2760d70e9693SJohannes Berg  *
2761d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
2762d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
2763d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
2764d70e9693SJohannes Berg  */
2765d70e9693SJohannes Berg 
2766d70e9693SJohannes Berg /**
27671f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
27681f87f7d3SJohannes Berg  * @wiphy: the wiphy
27691f87f7d3SJohannes Berg  * @blocked: block status
27701f87f7d3SJohannes Berg  */
27711f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
27721f87f7d3SJohannes Berg 
27731f87f7d3SJohannes Berg /**
27741f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
27751f87f7d3SJohannes Berg  * @wiphy: the wiphy
27761f87f7d3SJohannes Berg  */
27771f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
27781f87f7d3SJohannes Berg 
27791f87f7d3SJohannes Berg /**
27801f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
27811f87f7d3SJohannes Berg  * @wiphy: the wiphy
27821f87f7d3SJohannes Berg  */
27831f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
27841f87f7d3SJohannes Berg 
2785aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
2786aff89a9bSJohannes Berg /**
2787d70e9693SJohannes Berg  * DOC: Test mode
2788d70e9693SJohannes Berg  *
2789d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
2790d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
2791d70e9693SJohannes Berg  * factory programming.
2792d70e9693SJohannes Berg  *
2793d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
2794d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
2795d70e9693SJohannes Berg  */
2796d70e9693SJohannes Berg 
2797d70e9693SJohannes Berg /**
2798aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
2799aff89a9bSJohannes Berg  * @wiphy: the wiphy
2800aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
2801aff89a9bSJohannes Berg  *	be put into the skb
2802aff89a9bSJohannes Berg  *
2803aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
2804aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
2805aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
2806aff89a9bSJohannes Berg  *
2807aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is pre-filled
2808aff89a9bSJohannes Berg  * with the wiphy index and set up in a way that any data that is
2809aff89a9bSJohannes Berg  * put into the skb (with skb_put(), nla_put() or similar) will end
2810aff89a9bSJohannes Berg  * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
2811aff89a9bSJohannes Berg  * needs to be done with the skb is adding data for the corresponding
2812aff89a9bSJohannes Berg  * userspace tool which can then read that data out of the testdata
2813aff89a9bSJohannes Berg  * attribute. You must not modify the skb in any other way.
2814aff89a9bSJohannes Berg  *
2815aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
2816aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
2817aff89a9bSJohannes Berg  */
2818aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
2819aff89a9bSJohannes Berg 						  int approxlen);
2820aff89a9bSJohannes Berg 
2821aff89a9bSJohannes Berg /**
2822aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
2823aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
2824aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
2825aff89a9bSJohannes Berg  *
2826aff89a9bSJohannes Berg  * Returns an error code or 0 on success, since calling this
2827aff89a9bSJohannes Berg  * function will usually be the last thing before returning
2828aff89a9bSJohannes Berg  * from the @testmode_cmd you should return the error code.
2829aff89a9bSJohannes Berg  * Note that this function consumes the skb regardless of the
2830aff89a9bSJohannes Berg  * return value.
2831aff89a9bSJohannes Berg  */
2832aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
2833aff89a9bSJohannes Berg 
2834aff89a9bSJohannes Berg /**
2835aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
2836aff89a9bSJohannes Berg  * @wiphy: the wiphy
2837aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
2838aff89a9bSJohannes Berg  *	be put into the skb
2839aff89a9bSJohannes Berg  * @gfp: allocation flags
2840aff89a9bSJohannes Berg  *
2841aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
2842aff89a9bSJohannes Berg  * testmode multicast group.
2843aff89a9bSJohannes Berg  *
2844aff89a9bSJohannes Berg  * The returned skb (or %NULL if any errors happen) is set up in the
2845aff89a9bSJohannes Berg  * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
2846aff89a9bSJohannes Berg  * for an event. As there, you should simply add data to it that will
2847aff89a9bSJohannes Berg  * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
2848aff89a9bSJohannes Berg  * not modify the skb in any other way.
2849aff89a9bSJohannes Berg  *
2850aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
2851aff89a9bSJohannes Berg  * skb to send the event.
2852aff89a9bSJohannes Berg  */
2853aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
2854aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
2855aff89a9bSJohannes Berg 
2856aff89a9bSJohannes Berg /**
2857aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
2858aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
2859aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
2860aff89a9bSJohannes Berg  * @gfp: allocation flags
2861aff89a9bSJohannes Berg  *
2862aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
2863aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
2864aff89a9bSJohannes Berg  * consumes it.
2865aff89a9bSJohannes Berg  */
2866aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
2867aff89a9bSJohannes Berg 
2868aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
286971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
2870aff89a9bSJohannes Berg #else
2871aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
287271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
2873aff89a9bSJohannes Berg #endif
2874aff89a9bSJohannes Berg 
2875b23aa676SSamuel Ortiz /**
2876b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
2877b23aa676SSamuel Ortiz  *
2878b23aa676SSamuel Ortiz  * @dev: network device
2879b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
2880b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
2881b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
2882b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
2883b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
2884b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
2885b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
2886b23aa676SSamuel Ortiz  *	the real status code for failures.
2887b23aa676SSamuel Ortiz  * @gfp: allocation flags
2888b23aa676SSamuel Ortiz  *
2889b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
2890b23aa676SSamuel Ortiz  * succeeded.
2891b23aa676SSamuel Ortiz  */
2892b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
2893b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
2894b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
2895b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
2896b23aa676SSamuel Ortiz 
2897b23aa676SSamuel Ortiz /**
2898b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
2899b23aa676SSamuel Ortiz  *
2900b23aa676SSamuel Ortiz  * @dev: network device
2901ed9d0102SJouni Malinen  * @channel: the channel of the new AP
2902b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
2903b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
2904b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
2905b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
2906b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
2907b23aa676SSamuel Ortiz  * @gfp: allocation flags
2908b23aa676SSamuel Ortiz  *
2909b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
2910b23aa676SSamuel Ortiz  * from one AP to another while connected.
2911b23aa676SSamuel Ortiz  */
2912ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
2913ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
2914ed9d0102SJouni Malinen 		     const u8 *bssid,
2915b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
2916b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
2917b23aa676SSamuel Ortiz 
2918b23aa676SSamuel Ortiz /**
2919b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
2920b23aa676SSamuel Ortiz  *
2921b23aa676SSamuel Ortiz  * @dev: network device
2922b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
2923b23aa676SSamuel Ortiz  * @ie_len: length of IEs
2924b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
2925b23aa676SSamuel Ortiz  * @gfp: allocation flags
2926b23aa676SSamuel Ortiz  *
2927b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
2928b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
2929b23aa676SSamuel Ortiz  */
2930b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
2931b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
2932b23aa676SSamuel Ortiz 
29339588bbd5SJouni Malinen /**
29349588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
29359588bbd5SJouni Malinen  * @dev: network device
29369588bbd5SJouni Malinen  * @cookie: the request cookie
29379588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
29389588bbd5SJouni Malinen  * @channel_type: Channel type
29399588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
29409588bbd5SJouni Malinen  *	channel
29419588bbd5SJouni Malinen  * @gfp: allocation flags
29429588bbd5SJouni Malinen  */
29439588bbd5SJouni Malinen void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie,
29449588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
29459588bbd5SJouni Malinen 			       enum nl80211_channel_type channel_type,
29469588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
29479588bbd5SJouni Malinen 
29489588bbd5SJouni Malinen /**
29499588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
29509588bbd5SJouni Malinen  * @dev: network device
29519588bbd5SJouni Malinen  * @cookie: the request cookie
29529588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
29539588bbd5SJouni Malinen  * @channel_type: Channel type
29549588bbd5SJouni Malinen  * @gfp: allocation flags
29559588bbd5SJouni Malinen  */
29569588bbd5SJouni Malinen void cfg80211_remain_on_channel_expired(struct net_device *dev,
29579588bbd5SJouni Malinen 					u64 cookie,
29589588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
29599588bbd5SJouni Malinen 					enum nl80211_channel_type channel_type,
29609588bbd5SJouni Malinen 					gfp_t gfp);
2961b23aa676SSamuel Ortiz 
296298b62183SJohannes Berg 
296398b62183SJohannes Berg /**
296498b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
296598b62183SJohannes Berg  *
296698b62183SJohannes Berg  * @dev: the netdev
296798b62183SJohannes Berg  * @mac_addr: the station's address
296898b62183SJohannes Berg  * @sinfo: the station information
296998b62183SJohannes Berg  * @gfp: allocation flags
297098b62183SJohannes Berg  */
297198b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
297298b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
297398b62183SJohannes Berg 
2974026331c4SJouni Malinen /**
2975ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
2976ec15e68bSJouni Malinen  *
2977ec15e68bSJouni Malinen  * @dev: the netdev
2978ec15e68bSJouni Malinen  * @mac_addr: the station's address
2979ec15e68bSJouni Malinen  * @gfp: allocation flags
2980ec15e68bSJouni Malinen  */
2981ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
2982ec15e68bSJouni Malinen 
2983ec15e68bSJouni Malinen /**
29842e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
2985026331c4SJouni Malinen  * @dev: network device
2986026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
29872e161f78SJohannes Berg  * @buf: Management frame (header + body)
2988026331c4SJouni Malinen  * @len: length of the frame data
2989026331c4SJouni Malinen  * @gfp: context flags
29902e161f78SJohannes Berg  *
29912e161f78SJohannes Berg  * Returns %true if a user space application has registered for this frame.
29922e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
29932e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
29942e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
2995026331c4SJouni Malinen  *
2996026331c4SJouni Malinen  * This function is called whenever an Action frame is received for a station
2997026331c4SJouni Malinen  * mode interface, but is not processed in kernel.
2998026331c4SJouni Malinen  */
29992e161f78SJohannes Berg bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
3000026331c4SJouni Malinen 		      size_t len, gfp_t gfp);
3001026331c4SJouni Malinen 
3002026331c4SJouni Malinen /**
30032e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
3004026331c4SJouni Malinen  * @dev: network device
30052e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
30062e161f78SJohannes Berg  * @buf: Management frame (header + body)
3007026331c4SJouni Malinen  * @len: length of the frame data
3008026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
3009026331c4SJouni Malinen  * @gfp: context flags
3010026331c4SJouni Malinen  *
30112e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
30122e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3013026331c4SJouni Malinen  * transmission attempt.
3014026331c4SJouni Malinen  */
30152e161f78SJohannes Berg void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie,
3016026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
3017026331c4SJouni Malinen 
3018d6dc1a38SJuuso Oikarinen 
3019d6dc1a38SJuuso Oikarinen /**
3020d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
3021d6dc1a38SJuuso Oikarinen  * @dev: network device
3022d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
3023d6dc1a38SJuuso Oikarinen  * @gfp: context flags
3024d6dc1a38SJuuso Oikarinen  *
3025d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
3026d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
3027d6dc1a38SJuuso Oikarinen  */
3028d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
3029d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
3030d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
3031d6dc1a38SJuuso Oikarinen 
3032c063dbf5SJohannes Berg /**
3033c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
3034c063dbf5SJohannes Berg  * @dev: network device
3035c063dbf5SJohannes Berg  * @peer: peer's MAC address
3036c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
3037c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
3038c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
3039c063dbf5SJohannes Berg  * @gfp: context flags
3040c063dbf5SJohannes Berg  */
3041c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
3042c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
3043c063dbf5SJohannes Berg 
3044e5497d76SJohannes Berg /**
3045e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
3046e5497d76SJohannes Berg  * @dev: network device
3047e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
3048e5497d76SJohannes Berg  * @replay_ctr: new replay counter
3049af71ff85SJohannes Berg  * @gfp: allocation flags
3050e5497d76SJohannes Berg  */
3051e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3052e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
3053e5497d76SJohannes Berg 
3054e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
3055e1db74fcSJoe Perches 
3056e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
3057e1db74fcSJoe Perches 
3058e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
30599c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
3060e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
30619c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
3062e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
30639c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
3064e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
30659c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
3066e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
30679c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
3068e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
30699c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
3070e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
30719c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
3072e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
30739c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
3074073730d7SJoe Perches 
30759c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
3076e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
30779c376639SJoe Perches 
3078e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
30799c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
3080e1db74fcSJoe Perches 
3081e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
3082e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
3083e1db74fcSJoe Perches #else
3084e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
3085e1db74fcSJoe Perches ({									\
3086e1db74fcSJoe Perches 	if (0)								\
3087e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
3088e1db74fcSJoe Perches 	0;								\
3089e1db74fcSJoe Perches })
3090e1db74fcSJoe Perches #endif
3091e1db74fcSJoe Perches 
3092e1db74fcSJoe Perches /*
3093e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
3094e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
3095e1db74fcSJoe Perches  * file/line information and a backtrace.
3096e1db74fcSJoe Perches  */
3097e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
3098e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
3099e1db74fcSJoe Perches 
3100704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
3101