xref: /linux/include/net/cfg80211.h (revision d323655372590c533c275b1d798f9d1221efb5c6)
1704232c2SJohannes Berg #ifndef __NET_CFG80211_H
2704232c2SJohannes Berg #define __NET_CFG80211_H
3*d3236553SJohannes Berg /*
4*d3236553SJohannes Berg  * 802.11 device and configuration interface
5*d3236553SJohannes Berg  *
6*d3236553SJohannes Berg  * Copyright 2006-2009	Johannes Berg <johannes@sipsolutions.net>
7*d3236553SJohannes Berg  *
8*d3236553SJohannes Berg  * This program is free software; you can redistribute it and/or modify
9*d3236553SJohannes Berg  * it under the terms of the GNU General Public License version 2 as
10*d3236553SJohannes Berg  * published by the Free Software Foundation.
11*d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13*d3236553SJohannes Berg #include <linux/netdevice.h>
14*d3236553SJohannes Berg #include <linux/debugfs.h>
15*d3236553SJohannes 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>
21*d3236553SJohannes Berg #include <net/regulatory.h>
22*d3236553SJohannes Berg 
23fee52678SJohannes Berg /* remove once we remove the wext stuff */
24*d3236553SJohannes Berg #include <net/iw_handler.h>
25*d3236553SJohannes Berg #include <linux/wireless.h>
26*d3236553SJohannes Berg 
27704232c2SJohannes Berg 
28704232c2SJohannes Berg /*
29*d3236553SJohannes Berg  * wireless hardware capability structures
30*d3236553SJohannes Berg  */
31*d3236553SJohannes Berg 
32*d3236553SJohannes Berg /**
33*d3236553SJohannes Berg  * enum ieee80211_band - supported frequency bands
34704232c2SJohannes Berg  *
35*d3236553SJohannes Berg  * The bands are assigned this way because the supported
36*d3236553SJohannes Berg  * bitrates differ in these bands.
37*d3236553SJohannes Berg  *
38*d3236553SJohannes Berg  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39*d3236553SJohannes Berg  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
40*d3236553SJohannes Berg  */
41*d3236553SJohannes Berg enum ieee80211_band {
42*d3236553SJohannes Berg 	IEEE80211_BAND_2GHZ,
43*d3236553SJohannes Berg 	IEEE80211_BAND_5GHZ,
44*d3236553SJohannes Berg 
45*d3236553SJohannes Berg 	/* keep last */
46*d3236553SJohannes Berg 	IEEE80211_NUM_BANDS
47*d3236553SJohannes Berg };
48*d3236553SJohannes Berg 
49*d3236553SJohannes Berg /**
50*d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
51*d3236553SJohannes Berg  *
52*d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
53*d3236553SJohannes Berg  *
54*d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
55*d3236553SJohannes Berg  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
56*d3236553SJohannes Berg  *	on this channel.
57*d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
58*d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
59*d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
60*d3236553SJohannes Berg  * 	is not permitted.
61*d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
62*d3236553SJohannes Berg  * 	is not permitted.
63*d3236553SJohannes Berg  */
64*d3236553SJohannes Berg enum ieee80211_channel_flags {
65*d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
66*d3236553SJohannes Berg 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
67*d3236553SJohannes Berg 	IEEE80211_CHAN_NO_IBSS		= 1<<2,
68*d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
69*d3236553SJohannes Berg 	IEEE80211_CHAN_NO_FAT_ABOVE	= 1<<4,
70*d3236553SJohannes Berg 	IEEE80211_CHAN_NO_FAT_BELOW	= 1<<5,
71*d3236553SJohannes Berg };
72*d3236553SJohannes Berg 
73*d3236553SJohannes Berg /**
74*d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
75*d3236553SJohannes Berg  *
76*d3236553SJohannes Berg  * This structure describes a single channel for use
77*d3236553SJohannes Berg  * with cfg80211.
78*d3236553SJohannes Berg  *
79*d3236553SJohannes Berg  * @center_freq: center frequency in MHz
80*d3236553SJohannes Berg  * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
81*d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
82*d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
83*d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
84*d3236553SJohannes Berg  *	code to support devices with additional restrictions
85*d3236553SJohannes Berg  * @band: band this channel belongs to.
86*d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
87*d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
88*d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
89*d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
90*d3236553SJohannes Berg  *	to enable this, this is is useful only on 5 GHz band.
91*d3236553SJohannes Berg  * @orig_mag: internal use
92*d3236553SJohannes Berg  * @orig_mpwr: internal use
93*d3236553SJohannes Berg  */
94*d3236553SJohannes Berg struct ieee80211_channel {
95*d3236553SJohannes Berg 	enum ieee80211_band band;
96*d3236553SJohannes Berg 	u16 center_freq;
97*d3236553SJohannes Berg 	u8 max_bandwidth;
98*d3236553SJohannes Berg 	u16 hw_value;
99*d3236553SJohannes Berg 	u32 flags;
100*d3236553SJohannes Berg 	int max_antenna_gain;
101*d3236553SJohannes Berg 	int max_power;
102*d3236553SJohannes Berg 	bool beacon_found;
103*d3236553SJohannes Berg 	u32 orig_flags;
104*d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
105*d3236553SJohannes Berg };
106*d3236553SJohannes Berg 
107*d3236553SJohannes Berg /**
108*d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
109*d3236553SJohannes Berg  *
110*d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
111*d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
112*d3236553SJohannes Berg  * different bands/PHY modes.
113*d3236553SJohannes Berg  *
114*d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
115*d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
116*d3236553SJohannes Berg  *	with CCK rates.
117*d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
118*d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
119*d3236553SJohannes Berg  *	core code when registering the wiphy.
120*d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
121*d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
122*d3236553SJohannes Berg  *	core code when registering the wiphy.
123*d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
124*d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
125*d3236553SJohannes Berg  *	core code when registering the wiphy.
126*d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
127*d3236553SJohannes Berg  */
128*d3236553SJohannes Berg enum ieee80211_rate_flags {
129*d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
130*d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
131*d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
132*d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
133*d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
134*d3236553SJohannes Berg };
135*d3236553SJohannes Berg 
136*d3236553SJohannes Berg /**
137*d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
138*d3236553SJohannes Berg  *
139*d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
140*d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
141*d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
142*d3236553SJohannes Berg  * passed around.
143*d3236553SJohannes Berg  *
144*d3236553SJohannes Berg  * @flags: rate-specific flags
145*d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
146*d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
147*d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
148*d3236553SJohannes Berg  *	short preamble is used
149*d3236553SJohannes Berg  */
150*d3236553SJohannes Berg struct ieee80211_rate {
151*d3236553SJohannes Berg 	u32 flags;
152*d3236553SJohannes Berg 	u16 bitrate;
153*d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
154*d3236553SJohannes Berg };
155*d3236553SJohannes Berg 
156*d3236553SJohannes Berg /**
157*d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
158*d3236553SJohannes Berg  *
159*d3236553SJohannes Berg  * This structure describes most essential parameters needed
160*d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
161*d3236553SJohannes Berg  *
162*d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
163*d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
164*d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
165*d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
166*d3236553SJohannes Berg  * @mcs: Supported MCS rates
167*d3236553SJohannes Berg  */
168*d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
169*d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
170*d3236553SJohannes Berg 	bool ht_supported;
171*d3236553SJohannes Berg 	u8 ampdu_factor;
172*d3236553SJohannes Berg 	u8 ampdu_density;
173*d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
174*d3236553SJohannes Berg };
175*d3236553SJohannes Berg 
176*d3236553SJohannes Berg /**
177*d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
178*d3236553SJohannes Berg  *
179*d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
180*d3236553SJohannes Berg  * is able to operate in.
181*d3236553SJohannes Berg  *
182*d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
183*d3236553SJohannes Berg  *	in this band.
184*d3236553SJohannes Berg  * @band: the band this structure represents
185*d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
186*d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
187*d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
188*d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
189*d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
190*d3236553SJohannes Berg  */
191*d3236553SJohannes Berg struct ieee80211_supported_band {
192*d3236553SJohannes Berg 	struct ieee80211_channel *channels;
193*d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
194*d3236553SJohannes Berg 	enum ieee80211_band band;
195*d3236553SJohannes Berg 	int n_channels;
196*d3236553SJohannes Berg 	int n_bitrates;
197*d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
198*d3236553SJohannes Berg };
199*d3236553SJohannes Berg 
200*d3236553SJohannes Berg /*
201*d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
202704232c2SJohannes Berg  */
203704232c2SJohannes Berg 
2042ec600d6SLuis Carlos Cobo /**
2052ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
2062ec600d6SLuis Carlos Cobo  * @mesh_id: mesh ID to use
2072ec600d6SLuis Carlos Cobo  * @mesh_id_len: length of the mesh ID
2082ec600d6SLuis Carlos Cobo  */
2092ec600d6SLuis Carlos Cobo struct vif_params {
2102ec600d6SLuis Carlos Cobo        u8 *mesh_id;
2112ec600d6SLuis Carlos Cobo        int mesh_id_len;
2122ec600d6SLuis Carlos Cobo };
2132ec600d6SLuis Carlos Cobo 
21441ade00fSJohannes Berg /**
21541ade00fSJohannes Berg  * struct key_params - key information
21641ade00fSJohannes Berg  *
21741ade00fSJohannes Berg  * Information about a key
21841ade00fSJohannes Berg  *
21941ade00fSJohannes Berg  * @key: key material
22041ade00fSJohannes Berg  * @key_len: length of key material
22141ade00fSJohannes Berg  * @cipher: cipher suite selector
22241ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
22341ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
22441ade00fSJohannes Berg  *	length given by @seq_len.
22541ade00fSJohannes Berg  */
22641ade00fSJohannes Berg struct key_params {
22741ade00fSJohannes Berg 	u8 *key;
22841ade00fSJohannes Berg 	u8 *seq;
22941ade00fSJohannes Berg 	int key_len;
23041ade00fSJohannes Berg 	int seq_len;
23141ade00fSJohannes Berg 	u32 cipher;
23241ade00fSJohannes Berg };
23341ade00fSJohannes Berg 
234ed1b6cc7SJohannes Berg /**
235ed1b6cc7SJohannes Berg  * struct beacon_parameters - beacon parameters
236ed1b6cc7SJohannes Berg  *
237ed1b6cc7SJohannes Berg  * Used to configure the beacon for an interface.
238ed1b6cc7SJohannes Berg  *
239ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
240ed1b6cc7SJohannes Berg  *     or %NULL if not changed
241ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
242ed1b6cc7SJohannes Berg  *     or %NULL if not changed
243ed1b6cc7SJohannes Berg  * @interval: beacon interval or zero if not changed
244ed1b6cc7SJohannes Berg  * @dtim_period: DTIM period or zero if not changed
245ed1b6cc7SJohannes Berg  * @head_len: length of @head
246ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
247ed1b6cc7SJohannes Berg  */
248ed1b6cc7SJohannes Berg struct beacon_parameters {
249ed1b6cc7SJohannes Berg 	u8 *head, *tail;
250ed1b6cc7SJohannes Berg 	int interval, dtim_period;
251ed1b6cc7SJohannes Berg 	int head_len, tail_len;
252ed1b6cc7SJohannes Berg };
253ed1b6cc7SJohannes Berg 
2545727ef1bSJohannes Berg /**
2555727ef1bSJohannes Berg  * enum station_flags - station flags
2565727ef1bSJohannes Berg  *
2575727ef1bSJohannes Berg  * Station capability flags. Note that these must be the bits
2585727ef1bSJohannes Berg  * according to the nl80211 flags.
2595727ef1bSJohannes Berg  *
2605727ef1bSJohannes Berg  * @STATION_FLAG_CHANGED: station flags were changed
2615727ef1bSJohannes Berg  * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
2625727ef1bSJohannes Berg  * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
2635727ef1bSJohannes Berg  *	with short preambles
2645727ef1bSJohannes Berg  * @STATION_FLAG_WME: station is WME/QoS capable
2655394af4dSJouni Malinen  * @STATION_FLAG_MFP: station uses management frame protection
2665727ef1bSJohannes Berg  */
2675727ef1bSJohannes Berg enum station_flags {
2685727ef1bSJohannes Berg 	STATION_FLAG_CHANGED		= 1<<0,
2695727ef1bSJohannes Berg 	STATION_FLAG_AUTHORIZED		= 1<<NL80211_STA_FLAG_AUTHORIZED,
2705727ef1bSJohannes Berg 	STATION_FLAG_SHORT_PREAMBLE	= 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
2715727ef1bSJohannes Berg 	STATION_FLAG_WME		= 1<<NL80211_STA_FLAG_WME,
2725394af4dSJouni Malinen 	STATION_FLAG_MFP		= 1<<NL80211_STA_FLAG_MFP,
2735727ef1bSJohannes Berg };
2745727ef1bSJohannes Berg 
2755727ef1bSJohannes Berg /**
2762ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
2772ec600d6SLuis Carlos Cobo  *
2782ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
2792ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
2802ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
2812ec600d6SLuis Carlos Cobo  */
2822ec600d6SLuis Carlos Cobo enum plink_actions {
2832ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
2842ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
2852ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
2862ec600d6SLuis Carlos Cobo };
2872ec600d6SLuis Carlos Cobo 
2882ec600d6SLuis Carlos Cobo /**
2895727ef1bSJohannes Berg  * struct station_parameters - station parameters
2905727ef1bSJohannes Berg  *
2915727ef1bSJohannes Berg  * Used to change and create a new station.
2925727ef1bSJohannes Berg  *
2935727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
2945727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
2955727ef1bSJohannes Berg  *	(or NULL for no change)
2965727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
2975727ef1bSJohannes Berg  * @station_flags: station flags (see &enum station_flags)
2985727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
2995727ef1bSJohannes Berg  * @aid: AID or zero for no change
3005727ef1bSJohannes Berg  */
3015727ef1bSJohannes Berg struct station_parameters {
3025727ef1bSJohannes Berg 	u8 *supported_rates;
3035727ef1bSJohannes Berg 	struct net_device *vlan;
3045727ef1bSJohannes Berg 	u32 station_flags;
3055727ef1bSJohannes Berg 	int listen_interval;
3065727ef1bSJohannes Berg 	u16 aid;
3075727ef1bSJohannes Berg 	u8 supported_rates_len;
3082ec600d6SLuis Carlos Cobo 	u8 plink_action;
30936aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
3105727ef1bSJohannes Berg };
3115727ef1bSJohannes Berg 
312fd5b74dcSJohannes Berg /**
3132ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
314fd5b74dcSJohannes Berg  *
3152ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
3162ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
317fd5b74dcSJohannes Berg  *
3182ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
3192ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
3202ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
3212ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
3222ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
3232ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
324420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
325420e7fabSHenning Rogge  * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
326420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
32798c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
32898c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
329fd5b74dcSJohannes Berg  */
3302ec600d6SLuis Carlos Cobo enum station_info_flags {
3312ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
3322ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
3332ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
3342ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
3352ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
3362ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
337420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
338420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
33998c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
34098c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
341420e7fabSHenning Rogge };
342420e7fabSHenning Rogge 
343420e7fabSHenning Rogge /**
344420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
345420e7fabSHenning Rogge  *
346420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
347420e7fabSHenning Rogge  * type for 802.11n transmissions.
348420e7fabSHenning Rogge  *
349420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
350420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
351420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
352420e7fabSHenning Rogge  */
353420e7fabSHenning Rogge enum rate_info_flags {
354420e7fabSHenning Rogge 	RATE_INFO_FLAGS_MCS		= 1<<0,
355420e7fabSHenning Rogge 	RATE_INFO_FLAGS_40_MHZ_WIDTH	= 1<<1,
356420e7fabSHenning Rogge 	RATE_INFO_FLAGS_SHORT_GI	= 1<<2,
357420e7fabSHenning Rogge };
358420e7fabSHenning Rogge 
359420e7fabSHenning Rogge /**
360420e7fabSHenning Rogge  * struct rate_info - bitrate information
361420e7fabSHenning Rogge  *
362420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
363420e7fabSHenning Rogge  *
364420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
365420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
366420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
367420e7fabSHenning Rogge  */
368420e7fabSHenning Rogge struct rate_info {
369420e7fabSHenning Rogge 	u8 flags;
370420e7fabSHenning Rogge 	u8 mcs;
371420e7fabSHenning Rogge 	u16 legacy;
372fd5b74dcSJohannes Berg };
373fd5b74dcSJohannes Berg 
374fd5b74dcSJohannes Berg /**
3752ec600d6SLuis Carlos Cobo  * struct station_info - station information
376fd5b74dcSJohannes Berg  *
3772ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
378fd5b74dcSJohannes Berg  *
3792ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
380fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
381fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
382fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
3832ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
3842ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
3852ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
386420e7fabSHenning Rogge  * @signal: signal strength of last received packet in dBm
387420e7fabSHenning Rogge  * @txrate: current unicast bitrate to this station
38898c8a60aSJouni Malinen  * @rx_packets: packets received from this station
38998c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
390fd5b74dcSJohannes Berg  */
3912ec600d6SLuis Carlos Cobo struct station_info {
392fd5b74dcSJohannes Berg 	u32 filled;
393fd5b74dcSJohannes Berg 	u32 inactive_time;
394fd5b74dcSJohannes Berg 	u32 rx_bytes;
395fd5b74dcSJohannes Berg 	u32 tx_bytes;
3962ec600d6SLuis Carlos Cobo 	u16 llid;
3972ec600d6SLuis Carlos Cobo 	u16 plid;
3982ec600d6SLuis Carlos Cobo 	u8 plink_state;
399420e7fabSHenning Rogge 	s8 signal;
400420e7fabSHenning Rogge 	struct rate_info txrate;
40198c8a60aSJouni Malinen 	u32 rx_packets;
40298c8a60aSJouni Malinen 	u32 tx_packets;
403fd5b74dcSJohannes Berg };
404fd5b74dcSJohannes Berg 
40566f7ac50SMichael Wu /**
40666f7ac50SMichael Wu  * enum monitor_flags - monitor flags
40766f7ac50SMichael Wu  *
40866f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
40966f7ac50SMichael Wu  * according to the nl80211 flags.
41066f7ac50SMichael Wu  *
41166f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
41266f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
41366f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
41466f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
41566f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
41666f7ac50SMichael Wu  */
41766f7ac50SMichael Wu enum monitor_flags {
41866f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
41966f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
42066f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
42166f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
42266f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
42366f7ac50SMichael Wu };
42466f7ac50SMichael Wu 
4252ec600d6SLuis Carlos Cobo /**
4262ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
4272ec600d6SLuis Carlos Cobo  *
4282ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
4292ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
4302ec600d6SLuis Carlos Cobo  *
4312ec600d6SLuis Carlos Cobo  * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
4322ec600d6SLuis Carlos Cobo  * MPATH_INFO_DSN: @dsn filled
4332ec600d6SLuis Carlos Cobo  * MPATH_INFO_METRIC: @metric filled
4342ec600d6SLuis Carlos Cobo  * MPATH_INFO_EXPTIME: @exptime filled
4352ec600d6SLuis Carlos Cobo  * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
4362ec600d6SLuis Carlos Cobo  * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
4372ec600d6SLuis Carlos Cobo  * MPATH_INFO_FLAGS: @flags filled
4382ec600d6SLuis Carlos Cobo  */
4392ec600d6SLuis Carlos Cobo enum mpath_info_flags {
4402ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
4412ec600d6SLuis Carlos Cobo 	MPATH_INFO_DSN			= BIT(1),
4422ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
4432ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
4442ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
4452ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
4462ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
4472ec600d6SLuis Carlos Cobo };
4482ec600d6SLuis Carlos Cobo 
4492ec600d6SLuis Carlos Cobo /**
4502ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
4512ec600d6SLuis Carlos Cobo  *
4522ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
4532ec600d6SLuis Carlos Cobo  *
4542ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
4552ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
4562ec600d6SLuis Carlos Cobo  * @dsn: destination sequence number
4572ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
4582ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
4592ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
4602ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
4612ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
4622ec600d6SLuis Carlos Cobo  */
4632ec600d6SLuis Carlos Cobo struct mpath_info {
4642ec600d6SLuis Carlos Cobo 	u32 filled;
4652ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
4662ec600d6SLuis Carlos Cobo 	u32 dsn;
4672ec600d6SLuis Carlos Cobo 	u32 metric;
4682ec600d6SLuis Carlos Cobo 	u32 exptime;
4692ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
4702ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
4712ec600d6SLuis Carlos Cobo 	u8 flags;
4722ec600d6SLuis Carlos Cobo };
4732ec600d6SLuis Carlos Cobo 
4749f1ba906SJouni Malinen /**
4759f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
4769f1ba906SJouni Malinen  *
4779f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
4789f1ba906SJouni Malinen  *
4799f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
4809f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
4819f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
4829f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
4839f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
4849f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
48590c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
48690c97a04SJouni Malinen  *	(or NULL for no change)
48790c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
4889f1ba906SJouni Malinen  */
4899f1ba906SJouni Malinen struct bss_parameters {
4909f1ba906SJouni Malinen 	int use_cts_prot;
4919f1ba906SJouni Malinen 	int use_short_preamble;
4929f1ba906SJouni Malinen 	int use_short_slot_time;
49390c97a04SJouni Malinen 	u8 *basic_rates;
49490c97a04SJouni Malinen 	u8 basic_rates_len;
4959f1ba906SJouni Malinen };
4962ec600d6SLuis Carlos Cobo 
49793da9cc1Scolin@cozybit.com struct mesh_config {
49893da9cc1Scolin@cozybit.com 	/* Timeouts in ms */
49993da9cc1Scolin@cozybit.com 	/* Mesh plink management parameters */
50093da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
50193da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
50293da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
50393da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
50493da9cc1Scolin@cozybit.com 	u8  dot11MeshMaxRetries;
50593da9cc1Scolin@cozybit.com 	u8  dot11MeshTTL;
50693da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
50793da9cc1Scolin@cozybit.com 	/* HWMP parameters */
50893da9cc1Scolin@cozybit.com 	u8  dot11MeshHWMPmaxPREQretries;
50993da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
51093da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
51193da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
51293da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
51393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
51493da9cc1Scolin@cozybit.com };
51593da9cc1Scolin@cozybit.com 
51631888487SJouni Malinen /**
51731888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
51831888487SJouni Malinen  * @queue: TX queue identifier (NL80211_TXQ_Q_*)
51931888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
52031888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
52131888487SJouni Malinen  *	1..32767]
52231888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
52331888487SJouni Malinen  *	1..32767]
52431888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
52531888487SJouni Malinen  */
52631888487SJouni Malinen struct ieee80211_txq_params {
52731888487SJouni Malinen 	enum nl80211_txq_q queue;
52831888487SJouni Malinen 	u16 txop;
52931888487SJouni Malinen 	u16 cwmin;
53031888487SJouni Malinen 	u16 cwmax;
53131888487SJouni Malinen 	u8 aifs;
53231888487SJouni Malinen };
53331888487SJouni Malinen 
534704232c2SJohannes Berg /* from net/wireless.h */
535704232c2SJohannes Berg struct wiphy;
536704232c2SJohannes Berg 
53772bdcf34SJouni Malinen /* from net/ieee80211.h */
53872bdcf34SJouni Malinen struct ieee80211_channel;
53972bdcf34SJouni Malinen 
540704232c2SJohannes Berg /**
5412a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
5422a519311SJohannes Berg  * @ssid: the SSID
5432a519311SJohannes Berg  * @ssid_len: length of the ssid
5442a519311SJohannes Berg  */
5452a519311SJohannes Berg struct cfg80211_ssid {
5462a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
5472a519311SJohannes Berg 	u8 ssid_len;
5482a519311SJohannes Berg };
5492a519311SJohannes Berg 
5502a519311SJohannes Berg /**
5512a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
5522a519311SJohannes Berg  *
5532a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
5542a519311SJohannes Berg  * @n_ssids: number of SSIDs
5552a519311SJohannes Berg  * @channels: channels to scan on.
5562a519311SJohannes Berg  * @n_channels: number of channels for each band
55770692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
55870692ad2SJouni Malinen  * @ie_len: length of ie in octets
5592a519311SJohannes Berg  * @wiphy: the wiphy this was for
5602a519311SJohannes Berg  * @ifidx: the interface index
5612a519311SJohannes Berg  */
5622a519311SJohannes Berg struct cfg80211_scan_request {
5632a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
5642a519311SJohannes Berg 	int n_ssids;
5652a519311SJohannes Berg 	struct ieee80211_channel **channels;
5662a519311SJohannes Berg 	u32 n_channels;
567de95a54bSJohannes Berg 	const u8 *ie;
56870692ad2SJouni Malinen 	size_t ie_len;
5692a519311SJohannes Berg 
5702a519311SJohannes Berg 	/* internal */
5712a519311SJohannes Berg 	struct wiphy *wiphy;
5722a519311SJohannes Berg 	int ifidx;
5732a519311SJohannes Berg };
5742a519311SJohannes Berg 
5752a519311SJohannes Berg /**
5762a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
5772a519311SJohannes Berg  *
5782a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
5792a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
5802a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
5812a519311SJohannes Berg  */
5822a519311SJohannes Berg enum cfg80211_signal_type {
5832a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
5842a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
5852a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
5862a519311SJohannes Berg };
5872a519311SJohannes Berg 
5882a519311SJohannes Berg /**
5892a519311SJohannes Berg  * struct cfg80211_bss - BSS description
5902a519311SJohannes Berg  *
5912a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
5922a519311SJohannes Berg  * for use in scan results and similar.
5932a519311SJohannes Berg  *
5942a519311SJohannes Berg  * @bssid: BSSID of the BSS
5952a519311SJohannes Berg  * @tsf: timestamp of last received update
5962a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
5972a519311SJohannes Berg  * @capability: the capability field in host byte order
5982a519311SJohannes Berg  * @information_elements: the information elements (Note that there
5992a519311SJohannes Berg  *	is no guarantee that these are well-formed!)
6002a519311SJohannes Berg  * @len_information_elements: total length of the information elements
60177965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
602a08c1c1aSKalle Valo  * @hold: BSS should not expire
60378c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
6042a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
6052a519311SJohannes Berg  */
6062a519311SJohannes Berg struct cfg80211_bss {
6072a519311SJohannes Berg 	struct ieee80211_channel *channel;
6082a519311SJohannes Berg 
6092a519311SJohannes Berg 	u8 bssid[ETH_ALEN];
6102a519311SJohannes Berg 	u64 tsf;
6112a519311SJohannes Berg 	u16 beacon_interval;
6122a519311SJohannes Berg 	u16 capability;
6132a519311SJohannes Berg 	u8 *information_elements;
6142a519311SJohannes Berg 	size_t len_information_elements;
6152a519311SJohannes Berg 
6162a519311SJohannes Berg 	s32 signal;
6172a519311SJohannes Berg 
61878c1c7e1SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
6192a519311SJohannes Berg 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
6202a519311SJohannes Berg };
6212a519311SJohannes Berg 
6222a519311SJohannes Berg /**
623636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
624636a5d36SJouni Malinen  *
625636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
626636a5d36SJouni Malinen  * authentication.
627636a5d36SJouni Malinen  * NOTE: This structure will likely change when more code from mac80211 is
628636a5d36SJouni Malinen  * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
629636a5d36SJouni Malinen  * Before using this in a driver that does not use mac80211, it would be better
630636a5d36SJouni Malinen  * to check the status of that work and better yet, volunteer to work on it.
631636a5d36SJouni Malinen  *
632636a5d36SJouni Malinen  * @chan: The channel to use or %NULL if not specified (auto-select based on
633636a5d36SJouni Malinen  *	scan results)
634636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
635636a5d36SJouni Malinen  *	this field is required to be present; if the driver wants to help with
636636a5d36SJouni Malinen  *	BSS selection, it should use (yet to be added) MLME event to allow user
637636a5d36SJouni Malinen  *	space SME to be notified of roaming candidate, so that the SME can then
638636a5d36SJouni Malinen  *	use the authentication request with the recommended BSSID and whatever
639636a5d36SJouni Malinen  *	other data may be needed for authentication/association
640636a5d36SJouni Malinen  * @ssid: SSID or %NULL if not yet available
641636a5d36SJouni Malinen  * @ssid_len: Length of ssid in octets
642636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
643636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
644636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
645636a5d36SJouni Malinen  */
646636a5d36SJouni Malinen struct cfg80211_auth_request {
647636a5d36SJouni Malinen 	struct ieee80211_channel *chan;
648636a5d36SJouni Malinen 	u8 *peer_addr;
649636a5d36SJouni Malinen 	const u8 *ssid;
650636a5d36SJouni Malinen 	size_t ssid_len;
651636a5d36SJouni Malinen 	enum nl80211_auth_type auth_type;
652636a5d36SJouni Malinen 	const u8 *ie;
653636a5d36SJouni Malinen 	size_t ie_len;
654636a5d36SJouni Malinen };
655636a5d36SJouni Malinen 
656636a5d36SJouni Malinen /**
657636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
658636a5d36SJouni Malinen  *
659636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
660636a5d36SJouni Malinen  * (re)association.
661636a5d36SJouni Malinen  * NOTE: This structure will likely change when more code from mac80211 is
662636a5d36SJouni Malinen  * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
663636a5d36SJouni Malinen  * Before using this in a driver that does not use mac80211, it would be better
664636a5d36SJouni Malinen  * to check the status of that work and better yet, volunteer to work on it.
665636a5d36SJouni Malinen  *
666636a5d36SJouni Malinen  * @chan: The channel to use or %NULL if not specified (auto-select based on
667636a5d36SJouni Malinen  *	scan results)
668636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
669636a5d36SJouni Malinen  *	to be present and the STA must be in State 2 (authenticated) with the
670636a5d36SJouni Malinen  *	peer STA
671636a5d36SJouni Malinen  * @ssid: SSID
672636a5d36SJouni Malinen  * @ssid_len: Length of ssid in octets
673636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
674636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
675636a5d36SJouni Malinen  */
676636a5d36SJouni Malinen struct cfg80211_assoc_request {
677636a5d36SJouni Malinen 	struct ieee80211_channel *chan;
678636a5d36SJouni Malinen 	u8 *peer_addr;
679636a5d36SJouni Malinen 	const u8 *ssid;
680636a5d36SJouni Malinen 	size_t ssid_len;
681636a5d36SJouni Malinen 	const u8 *ie;
682636a5d36SJouni Malinen 	size_t ie_len;
683636a5d36SJouni Malinen };
684636a5d36SJouni Malinen 
685636a5d36SJouni Malinen /**
686636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
687636a5d36SJouni Malinen  *
688636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
689636a5d36SJouni Malinen  * deauthentication.
690636a5d36SJouni Malinen  *
691636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
692636a5d36SJouni Malinen  *	to be present and the STA must be authenticated with the peer STA
693636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
694636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
695636a5d36SJouni Malinen  */
696636a5d36SJouni Malinen struct cfg80211_deauth_request {
697636a5d36SJouni Malinen 	u8 *peer_addr;
698636a5d36SJouni Malinen 	u16 reason_code;
699636a5d36SJouni Malinen 	const u8 *ie;
700636a5d36SJouni Malinen 	size_t ie_len;
701636a5d36SJouni Malinen };
702636a5d36SJouni Malinen 
703636a5d36SJouni Malinen /**
704636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
705636a5d36SJouni Malinen  *
706636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
707636a5d36SJouni Malinen  * disassocation.
708636a5d36SJouni Malinen  *
709636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
710636a5d36SJouni Malinen  *	to be present and the STA must be associated with the peer STA
711636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
712636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
713636a5d36SJouni Malinen  */
714636a5d36SJouni Malinen struct cfg80211_disassoc_request {
715636a5d36SJouni Malinen 	u8 *peer_addr;
716636a5d36SJouni Malinen 	u16 reason_code;
717636a5d36SJouni Malinen 	const u8 *ie;
718636a5d36SJouni Malinen 	size_t ie_len;
719636a5d36SJouni Malinen };
720636a5d36SJouni Malinen 
721636a5d36SJouni Malinen /**
72204a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
72304a773adSJohannes Berg  *
72404a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
72504a773adSJohannes Berg  * method.
72604a773adSJohannes Berg  *
72704a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
72804a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
72904a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
73004a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
73104a773adSJohannes Berg  * @channel: The channel to use if no IBSS can be found to join.
73204a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
73304a773adSJohannes Berg  *	IBSSs to join on other channels.
73404a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
73504a773adSJohannes Berg  * @ie_len: length of that
73604a773adSJohannes Berg  */
73704a773adSJohannes Berg struct cfg80211_ibss_params {
73804a773adSJohannes Berg 	u8 *ssid;
73904a773adSJohannes Berg 	u8 *bssid;
74004a773adSJohannes Berg 	struct ieee80211_channel *channel;
74104a773adSJohannes Berg 	u8 *ie;
74204a773adSJohannes Berg 	u8 ssid_len, ie_len;
74304a773adSJohannes Berg 	bool channel_fixed;
74404a773adSJohannes Berg };
74504a773adSJohannes Berg 
74604a773adSJohannes Berg /**
747704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
748704232c2SJohannes Berg  *
749704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
750704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
751704232c2SJohannes Berg  *
752704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
753704232c2SJohannes Berg  * on success or a negative error code.
754704232c2SJohannes Berg  *
75543fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
75643fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
75743fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
75843fb45cbSJohannes Berg  *
7590378b3f1SJohannes Berg  * @suspend: wiphy device needs to be suspended
7600378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
7610378b3f1SJohannes Berg  *
76260719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
76360719ffdSJohannes Berg  *	must set the struct wireless_dev's iftype.
764704232c2SJohannes Berg  *
765704232c2SJohannes Berg  * @del_virtual_intf: remove the virtual interface determined by ifindex.
76655682965SJohannes Berg  *
76760719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
76860719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
76955682965SJohannes Berg  *
77041ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
77141ade00fSJohannes Berg  *	when adding a group key.
77241ade00fSJohannes Berg  *
77341ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
77441ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
77541ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
77641ade00fSJohannes Berg  *	after it returns.
77741ade00fSJohannes Berg  *
77841ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
77941ade00fSJohannes Berg  *	and @key_index
78041ade00fSJohannes Berg  *
78141ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
782ed1b6cc7SJohannes Berg  *
7833cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
7843cfcf6acSJouni Malinen  *
785ed1b6cc7SJohannes Berg  * @add_beacon: Add a beacon with given parameters, @head, @interval
786ed1b6cc7SJohannes Berg  *	and @dtim_period will be valid, @tail is optional.
787ed1b6cc7SJohannes Berg  * @set_beacon: Change the beacon parameters for an access point mode
788ed1b6cc7SJohannes Berg  *	interface. This should reject the call when no beacon has been
789ed1b6cc7SJohannes Berg  *	configured.
790ed1b6cc7SJohannes Berg  * @del_beacon: Remove beacon configuration and stop sending the beacon.
7915727ef1bSJohannes Berg  *
7925727ef1bSJohannes Berg  * @add_station: Add a new station.
7935727ef1bSJohannes Berg  *
7945727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
7955727ef1bSJohannes Berg  *
7965727ef1bSJohannes Berg  * @change_station: Modify a given station.
7972ec600d6SLuis Carlos Cobo  *
79893da9cc1Scolin@cozybit.com  * @get_mesh_params: Put the current mesh parameters into *params
79993da9cc1Scolin@cozybit.com  *
80093da9cc1Scolin@cozybit.com  * @set_mesh_params: Set mesh parameters.
80193da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
80293da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
80393da9cc1Scolin@cozybit.com  *
8042ec600d6SLuis Carlos Cobo  * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
8059f1ba906SJouni Malinen  *
8069f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
80731888487SJouni Malinen  *
80831888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
80972bdcf34SJouni Malinen  *
81072bdcf34SJouni Malinen  * @set_channel: Set channel
8119aed3cc1SJouni Malinen  *
8122a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
8132a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
8142a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
8152a519311SJohannes Berg  *	the scan/scan_done bracket too.
816636a5d36SJouni Malinen  *
817636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
818636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
819636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
820636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
82104a773adSJohannes Berg  *
82204a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
82304a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
82404a773adSJohannes Berg  *	to a merge.
82504a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
826704232c2SJohannes Berg  */
827704232c2SJohannes Berg struct cfg80211_ops {
8280378b3f1SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy);
8290378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
8300378b3f1SJohannes Berg 
831704232c2SJohannes Berg 	int	(*add_virtual_intf)(struct wiphy *wiphy, char *name,
8322ec600d6SLuis Carlos Cobo 				    enum nl80211_iftype type, u32 *flags,
8332ec600d6SLuis Carlos Cobo 				    struct vif_params *params);
834704232c2SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
83555682965SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
8362ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
8372ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
83841ade00fSJohannes Berg 
83941ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
84041ade00fSJohannes Berg 			   u8 key_index, u8 *mac_addr,
84141ade00fSJohannes Berg 			   struct key_params *params);
84241ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
84341ade00fSJohannes Berg 			   u8 key_index, u8 *mac_addr, void *cookie,
84441ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
84541ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
84641ade00fSJohannes Berg 			   u8 key_index, u8 *mac_addr);
84741ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
84841ade00fSJohannes Berg 				   struct net_device *netdev,
84941ade00fSJohannes Berg 				   u8 key_index);
8503cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
8513cfcf6acSJouni Malinen 					struct net_device *netdev,
8523cfcf6acSJouni Malinen 					u8 key_index);
853ed1b6cc7SJohannes Berg 
854ed1b6cc7SJohannes Berg 	int	(*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
855ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
856ed1b6cc7SJohannes Berg 	int	(*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
857ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
858ed1b6cc7SJohannes Berg 	int	(*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
8595727ef1bSJohannes Berg 
8605727ef1bSJohannes Berg 
8615727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
8625727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
8635727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
8645727ef1bSJohannes Berg 			       u8 *mac);
8655727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
8665727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
867fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
8682ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
8692ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
8702ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
8712ec600d6SLuis Carlos Cobo 
8722ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
8732ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
8742ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
8752ec600d6SLuis Carlos Cobo 			       u8 *dst);
8762ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
8772ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
8782ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
8792ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
8802ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
8812ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
8822ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
8832ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
88493da9cc1Scolin@cozybit.com 	int	(*get_mesh_params)(struct wiphy *wiphy,
88593da9cc1Scolin@cozybit.com 				struct net_device *dev,
88693da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
88793da9cc1Scolin@cozybit.com 	int	(*set_mesh_params)(struct wiphy *wiphy,
88893da9cc1Scolin@cozybit.com 				struct net_device *dev,
88993da9cc1Scolin@cozybit.com 				const struct mesh_config *nconf, u32 mask);
8909f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
8919f1ba906SJouni Malinen 			      struct bss_parameters *params);
89231888487SJouni Malinen 
89331888487SJouni Malinen 	int	(*set_txq_params)(struct wiphy *wiphy,
89431888487SJouni Malinen 				  struct ieee80211_txq_params *params);
89572bdcf34SJouni Malinen 
89672bdcf34SJouni Malinen 	int	(*set_channel)(struct wiphy *wiphy,
89772bdcf34SJouni Malinen 			       struct ieee80211_channel *chan,
898094d05dcSSujith 			       enum nl80211_channel_type channel_type);
8999aed3cc1SJouni Malinen 
9002a519311SJohannes Berg 	int	(*scan)(struct wiphy *wiphy, struct net_device *dev,
9012a519311SJohannes Berg 			struct cfg80211_scan_request *request);
902636a5d36SJouni Malinen 
903636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
904636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
905636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
906636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
907636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
908636a5d36SJouni Malinen 			  struct cfg80211_deauth_request *req);
909636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
910636a5d36SJouni Malinen 			    struct cfg80211_disassoc_request *req);
91104a773adSJohannes Berg 
91204a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
91304a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
91404a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
915704232c2SJohannes Berg };
916704232c2SJohannes Berg 
917*d3236553SJohannes Berg /*
918*d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
919*d3236553SJohannes Berg  * and registration/helper functions
920*d3236553SJohannes Berg  */
921*d3236553SJohannes Berg 
922*d3236553SJohannes Berg /**
923*d3236553SJohannes Berg  * struct wiphy - wireless hardware description
924*d3236553SJohannes Berg  * @idx: the wiphy index assigned to this item
925*d3236553SJohannes Berg  * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
926*d3236553SJohannes Berg  * @custom_regulatory: tells us the driver for this device
927*d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
928*d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
929*d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
930*d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
931*d3236553SJohannes Berg  * @strict_regulatory: tells us the driver for this device will ignore
932*d3236553SJohannes Berg  * 	regulatory domain settings until it gets its own regulatory domain
933*d3236553SJohannes Berg  * 	via its regulatory_hint(). After its gets its own regulatory domain
934*d3236553SJohannes Berg  * 	it will only allow further regulatory domain settings to further
935*d3236553SJohannes Berg  * 	enhance compliance. For example if channel 13 and 14 are disabled
936*d3236553SJohannes Berg  * 	by this regulatory domain no user regulatory domain can enable these
937*d3236553SJohannes Berg  * 	channels at a later time. This can be used for devices which do not
938*d3236553SJohannes Berg  * 	have calibration information gauranteed for frequencies or settings
939*d3236553SJohannes Berg  * 	outside of its regulatory domain.
940*d3236553SJohannes Berg  * @reg_notifier: the driver's regulatory notification callback
941*d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
942*d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
943*d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
944*d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
945*d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
946*d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
947*d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
948*d3236553SJohannes Berg  */
949*d3236553SJohannes Berg struct wiphy {
950*d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
951*d3236553SJohannes Berg 
952*d3236553SJohannes Berg 	/* permanent MAC address */
953*d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
954*d3236553SJohannes Berg 
955*d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
956*d3236553SJohannes Berg 	u16 interface_modes;
957*d3236553SJohannes Berg 
958*d3236553SJohannes Berg 	bool custom_regulatory;
959*d3236553SJohannes Berg 	bool strict_regulatory;
960*d3236553SJohannes Berg 
961*d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
962*d3236553SJohannes Berg 
963*d3236553SJohannes Berg 	int bss_priv_size;
964*d3236553SJohannes Berg 	u8 max_scan_ssids;
965*d3236553SJohannes Berg 	u16 max_scan_ie_len;
966*d3236553SJohannes Berg 
967*d3236553SJohannes Berg 	int n_cipher_suites;
968*d3236553SJohannes Berg 	const u32 *cipher_suites;
969*d3236553SJohannes Berg 
970*d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
971*d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
972*d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
973*d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
974*d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
975*d3236553SJohannes Berg 	void *privid;
976*d3236553SJohannes Berg 
977*d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
978*d3236553SJohannes Berg 
979*d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
980*d3236553SJohannes Berg 	int (*reg_notifier)(struct wiphy *wiphy,
981*d3236553SJohannes Berg 			    struct regulatory_request *request);
982*d3236553SJohannes Berg 
983*d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
984*d3236553SJohannes Berg 
985*d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd;
986*d3236553SJohannes Berg 
987*d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
988*d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
989*d3236553SJohannes Berg 	struct device dev;
990*d3236553SJohannes Berg 
991*d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
992*d3236553SJohannes Berg 	struct dentry *debugfsdir;
993*d3236553SJohannes Berg 
994*d3236553SJohannes Berg 	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
995*d3236553SJohannes Berg };
996*d3236553SJohannes Berg 
997*d3236553SJohannes Berg /**
998*d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
999*d3236553SJohannes Berg  *
1000*d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
1001*d3236553SJohannes Berg  */
1002*d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
1003*d3236553SJohannes Berg {
1004*d3236553SJohannes Berg 	BUG_ON(!wiphy);
1005*d3236553SJohannes Berg 	return &wiphy->priv;
1006*d3236553SJohannes Berg }
1007*d3236553SJohannes Berg 
1008*d3236553SJohannes Berg /**
1009*d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
1010*d3236553SJohannes Berg  *
1011*d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
1012*d3236553SJohannes Berg  * @dev: The device to parent it to
1013*d3236553SJohannes Berg  */
1014*d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1015*d3236553SJohannes Berg {
1016*d3236553SJohannes Berg 	wiphy->dev.parent = dev;
1017*d3236553SJohannes Berg }
1018*d3236553SJohannes Berg 
1019*d3236553SJohannes Berg /**
1020*d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
1021*d3236553SJohannes Berg  *
1022*d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
1023*d3236553SJohannes Berg  */
1024*d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
1025*d3236553SJohannes Berg {
1026*d3236553SJohannes Berg 	return wiphy->dev.parent;
1027*d3236553SJohannes Berg }
1028*d3236553SJohannes Berg 
1029*d3236553SJohannes Berg /**
1030*d3236553SJohannes Berg  * wiphy_name - get wiphy name
1031*d3236553SJohannes Berg  *
1032*d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
1033*d3236553SJohannes Berg  */
1034*d3236553SJohannes Berg static inline const char *wiphy_name(struct wiphy *wiphy)
1035*d3236553SJohannes Berg {
1036*d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
1037*d3236553SJohannes Berg }
1038*d3236553SJohannes Berg 
1039*d3236553SJohannes Berg /**
1040*d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
1041*d3236553SJohannes Berg  *
1042*d3236553SJohannes Berg  * @ops: The configuration operations for this device
1043*d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
1044*d3236553SJohannes Berg  *
1045*d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
1046*d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
1047*d3236553SJohannes Berg  *
1048*d3236553SJohannes Berg  * The returned pointer must be assigned to each netdev's
1049*d3236553SJohannes Berg  * ieee80211_ptr for proper operation.
1050*d3236553SJohannes Berg  */
1051*d3236553SJohannes Berg struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
1052*d3236553SJohannes Berg 
1053*d3236553SJohannes Berg /**
1054*d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
1055*d3236553SJohannes Berg  *
1056*d3236553SJohannes Berg  * @wiphy: The wiphy to register.
1057*d3236553SJohannes Berg  *
1058*d3236553SJohannes Berg  * Returns a non-negative wiphy index or a negative error code.
1059*d3236553SJohannes Berg  */
1060*d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
1061*d3236553SJohannes Berg 
1062*d3236553SJohannes Berg /**
1063*d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
1064*d3236553SJohannes Berg  *
1065*d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
1066*d3236553SJohannes Berg  *
1067*d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
1068*d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
1069*d3236553SJohannes Berg  * request that is being handled.
1070*d3236553SJohannes Berg  */
1071*d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
1072*d3236553SJohannes Berg 
1073*d3236553SJohannes Berg /**
1074*d3236553SJohannes Berg  * wiphy_free - free wiphy
1075*d3236553SJohannes Berg  *
1076*d3236553SJohannes Berg  * @wiphy: The wiphy to free
1077*d3236553SJohannes Berg  */
1078*d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
1079*d3236553SJohannes Berg 
1080*d3236553SJohannes Berg /**
1081*d3236553SJohannes Berg  * struct wireless_dev - wireless per-netdev state
1082*d3236553SJohannes Berg  *
1083*d3236553SJohannes Berg  * This structure must be allocated by the driver/stack
1084*d3236553SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device
1085*d3236553SJohannes Berg  * (this is intentional so it can be allocated along with
1086*d3236553SJohannes Berg  * the netdev.)
1087*d3236553SJohannes Berg  *
1088*d3236553SJohannes Berg  * @wiphy: pointer to hardware description
1089*d3236553SJohannes Berg  * @iftype: interface type
1090*d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
1091*d3236553SJohannes Berg  * @netdev: (private) Used to reference back to the netdev
1092*d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
1093*d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
1094*d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
1095*d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
1096*d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
1097*d3236553SJohannes Berg  * @wext_bssid: (private) Used by the internal wireless extensions compat code
1098*d3236553SJohannes Berg  */
1099*d3236553SJohannes Berg struct wireless_dev {
1100*d3236553SJohannes Berg 	struct wiphy *wiphy;
1101*d3236553SJohannes Berg 	enum nl80211_iftype iftype;
1102*d3236553SJohannes Berg 
1103*d3236553SJohannes Berg 	/* private to the generic wireless code */
1104*d3236553SJohannes Berg 	struct list_head list;
1105*d3236553SJohannes Berg 	struct net_device *netdev;
1106*d3236553SJohannes Berg 
1107*d3236553SJohannes Berg 	/* currently used for IBSS - might be rearranged in the future */
1108*d3236553SJohannes Berg 	struct cfg80211_bss *current_bss;
1109*d3236553SJohannes Berg 	u8 bssid[ETH_ALEN];
1110*d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
1111*d3236553SJohannes Berg 	u8 ssid_len;
1112*d3236553SJohannes Berg 
1113*d3236553SJohannes Berg #ifdef CONFIG_WIRELESS_EXT
1114*d3236553SJohannes Berg 	/* wext data */
1115*d3236553SJohannes Berg 	struct cfg80211_ibss_params wext;
1116*d3236553SJohannes Berg 	u8 wext_bssid[ETH_ALEN];
1117*d3236553SJohannes Berg #endif
1118*d3236553SJohannes Berg };
1119*d3236553SJohannes Berg 
1120*d3236553SJohannes Berg /**
1121*d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
1122*d3236553SJohannes Berg  *
1123*d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
1124*d3236553SJohannes Berg  */
1125*d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
1126*d3236553SJohannes Berg {
1127*d3236553SJohannes Berg 	BUG_ON(!wdev);
1128*d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
1129*d3236553SJohannes Berg }
1130*d3236553SJohannes Berg 
1131*d3236553SJohannes Berg /*
1132*d3236553SJohannes Berg  * Utility functions
1133*d3236553SJohannes Berg  */
1134*d3236553SJohannes Berg 
1135*d3236553SJohannes Berg /**
1136*d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
1137*d3236553SJohannes Berg  */
1138*d3236553SJohannes Berg extern int ieee80211_channel_to_frequency(int chan);
1139*d3236553SJohannes Berg 
1140*d3236553SJohannes Berg /**
1141*d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
1142*d3236553SJohannes Berg  */
1143*d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
1144*d3236553SJohannes Berg 
1145*d3236553SJohannes Berg /*
1146*d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
1147*d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
1148*d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
1149*d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
1150*d3236553SJohannes Berg  * clash.
1151*d3236553SJohannes Berg  */
1152*d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1153*d3236553SJohannes Berg 							 int freq);
1154*d3236553SJohannes Berg /**
1155*d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1156*d3236553SJohannes Berg  */
1157*d3236553SJohannes Berg static inline struct ieee80211_channel *
1158*d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
1159*d3236553SJohannes Berg {
1160*d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
1161*d3236553SJohannes Berg }
1162*d3236553SJohannes Berg 
1163*d3236553SJohannes Berg /**
1164*d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
1165*d3236553SJohannes Berg  *
1166*d3236553SJohannes Berg  * @sband: the band to look for rates in
1167*d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
1168*d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
1169*d3236553SJohannes Berg  *
1170*d3236553SJohannes Berg  * This function returns the basic rate corresponding to a given
1171*d3236553SJohannes Berg  * bitrate, that is the next lower bitrate contained in the basic
1172*d3236553SJohannes Berg  * rate map, which is, for this function, given as a bitmap of
1173*d3236553SJohannes Berg  * indices of rates in the band's bitrate table.
1174*d3236553SJohannes Berg  */
1175*d3236553SJohannes Berg struct ieee80211_rate *
1176*d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1177*d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
1178*d3236553SJohannes Berg 
1179*d3236553SJohannes Berg /*
1180*d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
1181*d3236553SJohannes Berg  *
1182*d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
1183*d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
1184*d3236553SJohannes Berg  */
1185*d3236553SJohannes Berg 
1186*d3236553SJohannes Berg /**
1187*d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1188*d3236553SJohannes Berg  * @rtheader: pointer to the radiotap header we are walking through
1189*d3236553SJohannes Berg  * @max_length: length of radiotap header in cpu byte ordering
1190*d3236553SJohannes Berg  * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
1191*d3236553SJohannes Berg  * @this_arg: pointer to current radiotap arg
1192*d3236553SJohannes Berg  * @arg_index: internal next argument index
1193*d3236553SJohannes Berg  * @arg: internal next argument pointer
1194*d3236553SJohannes Berg  * @next_bitmap: internal pointer to next present u32
1195*d3236553SJohannes Berg  * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1196*d3236553SJohannes Berg  */
1197*d3236553SJohannes Berg 
1198*d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
1199*d3236553SJohannes Berg 	struct ieee80211_radiotap_header *rtheader;
1200*d3236553SJohannes Berg 	int max_length;
1201*d3236553SJohannes Berg 	int this_arg_index;
1202*d3236553SJohannes Berg 	u8 *this_arg;
1203*d3236553SJohannes Berg 
1204*d3236553SJohannes Berg 	int arg_index;
1205*d3236553SJohannes Berg 	u8 *arg;
1206*d3236553SJohannes Berg 	__le32 *next_bitmap;
1207*d3236553SJohannes Berg 	u32 bitmap_shifter;
1208*d3236553SJohannes Berg };
1209*d3236553SJohannes Berg 
1210*d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
1211*d3236553SJohannes Berg    struct ieee80211_radiotap_iterator *iterator,
1212*d3236553SJohannes Berg    struct ieee80211_radiotap_header *radiotap_header,
1213*d3236553SJohannes Berg    int max_length);
1214*d3236553SJohannes Berg 
1215*d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
1216*d3236553SJohannes Berg    struct ieee80211_radiotap_iterator *iterator);
1217*d3236553SJohannes Berg 
1218*d3236553SJohannes Berg /*
1219*d3236553SJohannes Berg  * Regulatory helper functions for wiphys
1220*d3236553SJohannes Berg  */
1221*d3236553SJohannes Berg 
1222*d3236553SJohannes Berg /**
1223*d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
1224*d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
1225*d3236553SJohannes Berg  *	conflicts)
1226*d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
1227*d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
1228*d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
1229*d3236553SJohannes Berg  * 	alpha2.
1230*d3236553SJohannes Berg  *
1231*d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
1232*d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
1233*d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
1234*d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
1235*d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
1236*d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
1237*d3236553SJohannes Berg  *
1238*d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
1239*d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
1240*d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
1241*d3236553SJohannes Berg  *
1242*d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
1243*d3236553SJohannes Berg  * an -ENOMEM.
1244*d3236553SJohannes Berg  */
1245*d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1246*d3236553SJohannes Berg 
1247*d3236553SJohannes Berg /**
1248*d3236553SJohannes Berg  * regulatory_hint_11d - hints a country IE as a regulatory domain
1249*d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
1250*d3236553SJohannes Berg  *	conflicts)
1251*d3236553SJohannes Berg  * @country_ie: pointer to the country IE
1252*d3236553SJohannes Berg  * @country_ie_len: length of the country IE
1253*d3236553SJohannes Berg  *
1254*d3236553SJohannes Berg  * We will intersect the rd with the what CRDA tells us should apply
1255*d3236553SJohannes Berg  * for the alpha2 this country IE belongs to, this prevents APs from
1256*d3236553SJohannes Berg  * sending us incorrect or outdated information against a country.
1257*d3236553SJohannes Berg  */
1258*d3236553SJohannes Berg extern void regulatory_hint_11d(struct wiphy *wiphy,
1259*d3236553SJohannes Berg 				u8 *country_ie,
1260*d3236553SJohannes Berg 				u8 country_ie_len);
1261*d3236553SJohannes Berg /**
1262*d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1263*d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
1264*d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
1265*d3236553SJohannes Berg  *
1266*d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
1267*d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
1268*d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
1269*d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
1270*d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
1271*d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
1272*d3236553SJohannes Berg  */
1273*d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
1274*d3236553SJohannes Berg 	struct wiphy *wiphy,
1275*d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
1276*d3236553SJohannes Berg 
1277*d3236553SJohannes Berg /**
1278*d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
1279*d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
1280*d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
1281*d3236553SJohannes Berg  * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
1282*d3236553SJohannes Berg  * 	you can set this to 0. If this frequency is allowed we then set
1283*d3236553SJohannes Berg  * 	this value to the maximum allowed bandwidth.
1284*d3236553SJohannes Berg  * @reg_rule: the regulatory rule which we have for this frequency
1285*d3236553SJohannes Berg  *
1286*d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
1287*d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
1288*d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
1289*d3236553SJohannes Berg  * and processed already.
1290*d3236553SJohannes Berg  *
1291*d3236553SJohannes Berg  * Returns 0 if it was able to find a valid regulatory rule which does
1292*d3236553SJohannes Berg  * apply to the given center_freq otherwise it returns non-zero. It will
1293*d3236553SJohannes Berg  * also return -ERANGE if we determine the given center_freq does not even have
1294*d3236553SJohannes Berg  * a regulatory rule for a frequency range in the center_freq's band. See
1295*d3236553SJohannes Berg  * freq_in_rule_band() for our current definition of a band -- this is purely
1296*d3236553SJohannes Berg  * subjective and right now its 802.11 specific.
1297*d3236553SJohannes Berg  */
1298*d3236553SJohannes Berg extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
1299*d3236553SJohannes Berg 			 const struct ieee80211_reg_rule **reg_rule);
1300*d3236553SJohannes Berg 
1301*d3236553SJohannes Berg /*
1302*d3236553SJohannes Berg  * Temporary wext handlers & helper functions
1303*d3236553SJohannes Berg  *
1304*d3236553SJohannes Berg  * In the future cfg80211 will simply assign the entire wext handler
1305*d3236553SJohannes Berg  * structure to netdevs it manages, but we're not there yet.
1306*d3236553SJohannes Berg  */
1307fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev,
1308fee52678SJohannes Berg 			  struct iw_request_info *info,
1309fee52678SJohannes Berg 			  char *name, char *extra);
1310e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
1311e60c7744SJohannes Berg 			  u32 *mode, char *extra);
1312e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
1313e60c7744SJohannes Berg 			  u32 *mode, char *extra);
13142a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev,
13152a519311SJohannes Berg 			  struct iw_request_info *info,
13162a519311SJohannes Berg 			  union iwreq_data *wrqu, char *extra);
13172a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev,
13182a519311SJohannes Berg 			  struct iw_request_info *info,
13192a519311SJohannes Berg 			  struct iw_point *data, char *extra);
1320691597cbSJohannes Berg int cfg80211_wext_siwmlme(struct net_device *dev,
1321691597cbSJohannes Berg 			  struct iw_request_info *info,
1322691597cbSJohannes Berg 			  struct iw_point *data, char *extra);
13234aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev,
13244aa188e1SJohannes Berg 			   struct iw_request_info *info,
13254aa188e1SJohannes Berg 			   struct iw_point *data, char *extra);
132604a773adSJohannes Berg int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
132704a773adSJohannes Berg 			       struct iw_request_info *info,
132804a773adSJohannes Berg 			       struct iw_freq *freq, char *extra);
132904a773adSJohannes Berg int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
133004a773adSJohannes Berg 			       struct iw_request_info *info,
133104a773adSJohannes Berg 			       struct iw_freq *freq, char *extra);
133204a773adSJohannes Berg int cfg80211_ibss_wext_siwessid(struct net_device *dev,
133304a773adSJohannes Berg 				struct iw_request_info *info,
133404a773adSJohannes Berg 				struct iw_point *data, char *ssid);
133504a773adSJohannes Berg int cfg80211_ibss_wext_giwessid(struct net_device *dev,
133604a773adSJohannes Berg 				struct iw_request_info *info,
133704a773adSJohannes Berg 				struct iw_point *data, char *ssid);
133804a773adSJohannes Berg int cfg80211_ibss_wext_siwap(struct net_device *dev,
133904a773adSJohannes Berg 			     struct iw_request_info *info,
134004a773adSJohannes Berg 			     struct sockaddr *ap_addr, char *extra);
134104a773adSJohannes Berg int cfg80211_ibss_wext_giwap(struct net_device *dev,
134204a773adSJohannes Berg 			     struct iw_request_info *info,
134304a773adSJohannes Berg 			     struct sockaddr *ap_addr, char *extra);
134404a773adSJohannes Berg 
134504a773adSJohannes Berg struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
134604a773adSJohannes Berg 					     struct iw_freq *freq);
13472a519311SJohannes Berg 
1348*d3236553SJohannes Berg /*
1349*d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
1350*d3236553SJohannes Berg  * functions and BSS handling helpers
1351*d3236553SJohannes Berg  */
1352*d3236553SJohannes Berg 
13532a519311SJohannes Berg /**
13542a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
13552a519311SJohannes Berg  *
13562a519311SJohannes Berg  * @request: the corresponding scan request
13572a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
13582a519311SJohannes Berg  *	userspace will be notified of that
13592a519311SJohannes Berg  */
13602a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
13612a519311SJohannes Berg 
13622a519311SJohannes Berg /**
13632a519311SJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
13642a519311SJohannes Berg  *
13652a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
13662a519311SJohannes Berg  * @bss: the found BSS
136777965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
13682a519311SJohannes Berg  * @gfp: context flags
13692a519311SJohannes Berg  *
13702a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
13712a519311SJohannes Berg  * the BSS should be updated/added.
13722a519311SJohannes Berg  */
13732a519311SJohannes Berg struct cfg80211_bss*
13742a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
13752a519311SJohannes Berg 			  struct ieee80211_channel *channel,
13762a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
137777965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
13782a519311SJohannes Berg 
137906aa7afaSJussi Kivilinna struct cfg80211_bss*
138006aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
138106aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
138206aa7afaSJussi Kivilinna 		    const u8 *bssid,
138306aa7afaSJussi Kivilinna 		    u64 timestamp, u16 capability, u16 beacon_interval,
138406aa7afaSJussi Kivilinna 		    const u8 *ie, size_t ielen,
138506aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
138606aa7afaSJussi Kivilinna 
13872a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
13882a519311SJohannes Berg 				      struct ieee80211_channel *channel,
13892a519311SJohannes Berg 				      const u8 *bssid,
139079420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
139179420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
139279420f09SJohannes Berg static inline struct cfg80211_bss *
139379420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
139479420f09SJohannes Berg 		  struct ieee80211_channel *channel,
139579420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
139679420f09SJohannes Berg {
139779420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
139879420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
139979420f09SJohannes Berg }
140079420f09SJohannes Berg 
14012a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
14022a519311SJohannes Berg 				       struct ieee80211_channel *channel,
14032a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
14042a519311SJohannes Berg 				       const u8 *meshcfg);
14052a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
1406*d3236553SJohannes Berg 
1407d491af19SJohannes Berg /**
1408d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
1409d491af19SJohannes Berg  * @wiphy: the wiphy
1410d491af19SJohannes Berg  * @bss: the bss to remove
1411d491af19SJohannes Berg  *
1412d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
1413d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
1414d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
1415d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
1416d491af19SJohannes Berg  */
1417d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
1418fee52678SJohannes Berg 
14196039f6d2SJouni Malinen /**
14206039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
14216039f6d2SJouni Malinen  * @dev: network device
14226039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
14236039f6d2SJouni Malinen  * @len: length of the frame data
14246039f6d2SJouni Malinen  *
14256039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
14266039f6d2SJouni Malinen  * station mode.
14276039f6d2SJouni Malinen  */
14286039f6d2SJouni Malinen void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
14296039f6d2SJouni Malinen 
14306039f6d2SJouni Malinen /**
14316039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
14326039f6d2SJouni Malinen  * @dev: network device
14336039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
14346039f6d2SJouni Malinen  * @len: length of the frame data
14356039f6d2SJouni Malinen  *
14366039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
14376039f6d2SJouni Malinen  * processed in station mode.
14386039f6d2SJouni Malinen  */
14396039f6d2SJouni Malinen void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
14406039f6d2SJouni Malinen 
14416039f6d2SJouni Malinen /**
144253b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
14436039f6d2SJouni Malinen  * @dev: network device
14446039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
14456039f6d2SJouni Malinen  * @len: length of the frame data
14466039f6d2SJouni Malinen  *
14476039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
144853b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
144953b46b84SJouni Malinen  * locally generated ones.
14506039f6d2SJouni Malinen  */
145153b46b84SJouni Malinen void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
14526039f6d2SJouni Malinen 
14536039f6d2SJouni Malinen /**
145453b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
14556039f6d2SJouni Malinen  * @dev: network device
14566039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
14576039f6d2SJouni Malinen  * @len: length of the frame data
14586039f6d2SJouni Malinen  *
14596039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
146053b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
146153b46b84SJouni Malinen  * generated ones.
14626039f6d2SJouni Malinen  */
146353b46b84SJouni Malinen void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
14646039f6d2SJouni Malinen 
1465a08c1c1aSKalle Valo /**
1466a08c1c1aSKalle Valo  * cfg80211_hold_bss - exclude bss from expiration
1467a08c1c1aSKalle Valo  * @bss: bss which should not expire
1468a08c1c1aSKalle Valo  *
1469a08c1c1aSKalle Valo  * In a case when the BSS is not updated but it shouldn't expire this
1470a08c1c1aSKalle Valo  * function can be used to mark the BSS to be excluded from expiration.
1471a08c1c1aSKalle Valo  */
1472a08c1c1aSKalle Valo void cfg80211_hold_bss(struct cfg80211_bss *bss);
1473a08c1c1aSKalle Valo 
1474a08c1c1aSKalle Valo /**
1475a08c1c1aSKalle Valo  * cfg80211_unhold_bss - remove expiration exception from the BSS
1476a08c1c1aSKalle Valo  * @bss: bss which can expire again
1477a08c1c1aSKalle Valo  *
1478a08c1c1aSKalle Valo  * This function marks the BSS to be expirable again.
1479a08c1c1aSKalle Valo  */
1480a08c1c1aSKalle Valo void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1481a08c1c1aSKalle Valo 
1482a3b8b056SJouni Malinen /**
1483a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
1484a3b8b056SJouni Malinen  * @dev: network device
1485a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
1486a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
1487a3b8b056SJouni Malinen  * @key_id: Key identifier (0..3)
1488a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1489a3b8b056SJouni Malinen  *
1490a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
1491a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
1492a3b8b056SJouni Malinen  * primitive.
1493a3b8b056SJouni Malinen  */
1494a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1495a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
1496a3b8b056SJouni Malinen 				  const u8 *tsc);
1497a3b8b056SJouni Malinen 
149804a773adSJohannes Berg /**
149904a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
150004a773adSJohannes Berg  *
150104a773adSJohannes Berg  * @dev: network device
150204a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
150304a773adSJohannes Berg  * @gfp: allocation flags
150404a773adSJohannes Berg  *
150504a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
150604a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
150704a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
150804a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
150904a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
151004a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
151104a773adSJohannes Berg  */
151204a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
151304a773adSJohannes Berg 
1514704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
1515