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 23fee52678SJohannes Berg /* remove once we remove the wext stuff */ 24d3236553SJohannes Berg #include <net/iw_handler.h> 25d3236553SJohannes Berg #include <linux/wireless.h> 26d3236553SJohannes Berg 27704232c2SJohannes Berg 28d70e9693SJohannes Berg /** 29d70e9693SJohannes Berg * DOC: Introduction 30d70e9693SJohannes Berg * 31d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 32d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 33d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 34d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 35d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 36d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 37d70e9693SJohannes Berg * 38d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 39d70e9693SJohannes Berg * use restrictions. 40d70e9693SJohannes Berg */ 41d70e9693SJohannes Berg 42d70e9693SJohannes Berg 43d70e9693SJohannes Berg /** 44d70e9693SJohannes Berg * DOC: Device registration 45d70e9693SJohannes Berg * 46d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 47d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 48d70e9693SJohannes Berg * described below. 49d70e9693SJohannes Berg * 50d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 51d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 52d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 53d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 54d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 55d70e9693SJohannes Berg * the wireless part of the interface, normally this struct is embedded in the 56d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 57d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 58d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 59d70e9693SJohannes Berg * 60d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 61d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 62d70e9693SJohannes Berg * structures here describe these capabilities in detail. 63d70e9693SJohannes Berg */ 64d70e9693SJohannes Berg 65704232c2SJohannes Berg /* 66d3236553SJohannes Berg * wireless hardware capability structures 67d3236553SJohannes Berg */ 68d3236553SJohannes Berg 69d3236553SJohannes Berg /** 70d3236553SJohannes Berg * enum ieee80211_band - supported frequency bands 71704232c2SJohannes Berg * 72d3236553SJohannes Berg * The bands are assigned this way because the supported 73d3236553SJohannes Berg * bitrates differ in these bands. 74d3236553SJohannes Berg * 75d3236553SJohannes Berg * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 76d3236553SJohannes Berg * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 77abe37c4bSJohannes Berg * @IEEE80211_NUM_BANDS: number of defined bands 78d3236553SJohannes Berg */ 79d3236553SJohannes Berg enum ieee80211_band { 8013ae75b1SJouni Malinen IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 8113ae75b1SJouni Malinen IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 82d3236553SJohannes Berg 83d3236553SJohannes Berg /* keep last */ 84d3236553SJohannes Berg IEEE80211_NUM_BANDS 85d3236553SJohannes Berg }; 86d3236553SJohannes Berg 87d3236553SJohannes Berg /** 88d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 89d3236553SJohannes Berg * 90d3236553SJohannes Berg * Channel flags set by the regulatory control code. 91d3236553SJohannes Berg * 92d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 93d3236553SJohannes Berg * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted 94d3236553SJohannes Berg * on this channel. 95d3236553SJohannes Berg * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. 96d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 97689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 98d3236553SJohannes Berg * is not permitted. 99689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 100d3236553SJohannes Berg * is not permitted. 101d3236553SJohannes Berg */ 102d3236553SJohannes Berg enum ieee80211_channel_flags { 103d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 104d3236553SJohannes Berg IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, 105d3236553SJohannes Berg IEEE80211_CHAN_NO_IBSS = 1<<2, 106d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 107689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 108689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 109d3236553SJohannes Berg }; 110d3236553SJohannes Berg 111038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 112689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 113038659e7SLuis R. Rodriguez 114d3236553SJohannes Berg /** 115d3236553SJohannes Berg * struct ieee80211_channel - channel definition 116d3236553SJohannes Berg * 117d3236553SJohannes Berg * This structure describes a single channel for use 118d3236553SJohannes Berg * with cfg80211. 119d3236553SJohannes Berg * 120d3236553SJohannes Berg * @center_freq: center frequency in MHz 121d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 122d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 123d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 124d3236553SJohannes Berg * code to support devices with additional restrictions 125d3236553SJohannes Berg * @band: band this channel belongs to. 126d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 127d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 128d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 129d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 13077c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 131d3236553SJohannes Berg * @orig_mag: internal use 132d3236553SJohannes Berg * @orig_mpwr: internal use 133d3236553SJohannes Berg */ 134d3236553SJohannes Berg struct ieee80211_channel { 135d3236553SJohannes Berg enum ieee80211_band band; 136d3236553SJohannes Berg u16 center_freq; 137d3236553SJohannes Berg u16 hw_value; 138d3236553SJohannes Berg u32 flags; 139d3236553SJohannes Berg int max_antenna_gain; 140d3236553SJohannes Berg int max_power; 141d3236553SJohannes Berg bool beacon_found; 142d3236553SJohannes Berg u32 orig_flags; 143d3236553SJohannes Berg int orig_mag, orig_mpwr; 144d3236553SJohannes Berg }; 145d3236553SJohannes Berg 146d3236553SJohannes Berg /** 147d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 148d3236553SJohannes Berg * 149d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 150d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 151d3236553SJohannes Berg * different bands/PHY modes. 152d3236553SJohannes Berg * 153d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 154d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 155d3236553SJohannes Berg * with CCK rates. 156d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 157d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 158d3236553SJohannes Berg * core code when registering the wiphy. 159d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 160d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 161d3236553SJohannes Berg * core code when registering the wiphy. 162d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 163d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 164d3236553SJohannes Berg * core code when registering the wiphy. 165d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 166d3236553SJohannes Berg */ 167d3236553SJohannes Berg enum ieee80211_rate_flags { 168d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 169d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 170d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 171d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 172d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 173d3236553SJohannes Berg }; 174d3236553SJohannes Berg 175d3236553SJohannes Berg /** 176d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 177d3236553SJohannes Berg * 178d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 179d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 180d3236553SJohannes Berg * are only for driver use when pointers to this structure are 181d3236553SJohannes Berg * passed around. 182d3236553SJohannes Berg * 183d3236553SJohannes Berg * @flags: rate-specific flags 184d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 185d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 186d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 187d3236553SJohannes Berg * short preamble is used 188d3236553SJohannes Berg */ 189d3236553SJohannes Berg struct ieee80211_rate { 190d3236553SJohannes Berg u32 flags; 191d3236553SJohannes Berg u16 bitrate; 192d3236553SJohannes Berg u16 hw_value, hw_value_short; 193d3236553SJohannes Berg }; 194d3236553SJohannes Berg 195d3236553SJohannes Berg /** 196d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 197d3236553SJohannes Berg * 198d3236553SJohannes Berg * This structure describes most essential parameters needed 199d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 200d3236553SJohannes Berg * 201d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 202d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 203d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 204d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 205d3236553SJohannes Berg * @mcs: Supported MCS rates 206d3236553SJohannes Berg */ 207d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 208d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 209d3236553SJohannes Berg bool ht_supported; 210d3236553SJohannes Berg u8 ampdu_factor; 211d3236553SJohannes Berg u8 ampdu_density; 212d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 213d3236553SJohannes Berg }; 214d3236553SJohannes Berg 215d3236553SJohannes Berg /** 216d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 217d3236553SJohannes Berg * 218d3236553SJohannes Berg * This structure describes a frequency band a wiphy 219d3236553SJohannes Berg * is able to operate in. 220d3236553SJohannes Berg * 221d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 222d3236553SJohannes Berg * in this band. 223d3236553SJohannes Berg * @band: the band this structure represents 224d3236553SJohannes Berg * @n_channels: Number of channels in @channels 225d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 226d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 227d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 228d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 229abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 230d3236553SJohannes Berg */ 231d3236553SJohannes Berg struct ieee80211_supported_band { 232d3236553SJohannes Berg struct ieee80211_channel *channels; 233d3236553SJohannes Berg struct ieee80211_rate *bitrates; 234d3236553SJohannes Berg enum ieee80211_band band; 235d3236553SJohannes Berg int n_channels; 236d3236553SJohannes Berg int n_bitrates; 237d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 238d3236553SJohannes Berg }; 239d3236553SJohannes Berg 240d3236553SJohannes Berg /* 241d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 242704232c2SJohannes Berg */ 243704232c2SJohannes Berg 2442ec600d6SLuis Carlos Cobo /** 245d70e9693SJohannes Berg * DOC: Actions and configuration 246d70e9693SJohannes Berg * 247d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 248d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 249d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 250d70e9693SJohannes Berg * operations use are described separately. 251d70e9693SJohannes Berg * 252d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 253d70e9693SJohannes Berg * information via some functions that drivers need to call. 254d70e9693SJohannes Berg * 255d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 256d70e9693SJohannes Berg * in a separate chapter. 257d70e9693SJohannes Berg */ 258d70e9693SJohannes Berg 259d70e9693SJohannes Berg /** 2602ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 2612ec600d6SLuis Carlos Cobo * @mesh_id: mesh ID to use 2622ec600d6SLuis Carlos Cobo * @mesh_id_len: length of the mesh ID 2638b787643SFelix Fietkau * @use_4addr: use 4-address frames 2642ec600d6SLuis Carlos Cobo */ 2652ec600d6SLuis Carlos Cobo struct vif_params { 2662ec600d6SLuis Carlos Cobo u8 *mesh_id; 2672ec600d6SLuis Carlos Cobo int mesh_id_len; 2688b787643SFelix Fietkau int use_4addr; 2692ec600d6SLuis Carlos Cobo }; 2702ec600d6SLuis Carlos Cobo 27141ade00fSJohannes Berg /** 27241ade00fSJohannes Berg * struct key_params - key information 27341ade00fSJohannes Berg * 27441ade00fSJohannes Berg * Information about a key 27541ade00fSJohannes Berg * 27641ade00fSJohannes Berg * @key: key material 27741ade00fSJohannes Berg * @key_len: length of key material 27841ade00fSJohannes Berg * @cipher: cipher suite selector 27941ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 28041ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 28141ade00fSJohannes Berg * length given by @seq_len. 282abe37c4bSJohannes Berg * @seq_len: length of @seq. 28341ade00fSJohannes Berg */ 28441ade00fSJohannes Berg struct key_params { 28541ade00fSJohannes Berg u8 *key; 28641ade00fSJohannes Berg u8 *seq; 28741ade00fSJohannes Berg int key_len; 28841ade00fSJohannes Berg int seq_len; 28941ade00fSJohannes Berg u32 cipher; 29041ade00fSJohannes Berg }; 29141ade00fSJohannes Berg 292ed1b6cc7SJohannes Berg /** 29361fa713cSHolger Schurig * enum survey_info_flags - survey information flags 29461fa713cSHolger Schurig * 295abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 296abe37c4bSJohannes Berg * 29761fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 29861fa713cSHolger Schurig * it has filled in during the get_survey(). 29961fa713cSHolger Schurig */ 30061fa713cSHolger Schurig enum survey_info_flags { 30161fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 30261fa713cSHolger Schurig }; 30361fa713cSHolger Schurig 30461fa713cSHolger Schurig /** 30561fa713cSHolger Schurig * struct survey_info - channel survey response 30661fa713cSHolger Schurig * 30761fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 30861fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 30961fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 31061fa713cSHolger Schurig * optional 31161fa713cSHolger Schurig * 312abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 313abe37c4bSJohannes Berg * 31461fa713cSHolger Schurig * This structure can later be expanded with things like 31561fa713cSHolger Schurig * channel duty cycle etc. 31661fa713cSHolger Schurig */ 31761fa713cSHolger Schurig struct survey_info { 31861fa713cSHolger Schurig struct ieee80211_channel *channel; 31961fa713cSHolger Schurig u32 filled; 32061fa713cSHolger Schurig s8 noise; 32161fa713cSHolger Schurig }; 32261fa713cSHolger Schurig 32361fa713cSHolger Schurig /** 324ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 325ed1b6cc7SJohannes Berg * 326ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 327ed1b6cc7SJohannes Berg * 328ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 329ed1b6cc7SJohannes Berg * or %NULL if not changed 330ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 331ed1b6cc7SJohannes Berg * or %NULL if not changed 332ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 333ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 334ed1b6cc7SJohannes Berg * @head_len: length of @head 335ed1b6cc7SJohannes Berg * @tail_len: length of @tail 336ed1b6cc7SJohannes Berg */ 337ed1b6cc7SJohannes Berg struct beacon_parameters { 338ed1b6cc7SJohannes Berg u8 *head, *tail; 339ed1b6cc7SJohannes Berg int interval, dtim_period; 340ed1b6cc7SJohannes Berg int head_len, tail_len; 341ed1b6cc7SJohannes Berg }; 342ed1b6cc7SJohannes Berg 3435727ef1bSJohannes Berg /** 3442ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 3452ec600d6SLuis Carlos Cobo * 3462ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 3472ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 348abe37c4bSJohannes Berg * @PLINK_ACTION_BLOCK: block traffic from this mesh peer 3492ec600d6SLuis Carlos Cobo */ 3502ec600d6SLuis Carlos Cobo enum plink_actions { 3512ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 3522ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 3532ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 3542ec600d6SLuis Carlos Cobo }; 3552ec600d6SLuis Carlos Cobo 3562ec600d6SLuis Carlos Cobo /** 3575727ef1bSJohannes Berg * struct station_parameters - station parameters 3585727ef1bSJohannes Berg * 3595727ef1bSJohannes Berg * Used to change and create a new station. 3605727ef1bSJohannes Berg * 3615727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 3625727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 3635727ef1bSJohannes Berg * (or NULL for no change) 3645727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 365eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 366eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 367eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 368eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 3695727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 3705727ef1bSJohannes Berg * @aid: AID or zero for no change 371abe37c4bSJohannes Berg * @plink_action: plink action to take 372abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 3735727ef1bSJohannes Berg */ 3745727ef1bSJohannes Berg struct station_parameters { 3755727ef1bSJohannes Berg u8 *supported_rates; 3765727ef1bSJohannes Berg struct net_device *vlan; 377eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 3785727ef1bSJohannes Berg int listen_interval; 3795727ef1bSJohannes Berg u16 aid; 3805727ef1bSJohannes Berg u8 supported_rates_len; 3812ec600d6SLuis Carlos Cobo u8 plink_action; 38236aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 3835727ef1bSJohannes Berg }; 3845727ef1bSJohannes Berg 385fd5b74dcSJohannes Berg /** 3862ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 387fd5b74dcSJohannes Berg * 3882ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 3892ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 390fd5b74dcSJohannes Berg * 3912ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 3922ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 3932ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 3942ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 3952ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 3962ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 397420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 398420e7fabSHenning Rogge * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 399420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 40098c8a60aSJouni Malinen * @STATION_INFO_RX_PACKETS: @rx_packets filled 40198c8a60aSJouni Malinen * @STATION_INFO_TX_PACKETS: @tx_packets filled 402fd5b74dcSJohannes Berg */ 4032ec600d6SLuis Carlos Cobo enum station_info_flags { 4042ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 4052ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 4062ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 4072ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 4082ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 4092ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 410420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 411420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 41298c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 41398c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 414420e7fabSHenning Rogge }; 415420e7fabSHenning Rogge 416420e7fabSHenning Rogge /** 417420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 418420e7fabSHenning Rogge * 419420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 420420e7fabSHenning Rogge * type for 802.11n transmissions. 421420e7fabSHenning Rogge * 422420e7fabSHenning Rogge * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 423420e7fabSHenning Rogge * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 424420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 425420e7fabSHenning Rogge */ 426420e7fabSHenning Rogge enum rate_info_flags { 427420e7fabSHenning Rogge RATE_INFO_FLAGS_MCS = 1<<0, 428420e7fabSHenning Rogge RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 429420e7fabSHenning Rogge RATE_INFO_FLAGS_SHORT_GI = 1<<2, 430420e7fabSHenning Rogge }; 431420e7fabSHenning Rogge 432420e7fabSHenning Rogge /** 433420e7fabSHenning Rogge * struct rate_info - bitrate information 434420e7fabSHenning Rogge * 435420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 436420e7fabSHenning Rogge * 437420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 438420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 439420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 440420e7fabSHenning Rogge */ 441420e7fabSHenning Rogge struct rate_info { 442420e7fabSHenning Rogge u8 flags; 443420e7fabSHenning Rogge u8 mcs; 444420e7fabSHenning Rogge u16 legacy; 445fd5b74dcSJohannes Berg }; 446fd5b74dcSJohannes Berg 447fd5b74dcSJohannes Berg /** 4482ec600d6SLuis Carlos Cobo * struct station_info - station information 449fd5b74dcSJohannes Berg * 4502ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 451fd5b74dcSJohannes Berg * 4522ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 453fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 454fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 455fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 4562ec600d6SLuis Carlos Cobo * @llid: mesh local link id 4572ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 4582ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 459420e7fabSHenning Rogge * @signal: signal strength of last received packet in dBm 460420e7fabSHenning Rogge * @txrate: current unicast bitrate to this station 46198c8a60aSJouni Malinen * @rx_packets: packets received from this station 46298c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 463f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 464f5ea9120SJohannes Berg * This number should increase every time the list of stations 465f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 466f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 467fd5b74dcSJohannes Berg */ 4682ec600d6SLuis Carlos Cobo struct station_info { 469fd5b74dcSJohannes Berg u32 filled; 470fd5b74dcSJohannes Berg u32 inactive_time; 471fd5b74dcSJohannes Berg u32 rx_bytes; 472fd5b74dcSJohannes Berg u32 tx_bytes; 4732ec600d6SLuis Carlos Cobo u16 llid; 4742ec600d6SLuis Carlos Cobo u16 plid; 4752ec600d6SLuis Carlos Cobo u8 plink_state; 476420e7fabSHenning Rogge s8 signal; 477420e7fabSHenning Rogge struct rate_info txrate; 47898c8a60aSJouni Malinen u32 rx_packets; 47998c8a60aSJouni Malinen u32 tx_packets; 480f5ea9120SJohannes Berg 481f5ea9120SJohannes Berg int generation; 482fd5b74dcSJohannes Berg }; 483fd5b74dcSJohannes Berg 48466f7ac50SMichael Wu /** 48566f7ac50SMichael Wu * enum monitor_flags - monitor flags 48666f7ac50SMichael Wu * 48766f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 48866f7ac50SMichael Wu * according to the nl80211 flags. 48966f7ac50SMichael Wu * 49066f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 49166f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 49266f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 49366f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 49466f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 49566f7ac50SMichael Wu */ 49666f7ac50SMichael Wu enum monitor_flags { 49766f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 49866f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 49966f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 50066f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 50166f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 50266f7ac50SMichael Wu }; 50366f7ac50SMichael Wu 5042ec600d6SLuis Carlos Cobo /** 5052ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 5062ec600d6SLuis Carlos Cobo * 5072ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 5082ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 5092ec600d6SLuis Carlos Cobo * 510abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 511abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 512abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 513abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 514abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 515abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 516abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 5172ec600d6SLuis Carlos Cobo */ 5182ec600d6SLuis Carlos Cobo enum mpath_info_flags { 5192ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 520d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 5212ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 5222ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 5232ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 5242ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 5252ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 5262ec600d6SLuis Carlos Cobo }; 5272ec600d6SLuis Carlos Cobo 5282ec600d6SLuis Carlos Cobo /** 5292ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 5302ec600d6SLuis Carlos Cobo * 5312ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 5322ec600d6SLuis Carlos Cobo * 5332ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 5342ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 535d19b3bf6SRui Paulo * @sn: target sequence number 5362ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 5372ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 5382ec600d6SLuis Carlos Cobo * @flags: mesh path flags 5392ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 5402ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 541f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 542f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 543f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 544f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 5452ec600d6SLuis Carlos Cobo */ 5462ec600d6SLuis Carlos Cobo struct mpath_info { 5472ec600d6SLuis Carlos Cobo u32 filled; 5482ec600d6SLuis Carlos Cobo u32 frame_qlen; 549d19b3bf6SRui Paulo u32 sn; 5502ec600d6SLuis Carlos Cobo u32 metric; 5512ec600d6SLuis Carlos Cobo u32 exptime; 5522ec600d6SLuis Carlos Cobo u32 discovery_timeout; 5532ec600d6SLuis Carlos Cobo u8 discovery_retries; 5542ec600d6SLuis Carlos Cobo u8 flags; 555f5ea9120SJohannes Berg 556f5ea9120SJohannes Berg int generation; 5572ec600d6SLuis Carlos Cobo }; 5582ec600d6SLuis Carlos Cobo 5599f1ba906SJouni Malinen /** 5609f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 5619f1ba906SJouni Malinen * 5629f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 5639f1ba906SJouni Malinen * 5649f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 5659f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 5669f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 5679f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 5689f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 5699f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 57090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 57190c97a04SJouni Malinen * (or NULL for no change) 57290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 573fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 5749f1ba906SJouni Malinen */ 5759f1ba906SJouni Malinen struct bss_parameters { 5769f1ba906SJouni Malinen int use_cts_prot; 5779f1ba906SJouni Malinen int use_short_preamble; 5789f1ba906SJouni Malinen int use_short_slot_time; 57990c97a04SJouni Malinen u8 *basic_rates; 58090c97a04SJouni Malinen u8 basic_rates_len; 581fd8aaaf3SFelix Fietkau int ap_isolate; 5829f1ba906SJouni Malinen }; 5832ec600d6SLuis Carlos Cobo 58493da9cc1Scolin@cozybit.com struct mesh_config { 58593da9cc1Scolin@cozybit.com /* Timeouts in ms */ 58693da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 58793da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 58893da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 58993da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 59093da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 59193da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 59293da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 59393da9cc1Scolin@cozybit.com bool auto_open_plinks; 59493da9cc1Scolin@cozybit.com /* HWMP parameters */ 59593da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 59693da9cc1Scolin@cozybit.com u32 path_refresh_time; 59793da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 59893da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 59993da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 60093da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 60163c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 60293da9cc1Scolin@cozybit.com }; 60393da9cc1Scolin@cozybit.com 60431888487SJouni Malinen /** 60531888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 60631888487SJouni Malinen * @queue: TX queue identifier (NL80211_TXQ_Q_*) 60731888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 60831888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 60931888487SJouni Malinen * 1..32767] 61031888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 61131888487SJouni Malinen * 1..32767] 61231888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 61331888487SJouni Malinen */ 61431888487SJouni Malinen struct ieee80211_txq_params { 61531888487SJouni Malinen enum nl80211_txq_q queue; 61631888487SJouni Malinen u16 txop; 61731888487SJouni Malinen u16 cwmin; 61831888487SJouni Malinen u16 cwmax; 61931888487SJouni Malinen u8 aifs; 62031888487SJouni Malinen }; 62131888487SJouni Malinen 622704232c2SJohannes Berg /* from net/wireless.h */ 623704232c2SJohannes Berg struct wiphy; 624704232c2SJohannes Berg 625d70e9693SJohannes Berg /** 626d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 627d70e9693SJohannes Berg * 628d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 629d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 630d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 631d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 632d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 633d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 634d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 635d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 636d70e9693SJohannes Berg * in the wiphy structure. 637d70e9693SJohannes Berg * 638d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 639d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 640d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 641d70e9693SJohannes Berg * 642d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 643d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 644d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 645d70e9693SJohannes Berg * to userspace. 646d70e9693SJohannes Berg */ 64772bdcf34SJouni Malinen 648704232c2SJohannes Berg /** 6492a519311SJohannes Berg * struct cfg80211_ssid - SSID description 6502a519311SJohannes Berg * @ssid: the SSID 6512a519311SJohannes Berg * @ssid_len: length of the ssid 6522a519311SJohannes Berg */ 6532a519311SJohannes Berg struct cfg80211_ssid { 6542a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 6552a519311SJohannes Berg u8 ssid_len; 6562a519311SJohannes Berg }; 6572a519311SJohannes Berg 6582a519311SJohannes Berg /** 6592a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 6602a519311SJohannes Berg * 6612a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 6622a519311SJohannes Berg * @n_ssids: number of SSIDs 6632a519311SJohannes Berg * @channels: channels to scan on. 664ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 66570692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 66670692ad2SJouni Malinen * @ie_len: length of ie in octets 6672a519311SJohannes Berg * @wiphy: the wiphy this was for 668463d0183SJohannes Berg * @dev: the interface 669abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 6702a519311SJohannes Berg */ 6712a519311SJohannes Berg struct cfg80211_scan_request { 6722a519311SJohannes Berg struct cfg80211_ssid *ssids; 6732a519311SJohannes Berg int n_ssids; 6742a519311SJohannes Berg u32 n_channels; 675de95a54bSJohannes Berg const u8 *ie; 67670692ad2SJouni Malinen size_t ie_len; 6772a519311SJohannes Berg 6782a519311SJohannes Berg /* internal */ 6792a519311SJohannes Berg struct wiphy *wiphy; 680463d0183SJohannes Berg struct net_device *dev; 681667503ddSJohannes Berg bool aborted; 6825ba63533SJohannes Berg 6835ba63533SJohannes Berg /* keep last */ 6845ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 6852a519311SJohannes Berg }; 6862a519311SJohannes Berg 6872a519311SJohannes Berg /** 6882a519311SJohannes Berg * enum cfg80211_signal_type - signal type 6892a519311SJohannes Berg * 6902a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 6912a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 6922a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 6932a519311SJohannes Berg */ 6942a519311SJohannes Berg enum cfg80211_signal_type { 6952a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 6962a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 6972a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 6982a519311SJohannes Berg }; 6992a519311SJohannes Berg 7002a519311SJohannes Berg /** 7012a519311SJohannes Berg * struct cfg80211_bss - BSS description 7022a519311SJohannes Berg * 7032a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 7042a519311SJohannes Berg * for use in scan results and similar. 7052a519311SJohannes Berg * 706abe37c4bSJohannes Berg * @channel: channel this BSS is on 7072a519311SJohannes Berg * @bssid: BSSID of the BSS 7082a519311SJohannes Berg * @tsf: timestamp of last received update 7092a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 7102a519311SJohannes Berg * @capability: the capability field in host byte order 7112a519311SJohannes Berg * @information_elements: the information elements (Note that there 71234a6eddbSJouni Malinen * is no guarantee that these are well-formed!); this is a pointer to 71334a6eddbSJouni Malinen * either the beacon_ies or proberesp_ies depending on whether Probe 71434a6eddbSJouni Malinen * Response frame has been received 7152a519311SJohannes Berg * @len_information_elements: total length of the information elements 71634a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 71734a6eddbSJouni Malinen * @len_beacon_ies: total length of the beacon_ies 71834a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 71934a6eddbSJouni Malinen * @len_proberesp_ies: total length of the proberesp_ies 72077965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 72178c1c7e1SJohannes Berg * @free_priv: function pointer to free private data 7222a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 7232a519311SJohannes Berg */ 7242a519311SJohannes Berg struct cfg80211_bss { 7252a519311SJohannes Berg struct ieee80211_channel *channel; 7262a519311SJohannes Berg 7272a519311SJohannes Berg u8 bssid[ETH_ALEN]; 7282a519311SJohannes Berg u64 tsf; 7292a519311SJohannes Berg u16 beacon_interval; 7302a519311SJohannes Berg u16 capability; 7312a519311SJohannes Berg u8 *information_elements; 7322a519311SJohannes Berg size_t len_information_elements; 73334a6eddbSJouni Malinen u8 *beacon_ies; 73434a6eddbSJouni Malinen size_t len_beacon_ies; 73534a6eddbSJouni Malinen u8 *proberesp_ies; 73634a6eddbSJouni Malinen size_t len_proberesp_ies; 7372a519311SJohannes Berg 7382a519311SJohannes Berg s32 signal; 7392a519311SJohannes Berg 74078c1c7e1SJohannes Berg void (*free_priv)(struct cfg80211_bss *bss); 7412a519311SJohannes Berg u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 7422a519311SJohannes Berg }; 7432a519311SJohannes Berg 7442a519311SJohannes Berg /** 745517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 746517357c6SJohannes Berg * @bss: the bss to search 747517357c6SJohannes Berg * @ie: the IE ID 748517357c6SJohannes Berg * Returns %NULL if not found. 749517357c6SJohannes Berg */ 750517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 751517357c6SJohannes Berg 752517357c6SJohannes Berg 753517357c6SJohannes Berg /** 754b23aa676SSamuel Ortiz * struct cfg80211_crypto_settings - Crypto settings 755b23aa676SSamuel Ortiz * @wpa_versions: indicates which, if any, WPA versions are enabled 756b23aa676SSamuel Ortiz * (from enum nl80211_wpa_versions) 757b23aa676SSamuel Ortiz * @cipher_group: group key cipher suite (or 0 if unset) 758b23aa676SSamuel Ortiz * @n_ciphers_pairwise: number of AP supported unicast ciphers 759b23aa676SSamuel Ortiz * @ciphers_pairwise: unicast key cipher suites 760b23aa676SSamuel Ortiz * @n_akm_suites: number of AKM suites 761b23aa676SSamuel Ortiz * @akm_suites: AKM suites 762b23aa676SSamuel Ortiz * @control_port: Whether user space controls IEEE 802.1X port, i.e., 763b23aa676SSamuel Ortiz * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 764b23aa676SSamuel Ortiz * required to assume that the port is unauthorized until authorized by 765b23aa676SSamuel Ortiz * user space. Otherwise, port is marked authorized by default. 766c0692b8fSJohannes Berg * @control_port_ethertype: the control port protocol that should be 767c0692b8fSJohannes Berg * allowed through even on unauthorized ports 768c0692b8fSJohannes Berg * @control_port_no_encrypt: TRUE to prevent encryption of control port 769c0692b8fSJohannes Berg * protocol frames. 770b23aa676SSamuel Ortiz */ 771b23aa676SSamuel Ortiz struct cfg80211_crypto_settings { 772b23aa676SSamuel Ortiz u32 wpa_versions; 773b23aa676SSamuel Ortiz u32 cipher_group; 774b23aa676SSamuel Ortiz int n_ciphers_pairwise; 775b23aa676SSamuel Ortiz u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 776b23aa676SSamuel Ortiz int n_akm_suites; 777b23aa676SSamuel Ortiz u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 778b23aa676SSamuel Ortiz bool control_port; 779c0692b8fSJohannes Berg __be16 control_port_ethertype; 780c0692b8fSJohannes Berg bool control_port_no_encrypt; 781b23aa676SSamuel Ortiz }; 782b23aa676SSamuel Ortiz 783b23aa676SSamuel Ortiz /** 784636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 785636a5d36SJouni Malinen * 786636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 787636a5d36SJouni Malinen * authentication. 788636a5d36SJouni Malinen * 78919957bb3SJohannes Berg * @bss: The BSS to authenticate with. 790636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 791636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 792636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 793fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 794fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 795fffd0934SJohannes Berg * @key: WEP key for shared key authentication 796d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 797d5cdfacbSJouni Malinen * Authentication frame is to be transmitted and authentication state is 798d5cdfacbSJouni Malinen * to be changed without having to wait for a response from the peer STA 799d5cdfacbSJouni Malinen * (AP). 800636a5d36SJouni Malinen */ 801636a5d36SJouni Malinen struct cfg80211_auth_request { 80219957bb3SJohannes Berg struct cfg80211_bss *bss; 803636a5d36SJouni Malinen const u8 *ie; 804636a5d36SJouni Malinen size_t ie_len; 80519957bb3SJohannes Berg enum nl80211_auth_type auth_type; 806fffd0934SJohannes Berg const u8 *key; 807fffd0934SJohannes Berg u8 key_len, key_idx; 808d5cdfacbSJouni Malinen bool local_state_change; 809636a5d36SJouni Malinen }; 810636a5d36SJouni Malinen 811636a5d36SJouni Malinen /** 812636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 813636a5d36SJouni Malinen * 814636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 815636a5d36SJouni Malinen * (re)association. 81619957bb3SJohannes Berg * @bss: The BSS to associate with. 817636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 818636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 819dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 820b23aa676SSamuel Ortiz * @crypto: crypto settings 8213e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 822636a5d36SJouni Malinen */ 823636a5d36SJouni Malinen struct cfg80211_assoc_request { 82419957bb3SJohannes Berg struct cfg80211_bss *bss; 8253e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 826636a5d36SJouni Malinen size_t ie_len; 827b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 82819957bb3SJohannes Berg bool use_mfp; 829636a5d36SJouni Malinen }; 830636a5d36SJouni Malinen 831636a5d36SJouni Malinen /** 832636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 833636a5d36SJouni Malinen * 834636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 835636a5d36SJouni Malinen * deauthentication. 836636a5d36SJouni Malinen * 83719957bb3SJohannes Berg * @bss: the BSS to deauthenticate from 838636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 839636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 84019957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 841d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 842d5cdfacbSJouni Malinen * Deauthentication frame is to be transmitted. 843636a5d36SJouni Malinen */ 844636a5d36SJouni Malinen struct cfg80211_deauth_request { 84519957bb3SJohannes Berg struct cfg80211_bss *bss; 846636a5d36SJouni Malinen const u8 *ie; 847636a5d36SJouni Malinen size_t ie_len; 84819957bb3SJohannes Berg u16 reason_code; 849d5cdfacbSJouni Malinen bool local_state_change; 850636a5d36SJouni Malinen }; 851636a5d36SJouni Malinen 852636a5d36SJouni Malinen /** 853636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 854636a5d36SJouni Malinen * 855636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 856636a5d36SJouni Malinen * disassocation. 857636a5d36SJouni Malinen * 85819957bb3SJohannes Berg * @bss: the BSS to disassociate from 859636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 860636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 86119957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 862d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 863d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 864636a5d36SJouni Malinen */ 865636a5d36SJouni Malinen struct cfg80211_disassoc_request { 86619957bb3SJohannes Berg struct cfg80211_bss *bss; 867636a5d36SJouni Malinen const u8 *ie; 868636a5d36SJouni Malinen size_t ie_len; 86919957bb3SJohannes Berg u16 reason_code; 870d5cdfacbSJouni Malinen bool local_state_change; 871636a5d36SJouni Malinen }; 872636a5d36SJouni Malinen 873636a5d36SJouni Malinen /** 87404a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 87504a773adSJohannes Berg * 87604a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 87704a773adSJohannes Berg * method. 87804a773adSJohannes Berg * 87904a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 88004a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 88104a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 88204a773adSJohannes Berg * search for IBSSs with a different BSSID. 88304a773adSJohannes Berg * @channel: The channel to use if no IBSS can be found to join. 88404a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 88504a773adSJohannes Berg * IBSSs to join on other channels. 88604a773adSJohannes Berg * @ie: information element(s) to include in the beacon 88704a773adSJohannes Berg * @ie_len: length of that 8888e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 889fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 890fffd0934SJohannes Berg * after joining 891fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 89204a773adSJohannes Berg */ 89304a773adSJohannes Berg struct cfg80211_ibss_params { 89404a773adSJohannes Berg u8 *ssid; 89504a773adSJohannes Berg u8 *bssid; 89604a773adSJohannes Berg struct ieee80211_channel *channel; 89704a773adSJohannes Berg u8 *ie; 89804a773adSJohannes Berg u8 ssid_len, ie_len; 8998e30bc55SJohannes Berg u16 beacon_interval; 900fbd2c8dcSTeemu Paasikivi u32 basic_rates; 90104a773adSJohannes Berg bool channel_fixed; 902fffd0934SJohannes Berg bool privacy; 90304a773adSJohannes Berg }; 90404a773adSJohannes Berg 90504a773adSJohannes Berg /** 906b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 907b23aa676SSamuel Ortiz * 908b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 909b23aa676SSamuel Ortiz * authentication and association. 910b23aa676SSamuel Ortiz * 911b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 912b23aa676SSamuel Ortiz * on scan results) 913b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 914b23aa676SSamuel Ortiz * results) 915b23aa676SSamuel Ortiz * @ssid: SSID 916b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 917b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 918abe37c4bSJohannes Berg * @ie: IEs for association request 919abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 920b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 921b23aa676SSamuel Ortiz * @crypto: crypto settings 922fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 923fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 924fffd0934SJohannes Berg * @key: WEP key for shared key authentication 925b23aa676SSamuel Ortiz */ 926b23aa676SSamuel Ortiz struct cfg80211_connect_params { 927b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 928b23aa676SSamuel Ortiz u8 *bssid; 929b23aa676SSamuel Ortiz u8 *ssid; 930b23aa676SSamuel Ortiz size_t ssid_len; 931b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 932b23aa676SSamuel Ortiz u8 *ie; 933b23aa676SSamuel Ortiz size_t ie_len; 934b23aa676SSamuel Ortiz bool privacy; 935b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 936fffd0934SJohannes Berg const u8 *key; 937fffd0934SJohannes Berg u8 key_len, key_idx; 938b23aa676SSamuel Ortiz }; 939b23aa676SSamuel Ortiz 940b23aa676SSamuel Ortiz /** 941b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 942abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 943abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 944abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 945abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 946abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 947b9a5f8caSJouni Malinen */ 948b9a5f8caSJouni Malinen enum wiphy_params_flags { 949b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 950b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 951b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 952b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 95381077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 954b9a5f8caSJouni Malinen }; 955b9a5f8caSJouni Malinen 9569930380fSJohannes Berg /* 9579930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 9589930380fSJohannes Berg */ 9599930380fSJohannes Berg struct cfg80211_bitrate_mask { 9609930380fSJohannes Berg struct { 9619930380fSJohannes Berg u32 legacy; 96237eb0b16SJouni Malinen /* TODO: add support for masking MCS rates; e.g.: */ 96337eb0b16SJouni Malinen /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ 9649930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 9659930380fSJohannes Berg }; 96667fbb16bSSamuel Ortiz /** 96767fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 96867fbb16bSSamuel Ortiz * 96967fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 97067fbb16bSSamuel Ortiz * caching. 97167fbb16bSSamuel Ortiz * 97267fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 97367fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 97467fbb16bSSamuel Ortiz */ 97567fbb16bSSamuel Ortiz struct cfg80211_pmksa { 97667fbb16bSSamuel Ortiz u8 *bssid; 97767fbb16bSSamuel Ortiz u8 *pmkid; 97867fbb16bSSamuel Ortiz }; 9799930380fSJohannes Berg 9807643a2c3SJohannes Berg /** 981704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 982704232c2SJohannes Berg * 983704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 984704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 985704232c2SJohannes Berg * 986704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 987704232c2SJohannes Berg * on success or a negative error code. 988704232c2SJohannes Berg * 98943fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 99043fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 99143fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 99243fb45cbSJohannes Berg * 9930378b3f1SJohannes Berg * @suspend: wiphy device needs to be suspended 9940378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 9950378b3f1SJohannes Berg * 99660719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 997463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 998463d0183SJohannes Berg * the new netdev in the wiphy's network namespace! 999704232c2SJohannes Berg * 1000704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 100155682965SJohannes Berg * 100260719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 100360719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 100455682965SJohannes Berg * 100541ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 100641ade00fSJohannes Berg * when adding a group key. 100741ade00fSJohannes Berg * 100841ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 100941ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 101041ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 1011e3da574aSJohannes Berg * after it returns. This function should return an error if it is 1012e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 101341ade00fSJohannes Berg * 101441ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 1015e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 101641ade00fSJohannes Berg * 101741ade00fSJohannes Berg * @set_default_key: set the default key on an interface 1018ed1b6cc7SJohannes Berg * 10193cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 10203cfcf6acSJouni Malinen * 1021ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 1022ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 1023ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 1024ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 1025ed1b6cc7SJohannes Berg * configured. 1026ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 10275727ef1bSJohannes Berg * 10285727ef1bSJohannes Berg * @add_station: Add a new station. 10295727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 10305727ef1bSJohannes Berg * @change_station: Modify a given station. 1031abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 1032abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 1033abe37c4bSJohannes Berg * 1034abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 1035abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 1036abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 1037abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 1038abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 10392ec600d6SLuis Carlos Cobo * 104093da9cc1Scolin@cozybit.com * @get_mesh_params: Put the current mesh parameters into *params 104193da9cc1Scolin@cozybit.com * 104293da9cc1Scolin@cozybit.com * @set_mesh_params: Set mesh parameters. 104393da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 104493da9cc1Scolin@cozybit.com * set, and which to leave alone. 104593da9cc1Scolin@cozybit.com * 10469f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 104731888487SJouni Malinen * 104831888487SJouni Malinen * @set_txq_params: Set TX queue parameters 104972bdcf34SJouni Malinen * 1050f444de05SJohannes Berg * @set_channel: Set channel for a given wireless interface. Some devices 1051f444de05SJohannes Berg * may support multi-channel operation (by channel hopping) so cfg80211 1052f444de05SJohannes Berg * doesn't verify much. Note, however, that the passed netdev may be 1053f444de05SJohannes Berg * %NULL as well if the user requested changing the channel for the 1054f444de05SJohannes Berg * device itself, or for a monitor interface. 10559aed3cc1SJouni Malinen * 10562a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 10572a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 10582a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 10592a519311SJohannes Berg * the scan/scan_done bracket too. 1060636a5d36SJouni Malinen * 1061636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 1062636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 1063636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 1064636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 106504a773adSJohannes Berg * 1066b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 1067b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 1068b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 1069b23aa676SSamuel Ortiz * with the status from the AP. 1070b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 1071b23aa676SSamuel Ortiz * 107204a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 107304a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 107404a773adSJohannes Berg * to a merge. 107504a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 1076b9a5f8caSJouni Malinen * 1077b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 1078b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 1079b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 1080b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 10817643a2c3SJohannes Berg * 10827643a2c3SJohannes Berg * @set_tx_power: set the transmit power according to the parameters 10837643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 10841f87f7d3SJohannes Berg * return 0 if successful 10851f87f7d3SJohannes Berg * 1086abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 1087abe37c4bSJohannes Berg * 10881f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 10891f87f7d3SJohannes Berg * functions to adjust rfkill hw state 1090aff89a9bSJohannes Berg * 109161fa713cSHolger Schurig * @dump_survey: get site survey information. 109261fa713cSHolger Schurig * 10939588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 10949588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 10959588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 10969588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 10979588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 10989588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 10999588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 11009588bbd5SJouni Malinen * the duration value. 11012e161f78SJohannes Berg * @mgmt_tx: Transmit a management frame 11029588bbd5SJouni Malinen * 1103aff89a9bSJohannes Berg * @testmode_cmd: run a test mode command 110467fbb16bSSamuel Ortiz * 1105abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 1106abe37c4bSJohannes Berg * 110767fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 110867fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 110967fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 111067fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 111167fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 11129043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 11139043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 1114d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 111567fbb16bSSamuel Ortiz * 1116704232c2SJohannes Berg */ 1117704232c2SJohannes Berg struct cfg80211_ops { 11180378b3f1SJohannes Berg int (*suspend)(struct wiphy *wiphy); 11190378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 11200378b3f1SJohannes Berg 1121704232c2SJohannes Berg int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 11222ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 11232ec600d6SLuis Carlos Cobo struct vif_params *params); 1124463d0183SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 1125e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 1126e36d56b6SJohannes Berg struct net_device *dev, 11272ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 11282ec600d6SLuis Carlos Cobo struct vif_params *params); 112941ade00fSJohannes Berg 113041ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 11314e943900SJohannes Berg u8 key_index, const u8 *mac_addr, 113241ade00fSJohannes Berg struct key_params *params); 113341ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 11344e943900SJohannes Berg u8 key_index, const u8 *mac_addr, void *cookie, 113541ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 113641ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 11374e943900SJohannes Berg u8 key_index, const u8 *mac_addr); 113841ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 113941ade00fSJohannes Berg struct net_device *netdev, 114041ade00fSJohannes Berg u8 key_index); 11413cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 11423cfcf6acSJouni Malinen struct net_device *netdev, 11433cfcf6acSJouni Malinen u8 key_index); 1144ed1b6cc7SJohannes Berg 1145ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1146ed1b6cc7SJohannes Berg struct beacon_parameters *info); 1147ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1148ed1b6cc7SJohannes Berg struct beacon_parameters *info); 1149ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 11505727ef1bSJohannes Berg 11515727ef1bSJohannes Berg 11525727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 11535727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 11545727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 11555727ef1bSJohannes Berg u8 *mac); 11565727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 11575727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 1158fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 11592ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 11602ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 11612ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 11622ec600d6SLuis Carlos Cobo 11632ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 11642ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 11652ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 11662ec600d6SLuis Carlos Cobo u8 *dst); 11672ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 11682ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 11692ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 11702ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 11712ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 11722ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 11732ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 11742ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 117593da9cc1Scolin@cozybit.com int (*get_mesh_params)(struct wiphy *wiphy, 117693da9cc1Scolin@cozybit.com struct net_device *dev, 117793da9cc1Scolin@cozybit.com struct mesh_config *conf); 117893da9cc1Scolin@cozybit.com int (*set_mesh_params)(struct wiphy *wiphy, 117993da9cc1Scolin@cozybit.com struct net_device *dev, 118093da9cc1Scolin@cozybit.com const struct mesh_config *nconf, u32 mask); 11819f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 11829f1ba906SJouni Malinen struct bss_parameters *params); 118331888487SJouni Malinen 118431888487SJouni Malinen int (*set_txq_params)(struct wiphy *wiphy, 118531888487SJouni Malinen struct ieee80211_txq_params *params); 118672bdcf34SJouni Malinen 1187f444de05SJohannes Berg int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, 118872bdcf34SJouni Malinen struct ieee80211_channel *chan, 1189094d05dcSSujith enum nl80211_channel_type channel_type); 11909aed3cc1SJouni Malinen 11912a519311SJohannes Berg int (*scan)(struct wiphy *wiphy, struct net_device *dev, 11922a519311SJohannes Berg struct cfg80211_scan_request *request); 1193636a5d36SJouni Malinen 1194636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1195636a5d36SJouni Malinen struct cfg80211_auth_request *req); 1196636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1197636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 1198636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1199667503ddSJohannes Berg struct cfg80211_deauth_request *req, 1200667503ddSJohannes Berg void *cookie); 1201636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1202667503ddSJohannes Berg struct cfg80211_disassoc_request *req, 1203667503ddSJohannes Berg void *cookie); 120404a773adSJohannes Berg 1205b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1206b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 1207b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 1208b23aa676SSamuel Ortiz u16 reason_code); 1209b23aa676SSamuel Ortiz 121004a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 121104a773adSJohannes Berg struct cfg80211_ibss_params *params); 121204a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1213b9a5f8caSJouni Malinen 1214b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 12157643a2c3SJohannes Berg 12167643a2c3SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, 1217fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 12187643a2c3SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 12191f87f7d3SJohannes Berg 1220ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1221ab737a4fSJohannes Berg u8 *addr); 1222ab737a4fSJohannes Berg 12231f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 1224aff89a9bSJohannes Berg 1225aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 1226aff89a9bSJohannes Berg int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 1227aff89a9bSJohannes Berg #endif 1228bc92afd9SJohannes Berg 12299930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 12309930380fSJohannes Berg struct net_device *dev, 12319930380fSJohannes Berg const u8 *peer, 12329930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 12339930380fSJohannes Berg 123461fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 123561fa713cSHolger Schurig int idx, struct survey_info *info); 123661fa713cSHolger Schurig 123767fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 123867fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 123967fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 124067fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 124167fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 124267fbb16bSSamuel Ortiz 12439588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 12449588bbd5SJouni Malinen struct net_device *dev, 12459588bbd5SJouni Malinen struct ieee80211_channel *chan, 12469588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 12479588bbd5SJouni Malinen unsigned int duration, 12489588bbd5SJouni Malinen u64 *cookie); 12499588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 12509588bbd5SJouni Malinen struct net_device *dev, 12519588bbd5SJouni Malinen u64 cookie); 12529588bbd5SJouni Malinen 12532e161f78SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1254026331c4SJouni Malinen struct ieee80211_channel *chan, 1255026331c4SJouni Malinen enum nl80211_channel_type channel_type, 1256252aa631SJohannes Berg bool channel_type_valid, 1257026331c4SJouni Malinen const u8 *buf, size_t len, u64 *cookie); 1258026331c4SJouni Malinen 1259bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1260bc92afd9SJohannes Berg bool enabled, int timeout); 1261d6dc1a38SJuuso Oikarinen 1262d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 1263d6dc1a38SJuuso Oikarinen struct net_device *dev, 1264d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 1265704232c2SJohannes Berg }; 1266704232c2SJohannes Berg 1267d3236553SJohannes Berg /* 1268d3236553SJohannes Berg * wireless hardware and networking interfaces structures 1269d3236553SJohannes Berg * and registration/helper functions 1270d3236553SJohannes Berg */ 1271d3236553SJohannes Berg 1272d3236553SJohannes Berg /** 12735be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 12745be83de5SJohannes Berg * 12755be83de5SJohannes Berg * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device 1276d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 1277d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1278d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 1279d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 12805be83de5SJohannes Berg * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will 12815be83de5SJohannes Berg * ignore regulatory domain settings until it gets its own regulatory 12825be83de5SJohannes Berg * domain via its regulatory_hint(). After its gets its own regulatory 12835be83de5SJohannes Berg * domain it will only allow further regulatory domain settings to 12845be83de5SJohannes Berg * further enhance compliance. For example if channel 13 and 14 are 12855be83de5SJohannes Berg * disabled by this regulatory domain no user regulatory domain can 12865be83de5SJohannes Berg * enable these channels at a later time. This can be used for devices 12875be83de5SJohannes Berg * which do not have calibration information gauranteed for frequencies 12885be83de5SJohannes Berg * or settings outside of its regulatory domain. 12895be83de5SJohannes Berg * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure 12905be83de5SJohannes Berg * that passive scan flags and beaconing flags may not be lifted by 12915be83de5SJohannes Berg * cfg80211 due to regulatory beacon hints. For more information on beacon 129237184244SLuis R. Rodriguez * hints read the documenation for regulatory_hint_found_beacon() 12935be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 12945be83de5SJohannes Berg * wiphy at all 12955be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 12965be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 12975be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 12985be83de5SJohannes Berg * reason to override the default 12999bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 13009bc383deSJohannes Berg * on a VLAN interface) 13019bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 1302c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 1303c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 1304c0692b8fSJohannes Berg * control_port_no_encrypt flag. 13055be83de5SJohannes Berg */ 13065be83de5SJohannes Berg enum wiphy_flags { 13075be83de5SJohannes Berg WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 13085be83de5SJohannes Berg WIPHY_FLAG_STRICT_REGULATORY = BIT(1), 13095be83de5SJohannes Berg WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), 13105be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 13115be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 13129bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 13139bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 1314c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 13155be83de5SJohannes Berg }; 13165be83de5SJohannes Berg 1317ef15aac6SJohannes Berg struct mac_address { 1318ef15aac6SJohannes Berg u8 addr[ETH_ALEN]; 1319ef15aac6SJohannes Berg }; 1320ef15aac6SJohannes Berg 13212e161f78SJohannes Berg struct ieee80211_txrx_stypes { 13222e161f78SJohannes Berg u16 tx, rx; 13232e161f78SJohannes Berg }; 13242e161f78SJohannes Berg 13255be83de5SJohannes Berg /** 13265be83de5SJohannes Berg * struct wiphy - wireless hardware description 1327d3236553SJohannes Berg * @reg_notifier: the driver's regulatory notification callback 1328d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 1329d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 1330d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 1331d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 1332d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 1333d3236553SJohannes Berg * @cipher_suites: supported cipher suites 1334d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 1335b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 1336b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 1337b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1338b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 1339b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1340abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 1341ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 1342ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 1343ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 1344ef15aac6SJohannes Berg * four bits are variable then set it to 00:...:00:0f. The actual 1345ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 1346ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 1347ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 1348ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 1349ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 1350ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 1351ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 1352ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 1353abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 1354abe37c4bSJohannes Berg * automatically on wiphy renames 1355abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 1356abe37c4bSJohannes Berg * @wext: wireless extension handlers 1357abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 1358abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 1359abe37c4bSJohannes Berg * must be set by driver 1360abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 1361abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 1362abe37c4bSJohannes Berg * this variable determines its size 1363abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 1364abe37c4bSJohannes Berg * any given scan 1365abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 1366abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 1367abe37c4bSJohannes Berg * include fixed IEs like supported rates 1368abe37c4bSJohannes Berg * @coverage_class: current coverage class 1369abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 1370abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 1371abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 1372abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 1373abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 1374abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 13752e161f78SJohannes Berg * 13762e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 13772e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 13782e161f78SJohannes Berg * type 1379d3236553SJohannes Berg */ 1380d3236553SJohannes Berg struct wiphy { 1381d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 1382d3236553SJohannes Berg 1383ef15aac6SJohannes Berg /* permanent MAC address(es) */ 1384d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 1385ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 1386ef15aac6SJohannes Berg 1387ef15aac6SJohannes Berg struct mac_address *addresses; 1388d3236553SJohannes Berg 13892e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 13902e161f78SJohannes Berg 13912e161f78SJohannes Berg u16 n_addresses; 13922e161f78SJohannes Berg 1393d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1394d3236553SJohannes Berg u16 interface_modes; 1395d3236553SJohannes Berg 13965be83de5SJohannes Berg u32 flags; 1397463d0183SJohannes Berg 1398d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 1399d3236553SJohannes Berg 1400d3236553SJohannes Berg int bss_priv_size; 1401d3236553SJohannes Berg u8 max_scan_ssids; 1402d3236553SJohannes Berg u16 max_scan_ie_len; 1403d3236553SJohannes Berg 1404d3236553SJohannes Berg int n_cipher_suites; 1405d3236553SJohannes Berg const u32 *cipher_suites; 1406d3236553SJohannes Berg 1407b9a5f8caSJouni Malinen u8 retry_short; 1408b9a5f8caSJouni Malinen u8 retry_long; 1409b9a5f8caSJouni Malinen u32 frag_threshold; 1410b9a5f8caSJouni Malinen u32 rts_threshold; 141181077e82SLukáš Turek u8 coverage_class; 1412b9a5f8caSJouni Malinen 1413dfce95f5SKalle Valo char fw_version[ETHTOOL_BUSINFO_LEN]; 1414dfce95f5SKalle Valo u32 hw_version; 1415dfce95f5SKalle Valo 141667fbb16bSSamuel Ortiz u8 max_num_pmkids; 141767fbb16bSSamuel Ortiz 1418d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 1419d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 1420d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 1421d3236553SJohannes Berg * or not. Assign this to something global to your driver to 1422d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 1423cf5aa2f1SDavid Kilroy const void *privid; 1424d3236553SJohannes Berg 1425d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 1426d3236553SJohannes Berg 1427d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 1428d3236553SJohannes Berg int (*reg_notifier)(struct wiphy *wiphy, 1429d3236553SJohannes Berg struct regulatory_request *request); 1430d3236553SJohannes Berg 1431d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 1432d3236553SJohannes Berg 1433d3236553SJohannes Berg const struct ieee80211_regdomain *regd; 1434d3236553SJohannes Berg 1435d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 1436d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 1437d3236553SJohannes Berg struct device dev; 1438d3236553SJohannes Berg 1439d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 1440d3236553SJohannes Berg struct dentry *debugfsdir; 1441d3236553SJohannes Berg 1442463d0183SJohannes Berg #ifdef CONFIG_NET_NS 1443463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 1444463d0183SJohannes Berg struct net *_net; 1445463d0183SJohannes Berg #endif 1446463d0183SJohannes Berg 14473d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 14483d23e349SJohannes Berg const struct iw_handler_def *wext; 14493d23e349SJohannes Berg #endif 14503d23e349SJohannes Berg 1451d3236553SJohannes Berg char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1452d3236553SJohannes Berg }; 1453d3236553SJohannes Berg 1454463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 1455463d0183SJohannes Berg { 1456c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 1457463d0183SJohannes Berg } 1458463d0183SJohannes Berg 1459463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1460463d0183SJohannes Berg { 1461c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 1462463d0183SJohannes Berg } 1463463d0183SJohannes Berg 1464d3236553SJohannes Berg /** 1465d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 1466d3236553SJohannes Berg * 1467d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 1468d3236553SJohannes Berg */ 1469d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 1470d3236553SJohannes Berg { 1471d3236553SJohannes Berg BUG_ON(!wiphy); 1472d3236553SJohannes Berg return &wiphy->priv; 1473d3236553SJohannes Berg } 1474d3236553SJohannes Berg 1475d3236553SJohannes Berg /** 1476f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 1477f1f74825SDavid Kilroy * 1478f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 1479f1f74825SDavid Kilroy */ 1480f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 1481f1f74825SDavid Kilroy { 1482f1f74825SDavid Kilroy BUG_ON(!priv); 1483f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 1484f1f74825SDavid Kilroy } 1485f1f74825SDavid Kilroy 1486f1f74825SDavid Kilroy /** 1487d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 1488d3236553SJohannes Berg * 1489d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 1490d3236553SJohannes Berg * @dev: The device to parent it to 1491d3236553SJohannes Berg */ 1492d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1493d3236553SJohannes Berg { 1494d3236553SJohannes Berg wiphy->dev.parent = dev; 1495d3236553SJohannes Berg } 1496d3236553SJohannes Berg 1497d3236553SJohannes Berg /** 1498d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 1499d3236553SJohannes Berg * 1500d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 1501d3236553SJohannes Berg */ 1502d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 1503d3236553SJohannes Berg { 1504d3236553SJohannes Berg return wiphy->dev.parent; 1505d3236553SJohannes Berg } 1506d3236553SJohannes Berg 1507d3236553SJohannes Berg /** 1508d3236553SJohannes Berg * wiphy_name - get wiphy name 1509d3236553SJohannes Berg * 1510d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 1511d3236553SJohannes Berg */ 1512e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 1513d3236553SJohannes Berg { 1514d3236553SJohannes Berg return dev_name(&wiphy->dev); 1515d3236553SJohannes Berg } 1516d3236553SJohannes Berg 1517d3236553SJohannes Berg /** 1518d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 1519d3236553SJohannes Berg * 1520d3236553SJohannes Berg * @ops: The configuration operations for this device 1521d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 1522d3236553SJohannes Berg * 1523d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 1524d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 1525d3236553SJohannes Berg * 1526d3236553SJohannes Berg * The returned pointer must be assigned to each netdev's 1527d3236553SJohannes Berg * ieee80211_ptr for proper operation. 1528d3236553SJohannes Berg */ 15293dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 1530d3236553SJohannes Berg 1531d3236553SJohannes Berg /** 1532d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 1533d3236553SJohannes Berg * 1534d3236553SJohannes Berg * @wiphy: The wiphy to register. 1535d3236553SJohannes Berg * 1536d3236553SJohannes Berg * Returns a non-negative wiphy index or a negative error code. 1537d3236553SJohannes Berg */ 1538d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 1539d3236553SJohannes Berg 1540d3236553SJohannes Berg /** 1541d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 1542d3236553SJohannes Berg * 1543d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 1544d3236553SJohannes Berg * 1545d3236553SJohannes Berg * After this call, no more requests can be made with this priv 1546d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 1547d3236553SJohannes Berg * request that is being handled. 1548d3236553SJohannes Berg */ 1549d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 1550d3236553SJohannes Berg 1551d3236553SJohannes Berg /** 1552d3236553SJohannes Berg * wiphy_free - free wiphy 1553d3236553SJohannes Berg * 1554d3236553SJohannes Berg * @wiphy: The wiphy to free 1555d3236553SJohannes Berg */ 1556d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 1557d3236553SJohannes Berg 1558fffd0934SJohannes Berg /* internal structs */ 15596829c878SJohannes Berg struct cfg80211_conn; 156019957bb3SJohannes Berg struct cfg80211_internal_bss; 1561fffd0934SJohannes Berg struct cfg80211_cached_keys; 156219957bb3SJohannes Berg 156319957bb3SJohannes Berg #define MAX_AUTH_BSSES 4 15646829c878SJohannes Berg 1565d3236553SJohannes Berg /** 1566d3236553SJohannes Berg * struct wireless_dev - wireless per-netdev state 1567d3236553SJohannes Berg * 1568d3236553SJohannes Berg * This structure must be allocated by the driver/stack 1569d3236553SJohannes Berg * that uses the ieee80211_ptr field in struct net_device 1570d3236553SJohannes Berg * (this is intentional so it can be allocated along with 1571d3236553SJohannes Berg * the netdev.) 1572d3236553SJohannes Berg * 1573d3236553SJohannes Berg * @wiphy: pointer to hardware description 1574d3236553SJohannes Berg * @iftype: interface type 1575d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 1576d3236553SJohannes Berg * @netdev: (private) Used to reference back to the netdev 1577d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 1578f444de05SJohannes Berg * @channel: (private) Used by the internal configuration code to track 1579f444de05SJohannes Berg * user-set AP, monitor and WDS channels for wireless extensions 1580d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 1581d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 1582d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 1583d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 15849bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 15859bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 15869bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 15879bc383deSJohannes Berg * by cfg80211 on change_interface 15882e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 15892e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 1590abe37c4bSJohannes Berg * @mtx: mutex used to lock data in this struct 1591abe37c4bSJohannes Berg * @cleanup_work: work struct used for cleanup that can't be done directly 1592d3236553SJohannes Berg */ 1593d3236553SJohannes Berg struct wireless_dev { 1594d3236553SJohannes Berg struct wiphy *wiphy; 1595d3236553SJohannes Berg enum nl80211_iftype iftype; 1596d3236553SJohannes Berg 1597667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 1598d3236553SJohannes Berg struct list_head list; 1599d3236553SJohannes Berg struct net_device *netdev; 1600d3236553SJohannes Berg 16012e161f78SJohannes Berg struct list_head mgmt_registrations; 16022e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 1603026331c4SJouni Malinen 1604667503ddSJohannes Berg struct mutex mtx; 1605667503ddSJohannes Berg 1606ad002395SJohannes Berg struct work_struct cleanup_work; 1607ad002395SJohannes Berg 16089bc383deSJohannes Berg bool use_4addr; 16099bc383deSJohannes Berg 1610b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 1611d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 1612d3236553SJohannes Berg u8 ssid_len; 1613b23aa676SSamuel Ortiz enum { 1614b23aa676SSamuel Ortiz CFG80211_SME_IDLE, 16156829c878SJohannes Berg CFG80211_SME_CONNECTING, 1616b23aa676SSamuel Ortiz CFG80211_SME_CONNECTED, 1617b23aa676SSamuel Ortiz } sme_state; 16186829c878SJohannes Berg struct cfg80211_conn *conn; 1619fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 1620d3236553SJohannes Berg 1621667503ddSJohannes Berg struct list_head event_list; 1622667503ddSJohannes Berg spinlock_t event_lock; 1623667503ddSJohannes Berg 162419957bb3SJohannes Berg struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 162519957bb3SJohannes Berg struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 162619957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1627f444de05SJohannes Berg struct ieee80211_channel *channel; 162819957bb3SJohannes Berg 1629ffb9eb3dSKalle Valo bool ps; 1630ffb9eb3dSKalle Valo int ps_timeout; 1631ffb9eb3dSKalle Valo 16323d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 1633d3236553SJohannes Berg /* wext data */ 1634cbe8fa9cSJohannes Berg struct { 1635cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 1636f2129354SJohannes Berg struct cfg80211_connect_params connect; 1637fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 1638f2129354SJohannes Berg u8 *ie; 1639f2129354SJohannes Berg size_t ie_len; 1640f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1641f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 164208645126SJohannes Berg s8 default_key, default_mgmt_key; 1643ffb9eb3dSKalle Valo bool prev_bssid_valid; 1644cbe8fa9cSJohannes Berg } wext; 1645d3236553SJohannes Berg #endif 1646d3236553SJohannes Berg }; 1647d3236553SJohannes Berg 1648d3236553SJohannes Berg /** 1649d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 1650d3236553SJohannes Berg * 1651d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 1652d3236553SJohannes Berg */ 1653d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 1654d3236553SJohannes Berg { 1655d3236553SJohannes Berg BUG_ON(!wdev); 1656d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 1657d3236553SJohannes Berg } 1658d3236553SJohannes Berg 1659d70e9693SJohannes Berg /** 1660d70e9693SJohannes Berg * DOC: Utility functions 1661d70e9693SJohannes Berg * 1662d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 1663d3236553SJohannes Berg */ 1664d3236553SJohannes Berg 1665d3236553SJohannes Berg /** 1666d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 1667abe37c4bSJohannes Berg * @chan: channel number 1668d3236553SJohannes Berg */ 1669d3236553SJohannes Berg extern int ieee80211_channel_to_frequency(int chan); 1670d3236553SJohannes Berg 1671d3236553SJohannes Berg /** 1672d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 1673abe37c4bSJohannes Berg * @freq: center frequency 1674d3236553SJohannes Berg */ 1675d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 1676d3236553SJohannes Berg 1677d3236553SJohannes Berg /* 1678d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 1679d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 1680d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 1681d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 1682d3236553SJohannes Berg * clash. 1683d3236553SJohannes Berg */ 1684d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 1685d3236553SJohannes Berg int freq); 1686d3236553SJohannes Berg /** 1687d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1688abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 1689abe37c4bSJohannes Berg * @freq: the center frequency of the channel 1690d3236553SJohannes Berg */ 1691d3236553SJohannes Berg static inline struct ieee80211_channel * 1692d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 1693d3236553SJohannes Berg { 1694d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 1695d3236553SJohannes Berg } 1696d3236553SJohannes Berg 1697d3236553SJohannes Berg /** 1698d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 1699d3236553SJohannes Berg * 1700d3236553SJohannes Berg * @sband: the band to look for rates in 1701d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 1702d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 1703d3236553SJohannes Berg * 1704d3236553SJohannes Berg * This function returns the basic rate corresponding to a given 1705d3236553SJohannes Berg * bitrate, that is the next lower bitrate contained in the basic 1706d3236553SJohannes Berg * rate map, which is, for this function, given as a bitmap of 1707d3236553SJohannes Berg * indices of rates in the band's bitrate table. 1708d3236553SJohannes Berg */ 1709d3236553SJohannes Berg struct ieee80211_rate * 1710d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 1711d3236553SJohannes Berg u32 basic_rates, int bitrate); 1712d3236553SJohannes Berg 1713d3236553SJohannes Berg /* 1714d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 1715d3236553SJohannes Berg * 1716d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 1717d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 1718d3236553SJohannes Berg */ 1719d3236553SJohannes Berg 172033e5a2f7SJohannes Berg struct radiotap_align_size { 172133e5a2f7SJohannes Berg uint8_t align:4, size:4; 172233e5a2f7SJohannes Berg }; 172333e5a2f7SJohannes Berg 172433e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 172533e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 172633e5a2f7SJohannes Berg int n_bits; 172733e5a2f7SJohannes Berg uint32_t oui; 172833e5a2f7SJohannes Berg uint8_t subns; 172933e5a2f7SJohannes Berg }; 173033e5a2f7SJohannes Berg 173133e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 173233e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 173333e5a2f7SJohannes Berg int n_ns; 173433e5a2f7SJohannes Berg }; 173533e5a2f7SJohannes Berg 1736d3236553SJohannes Berg /** 1737d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 173833e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 173933e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 174033e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 174133e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 174233e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 174333e5a2f7SJohannes Berg * the beginning of the actual data portion 174433e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 174533e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 174633e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 174733e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 174833e5a2f7SJohannes Berg * radiotap namespace or not 174933e5a2f7SJohannes Berg * 175033e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 175133e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 175233e5a2f7SJohannes Berg * @_arg_index: next argument index 175333e5a2f7SJohannes Berg * @_arg: next argument pointer 175433e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 175533e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 175633e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 175733e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 175833e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 175933e5a2f7SJohannes Berg * next bitmap word 176033e5a2f7SJohannes Berg * 176133e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 176233e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 1763d3236553SJohannes Berg */ 1764d3236553SJohannes Berg 1765d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 176633e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 176733e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 176833e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 1769d3236553SJohannes Berg 177033e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 177167272440SJohannes Berg __le32 *_next_bitmap; 177233e5a2f7SJohannes Berg 177333e5a2f7SJohannes Berg unsigned char *this_arg; 177433e5a2f7SJohannes Berg int this_arg_index; 177533e5a2f7SJohannes Berg int this_arg_size; 177633e5a2f7SJohannes Berg 177733e5a2f7SJohannes Berg int is_radiotap_ns; 177833e5a2f7SJohannes Berg 177933e5a2f7SJohannes Berg int _max_length; 178033e5a2f7SJohannes Berg int _arg_index; 178133e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 178233e5a2f7SJohannes Berg int _reset_on_ext; 1783d3236553SJohannes Berg }; 1784d3236553SJohannes Berg 1785d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 1786d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 1787d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 178833e5a2f7SJohannes Berg int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); 1789d3236553SJohannes Berg 1790d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 1791d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 1792d3236553SJohannes Berg 179333e5a2f7SJohannes Berg 1794e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 1795e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 1796e31a16d6SZhu Yi 1797e31a16d6SZhu Yi /** 1798e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 1799e31a16d6SZhu Yi * 1800e31a16d6SZhu Yi * Given an skb with a raw 802.11 header at the data pointer this function 1801e31a16d6SZhu Yi * returns the 802.11 header length in bytes (not including encryption 1802e31a16d6SZhu Yi * headers). If the data in the sk_buff is too short to contain a valid 802.11 1803e31a16d6SZhu Yi * header the function returns 0. 1804e31a16d6SZhu Yi * 1805e31a16d6SZhu Yi * @skb: the frame 1806e31a16d6SZhu Yi */ 1807e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1808e31a16d6SZhu Yi 1809e31a16d6SZhu Yi /** 1810e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 1811e31a16d6SZhu Yi * @fc: frame control field in little-endian format 1812e31a16d6SZhu Yi */ 1813633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 1814e31a16d6SZhu Yi 1815e31a16d6SZhu Yi /** 1816d70e9693SJohannes Berg * DOC: Data path helpers 1817d70e9693SJohannes Berg * 1818d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 1819d70e9693SJohannes Berg * functions that help implement the data path for devices 1820d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 1821d70e9693SJohannes Berg */ 1822d70e9693SJohannes Berg 1823d70e9693SJohannes Berg /** 1824e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 1825e31a16d6SZhu Yi * @skb: the 802.11 data frame 1826e31a16d6SZhu Yi * @addr: the device MAC address 1827e31a16d6SZhu Yi * @iftype: the virtual interface type 1828e31a16d6SZhu Yi */ 1829eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 1830e31a16d6SZhu Yi enum nl80211_iftype iftype); 1831e31a16d6SZhu Yi 1832e31a16d6SZhu Yi /** 1833e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 1834e31a16d6SZhu Yi * @skb: the 802.3 frame 1835e31a16d6SZhu Yi * @addr: the device MAC address 1836e31a16d6SZhu Yi * @iftype: the virtual interface type 1837e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1838e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 1839e31a16d6SZhu Yi */ 1840eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 1841e31a16d6SZhu Yi enum nl80211_iftype iftype, u8 *bssid, bool qos); 1842e31a16d6SZhu Yi 1843e31a16d6SZhu Yi /** 1844eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 1845eaf85ca7SZhu Yi * 1846eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 1847eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 1848eaf85ca7SZhu Yi * @skb is consumed after the function returns. 1849eaf85ca7SZhu Yi * 1850eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 1851eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 1852eaf85ca7SZhu Yi * initialized by by the caller. 1853eaf85ca7SZhu Yi * @addr: The device MAC address. 1854eaf85ca7SZhu Yi * @iftype: The device interface type. 1855eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 1856eaf85ca7SZhu Yi */ 1857eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 1858eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 1859eaf85ca7SZhu Yi const unsigned int extra_headroom); 1860eaf85ca7SZhu Yi 1861eaf85ca7SZhu Yi /** 1862e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1863e31a16d6SZhu Yi * @skb: the data frame 1864e31a16d6SZhu Yi */ 1865e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1866e31a16d6SZhu Yi 1867c21dbf92SJohannes Berg /** 1868c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 1869c21dbf92SJohannes Berg * 1870c21dbf92SJohannes Berg * @eid: element ID 1871c21dbf92SJohannes Berg * @ies: data consisting of IEs 1872c21dbf92SJohannes Berg * @len: length of data 1873c21dbf92SJohannes Berg * 1874c21dbf92SJohannes Berg * This function will return %NULL if the element ID could 1875c21dbf92SJohannes Berg * not be found or if the element is invalid (claims to be 1876c21dbf92SJohannes Berg * longer than the given data), or a pointer to the first byte 1877c21dbf92SJohannes Berg * of the requested element, that is the byte containing the 1878c21dbf92SJohannes Berg * element ID. There are no checks on the element length 1879c21dbf92SJohannes Berg * other than having to fit into the given data. 1880c21dbf92SJohannes Berg */ 1881c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 1882c21dbf92SJohannes Berg 1883d70e9693SJohannes Berg /** 1884d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 1885d70e9693SJohannes Berg * 1886d70e9693SJohannes Berg * TODO 1887d3236553SJohannes Berg */ 1888d3236553SJohannes Berg 1889d3236553SJohannes Berg /** 1890d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 1891d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 1892d3236553SJohannes Berg * conflicts) 1893d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 1894d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 1895d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 1896d3236553SJohannes Berg * alpha2. 1897d3236553SJohannes Berg * 1898d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 1899d3236553SJohannes Berg * what it believes should be the current regulatory domain by 1900d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 1901d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 1902d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 1903d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 1904d3236553SJohannes Berg * 1905d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 1906d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 1907d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 1908d3236553SJohannes Berg * 1909d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 1910d3236553SJohannes Berg * an -ENOMEM. 1911d3236553SJohannes Berg */ 1912d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1913d3236553SJohannes Berg 1914d3236553SJohannes Berg /** 1915d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1916d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 1917d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 1918d3236553SJohannes Berg * 1919d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 1920d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 1921d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 1922d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 1923d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 1924d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 1925d3236553SJohannes Berg */ 1926d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 1927d3236553SJohannes Berg struct wiphy *wiphy, 1928d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 1929d3236553SJohannes Berg 1930d3236553SJohannes Berg /** 1931d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 1932d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 1933d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 1934038659e7SLuis R. Rodriguez * @desired_bw_khz: the desired max bandwidth you want to use per 1935038659e7SLuis R. Rodriguez * channel. Note that this is still 20 MHz if you want to use HT40 1936038659e7SLuis R. Rodriguez * as HT40 makes use of two channels for its 40 MHz width bandwidth. 1937038659e7SLuis R. Rodriguez * If set to 0 we'll assume you want the standard 20 MHz. 1938d3236553SJohannes Berg * @reg_rule: the regulatory rule which we have for this frequency 1939d3236553SJohannes Berg * 1940d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 1941d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 1942d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 1943d3236553SJohannes Berg * and processed already. 1944d3236553SJohannes Berg * 1945d3236553SJohannes Berg * Returns 0 if it was able to find a valid regulatory rule which does 1946d3236553SJohannes Berg * apply to the given center_freq otherwise it returns non-zero. It will 1947d3236553SJohannes Berg * also return -ERANGE if we determine the given center_freq does not even have 1948d3236553SJohannes Berg * a regulatory rule for a frequency range in the center_freq's band. See 1949d3236553SJohannes Berg * freq_in_rule_band() for our current definition of a band -- this is purely 1950d3236553SJohannes Berg * subjective and right now its 802.11 specific. 1951d3236553SJohannes Berg */ 1952038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy, 1953038659e7SLuis R. Rodriguez u32 center_freq, 1954038659e7SLuis R. Rodriguez u32 desired_bw_khz, 1955d3236553SJohannes Berg const struct ieee80211_reg_rule **reg_rule); 1956d3236553SJohannes Berg 1957d3236553SJohannes Berg /* 1958d3236553SJohannes Berg * Temporary wext handlers & helper functions 1959d3236553SJohannes Berg * 1960d3236553SJohannes Berg * In the future cfg80211 will simply assign the entire wext handler 1961d3236553SJohannes Berg * structure to netdevs it manages, but we're not there yet. 1962d3236553SJohannes Berg */ 1963fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev, 1964fee52678SJohannes Berg struct iw_request_info *info, 1965fee52678SJohannes Berg char *name, char *extra); 1966e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 1967e60c7744SJohannes Berg u32 *mode, char *extra); 1968e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 1969e60c7744SJohannes Berg u32 *mode, char *extra); 19702a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev, 19712a519311SJohannes Berg struct iw_request_info *info, 19722a519311SJohannes Berg union iwreq_data *wrqu, char *extra); 19732a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev, 19742a519311SJohannes Berg struct iw_request_info *info, 19752a519311SJohannes Berg struct iw_point *data, char *extra); 1976691597cbSJohannes Berg int cfg80211_wext_siwmlme(struct net_device *dev, 1977691597cbSJohannes Berg struct iw_request_info *info, 1978691597cbSJohannes Berg struct iw_point *data, char *extra); 19794aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev, 19804aa188e1SJohannes Berg struct iw_request_info *info, 19814aa188e1SJohannes Berg struct iw_point *data, char *extra); 1982f2129354SJohannes Berg int cfg80211_wext_siwgenie(struct net_device *dev, 1983f2129354SJohannes Berg struct iw_request_info *info, 1984f2129354SJohannes Berg struct iw_point *data, char *extra); 1985f2129354SJohannes Berg int cfg80211_wext_siwauth(struct net_device *dev, 1986f2129354SJohannes Berg struct iw_request_info *info, 1987f2129354SJohannes Berg struct iw_param *data, char *extra); 1988f2129354SJohannes Berg int cfg80211_wext_giwauth(struct net_device *dev, 1989f2129354SJohannes Berg struct iw_request_info *info, 1990f2129354SJohannes Berg struct iw_param *data, char *extra); 1991f2129354SJohannes Berg 19920e82ffe3SJohannes Berg int cfg80211_wext_siwfreq(struct net_device *dev, 19930e82ffe3SJohannes Berg struct iw_request_info *info, 19940e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 19950e82ffe3SJohannes Berg int cfg80211_wext_giwfreq(struct net_device *dev, 19960e82ffe3SJohannes Berg struct iw_request_info *info, 19970e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 19981f9298f9SJohannes Berg int cfg80211_wext_siwessid(struct net_device *dev, 19991f9298f9SJohannes Berg struct iw_request_info *info, 20001f9298f9SJohannes Berg struct iw_point *data, char *ssid); 20011f9298f9SJohannes Berg int cfg80211_wext_giwessid(struct net_device *dev, 20021f9298f9SJohannes Berg struct iw_request_info *info, 20031f9298f9SJohannes Berg struct iw_point *data, char *ssid); 20049930380fSJohannes Berg int cfg80211_wext_siwrate(struct net_device *dev, 20059930380fSJohannes Berg struct iw_request_info *info, 20069930380fSJohannes Berg struct iw_param *rate, char *extra); 20079930380fSJohannes Berg int cfg80211_wext_giwrate(struct net_device *dev, 20089930380fSJohannes Berg struct iw_request_info *info, 20099930380fSJohannes Berg struct iw_param *rate, char *extra); 20109930380fSJohannes Berg 2011b9a5f8caSJouni Malinen int cfg80211_wext_siwrts(struct net_device *dev, 2012b9a5f8caSJouni Malinen struct iw_request_info *info, 2013b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 2014b9a5f8caSJouni Malinen int cfg80211_wext_giwrts(struct net_device *dev, 2015b9a5f8caSJouni Malinen struct iw_request_info *info, 2016b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 2017b9a5f8caSJouni Malinen int cfg80211_wext_siwfrag(struct net_device *dev, 2018b9a5f8caSJouni Malinen struct iw_request_info *info, 2019b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 2020b9a5f8caSJouni Malinen int cfg80211_wext_giwfrag(struct net_device *dev, 2021b9a5f8caSJouni Malinen struct iw_request_info *info, 2022b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 2023b9a5f8caSJouni Malinen int cfg80211_wext_siwretry(struct net_device *dev, 2024b9a5f8caSJouni Malinen struct iw_request_info *info, 2025b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 2026b9a5f8caSJouni Malinen int cfg80211_wext_giwretry(struct net_device *dev, 2027b9a5f8caSJouni Malinen struct iw_request_info *info, 2028b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 202908645126SJohannes Berg int cfg80211_wext_siwencodeext(struct net_device *dev, 203008645126SJohannes Berg struct iw_request_info *info, 203108645126SJohannes Berg struct iw_point *erq, char *extra); 203208645126SJohannes Berg int cfg80211_wext_siwencode(struct net_device *dev, 203308645126SJohannes Berg struct iw_request_info *info, 203408645126SJohannes Berg struct iw_point *erq, char *keybuf); 203508645126SJohannes Berg int cfg80211_wext_giwencode(struct net_device *dev, 203608645126SJohannes Berg struct iw_request_info *info, 203708645126SJohannes Berg struct iw_point *erq, char *keybuf); 20387643a2c3SJohannes Berg int cfg80211_wext_siwtxpower(struct net_device *dev, 20397643a2c3SJohannes Berg struct iw_request_info *info, 20407643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 20417643a2c3SJohannes Berg int cfg80211_wext_giwtxpower(struct net_device *dev, 20427643a2c3SJohannes Berg struct iw_request_info *info, 20437643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 20448990646dSJohannes Berg struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev); 2045b9a5f8caSJouni Malinen 2046bc92afd9SJohannes Berg int cfg80211_wext_siwpower(struct net_device *dev, 2047bc92afd9SJohannes Berg struct iw_request_info *info, 2048bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 2049bc92afd9SJohannes Berg int cfg80211_wext_giwpower(struct net_device *dev, 2050bc92afd9SJohannes Berg struct iw_request_info *info, 2051bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 2052bc92afd9SJohannes Berg 2053562e4822SJohannes Berg int cfg80211_wext_siwap(struct net_device *dev, 2054ab737a4fSJohannes Berg struct iw_request_info *info, 2055562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 2056562e4822SJohannes Berg int cfg80211_wext_giwap(struct net_device *dev, 2057ab737a4fSJohannes Berg struct iw_request_info *info, 2058562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 2059ab737a4fSJohannes Berg 2060c28991a0SJohn W. Linville int cfg80211_wext_siwpmksa(struct net_device *dev, 2061c28991a0SJohn W. Linville struct iw_request_info *info, 2062c28991a0SJohn W. Linville struct iw_point *data, char *extra); 2063c28991a0SJohn W. Linville 2064d3236553SJohannes Berg /* 2065d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 2066d3236553SJohannes Berg * functions and BSS handling helpers 2067d3236553SJohannes Berg */ 2068d3236553SJohannes Berg 20692a519311SJohannes Berg /** 20702a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 20712a519311SJohannes Berg * 20722a519311SJohannes Berg * @request: the corresponding scan request 20732a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 20742a519311SJohannes Berg * userspace will be notified of that 20752a519311SJohannes Berg */ 20762a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 20772a519311SJohannes Berg 20782a519311SJohannes Berg /** 2079abe37c4bSJohannes Berg * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame 20802a519311SJohannes Berg * 20812a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 2082abe37c4bSJohannes Berg * @channel: The channel the frame was received on 2083abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 2084abe37c4bSJohannes Berg * @len: length of the management frame 208577965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 20862a519311SJohannes Berg * @gfp: context flags 20872a519311SJohannes Berg * 20882a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 20892a519311SJohannes Berg * the BSS should be updated/added. 20902a519311SJohannes Berg */ 20912a519311SJohannes Berg struct cfg80211_bss* 20922a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 20932a519311SJohannes Berg struct ieee80211_channel *channel, 20942a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 209577965c97SJohannes Berg s32 signal, gfp_t gfp); 20962a519311SJohannes Berg 2097abe37c4bSJohannes Berg /** 2098abe37c4bSJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 2099abe37c4bSJohannes Berg * 2100abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 2101abe37c4bSJohannes Berg * @channel: The channel the frame was received on 2102abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 2103abe37c4bSJohannes Berg * @timestamp: the TSF timestamp sent by the peer 2104abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 2105abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 2106abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 2107abe37c4bSJohannes Berg * @ielen: length of the additional IEs 2108abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 2109abe37c4bSJohannes Berg * @gfp: context flags 2110abe37c4bSJohannes Berg * 2111abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 2112abe37c4bSJohannes Berg * the BSS should be updated/added. 2113abe37c4bSJohannes Berg */ 211406aa7afaSJussi Kivilinna struct cfg80211_bss* 211506aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 211606aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 211706aa7afaSJussi Kivilinna const u8 *bssid, 211806aa7afaSJussi Kivilinna u64 timestamp, u16 capability, u16 beacon_interval, 211906aa7afaSJussi Kivilinna const u8 *ie, size_t ielen, 212006aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 212106aa7afaSJussi Kivilinna 21222a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 21232a519311SJohannes Berg struct ieee80211_channel *channel, 21242a519311SJohannes Berg const u8 *bssid, 212579420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 212679420f09SJohannes Berg u16 capa_mask, u16 capa_val); 212779420f09SJohannes Berg static inline struct cfg80211_bss * 212879420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 212979420f09SJohannes Berg struct ieee80211_channel *channel, 213079420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 213179420f09SJohannes Berg { 213279420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 213379420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 213479420f09SJohannes Berg } 213579420f09SJohannes Berg 21362a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 21372a519311SJohannes Berg struct ieee80211_channel *channel, 21382a519311SJohannes Berg const u8 *meshid, size_t meshidlen, 21392a519311SJohannes Berg const u8 *meshcfg); 21402a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss); 2141d3236553SJohannes Berg 2142d491af19SJohannes Berg /** 2143d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 2144d491af19SJohannes Berg * @wiphy: the wiphy 2145d491af19SJohannes Berg * @bss: the bss to remove 2146d491af19SJohannes Berg * 2147d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 2148d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 2149d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 2150d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 2151d491af19SJohannes Berg */ 2152d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 2153fee52678SJohannes Berg 21546039f6d2SJouni Malinen /** 21556039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 21566039f6d2SJouni Malinen * @dev: network device 21576039f6d2SJouni Malinen * @buf: authentication frame (header + body) 21586039f6d2SJouni Malinen * @len: length of the frame data 21596039f6d2SJouni Malinen * 21606039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 21611965c853SJouni Malinen * station mode. The driver is required to call either this function or 21621965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 2163cb0b4bebSJohannes Berg * call. This function may sleep. 21646039f6d2SJouni Malinen */ 2165cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 21666039f6d2SJouni Malinen 21676039f6d2SJouni Malinen /** 21681965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 21691965c853SJouni Malinen * @dev: network device 21701965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 2171cb0b4bebSJohannes Berg * 2172cb0b4bebSJohannes Berg * This function may sleep. 21731965c853SJouni Malinen */ 2174cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 21751965c853SJouni Malinen 21761965c853SJouni Malinen /** 2177a58ce43fSJohannes Berg * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled 2178a58ce43fSJohannes Berg * @dev: network device 2179a58ce43fSJohannes Berg * @addr: The MAC address of the device with which the authentication timed out 2180a58ce43fSJohannes Berg * 2181a58ce43fSJohannes Berg * When a pending authentication had no action yet, the driver may decide 2182a58ce43fSJohannes Berg * to not send a deauth frame, but in that case must calls this function 2183a58ce43fSJohannes Berg * to tell cfg80211 about this decision. It is only valid to call this 2184a58ce43fSJohannes Berg * function within the deauth() callback. 2185a58ce43fSJohannes Berg */ 2186a58ce43fSJohannes Berg void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); 2187a58ce43fSJohannes Berg 2188a58ce43fSJohannes Berg /** 21896039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 21906039f6d2SJouni Malinen * @dev: network device 21916039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 21926039f6d2SJouni Malinen * @len: length of the frame data 21936039f6d2SJouni Malinen * 21946039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 21951965c853SJouni Malinen * processed in station mode. The driver is required to call either this 21961965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 2197cb0b4bebSJohannes Berg * cfg80211_ops::assoc() call. This function may sleep. 21986039f6d2SJouni Malinen */ 2199cb0b4bebSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 22006039f6d2SJouni Malinen 22016039f6d2SJouni Malinen /** 22021965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 22031965c853SJouni Malinen * @dev: network device 22041965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 2205cb0b4bebSJohannes Berg * 2206cb0b4bebSJohannes Berg * This function may sleep. 22071965c853SJouni Malinen */ 2208cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 22091965c853SJouni Malinen 22101965c853SJouni Malinen /** 221153b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 22126039f6d2SJouni Malinen * @dev: network device 22136039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 22146039f6d2SJouni Malinen * @len: length of the frame data 22156039f6d2SJouni Malinen * 22166039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 221753b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 2218cb0b4bebSJohannes Berg * locally generated ones. This function may sleep. 22196039f6d2SJouni Malinen */ 2220ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 2221ce470613SHolger Schurig 2222ce470613SHolger Schurig /** 2223ce470613SHolger Schurig * __cfg80211_send_deauth - notification of processed deauthentication 2224ce470613SHolger Schurig * @dev: network device 2225ce470613SHolger Schurig * @buf: deauthentication frame (header + body) 2226ce470613SHolger Schurig * @len: length of the frame data 2227ce470613SHolger Schurig * 2228ce470613SHolger Schurig * Like cfg80211_send_deauth(), but doesn't take the wdev lock. 2229ce470613SHolger Schurig */ 2230ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 22316039f6d2SJouni Malinen 22326039f6d2SJouni Malinen /** 223353b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 22346039f6d2SJouni Malinen * @dev: network device 22356039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 22366039f6d2SJouni Malinen * @len: length of the frame data 22376039f6d2SJouni Malinen * 22386039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 223953b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 2240cb0b4bebSJohannes Berg * generated ones. This function may sleep. 22416039f6d2SJouni Malinen */ 2242ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); 2243ce470613SHolger Schurig 2244ce470613SHolger Schurig /** 2245ce470613SHolger Schurig * __cfg80211_send_disassoc - notification of processed disassociation 2246ce470613SHolger Schurig * @dev: network device 2247ce470613SHolger Schurig * @buf: disassociation response frame (header + body) 2248ce470613SHolger Schurig * @len: length of the frame data 2249ce470613SHolger Schurig * 2250ce470613SHolger Schurig * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. 2251ce470613SHolger Schurig */ 2252ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 2253ce470613SHolger Schurig size_t len); 22546039f6d2SJouni Malinen 2255a08c1c1aSKalle Valo /** 2256a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 2257a3b8b056SJouni Malinen * @dev: network device 2258a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 2259a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 2260a3b8b056SJouni Malinen * @key_id: Key identifier (0..3) 2261a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 2262e6d6e342SJohannes Berg * @gfp: allocation flags 2263a3b8b056SJouni Malinen * 2264a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 2265a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 2266a3b8b056SJouni Malinen * primitive. 2267a3b8b056SJouni Malinen */ 2268a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 2269a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 2270e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 2271a3b8b056SJouni Malinen 227204a773adSJohannes Berg /** 227304a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 227404a773adSJohannes Berg * 227504a773adSJohannes Berg * @dev: network device 227604a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 227704a773adSJohannes Berg * @gfp: allocation flags 227804a773adSJohannes Berg * 227904a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 228004a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 228104a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 228204a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 228304a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 228404a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 228504a773adSJohannes Berg */ 228604a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 228704a773adSJohannes Berg 22881f87f7d3SJohannes Berg /** 2289d70e9693SJohannes Berg * DOC: RFkill integration 2290d70e9693SJohannes Berg * 2291d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 2292d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 2293d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 2294d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 2295d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 2296d70e9693SJohannes Berg * 2297d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 2298d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 2299d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 2300d70e9693SJohannes Berg */ 2301d70e9693SJohannes Berg 2302d70e9693SJohannes Berg /** 23031f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 23041f87f7d3SJohannes Berg * @wiphy: the wiphy 23051f87f7d3SJohannes Berg * @blocked: block status 23061f87f7d3SJohannes Berg */ 23071f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 23081f87f7d3SJohannes Berg 23091f87f7d3SJohannes Berg /** 23101f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 23111f87f7d3SJohannes Berg * @wiphy: the wiphy 23121f87f7d3SJohannes Berg */ 23131f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 23141f87f7d3SJohannes Berg 23151f87f7d3SJohannes Berg /** 23161f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 23171f87f7d3SJohannes Berg * @wiphy: the wiphy 23181f87f7d3SJohannes Berg */ 23191f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 23201f87f7d3SJohannes Berg 2321aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2322aff89a9bSJohannes Berg /** 2323d70e9693SJohannes Berg * DOC: Test mode 2324d70e9693SJohannes Berg * 2325d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 2326d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 2327d70e9693SJohannes Berg * factory programming. 2328d70e9693SJohannes Berg * 2329d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 2330d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 2331d70e9693SJohannes Berg */ 2332d70e9693SJohannes Berg 2333d70e9693SJohannes Berg /** 2334aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 2335aff89a9bSJohannes Berg * @wiphy: the wiphy 2336aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 2337aff89a9bSJohannes Berg * be put into the skb 2338aff89a9bSJohannes Berg * 2339aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 2340aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 2341aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 2342aff89a9bSJohannes Berg * 2343aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is pre-filled 2344aff89a9bSJohannes Berg * with the wiphy index and set up in a way that any data that is 2345aff89a9bSJohannes Berg * put into the skb (with skb_put(), nla_put() or similar) will end 2346aff89a9bSJohannes Berg * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 2347aff89a9bSJohannes Berg * needs to be done with the skb is adding data for the corresponding 2348aff89a9bSJohannes Berg * userspace tool which can then read that data out of the testdata 2349aff89a9bSJohannes Berg * attribute. You must not modify the skb in any other way. 2350aff89a9bSJohannes Berg * 2351aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 2352aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 2353aff89a9bSJohannes Berg */ 2354aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 2355aff89a9bSJohannes Berg int approxlen); 2356aff89a9bSJohannes Berg 2357aff89a9bSJohannes Berg /** 2358aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 2359aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 2360aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 2361aff89a9bSJohannes Berg * 2362aff89a9bSJohannes Berg * Returns an error code or 0 on success, since calling this 2363aff89a9bSJohannes Berg * function will usually be the last thing before returning 2364aff89a9bSJohannes Berg * from the @testmode_cmd you should return the error code. 2365aff89a9bSJohannes Berg * Note that this function consumes the skb regardless of the 2366aff89a9bSJohannes Berg * return value. 2367aff89a9bSJohannes Berg */ 2368aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb); 2369aff89a9bSJohannes Berg 2370aff89a9bSJohannes Berg /** 2371aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 2372aff89a9bSJohannes Berg * @wiphy: the wiphy 2373aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 2374aff89a9bSJohannes Berg * be put into the skb 2375aff89a9bSJohannes Berg * @gfp: allocation flags 2376aff89a9bSJohannes Berg * 2377aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 2378aff89a9bSJohannes Berg * testmode multicast group. 2379aff89a9bSJohannes Berg * 2380aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is set up in the 2381aff89a9bSJohannes Berg * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 2382aff89a9bSJohannes Berg * for an event. As there, you should simply add data to it that will 2383aff89a9bSJohannes Berg * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 2384aff89a9bSJohannes Berg * not modify the skb in any other way. 2385aff89a9bSJohannes Berg * 2386aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 2387aff89a9bSJohannes Berg * skb to send the event. 2388aff89a9bSJohannes Berg */ 2389aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 2390aff89a9bSJohannes Berg int approxlen, gfp_t gfp); 2391aff89a9bSJohannes Berg 2392aff89a9bSJohannes Berg /** 2393aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 2394aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 2395aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 2396aff89a9bSJohannes Berg * @gfp: allocation flags 2397aff89a9bSJohannes Berg * 2398aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 2399aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 2400aff89a9bSJohannes Berg * consumes it. 2401aff89a9bSJohannes Berg */ 2402aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 2403aff89a9bSJohannes Berg 2404aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 2405aff89a9bSJohannes Berg #else 2406aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 2407aff89a9bSJohannes Berg #endif 2408aff89a9bSJohannes Berg 2409b23aa676SSamuel Ortiz /** 2410b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 2411b23aa676SSamuel Ortiz * 2412b23aa676SSamuel Ortiz * @dev: network device 2413b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 2414b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 2415b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 2416b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 2417b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 2418b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 2419b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 2420b23aa676SSamuel Ortiz * the real status code for failures. 2421b23aa676SSamuel Ortiz * @gfp: allocation flags 2422b23aa676SSamuel Ortiz * 2423b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 2424b23aa676SSamuel Ortiz * succeeded. 2425b23aa676SSamuel Ortiz */ 2426b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 2427b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 2428b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 2429b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 2430b23aa676SSamuel Ortiz 2431b23aa676SSamuel Ortiz /** 2432b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 2433b23aa676SSamuel Ortiz * 2434b23aa676SSamuel Ortiz * @dev: network device 2435b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 2436b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 2437b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 2438b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 2439b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 2440b23aa676SSamuel Ortiz * @gfp: allocation flags 2441b23aa676SSamuel Ortiz * 2442b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 2443b23aa676SSamuel Ortiz * from one AP to another while connected. 2444b23aa676SSamuel Ortiz */ 2445b23aa676SSamuel Ortiz void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 2446b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 2447b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 2448b23aa676SSamuel Ortiz 2449b23aa676SSamuel Ortiz /** 2450b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 2451b23aa676SSamuel Ortiz * 2452b23aa676SSamuel Ortiz * @dev: network device 2453b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 2454b23aa676SSamuel Ortiz * @ie_len: length of IEs 2455b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 2456b23aa676SSamuel Ortiz * @gfp: allocation flags 2457b23aa676SSamuel Ortiz * 2458b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 2459b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 2460b23aa676SSamuel Ortiz */ 2461b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 2462b23aa676SSamuel Ortiz u8 *ie, size_t ie_len, gfp_t gfp); 2463b23aa676SSamuel Ortiz 24649588bbd5SJouni Malinen /** 24659588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 24669588bbd5SJouni Malinen * @dev: network device 24679588bbd5SJouni Malinen * @cookie: the request cookie 24689588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 24699588bbd5SJouni Malinen * @channel_type: Channel type 24709588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 24719588bbd5SJouni Malinen * channel 24729588bbd5SJouni Malinen * @gfp: allocation flags 24739588bbd5SJouni Malinen */ 24749588bbd5SJouni Malinen void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 24759588bbd5SJouni Malinen struct ieee80211_channel *chan, 24769588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 24779588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 24789588bbd5SJouni Malinen 24799588bbd5SJouni Malinen /** 24809588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 24819588bbd5SJouni Malinen * @dev: network device 24829588bbd5SJouni Malinen * @cookie: the request cookie 24839588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 24849588bbd5SJouni Malinen * @channel_type: Channel type 24859588bbd5SJouni Malinen * @gfp: allocation flags 24869588bbd5SJouni Malinen */ 24879588bbd5SJouni Malinen void cfg80211_remain_on_channel_expired(struct net_device *dev, 24889588bbd5SJouni Malinen u64 cookie, 24899588bbd5SJouni Malinen struct ieee80211_channel *chan, 24909588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 24919588bbd5SJouni Malinen gfp_t gfp); 2492b23aa676SSamuel Ortiz 249398b62183SJohannes Berg 249498b62183SJohannes Berg /** 249598b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 249698b62183SJohannes Berg * 249798b62183SJohannes Berg * @dev: the netdev 249898b62183SJohannes Berg * @mac_addr: the station's address 249998b62183SJohannes Berg * @sinfo: the station information 250098b62183SJohannes Berg * @gfp: allocation flags 250198b62183SJohannes Berg */ 250298b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 250398b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 250498b62183SJohannes Berg 2505026331c4SJouni Malinen /** 25062e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 2507026331c4SJouni Malinen * @dev: network device 2508026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 25092e161f78SJohannes Berg * @buf: Management frame (header + body) 2510026331c4SJouni Malinen * @len: length of the frame data 2511026331c4SJouni Malinen * @gfp: context flags 25122e161f78SJohannes Berg * 25132e161f78SJohannes Berg * Returns %true if a user space application has registered for this frame. 25142e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 25152e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 25162e161f78SJohannes Berg * driver is responsible for rejecting the frame. 2517026331c4SJouni Malinen * 2518026331c4SJouni Malinen * This function is called whenever an Action frame is received for a station 2519026331c4SJouni Malinen * mode interface, but is not processed in kernel. 2520026331c4SJouni Malinen */ 25212e161f78SJohannes Berg bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 2522026331c4SJouni Malinen size_t len, gfp_t gfp); 2523026331c4SJouni Malinen 2524026331c4SJouni Malinen /** 25252e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 2526026331c4SJouni Malinen * @dev: network device 25272e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 25282e161f78SJohannes Berg * @buf: Management frame (header + body) 2529026331c4SJouni Malinen * @len: length of the frame data 2530026331c4SJouni Malinen * @ack: Whether frame was acknowledged 2531026331c4SJouni Malinen * @gfp: context flags 2532026331c4SJouni Malinen * 25332e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 25342e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 2535026331c4SJouni Malinen * transmission attempt. 2536026331c4SJouni Malinen */ 25372e161f78SJohannes Berg void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, 2538026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 2539026331c4SJouni Malinen 2540d6dc1a38SJuuso Oikarinen 2541d6dc1a38SJuuso Oikarinen /** 2542d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 2543d6dc1a38SJuuso Oikarinen * @dev: network device 2544d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 2545d6dc1a38SJuuso Oikarinen * @gfp: context flags 2546d6dc1a38SJuuso Oikarinen * 2547d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 2548d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 2549d6dc1a38SJuuso Oikarinen */ 2550d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 2551d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 2552d6dc1a38SJuuso Oikarinen gfp_t gfp); 2553d6dc1a38SJuuso Oikarinen 2554e1db74fcSJoe Perches #ifdef __KERNEL__ 2555e1db74fcSJoe Perches 2556e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 2557e1db74fcSJoe Perches 2558e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 2559e1db74fcSJoe Perches 2560e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 2561*9c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 2562e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 2563*9c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 2564e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 2565*9c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 2566e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 2567*9c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 2568e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 2569*9c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 2570e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 2571*9c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 2572e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 2573*9c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 2574e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 2575*9c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 2576073730d7SJoe Perches 2577*9c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 2578e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 2579*9c376639SJoe Perches 2580e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 2581*9c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 2582e1db74fcSJoe Perches 2583e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 2584e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 2585e1db74fcSJoe Perches #else 2586e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 2587e1db74fcSJoe Perches ({ \ 2588e1db74fcSJoe Perches if (0) \ 2589e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 2590e1db74fcSJoe Perches 0; \ 2591e1db74fcSJoe Perches }) 2592e1db74fcSJoe Perches #endif 2593e1db74fcSJoe Perches 2594e1db74fcSJoe Perches /* 2595e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 2596e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 2597e1db74fcSJoe Perches * file/line information and a backtrace. 2598e1db74fcSJoe Perches */ 2599e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 2600e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 2601e1db74fcSJoe Perches 2602e1db74fcSJoe Perches #endif 2603e1db74fcSJoe Perches 2604704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 2605