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 2618b787643SFelix Fietkau * @use_4addr: use 4-address frames 2622ec600d6SLuis Carlos Cobo */ 2632ec600d6SLuis Carlos Cobo struct vif_params { 2648b787643SFelix Fietkau int use_4addr; 2652ec600d6SLuis Carlos Cobo }; 2662ec600d6SLuis Carlos Cobo 26741ade00fSJohannes Berg /** 26841ade00fSJohannes Berg * struct key_params - key information 26941ade00fSJohannes Berg * 27041ade00fSJohannes Berg * Information about a key 27141ade00fSJohannes Berg * 27241ade00fSJohannes Berg * @key: key material 27341ade00fSJohannes Berg * @key_len: length of key material 27441ade00fSJohannes Berg * @cipher: cipher suite selector 27541ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 27641ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 27741ade00fSJohannes Berg * length given by @seq_len. 278abe37c4bSJohannes Berg * @seq_len: length of @seq. 27941ade00fSJohannes Berg */ 28041ade00fSJohannes Berg struct key_params { 28141ade00fSJohannes Berg u8 *key; 28241ade00fSJohannes Berg u8 *seq; 28341ade00fSJohannes Berg int key_len; 28441ade00fSJohannes Berg int seq_len; 28541ade00fSJohannes Berg u32 cipher; 28641ade00fSJohannes Berg }; 28741ade00fSJohannes Berg 288ed1b6cc7SJohannes Berg /** 28961fa713cSHolger Schurig * enum survey_info_flags - survey information flags 29061fa713cSHolger Schurig * 291abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 29217e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 2938610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in 2948610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in 2958610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in 2968610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in 2978610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in 298abe37c4bSJohannes Berg * 29961fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 30061fa713cSHolger Schurig * it has filled in during the get_survey(). 30161fa713cSHolger Schurig */ 30261fa713cSHolger Schurig enum survey_info_flags { 30361fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 30417e5a808SFelix Fietkau SURVEY_INFO_IN_USE = 1<<1, 3058610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME = 1<<2, 3068610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, 3078610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, 3088610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, 3098610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, 31061fa713cSHolger Schurig }; 31161fa713cSHolger Schurig 31261fa713cSHolger Schurig /** 31361fa713cSHolger Schurig * struct survey_info - channel survey response 31461fa713cSHolger Schurig * 31561fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 31661fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 31761fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 31861fa713cSHolger Schurig * optional 3198610c29aSFelix Fietkau * @channel_time: amount of time in ms the radio spent on the channel 3208610c29aSFelix Fietkau * @channel_time_busy: amount of time the primary channel was sensed busy 3218610c29aSFelix Fietkau * @channel_time_ext_busy: amount of time the extension channel was sensed busy 3228610c29aSFelix Fietkau * @channel_time_rx: amount of time the radio spent receiving data 3238610c29aSFelix Fietkau * @channel_time_tx: amount of time the radio spent transmitting data 32461fa713cSHolger Schurig * 325abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 326abe37c4bSJohannes Berg * 32761fa713cSHolger Schurig * This structure can later be expanded with things like 32861fa713cSHolger Schurig * channel duty cycle etc. 32961fa713cSHolger Schurig */ 33061fa713cSHolger Schurig struct survey_info { 33161fa713cSHolger Schurig struct ieee80211_channel *channel; 3328610c29aSFelix Fietkau u64 channel_time; 3338610c29aSFelix Fietkau u64 channel_time_busy; 3348610c29aSFelix Fietkau u64 channel_time_ext_busy; 3358610c29aSFelix Fietkau u64 channel_time_rx; 3368610c29aSFelix Fietkau u64 channel_time_tx; 33761fa713cSHolger Schurig u32 filled; 33861fa713cSHolger Schurig s8 noise; 33961fa713cSHolger Schurig }; 34061fa713cSHolger Schurig 34161fa713cSHolger Schurig /** 342ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 343ed1b6cc7SJohannes Berg * 344ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 345ed1b6cc7SJohannes Berg * 346ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 347ed1b6cc7SJohannes Berg * or %NULL if not changed 348ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 349ed1b6cc7SJohannes Berg * or %NULL if not changed 350ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 351ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 352ed1b6cc7SJohannes Berg * @head_len: length of @head 353ed1b6cc7SJohannes Berg * @tail_len: length of @tail 354ed1b6cc7SJohannes Berg */ 355ed1b6cc7SJohannes Berg struct beacon_parameters { 356ed1b6cc7SJohannes Berg u8 *head, *tail; 357ed1b6cc7SJohannes Berg int interval, dtim_period; 358ed1b6cc7SJohannes Berg int head_len, tail_len; 359ed1b6cc7SJohannes Berg }; 360ed1b6cc7SJohannes Berg 3615727ef1bSJohannes Berg /** 3622ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 3632ec600d6SLuis Carlos Cobo * 3642ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 3652ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 366abe37c4bSJohannes Berg * @PLINK_ACTION_BLOCK: block traffic from this mesh peer 3672ec600d6SLuis Carlos Cobo */ 3682ec600d6SLuis Carlos Cobo enum plink_actions { 3692ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 3702ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 3712ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 3722ec600d6SLuis Carlos Cobo }; 3732ec600d6SLuis Carlos Cobo 3742ec600d6SLuis Carlos Cobo /** 3755727ef1bSJohannes Berg * struct station_parameters - station parameters 3765727ef1bSJohannes Berg * 3775727ef1bSJohannes Berg * Used to change and create a new station. 3785727ef1bSJohannes Berg * 3795727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 3805727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 3815727ef1bSJohannes Berg * (or NULL for no change) 3825727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 383eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 384eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 385eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 386eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 3875727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 3885727ef1bSJohannes Berg * @aid: AID or zero for no change 389abe37c4bSJohannes Berg * @plink_action: plink action to take 390abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 3915727ef1bSJohannes Berg */ 3925727ef1bSJohannes Berg struct station_parameters { 3935727ef1bSJohannes Berg u8 *supported_rates; 3945727ef1bSJohannes Berg struct net_device *vlan; 395eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 3965727ef1bSJohannes Berg int listen_interval; 3975727ef1bSJohannes Berg u16 aid; 3985727ef1bSJohannes Berg u8 supported_rates_len; 3992ec600d6SLuis Carlos Cobo u8 plink_action; 40036aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 4015727ef1bSJohannes Berg }; 4025727ef1bSJohannes Berg 403fd5b74dcSJohannes Berg /** 4042ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 405fd5b74dcSJohannes Berg * 4062ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 4072ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 408fd5b74dcSJohannes Berg * 4092ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 4102ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 4112ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 4122ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 4132ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 4142ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 415420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 416c8dcfd8aSFelix Fietkau * @STATION_INFO_TX_BITRATE: @txrate fields are filled 417420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 41898c8a60aSJouni Malinen * @STATION_INFO_RX_PACKETS: @rx_packets filled 41998c8a60aSJouni Malinen * @STATION_INFO_TX_PACKETS: @tx_packets filled 420b206b4efSBruno Randolf * @STATION_INFO_TX_RETRIES: @tx_retries filled 421b206b4efSBruno Randolf * @STATION_INFO_TX_FAILED: @tx_failed filled 4225a5c731aSBen Greear * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 423541a45a1SBruno Randolf * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 424c8dcfd8aSFelix Fietkau * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 425f4263c98SPaul Stewart * @STATION_INFO_BSS_PARAM: @bss_param filled 426fd5b74dcSJohannes Berg */ 4272ec600d6SLuis Carlos Cobo enum station_info_flags { 4282ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 4292ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 4302ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 4312ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 4322ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 4332ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 434420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 435420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 43698c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 43798c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 438b206b4efSBruno Randolf STATION_INFO_TX_RETRIES = 1<<10, 439b206b4efSBruno Randolf STATION_INFO_TX_FAILED = 1<<11, 4405a5c731aSBen Greear STATION_INFO_RX_DROP_MISC = 1<<12, 441541a45a1SBruno Randolf STATION_INFO_SIGNAL_AVG = 1<<13, 442c8dcfd8aSFelix Fietkau STATION_INFO_RX_BITRATE = 1<<14, 443f4263c98SPaul Stewart STATION_INFO_BSS_PARAM = 1<<15, 444420e7fabSHenning Rogge }; 445420e7fabSHenning Rogge 446420e7fabSHenning Rogge /** 447420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 448420e7fabSHenning Rogge * 449420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 450420e7fabSHenning Rogge * type for 802.11n transmissions. 451420e7fabSHenning Rogge * 452420e7fabSHenning Rogge * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 453420e7fabSHenning Rogge * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 454420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 455420e7fabSHenning Rogge */ 456420e7fabSHenning Rogge enum rate_info_flags { 457420e7fabSHenning Rogge RATE_INFO_FLAGS_MCS = 1<<0, 458420e7fabSHenning Rogge RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 459420e7fabSHenning Rogge RATE_INFO_FLAGS_SHORT_GI = 1<<2, 460420e7fabSHenning Rogge }; 461420e7fabSHenning Rogge 462420e7fabSHenning Rogge /** 463420e7fabSHenning Rogge * struct rate_info - bitrate information 464420e7fabSHenning Rogge * 465420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 466420e7fabSHenning Rogge * 467420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 468420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 469420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 470420e7fabSHenning Rogge */ 471420e7fabSHenning Rogge struct rate_info { 472420e7fabSHenning Rogge u8 flags; 473420e7fabSHenning Rogge u8 mcs; 474420e7fabSHenning Rogge u16 legacy; 475fd5b74dcSJohannes Berg }; 476fd5b74dcSJohannes Berg 477fd5b74dcSJohannes Berg /** 478f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 479f4263c98SPaul Stewart * 480f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 481f4263c98SPaul Stewart * type for 802.11n transmissions. 482f4263c98SPaul Stewart * 483f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 484f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 485f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 486f4263c98SPaul Stewart */ 487f4263c98SPaul Stewart enum bss_param_flags { 488f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 489f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 490f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 491f4263c98SPaul Stewart }; 492f4263c98SPaul Stewart 493f4263c98SPaul Stewart /** 494f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 495f4263c98SPaul Stewart * 496f4263c98SPaul Stewart * Information about the currently associated BSS 497f4263c98SPaul Stewart * 498f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 499f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 500f4263c98SPaul Stewart * @beacon_interval: beacon interval 501f4263c98SPaul Stewart */ 502f4263c98SPaul Stewart struct sta_bss_parameters { 503f4263c98SPaul Stewart u8 flags; 504f4263c98SPaul Stewart u8 dtim_period; 505f4263c98SPaul Stewart u16 beacon_interval; 506f4263c98SPaul Stewart }; 507f4263c98SPaul Stewart 508f4263c98SPaul Stewart /** 5092ec600d6SLuis Carlos Cobo * struct station_info - station information 510fd5b74dcSJohannes Berg * 5112ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 512fd5b74dcSJohannes Berg * 5132ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 514fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 515fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 516fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 5172ec600d6SLuis Carlos Cobo * @llid: mesh local link id 5182ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 5192ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 520420e7fabSHenning Rogge * @signal: signal strength of last received packet in dBm 521541a45a1SBruno Randolf * @signal_avg: signal strength average in dBm 522858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 523858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 52498c8a60aSJouni Malinen * @rx_packets: packets received from this station 52598c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 526b206b4efSBruno Randolf * @tx_retries: cumulative retry counts 527b206b4efSBruno Randolf * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 5285a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 529f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 530f5ea9120SJohannes Berg * This number should increase every time the list of stations 531f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 532f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 533fd5b74dcSJohannes Berg */ 5342ec600d6SLuis Carlos Cobo struct station_info { 535fd5b74dcSJohannes Berg u32 filled; 536fd5b74dcSJohannes Berg u32 inactive_time; 537fd5b74dcSJohannes Berg u32 rx_bytes; 538fd5b74dcSJohannes Berg u32 tx_bytes; 5392ec600d6SLuis Carlos Cobo u16 llid; 5402ec600d6SLuis Carlos Cobo u16 plid; 5412ec600d6SLuis Carlos Cobo u8 plink_state; 542420e7fabSHenning Rogge s8 signal; 543541a45a1SBruno Randolf s8 signal_avg; 544420e7fabSHenning Rogge struct rate_info txrate; 545c8dcfd8aSFelix Fietkau struct rate_info rxrate; 54698c8a60aSJouni Malinen u32 rx_packets; 54798c8a60aSJouni Malinen u32 tx_packets; 548b206b4efSBruno Randolf u32 tx_retries; 549b206b4efSBruno Randolf u32 tx_failed; 5505a5c731aSBen Greear u32 rx_dropped_misc; 551f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 552f5ea9120SJohannes Berg 553f5ea9120SJohannes Berg int generation; 554fd5b74dcSJohannes Berg }; 555fd5b74dcSJohannes Berg 55666f7ac50SMichael Wu /** 55766f7ac50SMichael Wu * enum monitor_flags - monitor flags 55866f7ac50SMichael Wu * 55966f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 56066f7ac50SMichael Wu * according to the nl80211 flags. 56166f7ac50SMichael Wu * 56266f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 56366f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 56466f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 56566f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 56666f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 56766f7ac50SMichael Wu */ 56866f7ac50SMichael Wu enum monitor_flags { 56966f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 57066f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 57166f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 57266f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 57366f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 57466f7ac50SMichael Wu }; 57566f7ac50SMichael Wu 5762ec600d6SLuis Carlos Cobo /** 5772ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 5782ec600d6SLuis Carlos Cobo * 5792ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 5802ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 5812ec600d6SLuis Carlos Cobo * 582abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 583abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 584abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 585abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 586abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 587abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 588abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 5892ec600d6SLuis Carlos Cobo */ 5902ec600d6SLuis Carlos Cobo enum mpath_info_flags { 5912ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 592d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 5932ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 5942ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 5952ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 5962ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 5972ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 5982ec600d6SLuis Carlos Cobo }; 5992ec600d6SLuis Carlos Cobo 6002ec600d6SLuis Carlos Cobo /** 6012ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 6022ec600d6SLuis Carlos Cobo * 6032ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 6042ec600d6SLuis Carlos Cobo * 6052ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 6062ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 607d19b3bf6SRui Paulo * @sn: target sequence number 6082ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 6092ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 6102ec600d6SLuis Carlos Cobo * @flags: mesh path flags 6112ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 6122ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 613f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 614f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 615f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 616f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 6172ec600d6SLuis Carlos Cobo */ 6182ec600d6SLuis Carlos Cobo struct mpath_info { 6192ec600d6SLuis Carlos Cobo u32 filled; 6202ec600d6SLuis Carlos Cobo u32 frame_qlen; 621d19b3bf6SRui Paulo u32 sn; 6222ec600d6SLuis Carlos Cobo u32 metric; 6232ec600d6SLuis Carlos Cobo u32 exptime; 6242ec600d6SLuis Carlos Cobo u32 discovery_timeout; 6252ec600d6SLuis Carlos Cobo u8 discovery_retries; 6262ec600d6SLuis Carlos Cobo u8 flags; 627f5ea9120SJohannes Berg 628f5ea9120SJohannes Berg int generation; 6292ec600d6SLuis Carlos Cobo }; 6302ec600d6SLuis Carlos Cobo 6319f1ba906SJouni Malinen /** 6329f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 6339f1ba906SJouni Malinen * 6349f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 6359f1ba906SJouni Malinen * 6369f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 6379f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 6389f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 6399f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 6409f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 6419f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 64290c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 64390c97a04SJouni Malinen * (or NULL for no change) 64490c97a04SJouni Malinen * @basic_rates_len: number of basic rates 645fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 64650b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 64750b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 6489f1ba906SJouni Malinen */ 6499f1ba906SJouni Malinen struct bss_parameters { 6509f1ba906SJouni Malinen int use_cts_prot; 6519f1ba906SJouni Malinen int use_short_preamble; 6529f1ba906SJouni Malinen int use_short_slot_time; 65390c97a04SJouni Malinen u8 *basic_rates; 65490c97a04SJouni Malinen u8 basic_rates_len; 655fd8aaaf3SFelix Fietkau int ap_isolate; 65650b12f59SHelmut Schaa int ht_opmode; 6579f1ba906SJouni Malinen }; 6582ec600d6SLuis Carlos Cobo 65929cbe68cSJohannes Berg /* 66029cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 66129cbe68cSJohannes Berg * 66229cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 66329cbe68cSJohannes Berg */ 66493da9cc1Scolin@cozybit.com struct mesh_config { 66593da9cc1Scolin@cozybit.com /* Timeouts in ms */ 66693da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 66793da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 66893da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 66993da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 67093da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 67193da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 67293da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 67345904f21SJavier Cardona /* ttl used in path selection information elements */ 67445904f21SJavier Cardona u8 element_ttl; 67593da9cc1Scolin@cozybit.com bool auto_open_plinks; 67693da9cc1Scolin@cozybit.com /* HWMP parameters */ 67793da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 67893da9cc1Scolin@cozybit.com u32 path_refresh_time; 67993da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 68093da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 68193da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 68293da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 68363c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 68493da9cc1Scolin@cozybit.com }; 68593da9cc1Scolin@cozybit.com 68631888487SJouni Malinen /** 68729cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 68829cbe68cSJohannes Berg * @mesh_id: the mesh ID 68929cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 690c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 691c80d545dSJavier Cardona * @path_metric: which metric to use 692581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 693581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 69415d5dda6SJavier Cardona * @is_secure: or not 69529cbe68cSJohannes Berg * 69629cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 69729cbe68cSJohannes Berg */ 69829cbe68cSJohannes Berg struct mesh_setup { 69929cbe68cSJohannes Berg const u8 *mesh_id; 70029cbe68cSJohannes Berg u8 mesh_id_len; 701c80d545dSJavier Cardona u8 path_sel_proto; 702c80d545dSJavier Cardona u8 path_metric; 703581a8b0fSJavier Cardona const u8 *ie; 704581a8b0fSJavier Cardona u8 ie_len; 70515d5dda6SJavier Cardona bool is_secure; 70629cbe68cSJohannes Berg }; 70729cbe68cSJohannes Berg 70829cbe68cSJohannes Berg /** 70931888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 71031888487SJouni Malinen * @queue: TX queue identifier (NL80211_TXQ_Q_*) 71131888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 71231888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 71331888487SJouni Malinen * 1..32767] 71431888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 71531888487SJouni Malinen * 1..32767] 71631888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 71731888487SJouni Malinen */ 71831888487SJouni Malinen struct ieee80211_txq_params { 71931888487SJouni Malinen enum nl80211_txq_q queue; 72031888487SJouni Malinen u16 txop; 72131888487SJouni Malinen u16 cwmin; 72231888487SJouni Malinen u16 cwmax; 72331888487SJouni Malinen u8 aifs; 72431888487SJouni Malinen }; 72531888487SJouni Malinen 726704232c2SJohannes Berg /* from net/wireless.h */ 727704232c2SJohannes Berg struct wiphy; 728704232c2SJohannes Berg 729d70e9693SJohannes Berg /** 730d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 731d70e9693SJohannes Berg * 732d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 733d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 734d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 735d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 736d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 737d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 738d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 739d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 740d70e9693SJohannes Berg * in the wiphy structure. 741d70e9693SJohannes Berg * 742d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 743d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 744d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 745d70e9693SJohannes Berg * 746d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 747d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 748d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 749d70e9693SJohannes Berg * to userspace. 750d70e9693SJohannes Berg */ 75172bdcf34SJouni Malinen 752704232c2SJohannes Berg /** 7532a519311SJohannes Berg * struct cfg80211_ssid - SSID description 7542a519311SJohannes Berg * @ssid: the SSID 7552a519311SJohannes Berg * @ssid_len: length of the ssid 7562a519311SJohannes Berg */ 7572a519311SJohannes Berg struct cfg80211_ssid { 7582a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 7592a519311SJohannes Berg u8 ssid_len; 7602a519311SJohannes Berg }; 7612a519311SJohannes Berg 7622a519311SJohannes Berg /** 7632a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 7642a519311SJohannes Berg * 7652a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 7662a519311SJohannes Berg * @n_ssids: number of SSIDs 7672a519311SJohannes Berg * @channels: channels to scan on. 768ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 76970692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 77070692ad2SJouni Malinen * @ie_len: length of ie in octets 7712a519311SJohannes Berg * @wiphy: the wiphy this was for 772463d0183SJohannes Berg * @dev: the interface 773abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 7742a519311SJohannes Berg */ 7752a519311SJohannes Berg struct cfg80211_scan_request { 7762a519311SJohannes Berg struct cfg80211_ssid *ssids; 7772a519311SJohannes Berg int n_ssids; 7782a519311SJohannes Berg u32 n_channels; 779de95a54bSJohannes Berg const u8 *ie; 78070692ad2SJouni Malinen size_t ie_len; 7812a519311SJohannes Berg 7822a519311SJohannes Berg /* internal */ 7832a519311SJohannes Berg struct wiphy *wiphy; 784463d0183SJohannes Berg struct net_device *dev; 785667503ddSJohannes Berg bool aborted; 7865ba63533SJohannes Berg 7875ba63533SJohannes Berg /* keep last */ 7885ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 7892a519311SJohannes Berg }; 7902a519311SJohannes Berg 7912a519311SJohannes Berg /** 7922a519311SJohannes Berg * enum cfg80211_signal_type - signal type 7932a519311SJohannes Berg * 7942a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 7952a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 7962a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 7972a519311SJohannes Berg */ 7982a519311SJohannes Berg enum cfg80211_signal_type { 7992a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 8002a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 8012a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 8022a519311SJohannes Berg }; 8032a519311SJohannes Berg 8042a519311SJohannes Berg /** 8052a519311SJohannes Berg * struct cfg80211_bss - BSS description 8062a519311SJohannes Berg * 8072a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 8082a519311SJohannes Berg * for use in scan results and similar. 8092a519311SJohannes Berg * 810abe37c4bSJohannes Berg * @channel: channel this BSS is on 8112a519311SJohannes Berg * @bssid: BSSID of the BSS 8122a519311SJohannes Berg * @tsf: timestamp of last received update 8132a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 8142a519311SJohannes Berg * @capability: the capability field in host byte order 8152a519311SJohannes Berg * @information_elements: the information elements (Note that there 81634a6eddbSJouni Malinen * is no guarantee that these are well-formed!); this is a pointer to 81734a6eddbSJouni Malinen * either the beacon_ies or proberesp_ies depending on whether Probe 81834a6eddbSJouni Malinen * Response frame has been received 8192a519311SJohannes Berg * @len_information_elements: total length of the information elements 82034a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 82134a6eddbSJouni Malinen * @len_beacon_ies: total length of the beacon_ies 82234a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 82334a6eddbSJouni Malinen * @len_proberesp_ies: total length of the proberesp_ies 82477965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 82578c1c7e1SJohannes Berg * @free_priv: function pointer to free private data 8262a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 8272a519311SJohannes Berg */ 8282a519311SJohannes Berg struct cfg80211_bss { 8292a519311SJohannes Berg struct ieee80211_channel *channel; 8302a519311SJohannes Berg 8312a519311SJohannes Berg u8 bssid[ETH_ALEN]; 8322a519311SJohannes Berg u64 tsf; 8332a519311SJohannes Berg u16 beacon_interval; 8342a519311SJohannes Berg u16 capability; 8352a519311SJohannes Berg u8 *information_elements; 8362a519311SJohannes Berg size_t len_information_elements; 83734a6eddbSJouni Malinen u8 *beacon_ies; 83834a6eddbSJouni Malinen size_t len_beacon_ies; 83934a6eddbSJouni Malinen u8 *proberesp_ies; 84034a6eddbSJouni Malinen size_t len_proberesp_ies; 8412a519311SJohannes Berg 8422a519311SJohannes Berg s32 signal; 8432a519311SJohannes Berg 84478c1c7e1SJohannes Berg void (*free_priv)(struct cfg80211_bss *bss); 8452a519311SJohannes Berg u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 8462a519311SJohannes Berg }; 8472a519311SJohannes Berg 8482a519311SJohannes Berg /** 849517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 850517357c6SJohannes Berg * @bss: the bss to search 851517357c6SJohannes Berg * @ie: the IE ID 852517357c6SJohannes Berg * Returns %NULL if not found. 853517357c6SJohannes Berg */ 854517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 855517357c6SJohannes Berg 856517357c6SJohannes Berg 857517357c6SJohannes Berg /** 858b23aa676SSamuel Ortiz * struct cfg80211_crypto_settings - Crypto settings 859b23aa676SSamuel Ortiz * @wpa_versions: indicates which, if any, WPA versions are enabled 860b23aa676SSamuel Ortiz * (from enum nl80211_wpa_versions) 861b23aa676SSamuel Ortiz * @cipher_group: group key cipher suite (or 0 if unset) 862b23aa676SSamuel Ortiz * @n_ciphers_pairwise: number of AP supported unicast ciphers 863b23aa676SSamuel Ortiz * @ciphers_pairwise: unicast key cipher suites 864b23aa676SSamuel Ortiz * @n_akm_suites: number of AKM suites 865b23aa676SSamuel Ortiz * @akm_suites: AKM suites 866b23aa676SSamuel Ortiz * @control_port: Whether user space controls IEEE 802.1X port, i.e., 867b23aa676SSamuel Ortiz * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 868b23aa676SSamuel Ortiz * required to assume that the port is unauthorized until authorized by 869b23aa676SSamuel Ortiz * user space. Otherwise, port is marked authorized by default. 870c0692b8fSJohannes Berg * @control_port_ethertype: the control port protocol that should be 871c0692b8fSJohannes Berg * allowed through even on unauthorized ports 872c0692b8fSJohannes Berg * @control_port_no_encrypt: TRUE to prevent encryption of control port 873c0692b8fSJohannes Berg * protocol frames. 874b23aa676SSamuel Ortiz */ 875b23aa676SSamuel Ortiz struct cfg80211_crypto_settings { 876b23aa676SSamuel Ortiz u32 wpa_versions; 877b23aa676SSamuel Ortiz u32 cipher_group; 878b23aa676SSamuel Ortiz int n_ciphers_pairwise; 879b23aa676SSamuel Ortiz u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 880b23aa676SSamuel Ortiz int n_akm_suites; 881b23aa676SSamuel Ortiz u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 882b23aa676SSamuel Ortiz bool control_port; 883c0692b8fSJohannes Berg __be16 control_port_ethertype; 884c0692b8fSJohannes Berg bool control_port_no_encrypt; 885b23aa676SSamuel Ortiz }; 886b23aa676SSamuel Ortiz 887b23aa676SSamuel Ortiz /** 888636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 889636a5d36SJouni Malinen * 890636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 891636a5d36SJouni Malinen * authentication. 892636a5d36SJouni Malinen * 89319957bb3SJohannes Berg * @bss: The BSS to authenticate with. 894636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 895636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 896636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 897fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 898fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 899fffd0934SJohannes Berg * @key: WEP key for shared key authentication 900d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 901d5cdfacbSJouni Malinen * Authentication frame is to be transmitted and authentication state is 902d5cdfacbSJouni Malinen * to be changed without having to wait for a response from the peer STA 903d5cdfacbSJouni Malinen * (AP). 904636a5d36SJouni Malinen */ 905636a5d36SJouni Malinen struct cfg80211_auth_request { 90619957bb3SJohannes Berg struct cfg80211_bss *bss; 907636a5d36SJouni Malinen const u8 *ie; 908636a5d36SJouni Malinen size_t ie_len; 90919957bb3SJohannes Berg enum nl80211_auth_type auth_type; 910fffd0934SJohannes Berg const u8 *key; 911fffd0934SJohannes Berg u8 key_len, key_idx; 912d5cdfacbSJouni Malinen bool local_state_change; 913636a5d36SJouni Malinen }; 914636a5d36SJouni Malinen 915636a5d36SJouni Malinen /** 916636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 917636a5d36SJouni Malinen * 918636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 919636a5d36SJouni Malinen * (re)association. 92019957bb3SJohannes Berg * @bss: The BSS to associate with. 921636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 922636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 923dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 924b23aa676SSamuel Ortiz * @crypto: crypto settings 9253e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 926636a5d36SJouni Malinen */ 927636a5d36SJouni Malinen struct cfg80211_assoc_request { 92819957bb3SJohannes Berg struct cfg80211_bss *bss; 9293e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 930636a5d36SJouni Malinen size_t ie_len; 931b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 93219957bb3SJohannes Berg bool use_mfp; 933636a5d36SJouni Malinen }; 934636a5d36SJouni Malinen 935636a5d36SJouni Malinen /** 936636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 937636a5d36SJouni Malinen * 938636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 939636a5d36SJouni Malinen * deauthentication. 940636a5d36SJouni Malinen * 94119957bb3SJohannes Berg * @bss: the BSS to deauthenticate from 942636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 943636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 94419957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 945d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 946d5cdfacbSJouni Malinen * Deauthentication frame is to be transmitted. 947636a5d36SJouni Malinen */ 948636a5d36SJouni Malinen struct cfg80211_deauth_request { 94919957bb3SJohannes Berg struct cfg80211_bss *bss; 950636a5d36SJouni Malinen const u8 *ie; 951636a5d36SJouni Malinen size_t ie_len; 95219957bb3SJohannes Berg u16 reason_code; 953d5cdfacbSJouni Malinen bool local_state_change; 954636a5d36SJouni Malinen }; 955636a5d36SJouni Malinen 956636a5d36SJouni Malinen /** 957636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 958636a5d36SJouni Malinen * 959636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 960636a5d36SJouni Malinen * disassocation. 961636a5d36SJouni Malinen * 96219957bb3SJohannes Berg * @bss: the BSS to disassociate from 963636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 964636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 96519957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 966d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 967d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 968636a5d36SJouni Malinen */ 969636a5d36SJouni Malinen struct cfg80211_disassoc_request { 97019957bb3SJohannes Berg struct cfg80211_bss *bss; 971636a5d36SJouni Malinen const u8 *ie; 972636a5d36SJouni Malinen size_t ie_len; 97319957bb3SJohannes Berg u16 reason_code; 974d5cdfacbSJouni Malinen bool local_state_change; 975636a5d36SJouni Malinen }; 976636a5d36SJouni Malinen 977636a5d36SJouni Malinen /** 97804a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 97904a773adSJohannes Berg * 98004a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 98104a773adSJohannes Berg * method. 98204a773adSJohannes Berg * 98304a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 98404a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 98504a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 98604a773adSJohannes Berg * search for IBSSs with a different BSSID. 98704a773adSJohannes Berg * @channel: The channel to use if no IBSS can be found to join. 98804a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 98904a773adSJohannes Berg * IBSSs to join on other channels. 99004a773adSJohannes Berg * @ie: information element(s) to include in the beacon 99104a773adSJohannes Berg * @ie_len: length of that 9928e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 993fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 994fffd0934SJohannes Berg * after joining 995fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 996dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 99704a773adSJohannes Berg */ 99804a773adSJohannes Berg struct cfg80211_ibss_params { 99904a773adSJohannes Berg u8 *ssid; 100004a773adSJohannes Berg u8 *bssid; 100104a773adSJohannes Berg struct ieee80211_channel *channel; 100204a773adSJohannes Berg u8 *ie; 100304a773adSJohannes Berg u8 ssid_len, ie_len; 10048e30bc55SJohannes Berg u16 beacon_interval; 1005fbd2c8dcSTeemu Paasikivi u32 basic_rates; 100604a773adSJohannes Berg bool channel_fixed; 1007fffd0934SJohannes Berg bool privacy; 1008dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 100904a773adSJohannes Berg }; 101004a773adSJohannes Berg 101104a773adSJohannes Berg /** 1012b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1013b23aa676SSamuel Ortiz * 1014b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1015b23aa676SSamuel Ortiz * authentication and association. 1016b23aa676SSamuel Ortiz * 1017b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1018b23aa676SSamuel Ortiz * on scan results) 1019b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1020b23aa676SSamuel Ortiz * results) 1021b23aa676SSamuel Ortiz * @ssid: SSID 1022b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1023b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1024abe37c4bSJohannes Berg * @ie: IEs for association request 1025abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1026b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1027b23aa676SSamuel Ortiz * @crypto: crypto settings 1028fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1029fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1030fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1031b23aa676SSamuel Ortiz */ 1032b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1033b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 1034b23aa676SSamuel Ortiz u8 *bssid; 1035b23aa676SSamuel Ortiz u8 *ssid; 1036b23aa676SSamuel Ortiz size_t ssid_len; 1037b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 1038b23aa676SSamuel Ortiz u8 *ie; 1039b23aa676SSamuel Ortiz size_t ie_len; 1040b23aa676SSamuel Ortiz bool privacy; 1041b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1042fffd0934SJohannes Berg const u8 *key; 1043fffd0934SJohannes Berg u8 key_len, key_idx; 1044b23aa676SSamuel Ortiz }; 1045b23aa676SSamuel Ortiz 1046b23aa676SSamuel Ortiz /** 1047b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1048abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1049abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1050abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1051abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1052abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 1053b9a5f8caSJouni Malinen */ 1054b9a5f8caSJouni Malinen enum wiphy_params_flags { 1055b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1056b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1057b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1058b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 105981077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 1060b9a5f8caSJouni Malinen }; 1061b9a5f8caSJouni Malinen 10629930380fSJohannes Berg /* 10639930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 10649930380fSJohannes Berg */ 10659930380fSJohannes Berg struct cfg80211_bitrate_mask { 10669930380fSJohannes Berg struct { 10679930380fSJohannes Berg u32 legacy; 106837eb0b16SJouni Malinen /* TODO: add support for masking MCS rates; e.g.: */ 106937eb0b16SJouni Malinen /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ 10709930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 10719930380fSJohannes Berg }; 107267fbb16bSSamuel Ortiz /** 107367fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 107467fbb16bSSamuel Ortiz * 107567fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 107667fbb16bSSamuel Ortiz * caching. 107767fbb16bSSamuel Ortiz * 107867fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 107967fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 108067fbb16bSSamuel Ortiz */ 108167fbb16bSSamuel Ortiz struct cfg80211_pmksa { 108267fbb16bSSamuel Ortiz u8 *bssid; 108367fbb16bSSamuel Ortiz u8 *pmkid; 108467fbb16bSSamuel Ortiz }; 10859930380fSJohannes Berg 10867643a2c3SJohannes Berg /** 1087704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 1088704232c2SJohannes Berg * 1089704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 1090704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 1091704232c2SJohannes Berg * 1092704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 1093704232c2SJohannes Berg * on success or a negative error code. 1094704232c2SJohannes Berg * 109543fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 109643fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 109743fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 109843fb45cbSJohannes Berg * 10990378b3f1SJohannes Berg * @suspend: wiphy device needs to be suspended 11000378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 11010378b3f1SJohannes Berg * 110260719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 1103463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 1104f9e10ce4SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the netdev, 1105f9e10ce4SJohannes Berg * or an ERR_PTR. 1106704232c2SJohannes Berg * 1107704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 110855682965SJohannes Berg * 110960719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 111060719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 111155682965SJohannes Berg * 111241ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 111341ade00fSJohannes Berg * when adding a group key. 111441ade00fSJohannes Berg * 111541ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 111641ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 111741ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 1118e3da574aSJohannes Berg * after it returns. This function should return an error if it is 1119e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 112041ade00fSJohannes Berg * 112141ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 1122e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 112341ade00fSJohannes Berg * 112441ade00fSJohannes Berg * @set_default_key: set the default key on an interface 1125ed1b6cc7SJohannes Berg * 11263cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 11273cfcf6acSJouni Malinen * 1128ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 1129ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 1130ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 1131ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 1132ed1b6cc7SJohannes Berg * configured. 1133ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 11345727ef1bSJohannes Berg * 11355727ef1bSJohannes Berg * @add_station: Add a new station. 11365727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 11375727ef1bSJohannes Berg * @change_station: Modify a given station. 1138abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 1139abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 1140abe37c4bSJohannes Berg * 1141abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 1142abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 1143abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 1144abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 1145abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 1146f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 1147f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 11482ec600d6SLuis Carlos Cobo * 114924bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 115093da9cc1Scolin@cozybit.com * 115124bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 115293da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 115393da9cc1Scolin@cozybit.com * set, and which to leave alone. 115493da9cc1Scolin@cozybit.com * 11559f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 115631888487SJouni Malinen * 115731888487SJouni Malinen * @set_txq_params: Set TX queue parameters 115872bdcf34SJouni Malinen * 1159f444de05SJohannes Berg * @set_channel: Set channel for a given wireless interface. Some devices 1160f444de05SJohannes Berg * may support multi-channel operation (by channel hopping) so cfg80211 1161f444de05SJohannes Berg * doesn't verify much. Note, however, that the passed netdev may be 1162f444de05SJohannes Berg * %NULL as well if the user requested changing the channel for the 1163f444de05SJohannes Berg * device itself, or for a monitor interface. 11649aed3cc1SJouni Malinen * 11652a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 11662a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 11672a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 11682a519311SJohannes Berg * the scan/scan_done bracket too. 1169636a5d36SJouni Malinen * 1170636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 1171636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 1172636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 1173636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 117404a773adSJohannes Berg * 1175b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 1176b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 1177b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 1178b23aa676SSamuel Ortiz * with the status from the AP. 1179b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 1180b23aa676SSamuel Ortiz * 118104a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 118204a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 118304a773adSJohannes Berg * to a merge. 118404a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 1185b9a5f8caSJouni Malinen * 1186b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 1187b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 1188b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 1189b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 11907643a2c3SJohannes Berg * 11917643a2c3SJohannes Berg * @set_tx_power: set the transmit power according to the parameters 11927643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 11931f87f7d3SJohannes Berg * return 0 if successful 11941f87f7d3SJohannes Berg * 1195abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 1196abe37c4bSJohannes Berg * 11971f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 11981f87f7d3SJohannes Berg * functions to adjust rfkill hw state 1199aff89a9bSJohannes Berg * 120061fa713cSHolger Schurig * @dump_survey: get site survey information. 120161fa713cSHolger Schurig * 12029588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 12039588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 12049588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 12059588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 12069588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 12079588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 12089588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 12099588bbd5SJouni Malinen * the duration value. 1210f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 1211f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 1212f7ca38dfSJohannes Berg * frame on another channel 12139588bbd5SJouni Malinen * 1214aff89a9bSJohannes Berg * @testmode_cmd: run a test mode command 121567fbb16bSSamuel Ortiz * 1216abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 1217abe37c4bSJohannes Berg * 121867fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 121967fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 122067fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 122167fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 122267fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 12239043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 12249043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 1225d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 122667fbb16bSSamuel Ortiz * 1227271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 1228271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 1229271733cfSJohannes Berg * concurrently with itself. 1230547025d5SBruno Randolf * 1231547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 1232547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 1233547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 1234547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 1235547025d5SBruno Randolf * 1236547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 12373677713bSJohn W. Linville * 12383677713bSJohn W. Linville * @set_ringparam: Set tx and rx ring sizes. 12393677713bSJohn W. Linville * 12403677713bSJohn W. Linville * @get_ringparam: Get tx and rx ring current and maximum sizes. 1241704232c2SJohannes Berg */ 1242704232c2SJohannes Berg struct cfg80211_ops { 12430378b3f1SJohannes Berg int (*suspend)(struct wiphy *wiphy); 12440378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 12450378b3f1SJohannes Berg 1246f9e10ce4SJohannes Berg struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1247f9e10ce4SJohannes Berg char *name, 1248f9e10ce4SJohannes Berg enum nl80211_iftype type, 1249f9e10ce4SJohannes Berg u32 *flags, 12502ec600d6SLuis Carlos Cobo struct vif_params *params); 1251463d0183SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 1252e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 1253e36d56b6SJohannes Berg struct net_device *dev, 12542ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 12552ec600d6SLuis Carlos Cobo struct vif_params *params); 125641ade00fSJohannes Berg 125741ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 1258e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 125941ade00fSJohannes Berg struct key_params *params); 126041ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 1261e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 1262e31b8213SJohannes Berg void *cookie, 126341ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 126441ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 1265e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 126641ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 126741ade00fSJohannes Berg struct net_device *netdev, 1268dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 12693cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 12703cfcf6acSJouni Malinen struct net_device *netdev, 12713cfcf6acSJouni Malinen u8 key_index); 1272ed1b6cc7SJohannes Berg 1273ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1274ed1b6cc7SJohannes Berg struct beacon_parameters *info); 1275ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1276ed1b6cc7SJohannes Berg struct beacon_parameters *info); 1277ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 12785727ef1bSJohannes Berg 12795727ef1bSJohannes Berg 12805727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 12815727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 12825727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 12835727ef1bSJohannes Berg u8 *mac); 12845727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 12855727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 1286fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 12872ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 12882ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 12892ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 12902ec600d6SLuis Carlos Cobo 12912ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 12922ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 12932ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 12942ec600d6SLuis Carlos Cobo u8 *dst); 12952ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 12962ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 12972ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 12982ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 12992ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 13002ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 13012ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 13022ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 130324bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 130493da9cc1Scolin@cozybit.com struct net_device *dev, 130593da9cc1Scolin@cozybit.com struct mesh_config *conf); 130624bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 130729cbe68cSJohannes Berg struct net_device *dev, u32 mask, 130829cbe68cSJohannes Berg const struct mesh_config *nconf); 130929cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 131029cbe68cSJohannes Berg const struct mesh_config *conf, 131129cbe68cSJohannes Berg const struct mesh_setup *setup); 131229cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 131329cbe68cSJohannes Berg 13149f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 13159f1ba906SJouni Malinen struct bss_parameters *params); 131631888487SJouni Malinen 131731888487SJouni Malinen int (*set_txq_params)(struct wiphy *wiphy, 131831888487SJouni Malinen struct ieee80211_txq_params *params); 131972bdcf34SJouni Malinen 1320f444de05SJohannes Berg int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, 132172bdcf34SJouni Malinen struct ieee80211_channel *chan, 1322094d05dcSSujith enum nl80211_channel_type channel_type); 13239aed3cc1SJouni Malinen 13242a519311SJohannes Berg int (*scan)(struct wiphy *wiphy, struct net_device *dev, 13252a519311SJohannes Berg struct cfg80211_scan_request *request); 1326636a5d36SJouni Malinen 1327636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1328636a5d36SJouni Malinen struct cfg80211_auth_request *req); 1329636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1330636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 1331636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1332667503ddSJohannes Berg struct cfg80211_deauth_request *req, 1333667503ddSJohannes Berg void *cookie); 1334636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1335667503ddSJohannes Berg struct cfg80211_disassoc_request *req, 1336667503ddSJohannes Berg void *cookie); 133704a773adSJohannes Berg 1338b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1339b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 1340b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 1341b23aa676SSamuel Ortiz u16 reason_code); 1342b23aa676SSamuel Ortiz 134304a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 134404a773adSJohannes Berg struct cfg80211_ibss_params *params); 134504a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1346b9a5f8caSJouni Malinen 1347b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 13487643a2c3SJohannes Berg 13497643a2c3SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, 1350fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 13517643a2c3SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 13521f87f7d3SJohannes Berg 1353ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1354388ac775SJohannes Berg const u8 *addr); 1355ab737a4fSJohannes Berg 13561f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 1357aff89a9bSJohannes Berg 1358aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 1359aff89a9bSJohannes Berg int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 1360aff89a9bSJohannes Berg #endif 1361bc92afd9SJohannes Berg 13629930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 13639930380fSJohannes Berg struct net_device *dev, 13649930380fSJohannes Berg const u8 *peer, 13659930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 13669930380fSJohannes Berg 136761fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 136861fa713cSHolger Schurig int idx, struct survey_info *info); 136961fa713cSHolger Schurig 137067fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 137167fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 137267fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 137367fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 137467fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 137567fbb16bSSamuel Ortiz 13769588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 13779588bbd5SJouni Malinen struct net_device *dev, 13789588bbd5SJouni Malinen struct ieee80211_channel *chan, 13799588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 13809588bbd5SJouni Malinen unsigned int duration, 13819588bbd5SJouni Malinen u64 *cookie); 13829588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 13839588bbd5SJouni Malinen struct net_device *dev, 13849588bbd5SJouni Malinen u64 cookie); 13859588bbd5SJouni Malinen 13862e161f78SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1387f7ca38dfSJohannes Berg struct ieee80211_channel *chan, bool offchan, 1388026331c4SJouni Malinen enum nl80211_channel_type channel_type, 1389f7ca38dfSJohannes Berg bool channel_type_valid, unsigned int wait, 1390026331c4SJouni Malinen const u8 *buf, size_t len, u64 *cookie); 1391f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1392f7ca38dfSJohannes Berg struct net_device *dev, 1393f7ca38dfSJohannes Berg u64 cookie); 1394026331c4SJouni Malinen 1395bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1396bc92afd9SJohannes Berg bool enabled, int timeout); 1397d6dc1a38SJuuso Oikarinen 1398d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 1399d6dc1a38SJuuso Oikarinen struct net_device *dev, 1400d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 1401271733cfSJohannes Berg 1402271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 1403271733cfSJohannes Berg struct net_device *dev, 1404271733cfSJohannes Berg u16 frame_type, bool reg); 1405afe0cbf8SBruno Randolf 1406afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 1407afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 14083677713bSJohn W. Linville 14093677713bSJohn W. Linville int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); 14103677713bSJohn W. Linville void (*get_ringparam)(struct wiphy *wiphy, 14113677713bSJohn W. Linville u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); 1412704232c2SJohannes Berg }; 1413704232c2SJohannes Berg 1414d3236553SJohannes Berg /* 1415d3236553SJohannes Berg * wireless hardware and networking interfaces structures 1416d3236553SJohannes Berg * and registration/helper functions 1417d3236553SJohannes Berg */ 1418d3236553SJohannes Berg 1419d3236553SJohannes Berg /** 14205be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 14215be83de5SJohannes Berg * 14225be83de5SJohannes Berg * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device 1423d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 1424d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1425d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 1426d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 14275be83de5SJohannes Berg * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will 14285be83de5SJohannes Berg * ignore regulatory domain settings until it gets its own regulatory 1429749b527bSLuis R. Rodriguez * domain via its regulatory_hint() unless the regulatory hint is 1430749b527bSLuis R. Rodriguez * from a country IE. After its gets its own regulatory domain it will 1431749b527bSLuis R. Rodriguez * only allow further regulatory domain settings to further enhance 1432749b527bSLuis R. Rodriguez * compliance. For example if channel 13 and 14 are disabled by this 1433749b527bSLuis R. Rodriguez * regulatory domain no user regulatory domain can enable these channels 1434749b527bSLuis R. Rodriguez * at a later time. This can be used for devices which do not have 1435749b527bSLuis R. Rodriguez * calibration information guaranteed for frequencies or settings 1436749b527bSLuis R. Rodriguez * outside of its regulatory domain. 14375be83de5SJohannes Berg * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure 14385be83de5SJohannes Berg * that passive scan flags and beaconing flags may not be lifted by 14395be83de5SJohannes Berg * cfg80211 due to regulatory beacon hints. For more information on beacon 144037184244SLuis R. Rodriguez * hints read the documenation for regulatory_hint_found_beacon() 14415be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 14425be83de5SJohannes Berg * wiphy at all 14435be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 14445be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 14455be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 14465be83de5SJohannes Berg * reason to override the default 14479bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 14489bc383deSJohannes Berg * on a VLAN interface) 14499bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 1450c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 1451c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 1452c0692b8fSJohannes Berg * control_port_no_encrypt flag. 1453e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 1454dbd2fd65SJohannes Berg * @WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS: The device supports separate 1455dbd2fd65SJohannes Berg * unicast and multicast TX keys. 145615d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 145715d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 14585be83de5SJohannes Berg */ 14595be83de5SJohannes Berg enum wiphy_flags { 14605be83de5SJohannes Berg WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 14615be83de5SJohannes Berg WIPHY_FLAG_STRICT_REGULATORY = BIT(1), 14625be83de5SJohannes Berg WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), 14635be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 14645be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 14659bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 14669bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 1467c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 1468309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 1469dbd2fd65SJohannes Berg WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS= BIT(9), 147015d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 14715be83de5SJohannes Berg }; 14725be83de5SJohannes Berg 1473ef15aac6SJohannes Berg struct mac_address { 1474ef15aac6SJohannes Berg u8 addr[ETH_ALEN]; 1475ef15aac6SJohannes Berg }; 1476ef15aac6SJohannes Berg 14772e161f78SJohannes Berg struct ieee80211_txrx_stypes { 14782e161f78SJohannes Berg u16 tx, rx; 14792e161f78SJohannes Berg }; 14802e161f78SJohannes Berg 14815be83de5SJohannes Berg /** 14825be83de5SJohannes Berg * struct wiphy - wireless hardware description 14832784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 14842784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 14852784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 1486d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 1487d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 1488d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 1489d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 1490d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 1491d3236553SJohannes Berg * @cipher_suites: supported cipher suites 1492d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 1493b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 1494b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 1495b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1496b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 1497b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1498abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 1499ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 1500ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 1501ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 1502ef15aac6SJohannes Berg * four bits are variable then set it to 00:...:00:0f. The actual 1503ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 1504ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 1505ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 1506ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 1507ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 1508ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 1509ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 1510ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 1511abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 1512abe37c4bSJohannes Berg * automatically on wiphy renames 1513abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 1514abe37c4bSJohannes Berg * @wext: wireless extension handlers 1515abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 1516abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 1517abe37c4bSJohannes Berg * must be set by driver 1518abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 1519abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 1520abe37c4bSJohannes Berg * this variable determines its size 1521abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 1522abe37c4bSJohannes Berg * any given scan 1523abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 1524abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 1525abe37c4bSJohannes Berg * include fixed IEs like supported rates 1526abe37c4bSJohannes Berg * @coverage_class: current coverage class 1527abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 1528abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 1529abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 1530abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 1531abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 1532abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 15332e161f78SJohannes Berg * 15342e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 15352e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 15362e161f78SJohannes Berg * type 1537a7ffac95SBruno Randolf * 15387f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 15397f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 15407f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 15417f531e03SBruno Randolf * 15427f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 15437f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 15447f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 1545a293911dSJohannes Berg * 1546a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 1547a293911dSJohannes Berg * may request, if implemented. 1548d3236553SJohannes Berg */ 1549d3236553SJohannes Berg struct wiphy { 1550d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 1551d3236553SJohannes Berg 1552ef15aac6SJohannes Berg /* permanent MAC address(es) */ 1553d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 1554ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 1555ef15aac6SJohannes Berg 1556ef15aac6SJohannes Berg struct mac_address *addresses; 1557d3236553SJohannes Berg 15582e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 15592e161f78SJohannes Berg 15602e161f78SJohannes Berg u16 n_addresses; 15612e161f78SJohannes Berg 1562d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1563d3236553SJohannes Berg u16 interface_modes; 1564d3236553SJohannes Berg 15655be83de5SJohannes Berg u32 flags; 1566463d0183SJohannes Berg 1567d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 1568d3236553SJohannes Berg 1569d3236553SJohannes Berg int bss_priv_size; 1570d3236553SJohannes Berg u8 max_scan_ssids; 1571d3236553SJohannes Berg u16 max_scan_ie_len; 1572d3236553SJohannes Berg 1573d3236553SJohannes Berg int n_cipher_suites; 1574d3236553SJohannes Berg const u32 *cipher_suites; 1575d3236553SJohannes Berg 1576b9a5f8caSJouni Malinen u8 retry_short; 1577b9a5f8caSJouni Malinen u8 retry_long; 1578b9a5f8caSJouni Malinen u32 frag_threshold; 1579b9a5f8caSJouni Malinen u32 rts_threshold; 158081077e82SLukáš Turek u8 coverage_class; 1581b9a5f8caSJouni Malinen 1582dfce95f5SKalle Valo char fw_version[ETHTOOL_BUSINFO_LEN]; 1583dfce95f5SKalle Valo u32 hw_version; 1584dfce95f5SKalle Valo 1585a293911dSJohannes Berg u16 max_remain_on_channel_duration; 1586a293911dSJohannes Berg 158767fbb16bSSamuel Ortiz u8 max_num_pmkids; 158867fbb16bSSamuel Ortiz 15897f531e03SBruno Randolf u32 available_antennas_tx; 15907f531e03SBruno Randolf u32 available_antennas_rx; 1591a7ffac95SBruno Randolf 1592d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 1593d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 1594d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 1595d3236553SJohannes Berg * or not. Assign this to something global to your driver to 1596d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 1597cf5aa2f1SDavid Kilroy const void *privid; 1598d3236553SJohannes Berg 1599d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 1600d3236553SJohannes Berg 1601d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 1602d3236553SJohannes Berg int (*reg_notifier)(struct wiphy *wiphy, 1603d3236553SJohannes Berg struct regulatory_request *request); 1604d3236553SJohannes Berg 1605d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 1606d3236553SJohannes Berg 1607d3236553SJohannes Berg const struct ieee80211_regdomain *regd; 1608d3236553SJohannes Berg 1609d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 1610d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 1611d3236553SJohannes Berg struct device dev; 1612d3236553SJohannes Berg 1613d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 1614d3236553SJohannes Berg struct dentry *debugfsdir; 1615d3236553SJohannes Berg 1616463d0183SJohannes Berg #ifdef CONFIG_NET_NS 1617463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 1618463d0183SJohannes Berg struct net *_net; 1619463d0183SJohannes Berg #endif 1620463d0183SJohannes Berg 16213d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 16223d23e349SJohannes Berg const struct iw_handler_def *wext; 16233d23e349SJohannes Berg #endif 16243d23e349SJohannes Berg 1625d3236553SJohannes Berg char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1626d3236553SJohannes Berg }; 1627d3236553SJohannes Berg 1628463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 1629463d0183SJohannes Berg { 1630c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 1631463d0183SJohannes Berg } 1632463d0183SJohannes Berg 1633463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1634463d0183SJohannes Berg { 1635c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 1636463d0183SJohannes Berg } 1637463d0183SJohannes Berg 1638d3236553SJohannes Berg /** 1639d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 1640d3236553SJohannes Berg * 1641d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 1642d3236553SJohannes Berg */ 1643d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 1644d3236553SJohannes Berg { 1645d3236553SJohannes Berg BUG_ON(!wiphy); 1646d3236553SJohannes Berg return &wiphy->priv; 1647d3236553SJohannes Berg } 1648d3236553SJohannes Berg 1649d3236553SJohannes Berg /** 1650f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 1651f1f74825SDavid Kilroy * 1652f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 1653f1f74825SDavid Kilroy */ 1654f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 1655f1f74825SDavid Kilroy { 1656f1f74825SDavid Kilroy BUG_ON(!priv); 1657f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 1658f1f74825SDavid Kilroy } 1659f1f74825SDavid Kilroy 1660f1f74825SDavid Kilroy /** 1661d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 1662d3236553SJohannes Berg * 1663d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 1664d3236553SJohannes Berg * @dev: The device to parent it to 1665d3236553SJohannes Berg */ 1666d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1667d3236553SJohannes Berg { 1668d3236553SJohannes Berg wiphy->dev.parent = dev; 1669d3236553SJohannes Berg } 1670d3236553SJohannes Berg 1671d3236553SJohannes Berg /** 1672d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 1673d3236553SJohannes Berg * 1674d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 1675d3236553SJohannes Berg */ 1676d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 1677d3236553SJohannes Berg { 1678d3236553SJohannes Berg return wiphy->dev.parent; 1679d3236553SJohannes Berg } 1680d3236553SJohannes Berg 1681d3236553SJohannes Berg /** 1682d3236553SJohannes Berg * wiphy_name - get wiphy name 1683d3236553SJohannes Berg * 1684d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 1685d3236553SJohannes Berg */ 1686e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 1687d3236553SJohannes Berg { 1688d3236553SJohannes Berg return dev_name(&wiphy->dev); 1689d3236553SJohannes Berg } 1690d3236553SJohannes Berg 1691d3236553SJohannes Berg /** 1692d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 1693d3236553SJohannes Berg * 1694d3236553SJohannes Berg * @ops: The configuration operations for this device 1695d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 1696d3236553SJohannes Berg * 1697d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 1698d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 1699d3236553SJohannes Berg * 1700d3236553SJohannes Berg * The returned pointer must be assigned to each netdev's 1701d3236553SJohannes Berg * ieee80211_ptr for proper operation. 1702d3236553SJohannes Berg */ 17033dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 1704d3236553SJohannes Berg 1705d3236553SJohannes Berg /** 1706d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 1707d3236553SJohannes Berg * 1708d3236553SJohannes Berg * @wiphy: The wiphy to register. 1709d3236553SJohannes Berg * 1710d3236553SJohannes Berg * Returns a non-negative wiphy index or a negative error code. 1711d3236553SJohannes Berg */ 1712d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 1713d3236553SJohannes Berg 1714d3236553SJohannes Berg /** 1715d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 1716d3236553SJohannes Berg * 1717d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 1718d3236553SJohannes Berg * 1719d3236553SJohannes Berg * After this call, no more requests can be made with this priv 1720d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 1721d3236553SJohannes Berg * request that is being handled. 1722d3236553SJohannes Berg */ 1723d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 1724d3236553SJohannes Berg 1725d3236553SJohannes Berg /** 1726d3236553SJohannes Berg * wiphy_free - free wiphy 1727d3236553SJohannes Berg * 1728d3236553SJohannes Berg * @wiphy: The wiphy to free 1729d3236553SJohannes Berg */ 1730d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 1731d3236553SJohannes Berg 1732fffd0934SJohannes Berg /* internal structs */ 17336829c878SJohannes Berg struct cfg80211_conn; 173419957bb3SJohannes Berg struct cfg80211_internal_bss; 1735fffd0934SJohannes Berg struct cfg80211_cached_keys; 173619957bb3SJohannes Berg 173719957bb3SJohannes Berg #define MAX_AUTH_BSSES 4 17386829c878SJohannes Berg 1739d3236553SJohannes Berg /** 1740d3236553SJohannes Berg * struct wireless_dev - wireless per-netdev state 1741d3236553SJohannes Berg * 1742d3236553SJohannes Berg * This structure must be allocated by the driver/stack 1743d3236553SJohannes Berg * that uses the ieee80211_ptr field in struct net_device 1744d3236553SJohannes Berg * (this is intentional so it can be allocated along with 1745d3236553SJohannes Berg * the netdev.) 1746d3236553SJohannes Berg * 1747d3236553SJohannes Berg * @wiphy: pointer to hardware description 1748d3236553SJohannes Berg * @iftype: interface type 1749d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 1750d3236553SJohannes Berg * @netdev: (private) Used to reference back to the netdev 1751d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 1752f444de05SJohannes Berg * @channel: (private) Used by the internal configuration code to track 1753f444de05SJohannes Berg * user-set AP, monitor and WDS channels for wireless extensions 1754d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 1755d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 1756d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 175729cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 175829cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 1759d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 17609bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 17619bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 17629bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 17639bc383deSJohannes Berg * by cfg80211 on change_interface 17642e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 17652e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 1766abe37c4bSJohannes Berg * @mtx: mutex used to lock data in this struct 1767abe37c4bSJohannes Berg * @cleanup_work: work struct used for cleanup that can't be done directly 1768d3236553SJohannes Berg */ 1769d3236553SJohannes Berg struct wireless_dev { 1770d3236553SJohannes Berg struct wiphy *wiphy; 1771d3236553SJohannes Berg enum nl80211_iftype iftype; 1772d3236553SJohannes Berg 1773667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 1774d3236553SJohannes Berg struct list_head list; 1775d3236553SJohannes Berg struct net_device *netdev; 1776d3236553SJohannes Berg 17772e161f78SJohannes Berg struct list_head mgmt_registrations; 17782e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 1779026331c4SJouni Malinen 1780667503ddSJohannes Berg struct mutex mtx; 1781667503ddSJohannes Berg 1782ad002395SJohannes Berg struct work_struct cleanup_work; 1783ad002395SJohannes Berg 17849bc383deSJohannes Berg bool use_4addr; 17859bc383deSJohannes Berg 1786b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 1787d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 178829cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 1789b23aa676SSamuel Ortiz enum { 1790b23aa676SSamuel Ortiz CFG80211_SME_IDLE, 17916829c878SJohannes Berg CFG80211_SME_CONNECTING, 1792b23aa676SSamuel Ortiz CFG80211_SME_CONNECTED, 1793b23aa676SSamuel Ortiz } sme_state; 17946829c878SJohannes Berg struct cfg80211_conn *conn; 1795fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 1796d3236553SJohannes Berg 1797667503ddSJohannes Berg struct list_head event_list; 1798667503ddSJohannes Berg spinlock_t event_lock; 1799667503ddSJohannes Berg 180019957bb3SJohannes Berg struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 180119957bb3SJohannes Berg struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 180219957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1803f444de05SJohannes Berg struct ieee80211_channel *channel; 180419957bb3SJohannes Berg 1805ffb9eb3dSKalle Valo bool ps; 1806ffb9eb3dSKalle Valo int ps_timeout; 1807ffb9eb3dSKalle Valo 18083d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 1809d3236553SJohannes Berg /* wext data */ 1810cbe8fa9cSJohannes Berg struct { 1811cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 1812f2129354SJohannes Berg struct cfg80211_connect_params connect; 1813fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 1814f2129354SJohannes Berg u8 *ie; 1815f2129354SJohannes Berg size_t ie_len; 1816f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1817f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 181808645126SJohannes Berg s8 default_key, default_mgmt_key; 1819ffb9eb3dSKalle Valo bool prev_bssid_valid; 1820cbe8fa9cSJohannes Berg } wext; 1821d3236553SJohannes Berg #endif 1822d3236553SJohannes Berg }; 1823d3236553SJohannes Berg 1824d3236553SJohannes Berg /** 1825d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 1826d3236553SJohannes Berg * 1827d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 1828d3236553SJohannes Berg */ 1829d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 1830d3236553SJohannes Berg { 1831d3236553SJohannes Berg BUG_ON(!wdev); 1832d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 1833d3236553SJohannes Berg } 1834d3236553SJohannes Berg 1835d70e9693SJohannes Berg /** 1836d70e9693SJohannes Berg * DOC: Utility functions 1837d70e9693SJohannes Berg * 1838d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 1839d3236553SJohannes Berg */ 1840d3236553SJohannes Berg 1841d3236553SJohannes Berg /** 1842d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 1843abe37c4bSJohannes Berg * @chan: channel number 184459eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 1845d3236553SJohannes Berg */ 184659eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 1847d3236553SJohannes Berg 1848d3236553SJohannes Berg /** 1849d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 1850abe37c4bSJohannes Berg * @freq: center frequency 1851d3236553SJohannes Berg */ 1852d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 1853d3236553SJohannes Berg 1854d3236553SJohannes Berg /* 1855d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 1856d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 1857d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 1858d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 1859d3236553SJohannes Berg * clash. 1860d3236553SJohannes Berg */ 1861d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 1862d3236553SJohannes Berg int freq); 1863d3236553SJohannes Berg /** 1864d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1865abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 1866abe37c4bSJohannes Berg * @freq: the center frequency of the channel 1867d3236553SJohannes Berg */ 1868d3236553SJohannes Berg static inline struct ieee80211_channel * 1869d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 1870d3236553SJohannes Berg { 1871d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 1872d3236553SJohannes Berg } 1873d3236553SJohannes Berg 1874d3236553SJohannes Berg /** 1875d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 1876d3236553SJohannes Berg * 1877d3236553SJohannes Berg * @sband: the band to look for rates in 1878d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 1879d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 1880d3236553SJohannes Berg * 1881d3236553SJohannes Berg * This function returns the basic rate corresponding to a given 1882d3236553SJohannes Berg * bitrate, that is the next lower bitrate contained in the basic 1883d3236553SJohannes Berg * rate map, which is, for this function, given as a bitmap of 1884d3236553SJohannes Berg * indices of rates in the band's bitrate table. 1885d3236553SJohannes Berg */ 1886d3236553SJohannes Berg struct ieee80211_rate * 1887d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 1888d3236553SJohannes Berg u32 basic_rates, int bitrate); 1889d3236553SJohannes Berg 1890d3236553SJohannes Berg /* 1891d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 1892d3236553SJohannes Berg * 1893d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 1894d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 1895d3236553SJohannes Berg */ 1896d3236553SJohannes Berg 189733e5a2f7SJohannes Berg struct radiotap_align_size { 189833e5a2f7SJohannes Berg uint8_t align:4, size:4; 189933e5a2f7SJohannes Berg }; 190033e5a2f7SJohannes Berg 190133e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 190233e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 190333e5a2f7SJohannes Berg int n_bits; 190433e5a2f7SJohannes Berg uint32_t oui; 190533e5a2f7SJohannes Berg uint8_t subns; 190633e5a2f7SJohannes Berg }; 190733e5a2f7SJohannes Berg 190833e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 190933e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 191033e5a2f7SJohannes Berg int n_ns; 191133e5a2f7SJohannes Berg }; 191233e5a2f7SJohannes Berg 1913d3236553SJohannes Berg /** 1914d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 191533e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 191633e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 191733e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 191833e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 191933e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 192033e5a2f7SJohannes Berg * the beginning of the actual data portion 192133e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 192233e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 192333e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 192433e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 192533e5a2f7SJohannes Berg * radiotap namespace or not 192633e5a2f7SJohannes Berg * 192733e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 192833e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 192933e5a2f7SJohannes Berg * @_arg_index: next argument index 193033e5a2f7SJohannes Berg * @_arg: next argument pointer 193133e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 193233e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 193333e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 193433e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 193533e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 193633e5a2f7SJohannes Berg * next bitmap word 193733e5a2f7SJohannes Berg * 193833e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 193933e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 1940d3236553SJohannes Berg */ 1941d3236553SJohannes Berg 1942d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 194333e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 194433e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 194533e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 1946d3236553SJohannes Berg 194733e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 194867272440SJohannes Berg __le32 *_next_bitmap; 194933e5a2f7SJohannes Berg 195033e5a2f7SJohannes Berg unsigned char *this_arg; 195133e5a2f7SJohannes Berg int this_arg_index; 195233e5a2f7SJohannes Berg int this_arg_size; 195333e5a2f7SJohannes Berg 195433e5a2f7SJohannes Berg int is_radiotap_ns; 195533e5a2f7SJohannes Berg 195633e5a2f7SJohannes Berg int _max_length; 195733e5a2f7SJohannes Berg int _arg_index; 195833e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 195933e5a2f7SJohannes Berg int _reset_on_ext; 1960d3236553SJohannes Berg }; 1961d3236553SJohannes Berg 1962d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 1963d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 1964d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 196533e5a2f7SJohannes Berg int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); 1966d3236553SJohannes Berg 1967d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 1968d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 1969d3236553SJohannes Berg 197033e5a2f7SJohannes Berg 1971e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 1972e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 1973e31a16d6SZhu Yi 1974e31a16d6SZhu Yi /** 1975e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 1976e31a16d6SZhu Yi * 1977e31a16d6SZhu Yi * Given an skb with a raw 802.11 header at the data pointer this function 1978e31a16d6SZhu Yi * returns the 802.11 header length in bytes (not including encryption 1979e31a16d6SZhu Yi * headers). If the data in the sk_buff is too short to contain a valid 802.11 1980e31a16d6SZhu Yi * header the function returns 0. 1981e31a16d6SZhu Yi * 1982e31a16d6SZhu Yi * @skb: the frame 1983e31a16d6SZhu Yi */ 1984e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1985e31a16d6SZhu Yi 1986e31a16d6SZhu Yi /** 1987e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 1988e31a16d6SZhu Yi * @fc: frame control field in little-endian format 1989e31a16d6SZhu Yi */ 1990633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 1991e31a16d6SZhu Yi 1992e31a16d6SZhu Yi /** 1993d70e9693SJohannes Berg * DOC: Data path helpers 1994d70e9693SJohannes Berg * 1995d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 1996d70e9693SJohannes Berg * functions that help implement the data path for devices 1997d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 1998d70e9693SJohannes Berg */ 1999d70e9693SJohannes Berg 2000d70e9693SJohannes Berg /** 2001e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 2002e31a16d6SZhu Yi * @skb: the 802.11 data frame 2003e31a16d6SZhu Yi * @addr: the device MAC address 2004e31a16d6SZhu Yi * @iftype: the virtual interface type 2005e31a16d6SZhu Yi */ 2006eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 2007e31a16d6SZhu Yi enum nl80211_iftype iftype); 2008e31a16d6SZhu Yi 2009e31a16d6SZhu Yi /** 2010e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 2011e31a16d6SZhu Yi * @skb: the 802.3 frame 2012e31a16d6SZhu Yi * @addr: the device MAC address 2013e31a16d6SZhu Yi * @iftype: the virtual interface type 2014e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 2015e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 2016e31a16d6SZhu Yi */ 2017eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 2018e31a16d6SZhu Yi enum nl80211_iftype iftype, u8 *bssid, bool qos); 2019e31a16d6SZhu Yi 2020e31a16d6SZhu Yi /** 2021eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 2022eaf85ca7SZhu Yi * 2023eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 2024eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 2025eaf85ca7SZhu Yi * @skb is consumed after the function returns. 2026eaf85ca7SZhu Yi * 2027eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 2028eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 2029eaf85ca7SZhu Yi * initialized by by the caller. 2030eaf85ca7SZhu Yi * @addr: The device MAC address. 2031eaf85ca7SZhu Yi * @iftype: The device interface type. 2032eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 2033eaf85ca7SZhu Yi */ 2034eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 2035eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 2036eaf85ca7SZhu Yi const unsigned int extra_headroom); 2037eaf85ca7SZhu Yi 2038eaf85ca7SZhu Yi /** 2039e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 2040e31a16d6SZhu Yi * @skb: the data frame 2041e31a16d6SZhu Yi */ 2042e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb); 2043e31a16d6SZhu Yi 2044c21dbf92SJohannes Berg /** 2045c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 2046c21dbf92SJohannes Berg * 2047c21dbf92SJohannes Berg * @eid: element ID 2048c21dbf92SJohannes Berg * @ies: data consisting of IEs 2049c21dbf92SJohannes Berg * @len: length of data 2050c21dbf92SJohannes Berg * 2051c21dbf92SJohannes Berg * This function will return %NULL if the element ID could 2052c21dbf92SJohannes Berg * not be found or if the element is invalid (claims to be 2053c21dbf92SJohannes Berg * longer than the given data), or a pointer to the first byte 2054c21dbf92SJohannes Berg * of the requested element, that is the byte containing the 2055c21dbf92SJohannes Berg * element ID. There are no checks on the element length 2056c21dbf92SJohannes Berg * other than having to fit into the given data. 2057c21dbf92SJohannes Berg */ 2058c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 2059c21dbf92SJohannes Berg 2060d70e9693SJohannes Berg /** 2061d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 2062d70e9693SJohannes Berg * 2063d70e9693SJohannes Berg * TODO 2064d3236553SJohannes Berg */ 2065d3236553SJohannes Berg 2066d3236553SJohannes Berg /** 2067d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 2068d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 2069d3236553SJohannes Berg * conflicts) 2070d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 2071d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 2072d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 2073d3236553SJohannes Berg * alpha2. 2074d3236553SJohannes Berg * 2075d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 2076d3236553SJohannes Berg * what it believes should be the current regulatory domain by 2077d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 2078d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 2079d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 2080d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 2081d3236553SJohannes Berg * 2082d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 2083d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 2084d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 2085d3236553SJohannes Berg * 2086d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 2087d3236553SJohannes Berg * an -ENOMEM. 2088d3236553SJohannes Berg */ 2089d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 2090d3236553SJohannes Berg 2091d3236553SJohannes Berg /** 2092d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 2093d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 2094d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 2095d3236553SJohannes Berg * 2096d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 2097d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 2098d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 2099d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 2100d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 2101d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 2102d3236553SJohannes Berg */ 2103d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 2104d3236553SJohannes Berg struct wiphy *wiphy, 2105d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 2106d3236553SJohannes Berg 2107d3236553SJohannes Berg /** 2108d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 2109d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 2110d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 2111038659e7SLuis R. Rodriguez * @desired_bw_khz: the desired max bandwidth you want to use per 2112038659e7SLuis R. Rodriguez * channel. Note that this is still 20 MHz if you want to use HT40 2113038659e7SLuis R. Rodriguez * as HT40 makes use of two channels for its 40 MHz width bandwidth. 2114038659e7SLuis R. Rodriguez * If set to 0 we'll assume you want the standard 20 MHz. 2115d3236553SJohannes Berg * @reg_rule: the regulatory rule which we have for this frequency 2116d3236553SJohannes Berg * 2117d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 2118d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 2119d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 2120d3236553SJohannes Berg * and processed already. 2121d3236553SJohannes Berg * 2122d3236553SJohannes Berg * Returns 0 if it was able to find a valid regulatory rule which does 2123d3236553SJohannes Berg * apply to the given center_freq otherwise it returns non-zero. It will 2124d3236553SJohannes Berg * also return -ERANGE if we determine the given center_freq does not even have 2125d3236553SJohannes Berg * a regulatory rule for a frequency range in the center_freq's band. See 2126d3236553SJohannes Berg * freq_in_rule_band() for our current definition of a band -- this is purely 2127d3236553SJohannes Berg * subjective and right now its 802.11 specific. 2128d3236553SJohannes Berg */ 2129038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy, 2130038659e7SLuis R. Rodriguez u32 center_freq, 2131038659e7SLuis R. Rodriguez u32 desired_bw_khz, 2132d3236553SJohannes Berg const struct ieee80211_reg_rule **reg_rule); 2133d3236553SJohannes Berg 2134d3236553SJohannes Berg /* 2135d3236553SJohannes Berg * Temporary wext handlers & helper functions 2136d3236553SJohannes Berg * 2137d3236553SJohannes Berg * In the future cfg80211 will simply assign the entire wext handler 2138d3236553SJohannes Berg * structure to netdevs it manages, but we're not there yet. 2139d3236553SJohannes Berg */ 2140fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev, 2141fee52678SJohannes Berg struct iw_request_info *info, 2142fee52678SJohannes Berg char *name, char *extra); 2143e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 2144e60c7744SJohannes Berg u32 *mode, char *extra); 2145e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 2146e60c7744SJohannes Berg u32 *mode, char *extra); 21472a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev, 21482a519311SJohannes Berg struct iw_request_info *info, 21492a519311SJohannes Berg union iwreq_data *wrqu, char *extra); 21502a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev, 21512a519311SJohannes Berg struct iw_request_info *info, 21522a519311SJohannes Berg struct iw_point *data, char *extra); 2153691597cbSJohannes Berg int cfg80211_wext_siwmlme(struct net_device *dev, 2154691597cbSJohannes Berg struct iw_request_info *info, 2155691597cbSJohannes Berg struct iw_point *data, char *extra); 21564aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev, 21574aa188e1SJohannes Berg struct iw_request_info *info, 21584aa188e1SJohannes Berg struct iw_point *data, char *extra); 2159f2129354SJohannes Berg int cfg80211_wext_siwgenie(struct net_device *dev, 2160f2129354SJohannes Berg struct iw_request_info *info, 2161f2129354SJohannes Berg struct iw_point *data, char *extra); 2162f2129354SJohannes Berg int cfg80211_wext_siwauth(struct net_device *dev, 2163f2129354SJohannes Berg struct iw_request_info *info, 2164f2129354SJohannes Berg struct iw_param *data, char *extra); 2165f2129354SJohannes Berg int cfg80211_wext_giwauth(struct net_device *dev, 2166f2129354SJohannes Berg struct iw_request_info *info, 2167f2129354SJohannes Berg struct iw_param *data, char *extra); 2168f2129354SJohannes Berg 21690e82ffe3SJohannes Berg int cfg80211_wext_siwfreq(struct net_device *dev, 21700e82ffe3SJohannes Berg struct iw_request_info *info, 21710e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 21720e82ffe3SJohannes Berg int cfg80211_wext_giwfreq(struct net_device *dev, 21730e82ffe3SJohannes Berg struct iw_request_info *info, 21740e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 21751f9298f9SJohannes Berg int cfg80211_wext_siwessid(struct net_device *dev, 21761f9298f9SJohannes Berg struct iw_request_info *info, 21771f9298f9SJohannes Berg struct iw_point *data, char *ssid); 21781f9298f9SJohannes Berg int cfg80211_wext_giwessid(struct net_device *dev, 21791f9298f9SJohannes Berg struct iw_request_info *info, 21801f9298f9SJohannes Berg struct iw_point *data, char *ssid); 21819930380fSJohannes Berg int cfg80211_wext_siwrate(struct net_device *dev, 21829930380fSJohannes Berg struct iw_request_info *info, 21839930380fSJohannes Berg struct iw_param *rate, char *extra); 21849930380fSJohannes Berg int cfg80211_wext_giwrate(struct net_device *dev, 21859930380fSJohannes Berg struct iw_request_info *info, 21869930380fSJohannes Berg struct iw_param *rate, char *extra); 21879930380fSJohannes Berg 2188b9a5f8caSJouni Malinen int cfg80211_wext_siwrts(struct net_device *dev, 2189b9a5f8caSJouni Malinen struct iw_request_info *info, 2190b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 2191b9a5f8caSJouni Malinen int cfg80211_wext_giwrts(struct net_device *dev, 2192b9a5f8caSJouni Malinen struct iw_request_info *info, 2193b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 2194b9a5f8caSJouni Malinen int cfg80211_wext_siwfrag(struct net_device *dev, 2195b9a5f8caSJouni Malinen struct iw_request_info *info, 2196b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 2197b9a5f8caSJouni Malinen int cfg80211_wext_giwfrag(struct net_device *dev, 2198b9a5f8caSJouni Malinen struct iw_request_info *info, 2199b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 2200b9a5f8caSJouni Malinen int cfg80211_wext_siwretry(struct net_device *dev, 2201b9a5f8caSJouni Malinen struct iw_request_info *info, 2202b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 2203b9a5f8caSJouni Malinen int cfg80211_wext_giwretry(struct net_device *dev, 2204b9a5f8caSJouni Malinen struct iw_request_info *info, 2205b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 220608645126SJohannes Berg int cfg80211_wext_siwencodeext(struct net_device *dev, 220708645126SJohannes Berg struct iw_request_info *info, 220808645126SJohannes Berg struct iw_point *erq, char *extra); 220908645126SJohannes Berg int cfg80211_wext_siwencode(struct net_device *dev, 221008645126SJohannes Berg struct iw_request_info *info, 221108645126SJohannes Berg struct iw_point *erq, char *keybuf); 221208645126SJohannes Berg int cfg80211_wext_giwencode(struct net_device *dev, 221308645126SJohannes Berg struct iw_request_info *info, 221408645126SJohannes Berg struct iw_point *erq, char *keybuf); 22157643a2c3SJohannes Berg int cfg80211_wext_siwtxpower(struct net_device *dev, 22167643a2c3SJohannes Berg struct iw_request_info *info, 22177643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 22187643a2c3SJohannes Berg int cfg80211_wext_giwtxpower(struct net_device *dev, 22197643a2c3SJohannes Berg struct iw_request_info *info, 22207643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 22218990646dSJohannes Berg struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev); 2222b9a5f8caSJouni Malinen 2223bc92afd9SJohannes Berg int cfg80211_wext_siwpower(struct net_device *dev, 2224bc92afd9SJohannes Berg struct iw_request_info *info, 2225bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 2226bc92afd9SJohannes Berg int cfg80211_wext_giwpower(struct net_device *dev, 2227bc92afd9SJohannes Berg struct iw_request_info *info, 2228bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 2229bc92afd9SJohannes Berg 2230562e4822SJohannes Berg int cfg80211_wext_siwap(struct net_device *dev, 2231ab737a4fSJohannes Berg struct iw_request_info *info, 2232562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 2233562e4822SJohannes Berg int cfg80211_wext_giwap(struct net_device *dev, 2234ab737a4fSJohannes Berg struct iw_request_info *info, 2235562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 2236ab737a4fSJohannes Berg 2237c28991a0SJohn W. Linville int cfg80211_wext_siwpmksa(struct net_device *dev, 2238c28991a0SJohn W. Linville struct iw_request_info *info, 2239c28991a0SJohn W. Linville struct iw_point *data, char *extra); 2240c28991a0SJohn W. Linville 2241d3236553SJohannes Berg /* 2242d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 2243d3236553SJohannes Berg * functions and BSS handling helpers 2244d3236553SJohannes Berg */ 2245d3236553SJohannes Berg 22462a519311SJohannes Berg /** 22472a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 22482a519311SJohannes Berg * 22492a519311SJohannes Berg * @request: the corresponding scan request 22502a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 22512a519311SJohannes Berg * userspace will be notified of that 22522a519311SJohannes Berg */ 22532a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 22542a519311SJohannes Berg 22552a519311SJohannes Berg /** 2256abe37c4bSJohannes Berg * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame 22572a519311SJohannes Berg * 22582a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 2259abe37c4bSJohannes Berg * @channel: The channel the frame was received on 2260abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 2261abe37c4bSJohannes Berg * @len: length of the management frame 226277965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 22632a519311SJohannes Berg * @gfp: context flags 22642a519311SJohannes Berg * 22652a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 22662a519311SJohannes Berg * the BSS should be updated/added. 22672a519311SJohannes Berg */ 22682a519311SJohannes Berg struct cfg80211_bss* 22692a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 22702a519311SJohannes Berg struct ieee80211_channel *channel, 22712a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 227277965c97SJohannes Berg s32 signal, gfp_t gfp); 22732a519311SJohannes Berg 2274abe37c4bSJohannes Berg /** 2275abe37c4bSJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 2276abe37c4bSJohannes Berg * 2277abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 2278abe37c4bSJohannes Berg * @channel: The channel the frame was received on 2279abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 2280abe37c4bSJohannes Berg * @timestamp: the TSF timestamp sent by the peer 2281abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 2282abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 2283abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 2284abe37c4bSJohannes Berg * @ielen: length of the additional IEs 2285abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 2286abe37c4bSJohannes Berg * @gfp: context flags 2287abe37c4bSJohannes Berg * 2288abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 2289abe37c4bSJohannes Berg * the BSS should be updated/added. 2290abe37c4bSJohannes Berg */ 229106aa7afaSJussi Kivilinna struct cfg80211_bss* 229206aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 229306aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 229406aa7afaSJussi Kivilinna const u8 *bssid, 229506aa7afaSJussi Kivilinna u64 timestamp, u16 capability, u16 beacon_interval, 229606aa7afaSJussi Kivilinna const u8 *ie, size_t ielen, 229706aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 229806aa7afaSJussi Kivilinna 22992a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 23002a519311SJohannes Berg struct ieee80211_channel *channel, 23012a519311SJohannes Berg const u8 *bssid, 230279420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 230379420f09SJohannes Berg u16 capa_mask, u16 capa_val); 230479420f09SJohannes Berg static inline struct cfg80211_bss * 230579420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 230679420f09SJohannes Berg struct ieee80211_channel *channel, 230779420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 230879420f09SJohannes Berg { 230979420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 231079420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 231179420f09SJohannes Berg } 231279420f09SJohannes Berg 23132a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 23142a519311SJohannes Berg struct ieee80211_channel *channel, 23152a519311SJohannes Berg const u8 *meshid, size_t meshidlen, 23162a519311SJohannes Berg const u8 *meshcfg); 23172a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss); 2318d3236553SJohannes Berg 2319d491af19SJohannes Berg /** 2320d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 2321d491af19SJohannes Berg * @wiphy: the wiphy 2322d491af19SJohannes Berg * @bss: the bss to remove 2323d491af19SJohannes Berg * 2324d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 2325d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 2326d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 2327d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 2328d491af19SJohannes Berg */ 2329d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 2330fee52678SJohannes Berg 23316039f6d2SJouni Malinen /** 23326039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 23336039f6d2SJouni Malinen * @dev: network device 23346039f6d2SJouni Malinen * @buf: authentication frame (header + body) 23356039f6d2SJouni Malinen * @len: length of the frame data 23366039f6d2SJouni Malinen * 23376039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 23381965c853SJouni Malinen * station mode. The driver is required to call either this function or 23391965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 2340cb0b4bebSJohannes Berg * call. This function may sleep. 23416039f6d2SJouni Malinen */ 2342cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 23436039f6d2SJouni Malinen 23446039f6d2SJouni Malinen /** 23451965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 23461965c853SJouni Malinen * @dev: network device 23471965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 2348cb0b4bebSJohannes Berg * 2349cb0b4bebSJohannes Berg * This function may sleep. 23501965c853SJouni Malinen */ 2351cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 23521965c853SJouni Malinen 23531965c853SJouni Malinen /** 2354a58ce43fSJohannes Berg * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled 2355a58ce43fSJohannes Berg * @dev: network device 2356a58ce43fSJohannes Berg * @addr: The MAC address of the device with which the authentication timed out 2357a58ce43fSJohannes Berg * 2358a58ce43fSJohannes Berg * When a pending authentication had no action yet, the driver may decide 2359a58ce43fSJohannes Berg * to not send a deauth frame, but in that case must calls this function 2360a58ce43fSJohannes Berg * to tell cfg80211 about this decision. It is only valid to call this 2361a58ce43fSJohannes Berg * function within the deauth() callback. 2362a58ce43fSJohannes Berg */ 2363a58ce43fSJohannes Berg void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); 2364a58ce43fSJohannes Berg 2365a58ce43fSJohannes Berg /** 23666039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 23676039f6d2SJouni Malinen * @dev: network device 23686039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 23696039f6d2SJouni Malinen * @len: length of the frame data 23706039f6d2SJouni Malinen * 23716039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 23721965c853SJouni Malinen * processed in station mode. The driver is required to call either this 23731965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 2374cb0b4bebSJohannes Berg * cfg80211_ops::assoc() call. This function may sleep. 23756039f6d2SJouni Malinen */ 2376cb0b4bebSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 23776039f6d2SJouni Malinen 23786039f6d2SJouni Malinen /** 23791965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 23801965c853SJouni Malinen * @dev: network device 23811965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 2382cb0b4bebSJohannes Berg * 2383cb0b4bebSJohannes Berg * This function may sleep. 23841965c853SJouni Malinen */ 2385cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 23861965c853SJouni Malinen 23871965c853SJouni Malinen /** 238853b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 23896039f6d2SJouni Malinen * @dev: network device 23906039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 23916039f6d2SJouni Malinen * @len: length of the frame data 23926039f6d2SJouni Malinen * 23936039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 239453b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 2395cb0b4bebSJohannes Berg * locally generated ones. This function may sleep. 23966039f6d2SJouni Malinen */ 2397ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 2398ce470613SHolger Schurig 2399ce470613SHolger Schurig /** 2400ce470613SHolger Schurig * __cfg80211_send_deauth - notification of processed deauthentication 2401ce470613SHolger Schurig * @dev: network device 2402ce470613SHolger Schurig * @buf: deauthentication frame (header + body) 2403ce470613SHolger Schurig * @len: length of the frame data 2404ce470613SHolger Schurig * 2405ce470613SHolger Schurig * Like cfg80211_send_deauth(), but doesn't take the wdev lock. 2406ce470613SHolger Schurig */ 2407ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 24086039f6d2SJouni Malinen 24096039f6d2SJouni Malinen /** 241053b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 24116039f6d2SJouni Malinen * @dev: network device 24126039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 24136039f6d2SJouni Malinen * @len: length of the frame data 24146039f6d2SJouni Malinen * 24156039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 241653b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 2417cb0b4bebSJohannes Berg * generated ones. This function may sleep. 24186039f6d2SJouni Malinen */ 2419ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); 2420ce470613SHolger Schurig 2421ce470613SHolger Schurig /** 2422ce470613SHolger Schurig * __cfg80211_send_disassoc - notification of processed disassociation 2423ce470613SHolger Schurig * @dev: network device 2424ce470613SHolger Schurig * @buf: disassociation response frame (header + body) 2425ce470613SHolger Schurig * @len: length of the frame data 2426ce470613SHolger Schurig * 2427ce470613SHolger Schurig * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. 2428ce470613SHolger Schurig */ 2429ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 2430ce470613SHolger Schurig size_t len); 24316039f6d2SJouni Malinen 2432a08c1c1aSKalle Valo /** 2433cf4e594eSJouni Malinen * cfg80211_send_unprot_deauth - notification of unprotected deauthentication 2434cf4e594eSJouni Malinen * @dev: network device 2435cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 2436cf4e594eSJouni Malinen * @len: length of the frame data 2437cf4e594eSJouni Malinen * 2438cf4e594eSJouni Malinen * This function is called whenever a received Deauthentication frame has been 2439cf4e594eSJouni Malinen * dropped in station mode because of MFP being used but the Deauthentication 2440cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 2441cf4e594eSJouni Malinen */ 2442cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, 2443cf4e594eSJouni Malinen size_t len); 2444cf4e594eSJouni Malinen 2445cf4e594eSJouni Malinen /** 2446cf4e594eSJouni Malinen * cfg80211_send_unprot_disassoc - notification of unprotected disassociation 2447cf4e594eSJouni Malinen * @dev: network device 2448cf4e594eSJouni Malinen * @buf: disassociation frame (header + body) 2449cf4e594eSJouni Malinen * @len: length of the frame data 2450cf4e594eSJouni Malinen * 2451cf4e594eSJouni Malinen * This function is called whenever a received Disassociation frame has been 2452cf4e594eSJouni Malinen * dropped in station mode because of MFP being used but the Disassociation 2453cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 2454cf4e594eSJouni Malinen */ 2455cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, 2456cf4e594eSJouni Malinen size_t len); 2457cf4e594eSJouni Malinen 2458cf4e594eSJouni Malinen /** 2459a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 2460a3b8b056SJouni Malinen * @dev: network device 2461a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 2462a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 2463a3b8b056SJouni Malinen * @key_id: Key identifier (0..3) 2464a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 2465e6d6e342SJohannes Berg * @gfp: allocation flags 2466a3b8b056SJouni Malinen * 2467a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 2468a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 2469a3b8b056SJouni Malinen * primitive. 2470a3b8b056SJouni Malinen */ 2471a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 2472a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 2473e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 2474a3b8b056SJouni Malinen 247504a773adSJohannes Berg /** 247604a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 247704a773adSJohannes Berg * 247804a773adSJohannes Berg * @dev: network device 247904a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 248004a773adSJohannes Berg * @gfp: allocation flags 248104a773adSJohannes Berg * 248204a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 248304a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 248404a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 248504a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 248604a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 248704a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 248804a773adSJohannes Berg */ 248904a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 249004a773adSJohannes Berg 24911f87f7d3SJohannes Berg /** 2492*c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 2493*c93b5e71SJavier Cardona * 2494*c93b5e71SJavier Cardona * @dev: network device 2495*c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 2496*c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 2497*c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 2498*c93b5e71SJavier Cardona * @gfp: allocation flags 2499*c93b5e71SJavier Cardona * 2500*c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 2501*c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 2502*c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 2503*c93b5e71SJavier Cardona */ 2504*c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 2505*c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 2506*c93b5e71SJavier Cardona 2507*c93b5e71SJavier Cardona /** 2508d70e9693SJohannes Berg * DOC: RFkill integration 2509d70e9693SJohannes Berg * 2510d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 2511d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 2512d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 2513d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 2514d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 2515d70e9693SJohannes Berg * 2516d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 2517d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 2518d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 2519d70e9693SJohannes Berg */ 2520d70e9693SJohannes Berg 2521d70e9693SJohannes Berg /** 25221f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 25231f87f7d3SJohannes Berg * @wiphy: the wiphy 25241f87f7d3SJohannes Berg * @blocked: block status 25251f87f7d3SJohannes Berg */ 25261f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 25271f87f7d3SJohannes Berg 25281f87f7d3SJohannes Berg /** 25291f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 25301f87f7d3SJohannes Berg * @wiphy: the wiphy 25311f87f7d3SJohannes Berg */ 25321f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 25331f87f7d3SJohannes Berg 25341f87f7d3SJohannes Berg /** 25351f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 25361f87f7d3SJohannes Berg * @wiphy: the wiphy 25371f87f7d3SJohannes Berg */ 25381f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 25391f87f7d3SJohannes Berg 2540aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2541aff89a9bSJohannes Berg /** 2542d70e9693SJohannes Berg * DOC: Test mode 2543d70e9693SJohannes Berg * 2544d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 2545d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 2546d70e9693SJohannes Berg * factory programming. 2547d70e9693SJohannes Berg * 2548d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 2549d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 2550d70e9693SJohannes Berg */ 2551d70e9693SJohannes Berg 2552d70e9693SJohannes Berg /** 2553aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 2554aff89a9bSJohannes Berg * @wiphy: the wiphy 2555aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 2556aff89a9bSJohannes Berg * be put into the skb 2557aff89a9bSJohannes Berg * 2558aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 2559aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 2560aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 2561aff89a9bSJohannes Berg * 2562aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is pre-filled 2563aff89a9bSJohannes Berg * with the wiphy index and set up in a way that any data that is 2564aff89a9bSJohannes Berg * put into the skb (with skb_put(), nla_put() or similar) will end 2565aff89a9bSJohannes Berg * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 2566aff89a9bSJohannes Berg * needs to be done with the skb is adding data for the corresponding 2567aff89a9bSJohannes Berg * userspace tool which can then read that data out of the testdata 2568aff89a9bSJohannes Berg * attribute. You must not modify the skb in any other way. 2569aff89a9bSJohannes Berg * 2570aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 2571aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 2572aff89a9bSJohannes Berg */ 2573aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 2574aff89a9bSJohannes Berg int approxlen); 2575aff89a9bSJohannes Berg 2576aff89a9bSJohannes Berg /** 2577aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 2578aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 2579aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 2580aff89a9bSJohannes Berg * 2581aff89a9bSJohannes Berg * Returns an error code or 0 on success, since calling this 2582aff89a9bSJohannes Berg * function will usually be the last thing before returning 2583aff89a9bSJohannes Berg * from the @testmode_cmd you should return the error code. 2584aff89a9bSJohannes Berg * Note that this function consumes the skb regardless of the 2585aff89a9bSJohannes Berg * return value. 2586aff89a9bSJohannes Berg */ 2587aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb); 2588aff89a9bSJohannes Berg 2589aff89a9bSJohannes Berg /** 2590aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 2591aff89a9bSJohannes Berg * @wiphy: the wiphy 2592aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 2593aff89a9bSJohannes Berg * be put into the skb 2594aff89a9bSJohannes Berg * @gfp: allocation flags 2595aff89a9bSJohannes Berg * 2596aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 2597aff89a9bSJohannes Berg * testmode multicast group. 2598aff89a9bSJohannes Berg * 2599aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is set up in the 2600aff89a9bSJohannes Berg * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 2601aff89a9bSJohannes Berg * for an event. As there, you should simply add data to it that will 2602aff89a9bSJohannes Berg * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 2603aff89a9bSJohannes Berg * not modify the skb in any other way. 2604aff89a9bSJohannes Berg * 2605aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 2606aff89a9bSJohannes Berg * skb to send the event. 2607aff89a9bSJohannes Berg */ 2608aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 2609aff89a9bSJohannes Berg int approxlen, gfp_t gfp); 2610aff89a9bSJohannes Berg 2611aff89a9bSJohannes Berg /** 2612aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 2613aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 2614aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 2615aff89a9bSJohannes Berg * @gfp: allocation flags 2616aff89a9bSJohannes Berg * 2617aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 2618aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 2619aff89a9bSJohannes Berg * consumes it. 2620aff89a9bSJohannes Berg */ 2621aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 2622aff89a9bSJohannes Berg 2623aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 2624aff89a9bSJohannes Berg #else 2625aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 2626aff89a9bSJohannes Berg #endif 2627aff89a9bSJohannes Berg 2628b23aa676SSamuel Ortiz /** 2629b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 2630b23aa676SSamuel Ortiz * 2631b23aa676SSamuel Ortiz * @dev: network device 2632b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 2633b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 2634b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 2635b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 2636b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 2637b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 2638b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 2639b23aa676SSamuel Ortiz * the real status code for failures. 2640b23aa676SSamuel Ortiz * @gfp: allocation flags 2641b23aa676SSamuel Ortiz * 2642b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 2643b23aa676SSamuel Ortiz * succeeded. 2644b23aa676SSamuel Ortiz */ 2645b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 2646b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 2647b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 2648b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 2649b23aa676SSamuel Ortiz 2650b23aa676SSamuel Ortiz /** 2651b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 2652b23aa676SSamuel Ortiz * 2653b23aa676SSamuel Ortiz * @dev: network device 2654b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 2655b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 2656b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 2657b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 2658b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 2659b23aa676SSamuel Ortiz * @gfp: allocation flags 2660b23aa676SSamuel Ortiz * 2661b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 2662b23aa676SSamuel Ortiz * from one AP to another while connected. 2663b23aa676SSamuel Ortiz */ 2664b23aa676SSamuel Ortiz void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 2665b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 2666b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 2667b23aa676SSamuel Ortiz 2668b23aa676SSamuel Ortiz /** 2669b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 2670b23aa676SSamuel Ortiz * 2671b23aa676SSamuel Ortiz * @dev: network device 2672b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 2673b23aa676SSamuel Ortiz * @ie_len: length of IEs 2674b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 2675b23aa676SSamuel Ortiz * @gfp: allocation flags 2676b23aa676SSamuel Ortiz * 2677b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 2678b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 2679b23aa676SSamuel Ortiz */ 2680b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 2681b23aa676SSamuel Ortiz u8 *ie, size_t ie_len, gfp_t gfp); 2682b23aa676SSamuel Ortiz 26839588bbd5SJouni Malinen /** 26849588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 26859588bbd5SJouni Malinen * @dev: network device 26869588bbd5SJouni Malinen * @cookie: the request cookie 26879588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 26889588bbd5SJouni Malinen * @channel_type: Channel type 26899588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 26909588bbd5SJouni Malinen * channel 26919588bbd5SJouni Malinen * @gfp: allocation flags 26929588bbd5SJouni Malinen */ 26939588bbd5SJouni Malinen void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 26949588bbd5SJouni Malinen struct ieee80211_channel *chan, 26959588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 26969588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 26979588bbd5SJouni Malinen 26989588bbd5SJouni Malinen /** 26999588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 27009588bbd5SJouni Malinen * @dev: network device 27019588bbd5SJouni Malinen * @cookie: the request cookie 27029588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 27039588bbd5SJouni Malinen * @channel_type: Channel type 27049588bbd5SJouni Malinen * @gfp: allocation flags 27059588bbd5SJouni Malinen */ 27069588bbd5SJouni Malinen void cfg80211_remain_on_channel_expired(struct net_device *dev, 27079588bbd5SJouni Malinen u64 cookie, 27089588bbd5SJouni Malinen struct ieee80211_channel *chan, 27099588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 27109588bbd5SJouni Malinen gfp_t gfp); 2711b23aa676SSamuel Ortiz 271298b62183SJohannes Berg 271398b62183SJohannes Berg /** 271498b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 271598b62183SJohannes Berg * 271698b62183SJohannes Berg * @dev: the netdev 271798b62183SJohannes Berg * @mac_addr: the station's address 271898b62183SJohannes Berg * @sinfo: the station information 271998b62183SJohannes Berg * @gfp: allocation flags 272098b62183SJohannes Berg */ 272198b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 272298b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 272398b62183SJohannes Berg 2724026331c4SJouni Malinen /** 2725ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 2726ec15e68bSJouni Malinen * 2727ec15e68bSJouni Malinen * @dev: the netdev 2728ec15e68bSJouni Malinen * @mac_addr: the station's address 2729ec15e68bSJouni Malinen * @gfp: allocation flags 2730ec15e68bSJouni Malinen */ 2731ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 2732ec15e68bSJouni Malinen 2733ec15e68bSJouni Malinen /** 27342e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 2735026331c4SJouni Malinen * @dev: network device 2736026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 27372e161f78SJohannes Berg * @buf: Management frame (header + body) 2738026331c4SJouni Malinen * @len: length of the frame data 2739026331c4SJouni Malinen * @gfp: context flags 27402e161f78SJohannes Berg * 27412e161f78SJohannes Berg * Returns %true if a user space application has registered for this frame. 27422e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 27432e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 27442e161f78SJohannes Berg * driver is responsible for rejecting the frame. 2745026331c4SJouni Malinen * 2746026331c4SJouni Malinen * This function is called whenever an Action frame is received for a station 2747026331c4SJouni Malinen * mode interface, but is not processed in kernel. 2748026331c4SJouni Malinen */ 27492e161f78SJohannes Berg bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 2750026331c4SJouni Malinen size_t len, gfp_t gfp); 2751026331c4SJouni Malinen 2752026331c4SJouni Malinen /** 27532e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 2754026331c4SJouni Malinen * @dev: network device 27552e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 27562e161f78SJohannes Berg * @buf: Management frame (header + body) 2757026331c4SJouni Malinen * @len: length of the frame data 2758026331c4SJouni Malinen * @ack: Whether frame was acknowledged 2759026331c4SJouni Malinen * @gfp: context flags 2760026331c4SJouni Malinen * 27612e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 27622e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 2763026331c4SJouni Malinen * transmission attempt. 2764026331c4SJouni Malinen */ 27652e161f78SJohannes Berg void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, 2766026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 2767026331c4SJouni Malinen 2768d6dc1a38SJuuso Oikarinen 2769d6dc1a38SJuuso Oikarinen /** 2770d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 2771d6dc1a38SJuuso Oikarinen * @dev: network device 2772d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 2773d6dc1a38SJuuso Oikarinen * @gfp: context flags 2774d6dc1a38SJuuso Oikarinen * 2775d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 2776d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 2777d6dc1a38SJuuso Oikarinen */ 2778d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 2779d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 2780d6dc1a38SJuuso Oikarinen gfp_t gfp); 2781d6dc1a38SJuuso Oikarinen 2782c063dbf5SJohannes Berg /** 2783c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 2784c063dbf5SJohannes Berg * @dev: network device 2785c063dbf5SJohannes Berg * @peer: peer's MAC address 2786c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 2787c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 2788c063dbf5SJohannes Berg * threshold (to account for temporary interference) 2789c063dbf5SJohannes Berg * @gfp: context flags 2790c063dbf5SJohannes Berg */ 2791c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 2792c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 2793c063dbf5SJohannes Berg 2794e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 2795e1db74fcSJoe Perches 2796e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 2797e1db74fcSJoe Perches 2798e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 27999c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 2800e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 28019c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 2802e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 28039c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 2804e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 28059c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 2806e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 28079c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 2808e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 28099c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 2810e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 28119c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 2812e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 28139c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 2814073730d7SJoe Perches 28159c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 2816e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 28179c376639SJoe Perches 2818e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 28199c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 2820e1db74fcSJoe Perches 2821e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 2822e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 2823e1db74fcSJoe Perches #else 2824e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 2825e1db74fcSJoe Perches ({ \ 2826e1db74fcSJoe Perches if (0) \ 2827e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 2828e1db74fcSJoe Perches 0; \ 2829e1db74fcSJoe Perches }) 2830e1db74fcSJoe Perches #endif 2831e1db74fcSJoe Perches 2832e1db74fcSJoe Perches /* 2833e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 2834e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 2835e1db74fcSJoe Perches * file/line information and a backtrace. 2836e1db74fcSJoe Perches */ 2837e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 2838e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 2839e1db74fcSJoe Perches 2840704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 2841