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> 72740f0cfSJohannes Berg * Copyright 2013-2014 Intel Mobile Communications GmbH 8d3236553SJohannes Berg * 9d3236553SJohannes Berg * This program is free software; you can redistribute it and/or modify 10d3236553SJohannes Berg * it under the terms of the GNU General Public License version 2 as 11d3236553SJohannes Berg * published by the Free Software Foundation. 12d3236553SJohannes Berg */ 13704232c2SJohannes Berg 14d3236553SJohannes Berg #include <linux/netdevice.h> 15d3236553SJohannes Berg #include <linux/debugfs.h> 16d3236553SJohannes Berg #include <linux/list.h> 17187f1882SPaul Gortmaker #include <linux/bug.h> 18704232c2SJohannes Berg #include <linux/netlink.h> 19704232c2SJohannes Berg #include <linux/skbuff.h> 2055682965SJohannes Berg #include <linux/nl80211.h> 212a519311SJohannes Berg #include <linux/if_ether.h> 222a519311SJohannes Berg #include <linux/ieee80211.h> 232a0e047eSJohannes Berg #include <linux/net.h> 24d3236553SJohannes Berg #include <net/regulatory.h> 25d3236553SJohannes Berg 26d70e9693SJohannes Berg /** 27d70e9693SJohannes Berg * DOC: Introduction 28d70e9693SJohannes Berg * 29d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 30d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 31d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 32d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 33d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 34d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 35d70e9693SJohannes Berg * 36d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 37d70e9693SJohannes Berg * use restrictions. 38d70e9693SJohannes Berg */ 39d70e9693SJohannes Berg 40d70e9693SJohannes Berg 41d70e9693SJohannes Berg /** 42d70e9693SJohannes Berg * DOC: Device registration 43d70e9693SJohannes Berg * 44d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 45d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 46d70e9693SJohannes Berg * described below. 47d70e9693SJohannes Berg * 48d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 49d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 50d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 51d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 52d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 53d70e9693SJohannes Berg * the wireless part of the interface, normally this struct is embedded in the 54d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 55d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 56d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 57d70e9693SJohannes Berg * 58d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 59d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 60d70e9693SJohannes Berg * structures here describe these capabilities in detail. 61d70e9693SJohannes Berg */ 62d70e9693SJohannes Berg 639f5e8f6eSJohannes Berg struct wiphy; 649f5e8f6eSJohannes 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) 773a0c52a6SVladimir Kondratiev * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) 78abe37c4bSJohannes Berg * @IEEE80211_NUM_BANDS: number of defined bands 79d3236553SJohannes Berg */ 80d3236553SJohannes Berg enum ieee80211_band { 8113ae75b1SJouni Malinen IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 8213ae75b1SJouni Malinen IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 833a0c52a6SVladimir Kondratiev IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ, 84d3236553SJohannes Berg 85d3236553SJohannes Berg /* keep last */ 86d3236553SJohannes Berg IEEE80211_NUM_BANDS 87d3236553SJohannes Berg }; 88d3236553SJohannes Berg 89d3236553SJohannes Berg /** 90d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 91d3236553SJohannes Berg * 92d3236553SJohannes Berg * Channel flags set by the regulatory control code. 93d3236553SJohannes Berg * 94d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 958fe02e16SLuis R. Rodriguez * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 968fe02e16SLuis R. Rodriguez * sending probe requests or beaconing. 97d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 98689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 99d3236553SJohannes Berg * is not permitted. 100689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 101d3236553SJohannes Berg * is not permitted. 10203f6b084SSeth Forshee * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 103c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 104c7a6ee27SJohannes Berg * this flag indicates that an 80 MHz channel cannot use this 105c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 106c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 107c7a6ee27SJohannes Berg * restrictions. 108c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 109c7a6ee27SJohannes Berg * this flag indicates that an 160 MHz channel cannot use this 110c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 111c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 112c7a6ee27SJohannes Berg * restrictions. 113570dbde1SDavid Spinadel * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 114570dbde1SDavid Spinadel * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT 115ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 116ea077c1cSRostislav Lisovy * on this channel. 117ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 118ea077c1cSRostislav Lisovy * on this channel. 119570dbde1SDavid Spinadel * 120d3236553SJohannes Berg */ 121d3236553SJohannes Berg enum ieee80211_channel_flags { 122d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 1238fe02e16SLuis R. Rodriguez IEEE80211_CHAN_NO_IR = 1<<1, 1248fe02e16SLuis R. Rodriguez /* hole at 1<<2 */ 125d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 126689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 127689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 12803f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 129c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 130c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 131570dbde1SDavid Spinadel IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 132570dbde1SDavid Spinadel IEEE80211_CHAN_GO_CONCURRENT = 1<<10, 133ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_20MHZ = 1<<11, 134ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_10MHZ = 1<<12, 135d3236553SJohannes Berg }; 136d3236553SJohannes Berg 137038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 138689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 139038659e7SLuis R. Rodriguez 14004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 14104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 14204f39047SSimon Wunderlich 143d3236553SJohannes Berg /** 144d3236553SJohannes Berg * struct ieee80211_channel - channel definition 145d3236553SJohannes Berg * 146d3236553SJohannes Berg * This structure describes a single channel for use 147d3236553SJohannes Berg * with cfg80211. 148d3236553SJohannes Berg * 149d3236553SJohannes Berg * @center_freq: center frequency in MHz 150d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 151d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 152d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 153d3236553SJohannes Berg * code to support devices with additional restrictions 154d3236553SJohannes Berg * @band: band this channel belongs to. 155d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 156d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 157eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 158d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 159d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 16077c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 161d3236553SJohannes Berg * @orig_mag: internal use 162d3236553SJohannes Berg * @orig_mpwr: internal use 16304f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 16404f39047SSimon Wunderlich * on this channel. 16504f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 166089027e5SJanusz Dziedzic * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 167d3236553SJohannes Berg */ 168d3236553SJohannes Berg struct ieee80211_channel { 169d3236553SJohannes Berg enum ieee80211_band band; 170d3236553SJohannes Berg u16 center_freq; 171d3236553SJohannes Berg u16 hw_value; 172d3236553SJohannes Berg u32 flags; 173d3236553SJohannes Berg int max_antenna_gain; 174d3236553SJohannes Berg int max_power; 175eccc068eSHong Wu int max_reg_power; 176d3236553SJohannes Berg bool beacon_found; 177d3236553SJohannes Berg u32 orig_flags; 178d3236553SJohannes Berg int orig_mag, orig_mpwr; 17904f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 18004f39047SSimon Wunderlich unsigned long dfs_state_entered; 181089027e5SJanusz Dziedzic unsigned int dfs_cac_ms; 182d3236553SJohannes Berg }; 183d3236553SJohannes Berg 184d3236553SJohannes Berg /** 185d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 186d3236553SJohannes Berg * 187d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 188d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 189d3236553SJohannes Berg * different bands/PHY modes. 190d3236553SJohannes Berg * 191d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 192d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 193d3236553SJohannes Berg * with CCK rates. 194d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 195d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 196d3236553SJohannes Berg * core code when registering the wiphy. 197d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 198d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 199d3236553SJohannes Berg * core code when registering the wiphy. 200d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 201d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 202d3236553SJohannes Berg * core code when registering the wiphy. 203d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 20430e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 20530e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 206d3236553SJohannes Berg */ 207d3236553SJohannes Berg enum ieee80211_rate_flags { 208d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 209d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 210d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 211d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 212d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 21330e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 21430e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 215d3236553SJohannes Berg }; 216d3236553SJohannes Berg 217d3236553SJohannes Berg /** 218d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 219d3236553SJohannes Berg * 220d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 221d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 222d3236553SJohannes Berg * are only for driver use when pointers to this structure are 223d3236553SJohannes Berg * passed around. 224d3236553SJohannes Berg * 225d3236553SJohannes Berg * @flags: rate-specific flags 226d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 227d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 228d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 229d3236553SJohannes Berg * short preamble is used 230d3236553SJohannes Berg */ 231d3236553SJohannes Berg struct ieee80211_rate { 232d3236553SJohannes Berg u32 flags; 233d3236553SJohannes Berg u16 bitrate; 234d3236553SJohannes Berg u16 hw_value, hw_value_short; 235d3236553SJohannes Berg }; 236d3236553SJohannes Berg 237d3236553SJohannes Berg /** 238d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 239d3236553SJohannes Berg * 240d3236553SJohannes Berg * This structure describes most essential parameters needed 241d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 242d3236553SJohannes Berg * 243d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 244d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 245d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 246d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 247d3236553SJohannes Berg * @mcs: Supported MCS rates 248d3236553SJohannes Berg */ 249d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 250d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 251d3236553SJohannes Berg bool ht_supported; 252d3236553SJohannes Berg u8 ampdu_factor; 253d3236553SJohannes Berg u8 ampdu_density; 254d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 255d3236553SJohannes Berg }; 256d3236553SJohannes Berg 257d3236553SJohannes Berg /** 258bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 259bf0c111eSMahesh Palivela * 260bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 261bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 262bf0c111eSMahesh Palivela * 263bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 264bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 265bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 266bf0c111eSMahesh Palivela */ 267bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 268bf0c111eSMahesh Palivela bool vht_supported; 269bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 270bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 271bf0c111eSMahesh Palivela }; 272bf0c111eSMahesh Palivela 273bf0c111eSMahesh Palivela /** 274d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 275d3236553SJohannes Berg * 276d3236553SJohannes Berg * This structure describes a frequency band a wiphy 277d3236553SJohannes Berg * is able to operate in. 278d3236553SJohannes Berg * 279d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 280d3236553SJohannes Berg * in this band. 281d3236553SJohannes Berg * @band: the band this structure represents 282d3236553SJohannes Berg * @n_channels: Number of channels in @channels 283d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 284d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 285d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 286d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 287abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 288c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 289d3236553SJohannes Berg */ 290d3236553SJohannes Berg struct ieee80211_supported_band { 291d3236553SJohannes Berg struct ieee80211_channel *channels; 292d3236553SJohannes Berg struct ieee80211_rate *bitrates; 293d3236553SJohannes Berg enum ieee80211_band band; 294d3236553SJohannes Berg int n_channels; 295d3236553SJohannes Berg int n_bitrates; 296d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 297bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 298d3236553SJohannes Berg }; 299d3236553SJohannes Berg 300d3236553SJohannes Berg /* 301d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 302704232c2SJohannes Berg */ 303704232c2SJohannes Berg 3042ec600d6SLuis Carlos Cobo /** 305d70e9693SJohannes Berg * DOC: Actions and configuration 306d70e9693SJohannes Berg * 307d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 308d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 309d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 310d70e9693SJohannes Berg * operations use are described separately. 311d70e9693SJohannes Berg * 312d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 313d70e9693SJohannes Berg * information via some functions that drivers need to call. 314d70e9693SJohannes Berg * 315d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 316d70e9693SJohannes Berg * in a separate chapter. 317d70e9693SJohannes Berg */ 318d70e9693SJohannes Berg 319d70e9693SJohannes Berg /** 3202ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 3218b787643SFelix Fietkau * @use_4addr: use 4-address frames 322e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 323e8f479b1SBen Greear * If this parameter is set to zero address the driver may 324e8f479b1SBen Greear * determine the address as needed. 325e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 326e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 327e8f479b1SBen Greear ** only p2p devices with specified MAC. 3282ec600d6SLuis Carlos Cobo */ 3292ec600d6SLuis Carlos Cobo struct vif_params { 3308b787643SFelix Fietkau int use_4addr; 3311c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 3322ec600d6SLuis Carlos Cobo }; 3332ec600d6SLuis Carlos Cobo 33441ade00fSJohannes Berg /** 33541ade00fSJohannes Berg * struct key_params - key information 33641ade00fSJohannes Berg * 33741ade00fSJohannes Berg * Information about a key 33841ade00fSJohannes Berg * 33941ade00fSJohannes Berg * @key: key material 34041ade00fSJohannes Berg * @key_len: length of key material 34141ade00fSJohannes Berg * @cipher: cipher suite selector 34241ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 34341ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 34441ade00fSJohannes Berg * length given by @seq_len. 345abe37c4bSJohannes Berg * @seq_len: length of @seq. 34641ade00fSJohannes Berg */ 34741ade00fSJohannes Berg struct key_params { 348c1e5f471SJohannes Berg const u8 *key; 349c1e5f471SJohannes Berg const u8 *seq; 35041ade00fSJohannes Berg int key_len; 35141ade00fSJohannes Berg int seq_len; 35241ade00fSJohannes Berg u32 cipher; 35341ade00fSJohannes Berg }; 35441ade00fSJohannes Berg 355ed1b6cc7SJohannes Berg /** 356683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 357683b6d3bSJohannes Berg * @chan: the (control) channel 3583d9d1d66SJohannes Berg * @width: channel width 3593d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 3603d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 3613d9d1d66SJohannes Berg * (only with 80+80 MHz) 362683b6d3bSJohannes Berg */ 363683b6d3bSJohannes Berg struct cfg80211_chan_def { 364683b6d3bSJohannes Berg struct ieee80211_channel *chan; 3653d9d1d66SJohannes Berg enum nl80211_chan_width width; 3663d9d1d66SJohannes Berg u32 center_freq1; 3673d9d1d66SJohannes Berg u32 center_freq2; 368683b6d3bSJohannes Berg }; 369683b6d3bSJohannes Berg 3703d9d1d66SJohannes Berg /** 3713d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 3723d9d1d66SJohannes Berg * @chandef: the channel definition 3733d9d1d66SJohannes Berg * 3740ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 3753d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 3763d9d1d66SJohannes Berg */ 377683b6d3bSJohannes Berg static inline enum nl80211_channel_type 378683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 379683b6d3bSJohannes Berg { 3803d9d1d66SJohannes Berg switch (chandef->width) { 3813d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 3823d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 3833d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 3843d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 3853d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 3863d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 3873d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 3883d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 3893d9d1d66SJohannes Berg default: 3903d9d1d66SJohannes Berg WARN_ON(1); 3913d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 392683b6d3bSJohannes Berg } 3933d9d1d66SJohannes Berg } 3943d9d1d66SJohannes Berg 3953d9d1d66SJohannes Berg /** 3963d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 3973d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 3983d9d1d66SJohannes Berg * @channel: the control channel 3993d9d1d66SJohannes Berg * @chantype: the channel type 4003d9d1d66SJohannes Berg * 4013d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 4023d9d1d66SJohannes Berg */ 4033d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 4043d9d1d66SJohannes Berg struct ieee80211_channel *channel, 4053d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 4063d9d1d66SJohannes Berg 4073d9d1d66SJohannes Berg /** 4083d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 4093d9d1d66SJohannes Berg * @chandef1: first channel definition 4103d9d1d66SJohannes Berg * @chandef2: second channel definition 4113d9d1d66SJohannes Berg * 4120ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 4133d9d1d66SJohannes Berg * identical, %false otherwise. 4143d9d1d66SJohannes Berg */ 4153d9d1d66SJohannes Berg static inline bool 4163d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 4173d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 4183d9d1d66SJohannes Berg { 4193d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 4203d9d1d66SJohannes Berg chandef1->width == chandef2->width && 4213d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 4223d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 4233d9d1d66SJohannes Berg } 4243d9d1d66SJohannes Berg 4253d9d1d66SJohannes Berg /** 4263d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 4273d9d1d66SJohannes Berg * @chandef1: first channel definition 4283d9d1d66SJohannes Berg * @chandef2: second channel definition 4293d9d1d66SJohannes Berg * 4300ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 4313d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 4323d9d1d66SJohannes Berg */ 4333d9d1d66SJohannes Berg const struct cfg80211_chan_def * 4343d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 4353d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 436683b6d3bSJohannes Berg 437683b6d3bSJohannes Berg /** 4389f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 4399f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4400ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 4419f5e8f6eSJohannes Berg */ 4429f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 4439f5e8f6eSJohannes Berg 4449f5e8f6eSJohannes Berg /** 4459f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 4469f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 4479f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4480ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 4490ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 4509f5e8f6eSJohannes Berg */ 4519f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 4529f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 4539f5e8f6eSJohannes Berg u32 prohibited_flags); 4549f5e8f6eSJohannes Berg 4559f5e8f6eSJohannes Berg /** 456774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 457774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 458774f0734SSimon Wunderlich * @chandef: the channel definition to check 4592beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 4602beb6dabSLuciano Coelho * Returns: 4612beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 462774f0734SSimon Wunderlich */ 463774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 4642beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 465c3d62036SLuciano Coelho enum nl80211_iftype iftype); 466774f0734SSimon Wunderlich 467774f0734SSimon Wunderlich /** 46830e74732SSimon Wunderlich * ieee80211_chandef_rate_flags - returns rate flags for a channel 46930e74732SSimon Wunderlich * 47030e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 47130e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 47230e74732SSimon Wunderlich * 47330e74732SSimon Wunderlich * @chandef: channel definition for the channel 47430e74732SSimon Wunderlich * 47530e74732SSimon Wunderlich * Returns: rate flags which apply for this channel 47630e74732SSimon Wunderlich */ 47730e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 47830e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 47930e74732SSimon Wunderlich { 48030e74732SSimon Wunderlich switch (chandef->width) { 48130e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 48230e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 48330e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 48430e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 48530e74732SSimon Wunderlich default: 48630e74732SSimon Wunderlich break; 48730e74732SSimon Wunderlich } 48830e74732SSimon Wunderlich return 0; 48930e74732SSimon Wunderlich } 49030e74732SSimon Wunderlich 49130e74732SSimon Wunderlich /** 4920430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 4930430c883SSimon Wunderlich * 4940430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 4950430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 4960430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 4970430c883SSimon Wunderlich * 4980430c883SSimon Wunderlich * @chandef: channel definition for the channel 4990430c883SSimon Wunderlich * 5000430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 5010430c883SSimon Wunderlich */ 5020430c883SSimon Wunderlich static inline int 5030430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 5040430c883SSimon Wunderlich { 5050430c883SSimon Wunderlich switch (chandef->width) { 5060430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 5070430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 5080430c883SSimon Wunderlich chandef->chan->max_power); 5090430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 5100430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 5110430c883SSimon Wunderlich chandef->chan->max_power); 5120430c883SSimon Wunderlich default: 5130430c883SSimon Wunderlich break; 5140430c883SSimon Wunderlich } 5150430c883SSimon Wunderlich return chandef->chan->max_power; 5160430c883SSimon Wunderlich } 5170430c883SSimon Wunderlich 5180430c883SSimon Wunderlich /** 51961fa713cSHolger Schurig * enum survey_info_flags - survey information flags 52061fa713cSHolger Schurig * 521abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 52217e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 5238610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in 5248610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in 5258610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in 5268610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in 5278610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in 528abe37c4bSJohannes Berg * 52961fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 53061fa713cSHolger Schurig * it has filled in during the get_survey(). 53161fa713cSHolger Schurig */ 53261fa713cSHolger Schurig enum survey_info_flags { 53361fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 53417e5a808SFelix Fietkau SURVEY_INFO_IN_USE = 1<<1, 5358610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME = 1<<2, 5368610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, 5378610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, 5388610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, 5398610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, 54061fa713cSHolger Schurig }; 54161fa713cSHolger Schurig 54261fa713cSHolger Schurig /** 54361fa713cSHolger Schurig * struct survey_info - channel survey response 54461fa713cSHolger Schurig * 54561fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 54661fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 54761fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 54861fa713cSHolger Schurig * optional 5498610c29aSFelix Fietkau * @channel_time: amount of time in ms the radio spent on the channel 5508610c29aSFelix Fietkau * @channel_time_busy: amount of time the primary channel was sensed busy 5518610c29aSFelix Fietkau * @channel_time_ext_busy: amount of time the extension channel was sensed busy 5528610c29aSFelix Fietkau * @channel_time_rx: amount of time the radio spent receiving data 5538610c29aSFelix Fietkau * @channel_time_tx: amount of time the radio spent transmitting data 55461fa713cSHolger Schurig * 555abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 556abe37c4bSJohannes Berg * 55761fa713cSHolger Schurig * This structure can later be expanded with things like 55861fa713cSHolger Schurig * channel duty cycle etc. 55961fa713cSHolger Schurig */ 56061fa713cSHolger Schurig struct survey_info { 56161fa713cSHolger Schurig struct ieee80211_channel *channel; 5628610c29aSFelix Fietkau u64 channel_time; 5638610c29aSFelix Fietkau u64 channel_time_busy; 5648610c29aSFelix Fietkau u64 channel_time_ext_busy; 5658610c29aSFelix Fietkau u64 channel_time_rx; 5668610c29aSFelix Fietkau u64 channel_time_tx; 56761fa713cSHolger Schurig u32 filled; 56861fa713cSHolger Schurig s8 noise; 56961fa713cSHolger Schurig }; 57061fa713cSHolger Schurig 57161fa713cSHolger Schurig /** 5725fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 5735fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 5745fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 5755fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 5765fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 5775fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 5785fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 5795fb628e9SJouni Malinen * @akm_suites: AKM suites 5805fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 5815fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 5825fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 5835fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 5845fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 5855fb628e9SJouni Malinen * allowed through even on unauthorized ports 5865fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 5875fb628e9SJouni Malinen * protocol frames. 5885fb628e9SJouni Malinen */ 5895fb628e9SJouni Malinen struct cfg80211_crypto_settings { 5905fb628e9SJouni Malinen u32 wpa_versions; 5915fb628e9SJouni Malinen u32 cipher_group; 5925fb628e9SJouni Malinen int n_ciphers_pairwise; 5935fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 5945fb628e9SJouni Malinen int n_akm_suites; 5955fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 5965fb628e9SJouni Malinen bool control_port; 5975fb628e9SJouni Malinen __be16 control_port_ethertype; 5985fb628e9SJouni Malinen bool control_port_no_encrypt; 5995fb628e9SJouni Malinen }; 6005fb628e9SJouni Malinen 6015fb628e9SJouni Malinen /** 6028860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 603ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 604ed1b6cc7SJohannes Berg * or %NULL if not changed 605ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 606ed1b6cc7SJohannes Berg * or %NULL if not changed 607ed1b6cc7SJohannes Berg * @head_len: length of @head 608ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6099946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6109946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6119946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6129946ecfbSJouni Malinen * frames or %NULL 6139946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6149946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6159946ecfbSJouni Malinen * Response frames or %NULL 6169946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 61700f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 61800f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 619ed1b6cc7SJohannes Berg */ 6208860020eSJohannes Berg struct cfg80211_beacon_data { 6218860020eSJohannes Berg const u8 *head, *tail; 6228860020eSJohannes Berg const u8 *beacon_ies; 6238860020eSJohannes Berg const u8 *proberesp_ies; 6248860020eSJohannes Berg const u8 *assocresp_ies; 6258860020eSJohannes Berg const u8 *probe_resp; 6268860020eSJohannes Berg 6278860020eSJohannes Berg size_t head_len, tail_len; 6288860020eSJohannes Berg size_t beacon_ies_len; 6298860020eSJohannes Berg size_t proberesp_ies_len; 6308860020eSJohannes Berg size_t assocresp_ies_len; 6318860020eSJohannes Berg size_t probe_resp_len; 6328860020eSJohannes Berg }; 6338860020eSJohannes Berg 6346d45a74bSVasanthakumar Thiagarajan struct mac_address { 6356d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 6366d45a74bSVasanthakumar Thiagarajan }; 6376d45a74bSVasanthakumar Thiagarajan 6388860020eSJohannes Berg /** 63977765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 64077765eafSVasanthakumar Thiagarajan * 64177765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 642077f897aSJohannes Berg * entry specified by mac_addr 64377765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 64477765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 64577765eafSVasanthakumar Thiagarajan */ 64677765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 64777765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 64877765eafSVasanthakumar Thiagarajan int n_acl_entries; 64977765eafSVasanthakumar Thiagarajan 65077765eafSVasanthakumar Thiagarajan /* Keep it last */ 65177765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 65277765eafSVasanthakumar Thiagarajan }; 65377765eafSVasanthakumar Thiagarajan 6548860020eSJohannes Berg /** 6558860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 6568860020eSJohannes Berg * 6578860020eSJohannes Berg * Used to configure an AP interface. 6588860020eSJohannes Berg * 659683b6d3bSJohannes Berg * @chandef: defines the channel to use 6608860020eSJohannes Berg * @beacon: beacon data 6618860020eSJohannes Berg * @beacon_interval: beacon interval 6628860020eSJohannes Berg * @dtim_period: DTIM period 6638860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 6648860020eSJohannes Berg * user space) 6658860020eSJohannes Berg * @ssid_len: length of @ssid 6668860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 6678860020eSJohannes Berg * @crypto: crypto settings 6688860020eSJohannes Berg * @privacy: the BSS uses privacy 6698860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 67018998c38SEliad Peller * @smps_mode: SMPS mode 6711b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 67253cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 67353cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 67477765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 67577765eafSVasanthakumar Thiagarajan * MAC address based access control 6768860020eSJohannes Berg */ 6778860020eSJohannes Berg struct cfg80211_ap_settings { 678683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 679aa430da4SJohannes Berg 6808860020eSJohannes Berg struct cfg80211_beacon_data beacon; 6818860020eSJohannes Berg 6828860020eSJohannes Berg int beacon_interval, dtim_period; 68332e9de84SJouni Malinen const u8 *ssid; 68432e9de84SJouni Malinen size_t ssid_len; 68532e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 6865fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 6875fb628e9SJouni Malinen bool privacy; 6885fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 68918998c38SEliad Peller enum nl80211_smps_mode smps_mode; 6901b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 69153cabad7SJohannes Berg u8 p2p_ctwindow; 69253cabad7SJohannes Berg bool p2p_opp_ps; 69377765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 694ed1b6cc7SJohannes Berg }; 695ed1b6cc7SJohannes Berg 6965727ef1bSJohannes Berg /** 69716ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 69816ef1fe2SSimon Wunderlich * 69916ef1fe2SSimon Wunderlich * Used for channel switch 70016ef1fe2SSimon Wunderlich * 70116ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 70216ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7039a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7049a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7059a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7069a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 70716ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 70816ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 70916ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 71016ef1fe2SSimon Wunderlich * @count: number of beacons until switch 71116ef1fe2SSimon Wunderlich */ 71216ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 71316ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 71416ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 7159a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 7169a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 7179a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 7189a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 71916ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 72016ef1fe2SSimon Wunderlich bool radar_required; 72116ef1fe2SSimon Wunderlich bool block_tx; 72216ef1fe2SSimon Wunderlich u8 count; 72316ef1fe2SSimon Wunderlich }; 72416ef1fe2SSimon Wunderlich 72516ef1fe2SSimon Wunderlich /** 7263b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 7273b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 7289d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 729f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 7303b9ce80cSJohannes Berg * 7313b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 7323b9ce80cSJohannes Berg * for those that don't these flags will are used. 7333b9ce80cSJohannes Berg */ 7343b9ce80cSJohannes Berg enum station_parameters_apply_mask { 7353b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 7369d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 737f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 7383b9ce80cSJohannes Berg }; 7393b9ce80cSJohannes Berg 7403b9ce80cSJohannes Berg /** 7415727ef1bSJohannes Berg * struct station_parameters - station parameters 7425727ef1bSJohannes Berg * 7435727ef1bSJohannes Berg * Used to change and create a new station. 7445727ef1bSJohannes Berg * 7455727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 7465727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 7475727ef1bSJohannes Berg * (or NULL for no change) 7485727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 749eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 750eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 751eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 752eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 7535727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 7545727ef1bSJohannes Berg * @aid: AID or zero for no change 755abe37c4bSJohannes Berg * @plink_action: plink action to take 7569c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 757abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 758f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 759910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 760910868dbSEliad Peller * as the AC bitmap in the QoS info field 761910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 762910868dbSEliad Peller * QoS info field (but already shifted down) 763c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 764c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 765c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 7663b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 7673b1c5a53SMarco Porsch * to unknown) 7689d62a986SJouni Malinen * @capability: station capability 7699d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 7709d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 771c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 772c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 773c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 774c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 77560f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 77660f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 7775727ef1bSJohannes Berg */ 7785727ef1bSJohannes Berg struct station_parameters { 7792c1aabf3SJohannes Berg const u8 *supported_rates; 7805727ef1bSJohannes Berg struct net_device *vlan; 781eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 7823b9ce80cSJohannes Berg u32 sta_modify_mask; 7835727ef1bSJohannes Berg int listen_interval; 7845727ef1bSJohannes Berg u16 aid; 7855727ef1bSJohannes Berg u8 supported_rates_len; 7862ec600d6SLuis Carlos Cobo u8 plink_action; 7879c3990aaSJavier Cardona u8 plink_state; 7882c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 7892c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 790c75786c9SEliad Peller u8 uapsd_queues; 791c75786c9SEliad Peller u8 max_sp; 7923b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 7939d62a986SJouni Malinen u16 capability; 7942c1aabf3SJohannes Berg const u8 *ext_capab; 7959d62a986SJouni Malinen u8 ext_capab_len; 796c01fc9adSSunil Dutt const u8 *supported_channels; 797c01fc9adSSunil Dutt u8 supported_channels_len; 798c01fc9adSSunil Dutt const u8 *supported_oper_classes; 799c01fc9adSSunil Dutt u8 supported_oper_classes_len; 80060f4a7b1SMarek Kwaczynski u8 opmode_notif; 80160f4a7b1SMarek Kwaczynski bool opmode_notif_used; 8025727ef1bSJohannes Berg }; 8035727ef1bSJohannes Berg 804fd5b74dcSJohannes Berg /** 80589c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 80689c771e5SJouni Malinen * 80789c771e5SJouni Malinen * Used to delete a station entry (or all stations). 80889c771e5SJouni Malinen * 80989c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 81098856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 81198856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 81298856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 81389c771e5SJouni Malinen */ 81489c771e5SJouni Malinen struct station_del_parameters { 81589c771e5SJouni Malinen const u8 *mac; 81698856866SJouni Malinen u8 subtype; 81798856866SJouni Malinen u16 reason_code; 81889c771e5SJouni Malinen }; 81989c771e5SJouni Malinen 82089c771e5SJouni Malinen /** 82177ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 82277ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 82377ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 82477ee7c89SJohannes Berg * the AP MLME in the device 82577ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 82677ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 82777ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 82877ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 82977ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 83077ee7c89SJohannes Berg * supported/used) 83177ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 83277ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 833eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 834eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 83577ee7c89SJohannes Berg */ 83677ee7c89SJohannes Berg enum cfg80211_station_type { 83777ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 83877ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 83977ee7c89SJohannes Berg CFG80211_STA_AP_STA, 84077ee7c89SJohannes Berg CFG80211_STA_IBSS, 84177ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 84277ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 843eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 844eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 84577ee7c89SJohannes Berg }; 84677ee7c89SJohannes Berg 84777ee7c89SJohannes Berg /** 84877ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 84977ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 85077ee7c89SJohannes Berg * @params: the new parameters for a station 85177ee7c89SJohannes Berg * @statype: the type of station being modified 85277ee7c89SJohannes Berg * 85377ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 85477ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 85577ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 85677ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 85777ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 85877ee7c89SJohannes Berg */ 85977ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 86077ee7c89SJohannes Berg struct station_parameters *params, 86177ee7c89SJohannes Berg enum cfg80211_station_type statype); 86277ee7c89SJohannes Berg 86377ee7c89SJohannes Berg /** 8642ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 865fd5b74dcSJohannes Berg * 8662ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 8672ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 868fd5b74dcSJohannes Berg * 8692ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 8702ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 8712ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 872077f897aSJohannes Berg * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value 873077f897aSJohannes Berg * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value 8742ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 8752ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 8762ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 877420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 878c8dcfd8aSFelix Fietkau * @STATION_INFO_TX_BITRATE: @txrate fields are filled 879420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 88042745e03SVladimir Kondratiev * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value 88142745e03SVladimir Kondratiev * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value 882b206b4efSBruno Randolf * @STATION_INFO_TX_RETRIES: @tx_retries filled 883b206b4efSBruno Randolf * @STATION_INFO_TX_FAILED: @tx_failed filled 8845a5c731aSBen Greear * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 885541a45a1SBruno Randolf * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 886c8dcfd8aSFelix Fietkau * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 887f4263c98SPaul Stewart * @STATION_INFO_BSS_PARAM: @bss_param filled 888ebe27c91SMohammed Shafi Shajakhan * @STATION_INFO_CONNECTED_TIME: @connected_time filled 889040bdf71SFelix Fietkau * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 890bb6e753eSHelmut Schaa * @STATION_INFO_STA_FLAGS: @sta_flags filled 891a85e1d55SPaul Stewart * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 892d299a1f2SJavier Cardona * @STATION_INFO_T_OFFSET: @t_offset filled 8933b1c5a53SMarco Porsch * @STATION_INFO_LOCAL_PM: @local_pm filled 8943b1c5a53SMarco Porsch * @STATION_INFO_PEER_PM: @peer_pm filled 8953b1c5a53SMarco Porsch * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 896119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 897119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 898867d849fSAntonio Quartulli * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled 899fd5b74dcSJohannes Berg */ 9002ec600d6SLuis Carlos Cobo enum station_info_flags { 901867d849fSAntonio Quartulli STATION_INFO_INACTIVE_TIME = BIT(0), 902867d849fSAntonio Quartulli STATION_INFO_RX_BYTES = BIT(1), 903867d849fSAntonio Quartulli STATION_INFO_TX_BYTES = BIT(2), 904867d849fSAntonio Quartulli STATION_INFO_LLID = BIT(3), 905867d849fSAntonio Quartulli STATION_INFO_PLID = BIT(4), 906867d849fSAntonio Quartulli STATION_INFO_PLINK_STATE = BIT(5), 907867d849fSAntonio Quartulli STATION_INFO_SIGNAL = BIT(6), 908867d849fSAntonio Quartulli STATION_INFO_TX_BITRATE = BIT(7), 909867d849fSAntonio Quartulli STATION_INFO_RX_PACKETS = BIT(8), 910867d849fSAntonio Quartulli STATION_INFO_TX_PACKETS = BIT(9), 911867d849fSAntonio Quartulli STATION_INFO_TX_RETRIES = BIT(10), 912867d849fSAntonio Quartulli STATION_INFO_TX_FAILED = BIT(11), 913867d849fSAntonio Quartulli STATION_INFO_RX_DROP_MISC = BIT(12), 914867d849fSAntonio Quartulli STATION_INFO_SIGNAL_AVG = BIT(13), 915867d849fSAntonio Quartulli STATION_INFO_RX_BITRATE = BIT(14), 916867d849fSAntonio Quartulli STATION_INFO_BSS_PARAM = BIT(15), 917867d849fSAntonio Quartulli STATION_INFO_CONNECTED_TIME = BIT(16), 918867d849fSAntonio Quartulli STATION_INFO_ASSOC_REQ_IES = BIT(17), 919867d849fSAntonio Quartulli STATION_INFO_STA_FLAGS = BIT(18), 920867d849fSAntonio Quartulli STATION_INFO_BEACON_LOSS_COUNT = BIT(19), 921867d849fSAntonio Quartulli STATION_INFO_T_OFFSET = BIT(20), 922867d849fSAntonio Quartulli STATION_INFO_LOCAL_PM = BIT(21), 923867d849fSAntonio Quartulli STATION_INFO_PEER_PM = BIT(22), 924867d849fSAntonio Quartulli STATION_INFO_NONPEER_PM = BIT(23), 925867d849fSAntonio Quartulli STATION_INFO_RX_BYTES64 = BIT(24), 926867d849fSAntonio Quartulli STATION_INFO_TX_BYTES64 = BIT(25), 927867d849fSAntonio Quartulli STATION_INFO_CHAIN_SIGNAL = BIT(26), 928867d849fSAntonio Quartulli STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), 929867d849fSAntonio Quartulli STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), 930420e7fabSHenning Rogge }; 931420e7fabSHenning Rogge 932420e7fabSHenning Rogge /** 933420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 934420e7fabSHenning Rogge * 935420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 936420e7fabSHenning Rogge * type for 802.11n transmissions. 937420e7fabSHenning Rogge * 938db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 939db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 940db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission 941db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission 942db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission 943db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission 944420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 945db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 946420e7fabSHenning Rogge */ 947420e7fabSHenning Rogge enum rate_info_flags { 948db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 949db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 950db9c64cfSJohannes Berg RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2), 951db9c64cfSJohannes Berg RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3), 952db9c64cfSJohannes Berg RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4), 953db9c64cfSJohannes Berg RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5), 954db9c64cfSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(6), 955db9c64cfSJohannes Berg RATE_INFO_FLAGS_60G = BIT(7), 956420e7fabSHenning Rogge }; 957420e7fabSHenning Rogge 958420e7fabSHenning Rogge /** 959420e7fabSHenning Rogge * struct rate_info - bitrate information 960420e7fabSHenning Rogge * 961420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 962420e7fabSHenning Rogge * 963420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 964420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 965420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 966db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 967420e7fabSHenning Rogge */ 968420e7fabSHenning Rogge struct rate_info { 969420e7fabSHenning Rogge u8 flags; 970420e7fabSHenning Rogge u8 mcs; 971420e7fabSHenning Rogge u16 legacy; 972db9c64cfSJohannes Berg u8 nss; 973fd5b74dcSJohannes Berg }; 974fd5b74dcSJohannes Berg 975fd5b74dcSJohannes Berg /** 976f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 977f4263c98SPaul Stewart * 978f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 979f4263c98SPaul Stewart * type for 802.11n transmissions. 980f4263c98SPaul Stewart * 981f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 982f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 983f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 984f4263c98SPaul Stewart */ 985f4263c98SPaul Stewart enum bss_param_flags { 986f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 987f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 988f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 989f4263c98SPaul Stewart }; 990f4263c98SPaul Stewart 991f4263c98SPaul Stewart /** 992f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 993f4263c98SPaul Stewart * 994f4263c98SPaul Stewart * Information about the currently associated BSS 995f4263c98SPaul Stewart * 996f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 997f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 998f4263c98SPaul Stewart * @beacon_interval: beacon interval 999f4263c98SPaul Stewart */ 1000f4263c98SPaul Stewart struct sta_bss_parameters { 1001f4263c98SPaul Stewart u8 flags; 1002f4263c98SPaul Stewart u8 dtim_period; 1003f4263c98SPaul Stewart u16 beacon_interval; 1004f4263c98SPaul Stewart }; 1005f4263c98SPaul Stewart 1006119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1007119363c7SFelix Fietkau 1008f4263c98SPaul Stewart /** 10092ec600d6SLuis Carlos Cobo * struct station_info - station information 1010fd5b74dcSJohannes Berg * 10112ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1012fd5b74dcSJohannes Berg * 10132ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 1014ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1015fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 1016fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 1017fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 10182ec600d6SLuis Carlos Cobo * @llid: mesh local link id 10192ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 10202ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 102173c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 102273c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 102373c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 102473c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1025119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1026119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1027119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1028858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1029858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 103098c8a60aSJouni Malinen * @rx_packets: packets received from this station 103198c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 1032b206b4efSBruno Randolf * @tx_retries: cumulative retry counts 1033b206b4efSBruno Randolf * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 10345a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 10351ba01458SRandy Dunlap * @bss_param: current BSS parameters 1036f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1037f5ea9120SJohannes Berg * This number should increase every time the list of stations 1038f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1039f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 104050d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 104150d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 104250d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 104350d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 104450d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1045c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1046a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1047d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 10483b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 10493b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 10503b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1051867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1052867d849fSAntonio Quartulli * towards this station. 1053fd5b74dcSJohannes Berg */ 10542ec600d6SLuis Carlos Cobo struct station_info { 1055fd5b74dcSJohannes Berg u32 filled; 1056ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1057fd5b74dcSJohannes Berg u32 inactive_time; 105842745e03SVladimir Kondratiev u64 rx_bytes; 105942745e03SVladimir Kondratiev u64 tx_bytes; 10602ec600d6SLuis Carlos Cobo u16 llid; 10612ec600d6SLuis Carlos Cobo u16 plid; 10622ec600d6SLuis Carlos Cobo u8 plink_state; 1063420e7fabSHenning Rogge s8 signal; 1064541a45a1SBruno Randolf s8 signal_avg; 1065119363c7SFelix Fietkau 1066119363c7SFelix Fietkau u8 chains; 1067119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1068119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1069119363c7SFelix Fietkau 1070420e7fabSHenning Rogge struct rate_info txrate; 1071c8dcfd8aSFelix Fietkau struct rate_info rxrate; 107298c8a60aSJouni Malinen u32 rx_packets; 107398c8a60aSJouni Malinen u32 tx_packets; 1074b206b4efSBruno Randolf u32 tx_retries; 1075b206b4efSBruno Randolf u32 tx_failed; 10765a5c731aSBen Greear u32 rx_dropped_misc; 1077f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1078bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1079f5ea9120SJohannes Berg 1080f5ea9120SJohannes Berg int generation; 108150d3dfb7SJouni Malinen 108250d3dfb7SJouni Malinen const u8 *assoc_req_ies; 108350d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1084f612cedfSJouni Malinen 1085a85e1d55SPaul Stewart u32 beacon_loss_count; 1086d299a1f2SJavier Cardona s64 t_offset; 10873b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 10883b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 10893b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1090a85e1d55SPaul Stewart 1091867d849fSAntonio Quartulli u32 expected_throughput; 1092867d849fSAntonio Quartulli 1093f612cedfSJouni Malinen /* 1094f612cedfSJouni Malinen * Note: Add a new enum station_info_flags value for each new field and 1095f612cedfSJouni Malinen * use it to check which fields are initialized. 1096f612cedfSJouni Malinen */ 1097fd5b74dcSJohannes Berg }; 1098fd5b74dcSJohannes Berg 109966f7ac50SMichael Wu /** 11007406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11017406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11027406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11037406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11047406353dSAntonio Quartulli * 11057406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 11067406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 11077406353dSAntonio Quartulli * considered undefined. 11087406353dSAntonio Quartulli */ 11097406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 11107406353dSAntonio Quartulli struct station_info *sinfo); 11117406353dSAntonio Quartulli 11127406353dSAntonio Quartulli /** 111366f7ac50SMichael Wu * enum monitor_flags - monitor flags 111466f7ac50SMichael Wu * 111566f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 111666f7ac50SMichael Wu * according to the nl80211 flags. 111766f7ac50SMichael Wu * 111866f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 111966f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 112066f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 112166f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 112266f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1123e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 112466f7ac50SMichael Wu */ 112566f7ac50SMichael Wu enum monitor_flags { 112666f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 112766f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 112866f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 112966f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 113066f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1131e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 113266f7ac50SMichael Wu }; 113366f7ac50SMichael Wu 11342ec600d6SLuis Carlos Cobo /** 11352ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 11362ec600d6SLuis Carlos Cobo * 11372ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 11382ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 11392ec600d6SLuis Carlos Cobo * 1140abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1141abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1142abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1143abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1144abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1145abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1146abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 11472ec600d6SLuis Carlos Cobo */ 11482ec600d6SLuis Carlos Cobo enum mpath_info_flags { 11492ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1150d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 11512ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 11522ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 11532ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 11542ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 11552ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 11562ec600d6SLuis Carlos Cobo }; 11572ec600d6SLuis Carlos Cobo 11582ec600d6SLuis Carlos Cobo /** 11592ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 11602ec600d6SLuis Carlos Cobo * 11612ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 11622ec600d6SLuis Carlos Cobo * 11632ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 11642ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1165d19b3bf6SRui Paulo * @sn: target sequence number 11662ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 11672ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 11682ec600d6SLuis Carlos Cobo * @flags: mesh path flags 11692ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 11702ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1171f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1172f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1173f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1174f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 11752ec600d6SLuis Carlos Cobo */ 11762ec600d6SLuis Carlos Cobo struct mpath_info { 11772ec600d6SLuis Carlos Cobo u32 filled; 11782ec600d6SLuis Carlos Cobo u32 frame_qlen; 1179d19b3bf6SRui Paulo u32 sn; 11802ec600d6SLuis Carlos Cobo u32 metric; 11812ec600d6SLuis Carlos Cobo u32 exptime; 11822ec600d6SLuis Carlos Cobo u32 discovery_timeout; 11832ec600d6SLuis Carlos Cobo u8 discovery_retries; 11842ec600d6SLuis Carlos Cobo u8 flags; 1185f5ea9120SJohannes Berg 1186f5ea9120SJohannes Berg int generation; 11872ec600d6SLuis Carlos Cobo }; 11882ec600d6SLuis Carlos Cobo 11899f1ba906SJouni Malinen /** 11909f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 11919f1ba906SJouni Malinen * 11929f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 11939f1ba906SJouni Malinen * 11949f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 11959f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 11969f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 11979f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 11989f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 11999f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 120090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 120190c97a04SJouni Malinen * (or NULL for no change) 120290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1203fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 120450b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 120550b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 120653cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 120753cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 12089f1ba906SJouni Malinen */ 12099f1ba906SJouni Malinen struct bss_parameters { 12109f1ba906SJouni Malinen int use_cts_prot; 12119f1ba906SJouni Malinen int use_short_preamble; 12129f1ba906SJouni Malinen int use_short_slot_time; 1213c1e5f471SJohannes Berg const u8 *basic_rates; 121490c97a04SJouni Malinen u8 basic_rates_len; 1215fd8aaaf3SFelix Fietkau int ap_isolate; 121650b12f59SHelmut Schaa int ht_opmode; 121753cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 12189f1ba906SJouni Malinen }; 12192ec600d6SLuis Carlos Cobo 12203ddd53f3SChun-Yeow Yeoh /** 122129cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 122229cbe68cSJohannes Berg * 122329cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 12243ddd53f3SChun-Yeow Yeoh * 12253ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 12263ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 12273ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 12283ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 12293ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 12303ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 12313ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 12323ddd53f3SChun-Yeow Yeoh * mesh interface 12333ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 12343ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 12353ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 12363ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 12373ddd53f3SChun-Yeow Yeoh * elements 12383ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 12393ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 12403ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 12413ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 12423ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 12433ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 12443ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 12453ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 12463ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 12473ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 12483ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 12493ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 12503ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 12513ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 12523ddd53f3SChun-Yeow Yeoh * element 12533ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 12543ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 12553ddd53f3SChun-Yeow Yeoh * element 12563ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 12573ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 12583ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 12593ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 12603ddd53f3SChun-Yeow Yeoh * announcements are transmitted 12613ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 12623ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 12633ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 12643ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 12653ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 12663ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 12673ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 12683ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 12693ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 12703ddd53f3SChun-Yeow Yeoh * station to establish a peer link 12713ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1272ac1073a6SChun-Yeow Yeoh * 1273ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1274ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1275ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1276ac1073a6SChun-Yeow Yeoh * 1277ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1278ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1279728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1280728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1281728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 12823b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 12833b1c5a53SMarco Porsch * setting for new peer links. 12843b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 12853b1c5a53SMarco Porsch * after transmitting its beacon. 12868e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 12878e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 12888e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 128929cbe68cSJohannes Berg */ 129093da9cc1Scolin@cozybit.com struct mesh_config { 129193da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 129293da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 129393da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 129493da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 129593da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 129693da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 129745904f21SJavier Cardona u8 element_ttl; 129893da9cc1Scolin@cozybit.com bool auto_open_plinks; 1299d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 130093da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 130193da9cc1Scolin@cozybit.com u32 path_refresh_time; 130293da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 130393da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 130493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1305dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 130693da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 130763c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 13080507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 130916dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 131094f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 131155335137SAshok Nagarajan s32 rssi_threshold; 131270c33eaaSAshok Nagarajan u16 ht_opmode; 1313ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1314ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1315728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 13163b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 13173b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 13188e7c0538SColleen Twitty u32 plink_timeout; 131993da9cc1Scolin@cozybit.com }; 132093da9cc1Scolin@cozybit.com 132131888487SJouni Malinen /** 132229cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1323683b6d3bSJohannes Berg * @chandef: defines the channel to use 132429cbe68cSJohannes Berg * @mesh_id: the mesh ID 132529cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1326d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1327c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1328c80d545dSJavier Cardona * @path_metric: which metric to use 13296e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1330581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1331581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1332b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1333b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1334bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 13359bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 13369bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 13374bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1338ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 133929cbe68cSJohannes Berg * 134029cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 134129cbe68cSJohannes Berg */ 134229cbe68cSJohannes Berg struct mesh_setup { 1343683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 134429cbe68cSJohannes Berg const u8 *mesh_id; 134529cbe68cSJohannes Berg u8 mesh_id_len; 1346d299a1f2SJavier Cardona u8 sync_method; 1347c80d545dSJavier Cardona u8 path_sel_proto; 1348c80d545dSJavier Cardona u8 path_metric; 13496e16d90bSColleen Twitty u8 auth_id; 1350581a8b0fSJavier Cardona const u8 *ie; 1351581a8b0fSJavier Cardona u8 ie_len; 1352b130e5ceSJavier Cardona bool is_authenticated; 135315d5dda6SJavier Cardona bool is_secure; 1354bb2798d4SThomas Pedersen bool user_mpm; 13559bdbf04dSMarco Porsch u8 dtim_period; 13569bdbf04dSMarco Porsch u16 beacon_interval; 13574bb62344SChun-Yeow Yeoh int mcast_rate[IEEE80211_NUM_BANDS]; 1358ffb3cf30SAshok Nagarajan u32 basic_rates; 135929cbe68cSJohannes Berg }; 136029cbe68cSJohannes Berg 136129cbe68cSJohannes Berg /** 13626e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 13636e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 13646e0bd6c3SRostislav Lisovy * 13656e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 13666e0bd6c3SRostislav Lisovy */ 13676e0bd6c3SRostislav Lisovy struct ocb_setup { 13686e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 13696e0bd6c3SRostislav Lisovy }; 13706e0bd6c3SRostislav Lisovy 13716e0bd6c3SRostislav Lisovy /** 137231888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1373a3304b0aSJohannes Berg * @ac: AC identifier 137431888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 137531888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 137631888487SJouni Malinen * 1..32767] 137731888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 137831888487SJouni Malinen * 1..32767] 137931888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 138031888487SJouni Malinen */ 138131888487SJouni Malinen struct ieee80211_txq_params { 1382a3304b0aSJohannes Berg enum nl80211_ac ac; 138331888487SJouni Malinen u16 txop; 138431888487SJouni Malinen u16 cwmin; 138531888487SJouni Malinen u16 cwmax; 138631888487SJouni Malinen u8 aifs; 138731888487SJouni Malinen }; 138831888487SJouni Malinen 1389d70e9693SJohannes Berg /** 1390d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1391d70e9693SJohannes Berg * 1392d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1393d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1394d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1395d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1396d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1397d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1398d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1399d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1400d70e9693SJohannes Berg * in the wiphy structure. 1401d70e9693SJohannes Berg * 1402d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1403d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1404d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1405d70e9693SJohannes Berg * 1406d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1407d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1408d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1409d70e9693SJohannes Berg * to userspace. 1410d70e9693SJohannes Berg */ 141172bdcf34SJouni Malinen 1412704232c2SJohannes Berg /** 14132a519311SJohannes Berg * struct cfg80211_ssid - SSID description 14142a519311SJohannes Berg * @ssid: the SSID 14152a519311SJohannes Berg * @ssid_len: length of the ssid 14162a519311SJohannes Berg */ 14172a519311SJohannes Berg struct cfg80211_ssid { 14182a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 14192a519311SJohannes Berg u8 ssid_len; 14202a519311SJohannes Berg }; 14212a519311SJohannes Berg 14222a519311SJohannes Berg /** 14232a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 14242a519311SJohannes Berg * 14252a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 14262a519311SJohannes Berg * @n_ssids: number of SSIDs 14272a519311SJohannes Berg * @channels: channels to scan on. 1428ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1429dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 143070692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 143170692ad2SJouni Malinen * @ie_len: length of ie in octets 1432ed473771SSam Leffler * @flags: bit field of flags controlling operation 143334850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 14342a519311SJohannes Berg * @wiphy: the wiphy this was for 143515d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1436fd014284SJohannes Berg * @wdev: the wireless device to scan for 1437abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 14385fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1439e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 14402a519311SJohannes Berg */ 14412a519311SJohannes Berg struct cfg80211_scan_request { 14422a519311SJohannes Berg struct cfg80211_ssid *ssids; 14432a519311SJohannes Berg int n_ssids; 14442a519311SJohannes Berg u32 n_channels; 1445dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1446de95a54bSJohannes Berg const u8 *ie; 144770692ad2SJouni Malinen size_t ie_len; 1448ed473771SSam Leffler u32 flags; 14492a519311SJohannes Berg 145034850ab2SJohannes Berg u32 rates[IEEE80211_NUM_BANDS]; 145134850ab2SJohannes Berg 1452fd014284SJohannes Berg struct wireless_dev *wdev; 1453fd014284SJohannes Berg 14542a519311SJohannes Berg /* internal */ 14552a519311SJohannes Berg struct wiphy *wiphy; 145615d6030bSSam Leffler unsigned long scan_start; 14575fe231e8SJohannes Berg bool aborted, notified; 1458e9f935e3SRajkumar Manoharan bool no_cck; 14595ba63533SJohannes Berg 14605ba63533SJohannes Berg /* keep last */ 14615ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 14622a519311SJohannes Berg }; 14632a519311SJohannes Berg 14642a519311SJohannes Berg /** 1465a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1466a1f1c21cSLuciano Coelho * 1467ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1468ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1469a1f1c21cSLuciano Coelho */ 1470a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1471a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1472ea73cbceSJohannes Berg s32 rssi_thold; 1473a1f1c21cSLuciano Coelho }; 1474a1f1c21cSLuciano Coelho 1475a1f1c21cSLuciano Coelho /** 1476807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1477807f8a8cSLuciano Coelho * 1478807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1479807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1480807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1481dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1482bbe6ad6dSLuciano Coelho * @interval: interval between each scheduled scan cycle 1483807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1484807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1485ed473771SSam Leffler * @flags: bit field of flags controlling operation 1486a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1487a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1488a1f1c21cSLuciano Coelho * (others are filtered out). 1489a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1490a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1491807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1492807f8a8cSLuciano Coelho * @dev: the interface 1493077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1494807f8a8cSLuciano Coelho * @channels: channels to scan 1495ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1496ea73cbceSJohannes Berg * contains the minimum over all matchsets 1497807f8a8cSLuciano Coelho */ 1498807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1499807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1500807f8a8cSLuciano Coelho int n_ssids; 1501807f8a8cSLuciano Coelho u32 n_channels; 1502dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1503bbe6ad6dSLuciano Coelho u32 interval; 1504807f8a8cSLuciano Coelho const u8 *ie; 1505807f8a8cSLuciano Coelho size_t ie_len; 1506ed473771SSam Leffler u32 flags; 1507a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1508a1f1c21cSLuciano Coelho int n_match_sets; 1509ea73cbceSJohannes Berg s32 min_rssi_thold; 1510807f8a8cSLuciano Coelho 1511807f8a8cSLuciano Coelho /* internal */ 1512807f8a8cSLuciano Coelho struct wiphy *wiphy; 1513807f8a8cSLuciano Coelho struct net_device *dev; 151415d6030bSSam Leffler unsigned long scan_start; 1515807f8a8cSLuciano Coelho 1516807f8a8cSLuciano Coelho /* keep last */ 1517807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1518807f8a8cSLuciano Coelho }; 1519807f8a8cSLuciano Coelho 1520807f8a8cSLuciano Coelho /** 15212a519311SJohannes Berg * enum cfg80211_signal_type - signal type 15222a519311SJohannes Berg * 15232a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 15242a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 15252a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 15262a519311SJohannes Berg */ 15272a519311SJohannes Berg enum cfg80211_signal_type { 15282a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 15292a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 15302a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 15312a519311SJohannes Berg }; 15322a519311SJohannes Berg 15332a519311SJohannes Berg /** 15349caf0364SJohannes Berg * struct cfg80211_bss_ie_data - BSS entry IE data 15358cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 15369caf0364SJohannes Berg * @rcu_head: internal use, for freeing 15379caf0364SJohannes Berg * @len: length of the IEs 15380e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 15399caf0364SJohannes Berg * @data: IE data 15409caf0364SJohannes Berg */ 15419caf0364SJohannes Berg struct cfg80211_bss_ies { 15428cef2c9dSJohannes Berg u64 tsf; 15439caf0364SJohannes Berg struct rcu_head rcu_head; 15449caf0364SJohannes Berg int len; 15450e227084SJohannes Berg bool from_beacon; 15469caf0364SJohannes Berg u8 data[]; 15479caf0364SJohannes Berg }; 15489caf0364SJohannes Berg 15499caf0364SJohannes Berg /** 15502a519311SJohannes Berg * struct cfg80211_bss - BSS description 15512a519311SJohannes Berg * 15522a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 15532a519311SJohannes Berg * for use in scan results and similar. 15542a519311SJohannes Berg * 1555abe37c4bSJohannes Berg * @channel: channel this BSS is on 1556dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 15572a519311SJohannes Berg * @bssid: BSSID of the BSS 15582a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 15592a519311SJohannes Berg * @capability: the capability field in host byte order 156083c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 156183c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 156283c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 156383c7aa1aSJohannes Berg * received. It is always non-%NULL. 156434a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1565776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1566776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1567776b3580SJohannes Berg * @hidden_beacon_bss struct) 156834a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1569776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1570776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1571776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1572776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 157377965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 15742a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 15752a519311SJohannes Berg */ 15762a519311SJohannes Berg struct cfg80211_bss { 15772a519311SJohannes Berg struct ieee80211_channel *channel; 1578dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 15792a519311SJohannes Berg 15809caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 15819caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 15829caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 15839caf0364SJohannes Berg 1584776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 15852a519311SJohannes Berg 15862a519311SJohannes Berg s32 signal; 15872a519311SJohannes Berg 15889caf0364SJohannes Berg u16 beacon_interval; 15899caf0364SJohannes Berg u16 capability; 15909caf0364SJohannes Berg 15919caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 15929caf0364SJohannes Berg 15931c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 15942a519311SJohannes Berg }; 15952a519311SJohannes Berg 15962a519311SJohannes Berg /** 1597517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1598517357c6SJohannes Berg * @bss: the bss to search 1599517357c6SJohannes Berg * @ie: the IE ID 16009caf0364SJohannes Berg * 16019caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 16029caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 16030ae997dcSYacine Belkadi * Return: %NULL if not found. 1604517357c6SJohannes Berg */ 1605517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1606517357c6SJohannes Berg 1607517357c6SJohannes Berg 1608517357c6SJohannes Berg /** 1609636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1610636a5d36SJouni Malinen * 1611636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1612636a5d36SJouni Malinen * authentication. 1613636a5d36SJouni Malinen * 1614959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1615959867faSJohannes Berg * to it if it needs to keep it. 1616636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1617636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1618636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1619fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1620fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1621fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1622e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1623e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1624e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1625636a5d36SJouni Malinen */ 1626636a5d36SJouni Malinen struct cfg80211_auth_request { 162719957bb3SJohannes Berg struct cfg80211_bss *bss; 1628636a5d36SJouni Malinen const u8 *ie; 1629636a5d36SJouni Malinen size_t ie_len; 163019957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1631fffd0934SJohannes Berg const u8 *key; 1632fffd0934SJohannes Berg u8 key_len, key_idx; 1633e39e5b5eSJouni Malinen const u8 *sae_data; 1634e39e5b5eSJouni Malinen size_t sae_data_len; 1635636a5d36SJouni Malinen }; 1636636a5d36SJouni Malinen 1637636a5d36SJouni Malinen /** 16387e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 16397e7c8926SBen Greear * 16407e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1641ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1642bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 16437e7c8926SBen Greear */ 16447e7c8926SBen Greear enum cfg80211_assoc_req_flags { 16457e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1646ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1647bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 16487e7c8926SBen Greear }; 16497e7c8926SBen Greear 16507e7c8926SBen Greear /** 1651636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1652636a5d36SJouni Malinen * 1653636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1654636a5d36SJouni Malinen * (re)association. 1655959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1656959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1657959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1658959867faSJohannes Berg * association requests while already associating must be rejected. 1659636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1660636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1661dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1662b23aa676SSamuel Ortiz * @crypto: crypto settings 16633e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 16647e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 16657e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 16667e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 16677e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1668ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1669ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1670636a5d36SJouni Malinen */ 1671636a5d36SJouni Malinen struct cfg80211_assoc_request { 167219957bb3SJohannes Berg struct cfg80211_bss *bss; 16733e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1674636a5d36SJouni Malinen size_t ie_len; 1675b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 167619957bb3SJohannes Berg bool use_mfp; 16777e7c8926SBen Greear u32 flags; 16787e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 16797e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1680ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1681636a5d36SJouni Malinen }; 1682636a5d36SJouni Malinen 1683636a5d36SJouni Malinen /** 1684636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1685636a5d36SJouni Malinen * 1686636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1687636a5d36SJouni Malinen * deauthentication. 1688636a5d36SJouni Malinen * 168995de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1690636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1691636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 169219957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1693077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1694077f897aSJohannes Berg * do not set a deauth frame 1695636a5d36SJouni Malinen */ 1696636a5d36SJouni Malinen struct cfg80211_deauth_request { 169795de817bSJohannes Berg const u8 *bssid; 1698636a5d36SJouni Malinen const u8 *ie; 1699636a5d36SJouni Malinen size_t ie_len; 170019957bb3SJohannes Berg u16 reason_code; 17016863255bSStanislaw Gruszka bool local_state_change; 1702636a5d36SJouni Malinen }; 1703636a5d36SJouni Malinen 1704636a5d36SJouni Malinen /** 1705636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1706636a5d36SJouni Malinen * 1707636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1708636a5d36SJouni Malinen * disassocation. 1709636a5d36SJouni Malinen * 171019957bb3SJohannes Berg * @bss: the BSS to disassociate from 1711636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1712636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 171319957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1714d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1715d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1716636a5d36SJouni Malinen */ 1717636a5d36SJouni Malinen struct cfg80211_disassoc_request { 171819957bb3SJohannes Berg struct cfg80211_bss *bss; 1719636a5d36SJouni Malinen const u8 *ie; 1720636a5d36SJouni Malinen size_t ie_len; 172119957bb3SJohannes Berg u16 reason_code; 1722d5cdfacbSJouni Malinen bool local_state_change; 1723636a5d36SJouni Malinen }; 1724636a5d36SJouni Malinen 1725636a5d36SJouni Malinen /** 172604a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 172704a773adSJohannes Berg * 172804a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 172904a773adSJohannes Berg * method. 173004a773adSJohannes Berg * 173104a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 173204a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 173304a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 173404a773adSJohannes Berg * search for IBSSs with a different BSSID. 1735683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 173604a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 173704a773adSJohannes Berg * IBSSs to join on other channels. 173804a773adSJohannes Berg * @ie: information element(s) to include in the beacon 173904a773adSJohannes Berg * @ie_len: length of that 17408e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1741fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1742fffd0934SJohannes Berg * after joining 1743267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1744267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1745267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1746267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 17475336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 17485336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 17495336fa88SSimon Wunderlich * to operate on DFS channels. 1750fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1751dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1752803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1753803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1754803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 175504a773adSJohannes Berg */ 175604a773adSJohannes Berg struct cfg80211_ibss_params { 1757c1e5f471SJohannes Berg const u8 *ssid; 1758c1e5f471SJohannes Berg const u8 *bssid; 1759683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1760c1e5f471SJohannes Berg const u8 *ie; 176104a773adSJohannes Berg u8 ssid_len, ie_len; 17628e30bc55SJohannes Berg u16 beacon_interval; 1763fbd2c8dcSTeemu Paasikivi u32 basic_rates; 176404a773adSJohannes Berg bool channel_fixed; 1765fffd0934SJohannes Berg bool privacy; 1766267335d6SAntonio Quartulli bool control_port; 17675336fa88SSimon Wunderlich bool userspace_handles_dfs; 1768dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 1769803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1770803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 177104a773adSJohannes Berg }; 177204a773adSJohannes Berg 177304a773adSJohannes Berg /** 1774b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1775b23aa676SSamuel Ortiz * 1776b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1777b23aa676SSamuel Ortiz * authentication and association. 1778b23aa676SSamuel Ortiz * 1779b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1780b23aa676SSamuel Ortiz * on scan results) 17811df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 17821df4a510SJouni Malinen * %NULL if not specified 1783b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1784b23aa676SSamuel Ortiz * results) 17851df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 17861df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 17871df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 17881df4a510SJouni Malinen * to use. 1789b23aa676SSamuel Ortiz * @ssid: SSID 1790b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1791b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1792abe37c4bSJohannes Berg * @ie: IEs for association request 1793abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1794b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1795cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1796b23aa676SSamuel Ortiz * @crypto: crypto settings 1797fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1798fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1799fffd0934SJohannes Berg * @key: WEP key for shared key authentication 18007e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 18014486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 18024486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 18037e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 18047e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 18057e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1806ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 1807ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 1808b23aa676SSamuel Ortiz */ 1809b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1810b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 18111df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 1812664834deSJouni Malinen const u8 *bssid; 18131df4a510SJouni Malinen const u8 *bssid_hint; 1814664834deSJouni Malinen const u8 *ssid; 1815b23aa676SSamuel Ortiz size_t ssid_len; 1816b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 18174b5800feSJohannes Berg const u8 *ie; 1818b23aa676SSamuel Ortiz size_t ie_len; 1819b23aa676SSamuel Ortiz bool privacy; 1820cee00a95SJouni Malinen enum nl80211_mfp mfp; 1821b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1822fffd0934SJohannes Berg const u8 *key; 1823fffd0934SJohannes Berg u8 key_len, key_idx; 18247e7c8926SBen Greear u32 flags; 18254486ea98SBala Shanmugam int bg_scan_period; 18267e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 18277e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1828ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 1829ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 1830b23aa676SSamuel Ortiz }; 1831b23aa676SSamuel Ortiz 1832b23aa676SSamuel Ortiz /** 1833b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1834abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1835abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1836abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1837abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1838abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 18393057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 1840b9a5f8caSJouni Malinen */ 1841b9a5f8caSJouni Malinen enum wiphy_params_flags { 1842b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1843b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1844b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1845b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 184681077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 18473057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 1848b9a5f8caSJouni Malinen }; 1849b9a5f8caSJouni Malinen 18509930380fSJohannes Berg /* 18519930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 18529930380fSJohannes Berg */ 18539930380fSJohannes Berg struct cfg80211_bitrate_mask { 18549930380fSJohannes Berg struct { 18559930380fSJohannes Berg u32 legacy; 1856d1e33e65SJanusz Dziedzic u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1857204e35a9SJanusz Dziedzic u16 vht_mcs[NL80211_VHT_NSS_MAX]; 18580b9323f6SJanusz Dziedzic enum nl80211_txrate_gi gi; 18599930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 18609930380fSJohannes Berg }; 186167fbb16bSSamuel Ortiz /** 186267fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 186367fbb16bSSamuel Ortiz * 186467fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 186567fbb16bSSamuel Ortiz * caching. 186667fbb16bSSamuel Ortiz * 186767fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 186867fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 186967fbb16bSSamuel Ortiz */ 187067fbb16bSSamuel Ortiz struct cfg80211_pmksa { 1871c1e5f471SJohannes Berg const u8 *bssid; 1872c1e5f471SJohannes Berg const u8 *pmkid; 187367fbb16bSSamuel Ortiz }; 18749930380fSJohannes Berg 18757643a2c3SJohannes Berg /** 187650ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 1877ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 1878ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 1879ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 1880ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 1881bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 1882ff1b6e69SJohannes Berg * 1883ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 1884ff1b6e69SJohannes Berg * memory, free @mask only! 1885ff1b6e69SJohannes Berg */ 188650ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 1887922bd80fSJohannes Berg const u8 *mask, *pattern; 1888ff1b6e69SJohannes Berg int pattern_len; 1889bb92d199SAmitkumar Karwar int pkt_offset; 1890ff1b6e69SJohannes Berg }; 1891ff1b6e69SJohannes Berg 1892ff1b6e69SJohannes Berg /** 18932a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 18942a0e047eSJohannes Berg * 18952a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 18962a0e047eSJohannes Berg * @src: source IP address 18972a0e047eSJohannes Berg * @dst: destination IP address 18982a0e047eSJohannes Berg * @dst_mac: destination MAC address 18992a0e047eSJohannes Berg * @src_port: source port 19002a0e047eSJohannes Berg * @dst_port: destination port 19012a0e047eSJohannes Berg * @payload_len: data payload length 19022a0e047eSJohannes Berg * @payload: data payload buffer 19032a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 19042a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 19052a0e047eSJohannes Berg * @wake_len: wakeup payload match length 19062a0e047eSJohannes Berg * @wake_data: wakeup payload match data 19072a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 19082a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 19092a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 19102a0e047eSJohannes Berg */ 19112a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 19122a0e047eSJohannes Berg struct socket *sock; 19132a0e047eSJohannes Berg __be32 src, dst; 19142a0e047eSJohannes Berg u16 src_port, dst_port; 19152a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 19162a0e047eSJohannes Berg int payload_len; 19172a0e047eSJohannes Berg const u8 *payload; 19182a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 19192a0e047eSJohannes Berg u32 data_interval; 19202a0e047eSJohannes Berg u32 wake_len; 19212a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 19222a0e047eSJohannes Berg u32 tokens_size; 19232a0e047eSJohannes Berg /* must be last, variable member */ 19242a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 1925ff1b6e69SJohannes Berg }; 1926ff1b6e69SJohannes Berg 1927ff1b6e69SJohannes Berg /** 1928ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 1929ff1b6e69SJohannes Berg * 1930ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 1931ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 1932ff1b6e69SJohannes Berg * operating as normal during suspend 1933ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 1934ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 1935ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 1936ff1b6e69SJohannes Berg * @n_patterns: number of patterns 193777dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 193877dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 193977dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 194077dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 19412a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 19422a0e047eSJohannes Berg * NULL if not configured. 1943ff1b6e69SJohannes Berg */ 1944ff1b6e69SJohannes Berg struct cfg80211_wowlan { 194577dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 194677dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 194777dbbb13SJohannes Berg rfkill_release; 194850ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 19492a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 1950ff1b6e69SJohannes Berg int n_patterns; 1951ff1b6e69SJohannes Berg }; 1952ff1b6e69SJohannes Berg 1953ff1b6e69SJohannes Berg /** 1954be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 1955be29b99aSAmitkumar Karwar * 1956be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 1957be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 1958be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 1959be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 1960be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 1961be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 1962be29b99aSAmitkumar Karwar */ 1963be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 1964be29b99aSAmitkumar Karwar int delay; 1965be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 1966be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 1967be29b99aSAmitkumar Karwar int n_patterns; 1968be29b99aSAmitkumar Karwar }; 1969be29b99aSAmitkumar Karwar 1970be29b99aSAmitkumar Karwar /** 1971be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 1972be29b99aSAmitkumar Karwar * 1973be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 1974be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 1975be29b99aSAmitkumar Karwar * @n_rules: number of rules 1976be29b99aSAmitkumar Karwar */ 1977be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 1978be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 1979be29b99aSAmitkumar Karwar int n_rules; 1980be29b99aSAmitkumar Karwar }; 1981be29b99aSAmitkumar Karwar 1982be29b99aSAmitkumar Karwar /** 1983cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 1984cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 1985cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 1986cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 1987cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 1988cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 1989cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 1990cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 1991cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 1992cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 1993cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 1994cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 1995cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 1996cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 1997cd8f7cb4SJohannes Berg * it is. 19982a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 19992a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 20002a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 2001cd8f7cb4SJohannes Berg */ 2002cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2003cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2004cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 20052a0e047eSJohannes Berg rfkill_release, packet_80211, 20062a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2007cd8f7cb4SJohannes Berg s32 pattern_idx; 2008cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2009cd8f7cb4SJohannes Berg const void *packet; 2010cd8f7cb4SJohannes Berg }; 2011cd8f7cb4SJohannes Berg 2012cd8f7cb4SJohannes Berg /** 2013e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 201478f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 201578f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 201678f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2017e5497d76SJohannes Berg */ 2018e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 201978f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2020e5497d76SJohannes Berg }; 2021e5497d76SJohannes Berg 2022e5497d76SJohannes Berg /** 2023355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2024355199e0SJouni Malinen * 2025355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2026355199e0SJouni Malinen * 2027355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2028355199e0SJouni Malinen * @ie: Fast Transition IEs 2029355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2030355199e0SJouni Malinen */ 2031355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2032355199e0SJouni Malinen u16 md; 2033355199e0SJouni Malinen const u8 *ie; 2034355199e0SJouni Malinen size_t ie_len; 2035355199e0SJouni Malinen }; 2036355199e0SJouni Malinen 2037355199e0SJouni Malinen /** 2038b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2039b176e629SAndrei Otcheretianski * 2040b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2041b176e629SAndrei Otcheretianski * 2042b176e629SAndrei Otcheretianski * @chan: channel to use 2043b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2044b176e629SAndrei Otcheretianski * @wait: duration for ROC 2045b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2046b176e629SAndrei Otcheretianski * @len: buffer length 2047b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2048b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 204934d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 205034d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2051b176e629SAndrei Otcheretianski */ 2052b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2053b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2054b176e629SAndrei Otcheretianski bool offchan; 2055b176e629SAndrei Otcheretianski unsigned int wait; 2056b176e629SAndrei Otcheretianski const u8 *buf; 2057b176e629SAndrei Otcheretianski size_t len; 2058b176e629SAndrei Otcheretianski bool no_cck; 2059b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 206034d22ce2SAndrei Otcheretianski int n_csa_offsets; 206134d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2062b176e629SAndrei Otcheretianski }; 2063b176e629SAndrei Otcheretianski 2064b176e629SAndrei Otcheretianski /** 2065fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2066fa9ffc74SKyeyoon Park * 2067fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2068fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2069fa9ffc74SKyeyoon Park */ 2070fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2071fa9ffc74SKyeyoon Park u8 dscp; 2072fa9ffc74SKyeyoon Park u8 up; 2073fa9ffc74SKyeyoon Park }; 2074fa9ffc74SKyeyoon Park 2075fa9ffc74SKyeyoon Park /** 2076fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2077fa9ffc74SKyeyoon Park * 2078fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2079fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2080fa9ffc74SKyeyoon Park */ 2081fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2082fa9ffc74SKyeyoon Park u8 low; 2083fa9ffc74SKyeyoon Park u8 high; 2084fa9ffc74SKyeyoon Park }; 2085fa9ffc74SKyeyoon Park 2086fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2087fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2088fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2089fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2090fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2091fa9ffc74SKyeyoon Park 2092fa9ffc74SKyeyoon Park /** 2093fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2094fa9ffc74SKyeyoon Park * 2095fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2096fa9ffc74SKyeyoon Park * 2097fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2098fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2099fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2100fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2101fa9ffc74SKyeyoon Park */ 2102fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2103fa9ffc74SKyeyoon Park u8 num_des; 2104fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2105fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2106fa9ffc74SKyeyoon Park }; 2107fa9ffc74SKyeyoon Park 2108fa9ffc74SKyeyoon Park /** 2109704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2110704232c2SJohannes Berg * 2111704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2112704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2113704232c2SJohannes Berg * 2114704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2115704232c2SJohannes Berg * on success or a negative error code. 2116704232c2SJohannes Berg * 211743fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 211843fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 211943fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 212043fb45cbSJohannes Berg * 2121ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2122ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2123ff1b6e69SJohannes Berg * configured for the device. 21240378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 21256d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 21266d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 21276d52563fSJohannes Berg * the device. 21280378b3f1SJohannes Berg * 212960719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2130463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 213184efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 213298104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 213398104fdeSJohannes Berg * also set the address member in the wdev. 2134704232c2SJohannes Berg * 213584efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 213655682965SJohannes Berg * 213760719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 213860719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 213955682965SJohannes Berg * 214041ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 214141ade00fSJohannes Berg * when adding a group key. 214241ade00fSJohannes Berg * 214341ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 214441ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 214541ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2146e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2147e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 214841ade00fSJohannes Berg * 214941ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2150e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 215141ade00fSJohannes Berg * 215241ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2153ed1b6cc7SJohannes Berg * 21543cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 21553cfcf6acSJouni Malinen * 2156e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2157e5497d76SJohannes Berg * 2158c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2159c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2160c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2161c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 21625727ef1bSJohannes Berg * 21635727ef1bSJohannes Berg * @add_station: Add a new station. 216489c771e5SJouni Malinen * @del_station: Remove a station 2165bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2166bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2167bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 216877ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 216977ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2170abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2171abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2172abe37c4bSJohannes Berg * 2173abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2174abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2175abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2176abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2177abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 217866be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 217966be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2180f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 21818d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2182f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 21838d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 21842ec600d6SLuis Carlos Cobo * 218524bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 218693da9cc1Scolin@cozybit.com * 218724bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 218893da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 218993da9cc1Scolin@cozybit.com * set, and which to leave alone. 219093da9cc1Scolin@cozybit.com * 21919f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 219231888487SJouni Malinen * 219331888487SJouni Malinen * @set_txq_params: Set TX queue parameters 219472bdcf34SJouni Malinen * 2195e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2196e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2197e8c9bd5bSJohannes Berg * join the mesh instead. 2198e8c9bd5bSJohannes Berg * 2199e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2200e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2201e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2202e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 22039aed3cc1SJouni Malinen * 22042a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 22052a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 22062a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 22072a519311SJohannes Berg * the scan/scan_done bracket too. 2208636a5d36SJouni Malinen * 2209636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 22108d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2211636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 22128d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2213636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 22148d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2215636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 22168d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 221704a773adSJohannes Berg * 2218b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2219b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 2220b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 2221b23aa676SSamuel Ortiz * with the status from the AP. 22228d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2223b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 22248d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2225b23aa676SSamuel Ortiz * 222604a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 222704a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 222804a773adSJohannes Berg * to a merge. 22298d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 223004a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 22318d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2232b9a5f8caSJouni Malinen * 2233f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2234f4e583c8SAntonio Quartulli * MESH mode) 2235f4e583c8SAntonio Quartulli * 2236b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2237b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2238b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2239b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 22407643a2c3SJohannes Berg * 22411432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2242c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2243c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2244c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2245c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 22467643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 22471f87f7d3SJohannes Berg * return 0 if successful 22481f87f7d3SJohannes Berg * 2249abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2250abe37c4bSJohannes Berg * 22511f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 22521f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2253aff89a9bSJohannes Berg * 225461fa713cSHolger Schurig * @dump_survey: get site survey information. 225561fa713cSHolger Schurig * 22569588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 22579588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 22589588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 22599588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 22609588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 22619588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 22629588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 22639588bbd5SJouni Malinen * the duration value. 2264f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2265f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2266f7ca38dfSJohannes Berg * frame on another channel 22679588bbd5SJouni Malinen * 2268fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 226971063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 227071063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 227171063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 227271063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 227371063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 227471063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 227567fbb16bSSamuel Ortiz * 2276abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2277abe37c4bSJohannes Berg * 227867fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 227967fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 228067fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 228167fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 228267fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 22839043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 22849043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2285d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 228684f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 228784f10708SThomas Pedersen * thresholds. 2288807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2289d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2290d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2291d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2292d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2293d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2294d9b8396aSJohannes Berg * method returns 0.) 229567fbb16bSSamuel Ortiz * 2296271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 2297271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 2298271733cfSJohannes Berg * concurrently with itself. 2299547025d5SBruno Randolf * 2300547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2301547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2302547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2303547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2304547025d5SBruno Randolf * 2305547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 23063677713bSJohn W. Linville * 2307109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2308109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 23097f6cf311SJohannes Berg * 23107f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 23117f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 23121d9d9213SSimon Wunderlich * 23131d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2314d6199218SBen Greear * 23155b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 23165b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 23175b7ccaf3SJohannes Berg * current monitoring channel. 231898104fdeSJohannes Berg * 231998104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 232098104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 232177765eafSVasanthakumar Thiagarajan * 232277765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 232377765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 232477765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 232577765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 232677765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 232777765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 232804f39047SSimon Wunderlich * 232904f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 23308bf24293SJouni Malinen * 23318bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 23328bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 23338bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 23345de17984SArend van Spriel * 23355de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 23365de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 23375de17984SArend van Spriel * driver can take the most appropriate actions. 23385de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 23395de17984SArend van Spriel * reliability. This operation can not fail. 2340be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 234116ef1fe2SSimon Wunderlich * 234297dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 234397dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 234497dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 234597dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 234697dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 234797dc94f1SMichal Kazior * as soon as possible. 2348fa9ffc74SKyeyoon Park * 2349fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2350e16821bcSJouni Malinen * 2351e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2352e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2353e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2354960d01acSJohannes Berg * 2355960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2356960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2357960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2358960d01acSJohannes Berg * account. 2359960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2360960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2361960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2362960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2363960d01acSJohannes Berg * rejected) 2364960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 23656e0bd6c3SRostislav Lisovy * 23666e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 23676e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 23686e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 23696e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 2370*1057d35eSArik Nemtsov * 2371*1057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 2372*1057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 2373*1057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 2374*1057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 2375*1057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2376704232c2SJohannes Berg */ 2377704232c2SJohannes Berg struct cfg80211_ops { 2378ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 23790378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 23806d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 23810378b3f1SJohannes Berg 238284efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2383552bff0cSJohannes Berg const char *name, 2384f9e10ce4SJohannes Berg enum nl80211_iftype type, 2385f9e10ce4SJohannes Berg u32 *flags, 23862ec600d6SLuis Carlos Cobo struct vif_params *params); 238784efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 238884efbb84SJohannes Berg struct wireless_dev *wdev); 2389e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2390e36d56b6SJohannes Berg struct net_device *dev, 23912ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 23922ec600d6SLuis Carlos Cobo struct vif_params *params); 239341ade00fSJohannes Berg 239441ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2395e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 239641ade00fSJohannes Berg struct key_params *params); 239741ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2398e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2399e31b8213SJohannes Berg void *cookie, 240041ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 240141ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2402e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 240341ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 240441ade00fSJohannes Berg struct net_device *netdev, 2405dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 24063cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 24073cfcf6acSJouni Malinen struct net_device *netdev, 24083cfcf6acSJouni Malinen u8 key_index); 2409ed1b6cc7SJohannes Berg 24108860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 24118860020eSJohannes Berg struct cfg80211_ap_settings *settings); 24128860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 24138860020eSJohannes Berg struct cfg80211_beacon_data *info); 24148860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 24155727ef1bSJohannes Berg 24165727ef1bSJohannes Berg 24175727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 24183b3a0162SJohannes Berg const u8 *mac, 24193b3a0162SJohannes Berg struct station_parameters *params); 24205727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 242189c771e5SJouni Malinen struct station_del_parameters *params); 24225727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 24233b3a0162SJohannes Berg const u8 *mac, 24243b3a0162SJohannes Berg struct station_parameters *params); 2425fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 24263b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 24272ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 24282ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 24292ec600d6SLuis Carlos Cobo 24302ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 24313b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 24322ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 24333b3a0162SJohannes Berg const u8 *dst); 24342ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 24353b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 24362ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 24373b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 24382ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 24392ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 24402ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 244166be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 244266be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 244366be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 244466be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 244566be7d2bSHenning Rogge struct mpath_info *pinfo); 244624bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 244793da9cc1Scolin@cozybit.com struct net_device *dev, 244893da9cc1Scolin@cozybit.com struct mesh_config *conf); 244924bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 245029cbe68cSJohannes Berg struct net_device *dev, u32 mask, 245129cbe68cSJohannes Berg const struct mesh_config *nconf); 245229cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 245329cbe68cSJohannes Berg const struct mesh_config *conf, 245429cbe68cSJohannes Berg const struct mesh_setup *setup); 245529cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 245629cbe68cSJohannes Berg 24576e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 24586e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 24596e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 24606e0bd6c3SRostislav Lisovy 24619f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 24629f1ba906SJouni Malinen struct bss_parameters *params); 246331888487SJouni Malinen 2464f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 246531888487SJouni Malinen struct ieee80211_txq_params *params); 246672bdcf34SJouni Malinen 2467e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2468e8c9bd5bSJohannes Berg struct net_device *dev, 2469e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2470e8c9bd5bSJohannes Berg 2471e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2472683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 24739aed3cc1SJouni Malinen 2474fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 24752a519311SJohannes Berg struct cfg80211_scan_request *request); 2476636a5d36SJouni Malinen 2477636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2478636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2479636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2480636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2481636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 248263c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2483636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 248463c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 248504a773adSJohannes Berg 2486b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2487b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2488b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2489b23aa676SSamuel Ortiz u16 reason_code); 2490b23aa676SSamuel Ortiz 249104a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 249204a773adSJohannes Berg struct cfg80211_ibss_params *params); 249304a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2494b9a5f8caSJouni Malinen 2495f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 2496f4e583c8SAntonio Quartulli int rate[IEEE80211_NUM_BANDS]); 2497f4e583c8SAntonio Quartulli 2498b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 24997643a2c3SJohannes Berg 2500c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2501fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2502c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2503c8442118SJohannes Berg int *dbm); 25041f87f7d3SJohannes Berg 2505ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2506388ac775SJohannes Berg const u8 *addr); 2507ab737a4fSJohannes Berg 25081f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2509aff89a9bSJohannes Berg 2510aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2511fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2512fc73f11fSDavid Spinadel void *data, int len); 251371063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 251471063f0eSWey-Yi Guy struct netlink_callback *cb, 251571063f0eSWey-Yi Guy void *data, int len); 2516aff89a9bSJohannes Berg #endif 2517bc92afd9SJohannes Berg 25189930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 25199930380fSJohannes Berg struct net_device *dev, 25209930380fSJohannes Berg const u8 *peer, 25219930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 25229930380fSJohannes Berg 252361fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 252461fa713cSHolger Schurig int idx, struct survey_info *info); 252561fa713cSHolger Schurig 252667fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 252767fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 252867fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 252967fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 253067fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 253167fbb16bSSamuel Ortiz 25329588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 253371bbc994SJohannes Berg struct wireless_dev *wdev, 25349588bbd5SJouni Malinen struct ieee80211_channel *chan, 25359588bbd5SJouni Malinen unsigned int duration, 25369588bbd5SJouni Malinen u64 *cookie); 25379588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 253871bbc994SJohannes Berg struct wireless_dev *wdev, 25399588bbd5SJouni Malinen u64 cookie); 25409588bbd5SJouni Malinen 254171bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2542b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2543b176e629SAndrei Otcheretianski u64 *cookie); 2544f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 254571bbc994SJohannes Berg struct wireless_dev *wdev, 2546f7ca38dfSJohannes Berg u64 cookie); 2547026331c4SJouni Malinen 2548bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2549bc92afd9SJohannes Berg bool enabled, int timeout); 2550d6dc1a38SJuuso Oikarinen 2551d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2552d6dc1a38SJuuso Oikarinen struct net_device *dev, 2553d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2554271733cfSJohannes Berg 255584f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 255684f10708SThomas Pedersen struct net_device *dev, 255784f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 255884f10708SThomas Pedersen 2559271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 256071bbc994SJohannes Berg struct wireless_dev *wdev, 2561271733cfSJohannes Berg u16 frame_type, bool reg); 2562afe0cbf8SBruno Randolf 2563afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2564afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 25653677713bSJohn W. Linville 2566807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2567807f8a8cSLuciano Coelho struct net_device *dev, 2568807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 256985a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2570e5497d76SJohannes Berg 2571e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2572e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2573109086ceSArik Nemtsov 2574109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 25753b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2576df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 257731fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2578109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 25793b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 25807f6cf311SJohannes Berg 25817f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 25827f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2583e999882aSJohannes Berg 25841d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 25851d9d9213SSimon Wunderlich struct net_device *dev, 25861d9d9213SSimon Wunderlich u16 noack_map); 25871d9d9213SSimon Wunderlich 2588683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 25895b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2590683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 259198104fdeSJohannes Berg 259298104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 259398104fdeSJohannes Berg struct wireless_dev *wdev); 259498104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 259598104fdeSJohannes Berg struct wireless_dev *wdev); 259677765eafSVasanthakumar Thiagarajan 259777765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 259877765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 259904f39047SSimon Wunderlich 260004f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 260104f39047SSimon Wunderlich struct net_device *dev, 260231559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 260331559f35SJanusz Dziedzic u32 cac_time_ms); 2604355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2605355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 26065de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 26075de17984SArend van Spriel struct wireless_dev *wdev, 26085de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 26095de17984SArend van Spriel u16 duration); 26105de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 26115de17984SArend van Spriel struct wireless_dev *wdev); 2612be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 2613be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 261416ef1fe2SSimon Wunderlich 261516ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 261616ef1fe2SSimon Wunderlich struct net_device *dev, 261716ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 2618e16821bcSJouni Malinen 2619fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 2620fa9ffc74SKyeyoon Park struct net_device *dev, 2621fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 2622e16821bcSJouni Malinen 2623e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2624e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 2625960d01acSJohannes Berg 2626960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2627960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 2628960d01acSJohannes Berg u16 admitted_time); 2629960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2630960d01acSJohannes Berg u8 tsid, const u8 *peer); 2631*1057d35eSArik Nemtsov 2632*1057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 2633*1057d35eSArik Nemtsov struct net_device *dev, 2634*1057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 2635*1057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 2636*1057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 2637*1057d35eSArik Nemtsov struct net_device *dev, 2638*1057d35eSArik Nemtsov const u8 *addr); 2639704232c2SJohannes Berg }; 2640704232c2SJohannes Berg 2641d3236553SJohannes Berg /* 2642d3236553SJohannes Berg * wireless hardware and networking interfaces structures 2643d3236553SJohannes Berg * and registration/helper functions 2644d3236553SJohannes Berg */ 2645d3236553SJohannes Berg 2646d3236553SJohannes Berg /** 26475be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 26485be83de5SJohannes Berg * 26495be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 26505be83de5SJohannes Berg * wiphy at all 26515be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 26525be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 26535be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 26545be83de5SJohannes Berg * reason to override the default 26559bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 26569bc383deSJohannes Berg * on a VLAN interface) 26579bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 2658c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 2659c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 2660c0692b8fSJohannes Berg * control_port_no_encrypt flag. 2661e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 266215d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 266315d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 26641ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 2665f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 2666f4b34b55SVivek Natarajan * firmware. 2667cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 2668109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 2669109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 2670109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 2671109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 2672109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 2673109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 2674562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 26755e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 26765e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 26775e760230SJohannes Berg * cfg80211_report_obss_beacon(). 267887bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 267987bbbe22SArik Nemtsov * responds to probe-requests in hardware. 26807c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 26817c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 26822f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 268316ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 268416ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 26855be83de5SJohannes Berg */ 26865be83de5SJohannes Berg enum wiphy_flags { 2687723e73acSJohannes Berg /* use hole at 0 */ 2688a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 2689a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 26905be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 26915be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 26929bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 26939bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 2694c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 2695309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 269615d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 2697807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 26988e8b41f9SJohannes Berg /* use hole at 12 */ 2699f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 2700cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 2701109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 2702109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 2703562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 27045e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 270587bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 27067c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 27077c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 27082f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 270916ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 27107527a782SJohannes Berg }; 27117527a782SJohannes Berg 27127527a782SJohannes Berg /** 27137527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 27147527a782SJohannes Berg * @max: maximum number of interfaces of these types 27157527a782SJohannes Berg * @types: interface types (bits) 27167527a782SJohannes Berg */ 27177527a782SJohannes Berg struct ieee80211_iface_limit { 27187527a782SJohannes Berg u16 max; 27197527a782SJohannes Berg u16 types; 27207527a782SJohannes Berg }; 27217527a782SJohannes Berg 27227527a782SJohannes Berg /** 27237527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 27247527a782SJohannes Berg * @limits: limits for the given interface types 27257527a782SJohannes Berg * @n_limits: number of limitations 27267527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 27277527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 27287527a782SJohannes Berg * group 27297527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 27307527a782SJohannes Berg * between infrastructure and AP types must match. This is required 27317527a782SJohannes Berg * only in special cases. 273211c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 27338c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 27347527a782SJohannes Berg * 2735b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 2736b80edbc1SLuciano Coelho * combinations it supports concurrently. 27377527a782SJohannes Berg * 2738b80edbc1SLuciano Coelho * Examples: 2739b80edbc1SLuciano Coelho * 2740b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 27417527a782SJohannes Berg * 27427527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 27437527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 27447527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 27457527a782SJohannes Berg * }; 27467527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 27477527a782SJohannes Berg * .limits = limits1, 27487527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 27497527a782SJohannes Berg * .max_interfaces = 2, 27507527a782SJohannes Berg * .beacon_int_infra_match = true, 27517527a782SJohannes Berg * }; 27527527a782SJohannes Berg * 27537527a782SJohannes Berg * 2754b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 27557527a782SJohannes Berg * 27567527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 27577527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 27587527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 27597527a782SJohannes Berg * }; 27607527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 27617527a782SJohannes Berg * .limits = limits2, 27627527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 27637527a782SJohannes Berg * .max_interfaces = 8, 27647527a782SJohannes Berg * .num_different_channels = 1, 27657527a782SJohannes Berg * }; 27667527a782SJohannes Berg * 27677527a782SJohannes Berg * 2768b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2769b80edbc1SLuciano Coelho * 27707527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 27717527a782SJohannes Berg * 27727527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 27737527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 27747527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 27757527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 27767527a782SJohannes Berg * }; 27777527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 27787527a782SJohannes Berg * .limits = limits3, 27797527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 27807527a782SJohannes Berg * .max_interfaces = 4, 27817527a782SJohannes Berg * .num_different_channels = 2, 27827527a782SJohannes Berg * }; 27837527a782SJohannes Berg */ 27847527a782SJohannes Berg struct ieee80211_iface_combination { 27857527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 27867527a782SJohannes Berg u32 num_different_channels; 27877527a782SJohannes Berg u16 max_interfaces; 27887527a782SJohannes Berg u8 n_limits; 27897527a782SJohannes Berg bool beacon_int_infra_match; 279011c4a075SSimon Wunderlich u8 radar_detect_widths; 27918c48b50aSFelix Fietkau u8 radar_detect_regions; 27925be83de5SJohannes Berg }; 27935be83de5SJohannes Berg 27942e161f78SJohannes Berg struct ieee80211_txrx_stypes { 27952e161f78SJohannes Berg u16 tx, rx; 27962e161f78SJohannes Berg }; 27972e161f78SJohannes Berg 27985be83de5SJohannes Berg /** 2799ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 2800ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 2801ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 2802ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 2803ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 2804ff1b6e69SJohannes Berg * packet should be preserved in that case 2805ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 2806ff1b6e69SJohannes Berg * (see nl80211.h) 2807ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 280877dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 280977dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 281077dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 281177dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 281277dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 2813ff1b6e69SJohannes Berg */ 2814ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 2815ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 2816ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 2817ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 281877dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 281977dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 282077dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 282177dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 282277dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 2823ff1b6e69SJohannes Berg }; 2824ff1b6e69SJohannes Berg 28252a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 28262a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 28272a0e047eSJohannes Berg u32 data_payload_max; 28282a0e047eSJohannes Berg u32 data_interval_max; 28292a0e047eSJohannes Berg u32 wake_payload_max; 28302a0e047eSJohannes Berg bool seq; 28312a0e047eSJohannes Berg }; 28322a0e047eSJohannes Berg 2833ff1b6e69SJohannes Berg /** 2834ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 2835ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 2836ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 2837ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 2838ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 2839ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 2840bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 28412a0e047eSJohannes Berg * @tcp: TCP wakeup support information 2842ff1b6e69SJohannes Berg */ 2843ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 2844ff1b6e69SJohannes Berg u32 flags; 2845ff1b6e69SJohannes Berg int n_patterns; 2846ff1b6e69SJohannes Berg int pattern_max_len; 2847ff1b6e69SJohannes Berg int pattern_min_len; 2848bb92d199SAmitkumar Karwar int max_pkt_offset; 28492a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 2850ff1b6e69SJohannes Berg }; 2851ff1b6e69SJohannes Berg 2852ff1b6e69SJohannes Berg /** 2853be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 2854be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 2855be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 2856be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 2857be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 2858be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 2859be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 2860be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 2861be29b99aSAmitkumar Karwar */ 2862be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 2863be29b99aSAmitkumar Karwar int n_rules; 2864be29b99aSAmitkumar Karwar int max_delay; 2865be29b99aSAmitkumar Karwar int n_patterns; 2866be29b99aSAmitkumar Karwar int pattern_max_len; 2867be29b99aSAmitkumar Karwar int pattern_min_len; 2868be29b99aSAmitkumar Karwar int max_pkt_offset; 2869be29b99aSAmitkumar Karwar }; 2870be29b99aSAmitkumar Karwar 2871be29b99aSAmitkumar Karwar /** 2872ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 2873ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 2874ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 2875ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 2876ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 2877ad7e718cSJohannes Berg */ 2878ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 2879ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 2880ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 2881ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 2882ad7e718cSJohannes Berg }; 2883ad7e718cSJohannes Berg 2884ad7e718cSJohannes Berg /** 2885ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 2886ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 2887ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 2888ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 2889ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 2890ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 2891ad7e718cSJohannes Berg */ 2892ad7e718cSJohannes Berg struct wiphy_vendor_command { 2893ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 2894ad7e718cSJohannes Berg u32 flags; 2895ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 2896ad7e718cSJohannes Berg const void *data, int data_len); 2897ad7e718cSJohannes Berg }; 2898ad7e718cSJohannes Berg 2899ad7e718cSJohannes Berg /** 29005be83de5SJohannes Berg * struct wiphy - wireless hardware description 29012784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 29022784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 29032784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 2904d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 2905d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 2906d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 2907d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 2908d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 2909d3236553SJohannes Berg * @cipher_suites: supported cipher suites 2910d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 2911b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 2912b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 2913b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 2914b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 2915b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 2916abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 2917ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 2918ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 2919ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 29200fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 2921ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 2922ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 2923ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 2924ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 2925ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 2926ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 2927ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 2928ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 2929fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 2930fd235913SRandy Dunlap * unregister hardware 2931abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 2932abe37c4bSJohannes Berg * automatically on wiphy renames 2933abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 29344a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 2935abe37c4bSJohannes Berg * @wext: wireless extension handlers 2936abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 2937abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 2938abe37c4bSJohannes Berg * must be set by driver 29397527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 29407527a782SJohannes Berg * list single interface types. 29417527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 29427527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 29437527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 2944abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 2945a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 2946a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 29471f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 2948abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 2949abe37c4bSJohannes Berg * this variable determines its size 2950abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 2951abe37c4bSJohannes Berg * any given scan 295293b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 295393b6aa69SLuciano Coelho * for in any given scheduled scan 2954a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 2955a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 2956a1f1c21cSLuciano Coelho * supported. 2957abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 2958abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 2959abe37c4bSJohannes Berg * include fixed IEs like supported rates 29605a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 29615a865badSLuciano Coelho * scans 2962abe37c4bSJohannes Berg * @coverage_class: current coverage class 2963abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 2964abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 2965abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 2966abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 2967abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 2968abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 29692e161f78SJohannes Berg * 29702e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 29712e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 29722e161f78SJohannes Berg * type 2973a7ffac95SBruno Randolf * 29747f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 29757f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 29767f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 29777f531e03SBruno Randolf * 29787f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 29797f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 29807f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 2981a293911dSJohannes Berg * 298215f0ebc2SRandy Dunlap * @probe_resp_offload: 298315f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 298415f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 298515f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 298615f0ebc2SRandy Dunlap * 2987a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 2988a293911dSJohannes Berg * may request, if implemented. 2989ff1b6e69SJohannes Berg * 2990ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 29916abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 29926abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 29936abb9cb9SJohannes Berg * to the suspend() operation instead. 2994562a7480SJohannes Berg * 2995562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 29967e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 29977e7c8926SBen Greear * If null, then none can be over-ridden. 2998ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 2999ee2aca34SJohannes Berg * If null, then none can be over-ridden. 300077765eafSVasanthakumar Thiagarajan * 300177765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 300277765eafSVasanthakumar Thiagarajan * supports for ACL. 3003a50df0c4SJohannes Berg * 3004a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3005a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3006a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3007a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3008a50df0c4SJohannes Berg * 802.11-2012 8.4.2.29 for the defined fields. 3009a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3010a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3011be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3012ad7e718cSJohannes Berg * 3013ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3014ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3015567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3016567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3017b43504cfSJouni Malinen * 3018b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3019b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3020b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3021b43504cfSJouni Malinen * some cases, but may not always reach. 3022c2e4323bSLuciano Coelho * 3023c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3024c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3025c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3026c2e4323bSLuciano Coelho * infinite. 302767af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 302867af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 302967af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 303067af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 303167af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 303267af9811SEmmanuel Grumbach * This value should be set in MHz. 3033d3236553SJohannes Berg */ 3034d3236553SJohannes Berg struct wiphy { 3035d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3036d3236553SJohannes Berg 3037ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3038d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3039ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3040ef15aac6SJohannes Berg 3041ef15aac6SJohannes Berg struct mac_address *addresses; 3042d3236553SJohannes Berg 30432e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 30442e161f78SJohannes Berg 30457527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 30467527a782SJohannes Berg int n_iface_combinations; 30477527a782SJohannes Berg u16 software_iftypes; 30487527a782SJohannes Berg 30492e161f78SJohannes Berg u16 n_addresses; 30502e161f78SJohannes Berg 3051d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3052d3236553SJohannes Berg u16 interface_modes; 3053d3236553SJohannes Berg 305477765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 305577765eafSVasanthakumar Thiagarajan 3056a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3057463d0183SJohannes Berg 3058562a7480SJohannes Berg u32 ap_sme_capa; 3059562a7480SJohannes Berg 3060d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3061d3236553SJohannes Berg 3062d3236553SJohannes Berg int bss_priv_size; 3063d3236553SJohannes Berg u8 max_scan_ssids; 306493b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3065a1f1c21cSLuciano Coelho u8 max_match_sets; 3066d3236553SJohannes Berg u16 max_scan_ie_len; 30675a865badSLuciano Coelho u16 max_sched_scan_ie_len; 3068d3236553SJohannes Berg 3069d3236553SJohannes Berg int n_cipher_suites; 3070d3236553SJohannes Berg const u32 *cipher_suites; 3071d3236553SJohannes Berg 3072b9a5f8caSJouni Malinen u8 retry_short; 3073b9a5f8caSJouni Malinen u8 retry_long; 3074b9a5f8caSJouni Malinen u32 frag_threshold; 3075b9a5f8caSJouni Malinen u32 rts_threshold; 307681077e82SLukáš Turek u8 coverage_class; 3077b9a5f8caSJouni Malinen 307881135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3079dfce95f5SKalle Valo u32 hw_version; 3080dfce95f5SKalle Valo 3081dfb89c56SJohannes Berg #ifdef CONFIG_PM 3082964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 30836abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3084dfb89c56SJohannes Berg #endif 3085ff1b6e69SJohannes Berg 3086a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3087a293911dSJohannes Berg 308867fbb16bSSamuel Ortiz u8 max_num_pmkids; 308967fbb16bSSamuel Ortiz 30907f531e03SBruno Randolf u32 available_antennas_tx; 30917f531e03SBruno Randolf u32 available_antennas_rx; 3092a7ffac95SBruno Randolf 309387bbbe22SArik Nemtsov /* 309487bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 309587bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 309687bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 309787bbbe22SArik Nemtsov */ 309887bbbe22SArik Nemtsov u32 probe_resp_offload; 309987bbbe22SArik Nemtsov 3100a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3101a50df0c4SJohannes Berg u8 extended_capabilities_len; 3102a50df0c4SJohannes Berg 3103d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3104d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3105d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3106d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3107d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3108cf5aa2f1SDavid Kilroy const void *privid; 3109d3236553SJohannes Berg 3110d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 3111d3236553SJohannes Berg 3112d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 31130c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3114d3236553SJohannes Berg struct regulatory_request *request); 3115d3236553SJohannes Berg 3116d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3117d3236553SJohannes Berg 3118458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3119d3236553SJohannes Berg 3120d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3121d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3122d3236553SJohannes Berg struct device dev; 3123d3236553SJohannes Berg 3124ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3125ecb44335SStanislaw Gruszka bool registered; 3126ecb44335SStanislaw Gruszka 3127d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3128d3236553SJohannes Berg struct dentry *debugfsdir; 3129d3236553SJohannes Berg 31307e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3131ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 31327e7c8926SBen Greear 3133463d0183SJohannes Berg #ifdef CONFIG_NET_NS 3134463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 3135463d0183SJohannes Berg struct net *_net; 3136463d0183SJohannes Berg #endif 3137463d0183SJohannes Berg 31383d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 31393d23e349SJohannes Berg const struct iw_handler_def *wext; 31403d23e349SJohannes Berg #endif 31413d23e349SJohannes Berg 3142be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3143be29b99aSAmitkumar Karwar 3144ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3145567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3146567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3147ad7e718cSJohannes Berg 3148b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3149b43504cfSJouni Malinen 31509a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 315167af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 31529a774c78SAndrei Otcheretianski 31531c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3154d3236553SJohannes Berg }; 3155d3236553SJohannes Berg 3156463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3157463d0183SJohannes Berg { 3158c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3159463d0183SJohannes Berg } 3160463d0183SJohannes Berg 3161463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3162463d0183SJohannes Berg { 3163c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3164463d0183SJohannes Berg } 3165463d0183SJohannes Berg 3166d3236553SJohannes Berg /** 3167d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3168d3236553SJohannes Berg * 3169d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 31700ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3171d3236553SJohannes Berg */ 3172d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3173d3236553SJohannes Berg { 3174d3236553SJohannes Berg BUG_ON(!wiphy); 3175d3236553SJohannes Berg return &wiphy->priv; 3176d3236553SJohannes Berg } 3177d3236553SJohannes Berg 3178d3236553SJohannes Berg /** 3179f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3180f1f74825SDavid Kilroy * 3181f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 31820ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3183f1f74825SDavid Kilroy */ 3184f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3185f1f74825SDavid Kilroy { 3186f1f74825SDavid Kilroy BUG_ON(!priv); 3187f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3188f1f74825SDavid Kilroy } 3189f1f74825SDavid Kilroy 3190f1f74825SDavid Kilroy /** 3191d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3192d3236553SJohannes Berg * 3193d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3194d3236553SJohannes Berg * @dev: The device to parent it to 3195d3236553SJohannes Berg */ 3196d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3197d3236553SJohannes Berg { 3198d3236553SJohannes Berg wiphy->dev.parent = dev; 3199d3236553SJohannes Berg } 3200d3236553SJohannes Berg 3201d3236553SJohannes Berg /** 3202d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3203d3236553SJohannes Berg * 3204d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 32050ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3206d3236553SJohannes Berg */ 3207d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3208d3236553SJohannes Berg { 3209d3236553SJohannes Berg return wiphy->dev.parent; 3210d3236553SJohannes Berg } 3211d3236553SJohannes Berg 3212d3236553SJohannes Berg /** 3213d3236553SJohannes Berg * wiphy_name - get wiphy name 3214d3236553SJohannes Berg * 3215d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 32160ae997dcSYacine Belkadi * Return: The name of @wiphy. 3217d3236553SJohannes Berg */ 3218e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3219d3236553SJohannes Berg { 3220d3236553SJohannes Berg return dev_name(&wiphy->dev); 3221d3236553SJohannes Berg } 3222d3236553SJohannes Berg 3223d3236553SJohannes Berg /** 32241998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 32251998d90aSBen Greear * 32261998d90aSBen Greear * @ops: The configuration operations for this device 32271998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 32281998d90aSBen Greear * @requested_name: Request a particular name. 32291998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 32301998d90aSBen Greear * 32311998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 32321998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 32331998d90aSBen Greear * 32341998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 32351998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 32361998d90aSBen Greear */ 32371998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 32381998d90aSBen Greear const char *requested_name); 32391998d90aSBen Greear 32401998d90aSBen Greear /** 3241d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3242d3236553SJohannes Berg * 3243d3236553SJohannes Berg * @ops: The configuration operations for this device 3244d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3245d3236553SJohannes Berg * 3246d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3247d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3248d3236553SJohannes Berg * 32490ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 32500ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3251d3236553SJohannes Berg */ 32521998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 32531998d90aSBen Greear int sizeof_priv) 32541998d90aSBen Greear { 32551998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 32561998d90aSBen Greear } 3257d3236553SJohannes Berg 3258d3236553SJohannes Berg /** 3259d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3260d3236553SJohannes Berg * 3261d3236553SJohannes Berg * @wiphy: The wiphy to register. 3262d3236553SJohannes Berg * 32630ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3264d3236553SJohannes Berg */ 326510dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3266d3236553SJohannes Berg 3267d3236553SJohannes Berg /** 3268d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3269d3236553SJohannes Berg * 3270d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3271d3236553SJohannes Berg * 3272d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3273d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3274d3236553SJohannes Berg * request that is being handled. 3275d3236553SJohannes Berg */ 327610dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3277d3236553SJohannes Berg 3278d3236553SJohannes Berg /** 3279d3236553SJohannes Berg * wiphy_free - free wiphy 3280d3236553SJohannes Berg * 3281d3236553SJohannes Berg * @wiphy: The wiphy to free 3282d3236553SJohannes Berg */ 328310dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3284d3236553SJohannes Berg 3285fffd0934SJohannes Berg /* internal structs */ 32866829c878SJohannes Berg struct cfg80211_conn; 328719957bb3SJohannes Berg struct cfg80211_internal_bss; 3288fffd0934SJohannes Berg struct cfg80211_cached_keys; 328919957bb3SJohannes Berg 3290d3236553SJohannes Berg /** 329189a54e48SJohannes Berg * struct wireless_dev - wireless device state 3292d3236553SJohannes Berg * 329389a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 329489a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 329589a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 329689a54e48SJohannes Berg * It need not be registered then as netdev registration will 329789a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 329889a54e48SJohannes Berg * 329989a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 330089a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 330189a54e48SJohannes Berg * there's no netdev registration in that case it may not be 330289a54e48SJohannes Berg * allocated outside of callback operations that return it. 3303d3236553SJohannes Berg * 3304d3236553SJohannes Berg * @wiphy: pointer to hardware description 3305d3236553SJohannes Berg * @iftype: interface type 3306d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 330789a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 330889a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 330989a54e48SJohannes Berg * wireless device if it has no netdev 3310d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 33119e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 33129e0e2961SMichal Kazior * the user-set channel definition. 3313780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3314aa430da4SJohannes Berg * track the channel to be used for AP later 3315d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3316d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3317d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 331829cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 331929cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3320d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 33219bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 33229bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 33239bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 33249bc383deSJohannes Berg * by cfg80211 on change_interface 33252e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 33262e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 33278d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 33288d61ffa5SJohannes Berg * and some API functions require it held 332956d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 333056d1893dSJohannes Berg * beacons, 0 when not valid 333198104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 333298104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 333304f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 333404f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 333531559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3336780b40dfSJohannes Berg * @ps: powersave mode is enabled 3337780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3338780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3339780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3340780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3341780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 3342780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 33435336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3344780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3345780b40dfSJohannes Berg * @event_lock: (private) lock for event list 334678f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3347d3236553SJohannes Berg */ 3348d3236553SJohannes Berg struct wireless_dev { 3349d3236553SJohannes Berg struct wiphy *wiphy; 3350d3236553SJohannes Berg enum nl80211_iftype iftype; 3351d3236553SJohannes Berg 3352667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3353d3236553SJohannes Berg struct list_head list; 3354d3236553SJohannes Berg struct net_device *netdev; 3355d3236553SJohannes Berg 335689a54e48SJohannes Berg u32 identifier; 335789a54e48SJohannes Berg 33582e161f78SJohannes Berg struct list_head mgmt_registrations; 33592e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3360026331c4SJouni Malinen 3361667503ddSJohannes Berg struct mutex mtx; 3362667503ddSJohannes Berg 336398104fdeSJohannes Berg bool use_4addr, p2p_started; 336498104fdeSJohannes Berg 336598104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 33669bc383deSJohannes Berg 3367b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3368d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 336929cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 33706829c878SJohannes Berg struct cfg80211_conn *conn; 3371fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 3372d3236553SJohannes Berg 3373667503ddSJohannes Berg struct list_head event_list; 3374667503ddSJohannes Berg spinlock_t event_lock; 3375667503ddSJohannes Berg 337619957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3377683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 33789e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3379f4489ebeSMichal Kazior 3380c30a3d38SMichal Kazior bool ibss_fixed; 33815336fa88SSimon Wunderlich bool ibss_dfs_possible; 3382c30a3d38SMichal Kazior 3383ffb9eb3dSKalle Valo bool ps; 3384ffb9eb3dSKalle Valo int ps_timeout; 3385ffb9eb3dSKalle Valo 338656d1893dSJohannes Berg int beacon_interval; 338756d1893dSJohannes Berg 338815e47304SEric W. Biederman u32 ap_unexpected_nlportid; 338928946da7SJohannes Berg 339004f39047SSimon Wunderlich bool cac_started; 339104f39047SSimon Wunderlich unsigned long cac_start_time; 339231559f35SJanusz Dziedzic unsigned int cac_time_ms; 339304f39047SSimon Wunderlich 339478f22b6aSJohannes Berg u32 owner_nlportid; 339578f22b6aSJohannes Berg 33963d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3397d3236553SJohannes Berg /* wext data */ 3398cbe8fa9cSJohannes Berg struct { 3399cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3400f2129354SJohannes Berg struct cfg80211_connect_params connect; 3401fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3402c1e5f471SJohannes Berg const u8 *ie; 3403f2129354SJohannes Berg size_t ie_len; 3404f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3405f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 340608645126SJohannes Berg s8 default_key, default_mgmt_key; 3407ffb9eb3dSKalle Valo bool prev_bssid_valid; 3408cbe8fa9cSJohannes Berg } wext; 3409d3236553SJohannes Berg #endif 3410d3236553SJohannes Berg }; 3411d3236553SJohannes Berg 341298104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 341398104fdeSJohannes Berg { 341498104fdeSJohannes Berg if (wdev->netdev) 341598104fdeSJohannes Berg return wdev->netdev->dev_addr; 341698104fdeSJohannes Berg return wdev->address; 341798104fdeSJohannes Berg } 341898104fdeSJohannes Berg 3419d3236553SJohannes Berg /** 3420d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3421d3236553SJohannes Berg * 3422d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 34230ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3424d3236553SJohannes Berg */ 3425d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3426d3236553SJohannes Berg { 3427d3236553SJohannes Berg BUG_ON(!wdev); 3428d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3429d3236553SJohannes Berg } 3430d3236553SJohannes Berg 3431d70e9693SJohannes Berg /** 3432d70e9693SJohannes Berg * DOC: Utility functions 3433d70e9693SJohannes Berg * 3434d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3435d3236553SJohannes Berg */ 3436d3236553SJohannes Berg 3437d3236553SJohannes Berg /** 3438d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3439abe37c4bSJohannes Berg * @chan: channel number 344059eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 34410ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3442d3236553SJohannes Berg */ 344310dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 3444d3236553SJohannes Berg 3445d3236553SJohannes Berg /** 3446d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3447abe37c4bSJohannes Berg * @freq: center frequency 34480ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3449d3236553SJohannes Berg */ 345010dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3451d3236553SJohannes Berg 3452d3236553SJohannes Berg /* 3453d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3454d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3455d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3456d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3457d3236553SJohannes Berg * clash. 3458d3236553SJohannes Berg */ 345910dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3460d3236553SJohannes Berg int freq); 3461d3236553SJohannes Berg /** 3462d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3463abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3464abe37c4bSJohannes Berg * @freq: the center frequency of the channel 34650ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3466d3236553SJohannes Berg */ 3467d3236553SJohannes Berg static inline struct ieee80211_channel * 3468d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3469d3236553SJohannes Berg { 3470d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3471d3236553SJohannes Berg } 3472d3236553SJohannes Berg 3473d3236553SJohannes Berg /** 3474d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3475d3236553SJohannes Berg * 3476d3236553SJohannes Berg * @sband: the band to look for rates in 3477d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3478d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3479d3236553SJohannes Berg * 34800ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 34810ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 34820ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 34830ae997dcSYacine Belkadi * rates in the band's bitrate table. 3484d3236553SJohannes Berg */ 3485d3236553SJohannes Berg struct ieee80211_rate * 3486d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3487d3236553SJohannes Berg u32 basic_rates, int bitrate); 3488d3236553SJohannes Berg 3489b422c6cdSAshok Nagarajan /** 3490b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3491b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 349274608acaSSimon Wunderlich * @scan_width: width of the control channel 3493b422c6cdSAshok Nagarajan * 3494b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3495b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3496b422c6cdSAshok Nagarajan */ 349774608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 349874608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3499b422c6cdSAshok Nagarajan 3500d3236553SJohannes Berg /* 3501d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3502d3236553SJohannes Berg * 3503d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3504d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3505d3236553SJohannes Berg */ 3506d3236553SJohannes Berg 350733e5a2f7SJohannes Berg struct radiotap_align_size { 350833e5a2f7SJohannes Berg uint8_t align:4, size:4; 350933e5a2f7SJohannes Berg }; 351033e5a2f7SJohannes Berg 351133e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 351233e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 351333e5a2f7SJohannes Berg int n_bits; 351433e5a2f7SJohannes Berg uint32_t oui; 351533e5a2f7SJohannes Berg uint8_t subns; 351633e5a2f7SJohannes Berg }; 351733e5a2f7SJohannes Berg 351833e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 351933e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 352033e5a2f7SJohannes Berg int n_ns; 352133e5a2f7SJohannes Berg }; 352233e5a2f7SJohannes Berg 3523d3236553SJohannes Berg /** 3524d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 352533e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 352633e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 352733e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 352833e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 352933e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 353033e5a2f7SJohannes Berg * the beginning of the actual data portion 353133e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 353233e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 353333e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 353433e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 353533e5a2f7SJohannes Berg * radiotap namespace or not 353633e5a2f7SJohannes Berg * 353733e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 353833e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 353933e5a2f7SJohannes Berg * @_arg_index: next argument index 354033e5a2f7SJohannes Berg * @_arg: next argument pointer 354133e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 354233e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 354333e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 354433e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 354533e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 354633e5a2f7SJohannes Berg * next bitmap word 354733e5a2f7SJohannes Berg * 354833e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 354933e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 3550d3236553SJohannes Berg */ 3551d3236553SJohannes Berg 3552d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 355333e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 355433e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 355533e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 3556d3236553SJohannes Berg 355733e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 355867272440SJohannes Berg __le32 *_next_bitmap; 355933e5a2f7SJohannes Berg 356033e5a2f7SJohannes Berg unsigned char *this_arg; 356133e5a2f7SJohannes Berg int this_arg_index; 356233e5a2f7SJohannes Berg int this_arg_size; 356333e5a2f7SJohannes Berg 356433e5a2f7SJohannes Berg int is_radiotap_ns; 356533e5a2f7SJohannes Berg 356633e5a2f7SJohannes Berg int _max_length; 356733e5a2f7SJohannes Berg int _arg_index; 356833e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 356933e5a2f7SJohannes Berg int _reset_on_ext; 3570d3236553SJohannes Berg }; 3571d3236553SJohannes Berg 357210dd9b7cSJoe Perches int 357310dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 3574d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 357510dd9b7cSJoe Perches int max_length, 357610dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 3577d3236553SJohannes Berg 357810dd9b7cSJoe Perches int 357910dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 3580d3236553SJohannes Berg 358133e5a2f7SJohannes Berg 3582e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 3583e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 3584e31a16d6SZhu Yi 3585e31a16d6SZhu Yi /** 3586e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 3587e31a16d6SZhu Yi * 3588e31a16d6SZhu Yi * @skb: the frame 35890ae997dcSYacine Belkadi * 35900ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 35910ae997dcSYacine Belkadi * returns the 802.11 header length. 35920ae997dcSYacine Belkadi * 35930ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 35940ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 35950ae997dcSYacine Belkadi * 802.11 header. 3596e31a16d6SZhu Yi */ 3597e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3598e31a16d6SZhu Yi 3599e31a16d6SZhu Yi /** 3600e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 3601e31a16d6SZhu Yi * @fc: frame control field in little-endian format 36020ae997dcSYacine Belkadi * Return: The header length in bytes. 3603e31a16d6SZhu Yi */ 3604633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3605e31a16d6SZhu Yi 3606e31a16d6SZhu Yi /** 36079b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 36089b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 36099b395bc3SJohannes Berg * (first byte) will be accessed 36100ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 36119b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 36129b395bc3SJohannes Berg */ 36139b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 36149b395bc3SJohannes Berg 36159b395bc3SJohannes Berg /** 3616d70e9693SJohannes Berg * DOC: Data path helpers 3617d70e9693SJohannes Berg * 3618d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 3619d70e9693SJohannes Berg * functions that help implement the data path for devices 3620d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 3621d70e9693SJohannes Berg */ 3622d70e9693SJohannes Berg 3623d70e9693SJohannes Berg /** 3624e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 3625e31a16d6SZhu Yi * @skb: the 802.11 data frame 3626e31a16d6SZhu Yi * @addr: the device MAC address 3627e31a16d6SZhu Yi * @iftype: the virtual interface type 36280ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 3629e31a16d6SZhu Yi */ 3630eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3631e31a16d6SZhu Yi enum nl80211_iftype iftype); 3632e31a16d6SZhu Yi 3633e31a16d6SZhu Yi /** 3634e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 3635e31a16d6SZhu Yi * @skb: the 802.3 frame 3636e31a16d6SZhu Yi * @addr: the device MAC address 3637e31a16d6SZhu Yi * @iftype: the virtual interface type 3638e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3639e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 36400ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 3641e31a16d6SZhu Yi */ 3642eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3643c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 3644c1e5f471SJohannes Berg bool qos); 3645e31a16d6SZhu Yi 3646e31a16d6SZhu Yi /** 3647eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3648eaf85ca7SZhu Yi * 3649eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 3650eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 3651eaf85ca7SZhu Yi * @skb is consumed after the function returns. 3652eaf85ca7SZhu Yi * 3653eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 3654eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 3655eaf85ca7SZhu Yi * initialized by by the caller. 3656eaf85ca7SZhu Yi * @addr: The device MAC address. 3657eaf85ca7SZhu Yi * @iftype: The device interface type. 3658eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 36598b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 3660eaf85ca7SZhu Yi */ 3661eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 3662eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 36638b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 36648b3becadSYogesh Ashok Powar bool has_80211_header); 3665eaf85ca7SZhu Yi 3666eaf85ca7SZhu Yi /** 3667e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3668e31a16d6SZhu Yi * @skb: the data frame 3669fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 36700ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 3671e31a16d6SZhu Yi */ 3672fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 3673fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3674e31a16d6SZhu Yi 3675c21dbf92SJohannes Berg /** 3676c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 3677c21dbf92SJohannes Berg * 3678c21dbf92SJohannes Berg * @eid: element ID 3679c21dbf92SJohannes Berg * @ies: data consisting of IEs 3680c21dbf92SJohannes Berg * @len: length of data 3681c21dbf92SJohannes Berg * 36820ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 36830ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 36840ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 36850ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 36860ae997dcSYacine Belkadi * 36870ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 36880ae997dcSYacine Belkadi * having to fit into the given data. 3689c21dbf92SJohannes Berg */ 3690c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3691c21dbf92SJohannes Berg 3692d70e9693SJohannes Berg /** 36930c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 36940c28ec58SEliad Peller * 36950c28ec58SEliad Peller * @oui: vendor OUI 36960c28ec58SEliad Peller * @oui_type: vendor-specific OUI type 36970c28ec58SEliad Peller * @ies: data consisting of IEs 36980c28ec58SEliad Peller * @len: length of data 36990c28ec58SEliad Peller * 37000ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 37010ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 37020ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 37030ae997dcSYacine Belkadi * element ID. 37040ae997dcSYacine Belkadi * 37050ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 37060ae997dcSYacine Belkadi * the given data. 37070c28ec58SEliad Peller */ 37080c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 37090c28ec58SEliad Peller const u8 *ies, int len); 37100c28ec58SEliad Peller 37110c28ec58SEliad Peller /** 3712d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 3713d70e9693SJohannes Berg * 3714d70e9693SJohannes Berg * TODO 3715d3236553SJohannes Berg */ 3716d3236553SJohannes Berg 3717d3236553SJohannes Berg /** 3718d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 3719d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 3720d3236553SJohannes Berg * conflicts) 3721d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 3722d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 3723d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 3724d3236553SJohannes Berg * alpha2. 3725d3236553SJohannes Berg * 3726d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 3727d3236553SJohannes Berg * what it believes should be the current regulatory domain by 3728d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 3729d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 3730d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 3731d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 3732d3236553SJohannes Berg * 3733d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 3734d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 3735d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 3736d3236553SJohannes Berg * 3737d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 3738d3236553SJohannes Berg * an -ENOMEM. 37390ae997dcSYacine Belkadi * 37400ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 3741d3236553SJohannes Berg */ 374210dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3743d3236553SJohannes Berg 3744d3236553SJohannes Berg /** 3745d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 3746d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 3747d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 3748d3236553SJohannes Berg * 3749d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 3750d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 3751d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 3752d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 3753d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 3754d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 3755222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 3756ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 3757222ea581SLuis R. Rodriguez * that called this helper. 3758d3236553SJohannes Berg */ 375910dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 3760d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 3761d3236553SJohannes Berg 3762d3236553SJohannes Berg /** 3763d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 3764d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 3765d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 3766d3236553SJohannes Berg * 3767d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 3768d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 3769d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 3770d3236553SJohannes Berg * and processed already. 3771d3236553SJohannes Berg * 37720ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 37730ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 37740ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 37750ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 37760ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 37770ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 37780ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 3779d3236553SJohannes Berg */ 3780361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3781361c9c8bSJohannes Berg u32 center_freq); 3782d3236553SJohannes Berg 3783034c6d6eSLuis R. Rodriguez /** 3784034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 3785034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 3786034c6d6eSLuis R. Rodriguez * 3787034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 3788034c6d6eSLuis R. Rodriguez * proper string representation. 3789034c6d6eSLuis R. Rodriguez */ 3790034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 3791034c6d6eSLuis R. Rodriguez 3792d3236553SJohannes Berg /* 3793d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 3794d3236553SJohannes Berg * functions and BSS handling helpers 3795d3236553SJohannes Berg */ 3796d3236553SJohannes Berg 37972a519311SJohannes Berg /** 37982a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 37992a519311SJohannes Berg * 38002a519311SJohannes Berg * @request: the corresponding scan request 38012a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 38022a519311SJohannes Berg * userspace will be notified of that 38032a519311SJohannes Berg */ 38042a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 38052a519311SJohannes Berg 38062a519311SJohannes Berg /** 3807807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 3808807f8a8cSLuciano Coelho * 3809807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 3810807f8a8cSLuciano Coelho */ 3811807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 3812807f8a8cSLuciano Coelho 3813807f8a8cSLuciano Coelho /** 3814807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 3815807f8a8cSLuciano Coelho * 3816807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 3817807f8a8cSLuciano Coelho * 3818807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 3819807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 3820807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 3821807f8a8cSLuciano Coelho */ 3822807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3823807f8a8cSLuciano Coelho 3824807f8a8cSLuciano Coelho /** 3825792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 3826792e6aa7SEliad Peller * 3827792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 3828792e6aa7SEliad Peller * 3829792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 3830792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 3831792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 3832792e6aa7SEliad Peller * This function should be called with rtnl locked. 3833792e6aa7SEliad Peller */ 3834792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 3835792e6aa7SEliad Peller 3836792e6aa7SEliad Peller /** 3837dcd6eac1SSimon Wunderlich * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 38382a519311SJohannes Berg * 38392a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 38403afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3841dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 3842abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 3843abe37c4bSJohannes Berg * @len: length of the management frame 384477965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 38452a519311SJohannes Berg * @gfp: context flags 38462a519311SJohannes Berg * 38472a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 38482a519311SJohannes Berg * the BSS should be updated/added. 3849ef100682SJohannes Berg * 38500ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 38510ae997dcSYacine Belkadi * Or %NULL on error. 38522a519311SJohannes Berg */ 3853ef100682SJohannes Berg struct cfg80211_bss * __must_check 3854dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 38553afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3856dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 3857dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 3858dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3859dcd6eac1SSimon Wunderlich 3860dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 38612a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 38623afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 38632a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 3864dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 3865dcd6eac1SSimon Wunderlich { 38663afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width_frame(wiphy, rx_channel, 3867dcd6eac1SSimon Wunderlich NL80211_BSS_CHAN_WIDTH_20, 3868dcd6eac1SSimon Wunderlich mgmt, len, signal, gfp); 3869dcd6eac1SSimon Wunderlich } 38702a519311SJohannes Berg 3871abe37c4bSJohannes Berg /** 38725bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 38735bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 38745bc8c1f2SJohannes Berg * from a beacon or probe response 38755bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 38765bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 38775bc8c1f2SJohannes Berg */ 38785bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 38795bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 38805bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 38815bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 38825bc8c1f2SJohannes Berg }; 38835bc8c1f2SJohannes Berg 38845bc8c1f2SJohannes Berg /** 38855bc8c1f2SJohannes Berg * cfg80211_inform_bss_width - inform cfg80211 of a new BSS 3886abe37c4bSJohannes Berg * 3887abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 38883afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3889dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 38905bc8c1f2SJohannes Berg * @ftype: frame type (if known) 3891abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 38927b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3893abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 3894abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 3895abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 3896abe37c4bSJohannes Berg * @ielen: length of the additional IEs 3897abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 3898abe37c4bSJohannes Berg * @gfp: context flags 3899abe37c4bSJohannes Berg * 3900abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 3901abe37c4bSJohannes Berg * the BSS should be updated/added. 3902ef100682SJohannes Berg * 39030ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39040ae997dcSYacine Belkadi * Or %NULL on error. 3905abe37c4bSJohannes Berg */ 3906ef100682SJohannes Berg struct cfg80211_bss * __must_check 3907dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 39083afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3909dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 39105bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 3911dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 3912dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 3913dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3914dcd6eac1SSimon Wunderlich 3915dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 391606aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 39173afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 39185bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 39197b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 39207b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 3921dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 3922dcd6eac1SSimon Wunderlich { 39233afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width(wiphy, rx_channel, 39245bc8c1f2SJohannes Berg NL80211_BSS_CHAN_WIDTH_20, ftype, 3925dcd6eac1SSimon Wunderlich bssid, tsf, capability, 3926dcd6eac1SSimon Wunderlich beacon_interval, ie, ielen, signal, 3927dcd6eac1SSimon Wunderlich gfp); 3928dcd6eac1SSimon Wunderlich } 392906aa7afaSJussi Kivilinna 39302a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 39312a519311SJohannes Berg struct ieee80211_channel *channel, 39322a519311SJohannes Berg const u8 *bssid, 393379420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 393479420f09SJohannes Berg u16 capa_mask, u16 capa_val); 393579420f09SJohannes Berg static inline struct cfg80211_bss * 393679420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 393779420f09SJohannes Berg struct ieee80211_channel *channel, 393879420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 393979420f09SJohannes Berg { 394079420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 394179420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 394279420f09SJohannes Berg } 394379420f09SJohannes Berg 39444c0c0b75SJohannes Berg /** 39454c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 39465b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 39474c0c0b75SJohannes Berg * @bss: the BSS struct to reference 39484c0c0b75SJohannes Berg * 39494c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 39504c0c0b75SJohannes Berg */ 39515b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 39524c0c0b75SJohannes Berg 39534c0c0b75SJohannes Berg /** 39544c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 39555b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 39564c0c0b75SJohannes Berg * @bss: the BSS struct 39574c0c0b75SJohannes Berg * 39584c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 39594c0c0b75SJohannes Berg */ 39605b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 3961d3236553SJohannes Berg 3962d491af19SJohannes Berg /** 3963d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 3964d491af19SJohannes Berg * @wiphy: the wiphy 3965d491af19SJohannes Berg * @bss: the bss to remove 3966d491af19SJohannes Berg * 3967d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 3968d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 3969d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 3970d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 3971d491af19SJohannes Berg */ 3972d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 3973fee52678SJohannes Berg 3974dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 3975dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 3976dcd6eac1SSimon Wunderlich { 3977dcd6eac1SSimon Wunderlich switch (chandef->width) { 3978dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 3979dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 3980dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 3981dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 3982dcd6eac1SSimon Wunderlich default: 3983dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 3984dcd6eac1SSimon Wunderlich } 3985dcd6eac1SSimon Wunderlich } 3986dcd6eac1SSimon Wunderlich 39876039f6d2SJouni Malinen /** 39886ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 39896039f6d2SJouni Malinen * @dev: network device 39906039f6d2SJouni Malinen * @buf: authentication frame (header + body) 39916039f6d2SJouni Malinen * @len: length of the frame data 39926039f6d2SJouni Malinen * 39936ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 39946ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 39956ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 39966ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 39976ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 39986ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 39996ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 40006ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 40016ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 40026ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 40036ff57cf8SJohannes Berg * 40046ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 40056039f6d2SJouni Malinen */ 40066ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 40076039f6d2SJouni Malinen 40086039f6d2SJouni Malinen /** 40096ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 40101965c853SJouni Malinen * @dev: network device 40111965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4012cb0b4bebSJohannes Berg * 40138d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 40148d61ffa5SJohannes Berg * mutex. 40151965c853SJouni Malinen */ 40166ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 40171965c853SJouni Malinen 40181965c853SJouni Malinen /** 40196ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 40206039f6d2SJouni Malinen * @dev: network device 40216ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 40226ff57cf8SJohannes Berg * moves to cfg80211 in this call 40236ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 40246039f6d2SJouni Malinen * @len: length of the frame data 4025b0b6aa2cSEliad Peller * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a. 40266039f6d2SJouni Malinen * 40276ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 40286ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40296ff57cf8SJohannes Berg * 40306ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 40316039f6d2SJouni Malinen */ 40326ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 40336ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4034b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4035b0b6aa2cSEliad Peller int uapsd_queues); 40366039f6d2SJouni Malinen 40376039f6d2SJouni Malinen /** 40386ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 40391965c853SJouni Malinen * @dev: network device 4040959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4041cb0b4bebSJohannes Berg * 40428d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 40431965c853SJouni Malinen */ 4044959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 40451965c853SJouni Malinen 40461965c853SJouni Malinen /** 40476ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 40486039f6d2SJouni Malinen * @dev: network device 40496ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 40506039f6d2SJouni Malinen * @len: length of the frame data 40516039f6d2SJouni Malinen * 40526039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 405353b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 40548d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 40558d61ffa5SJohannes Berg * corresponding wdev's mutex. 40566039f6d2SJouni Malinen */ 40576ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4058ce470613SHolger Schurig 4059ce470613SHolger Schurig /** 40606ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4061cf4e594eSJouni Malinen * @dev: network device 4062cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4063cf4e594eSJouni Malinen * @len: length of the frame data 4064cf4e594eSJouni Malinen * 40656ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 40666ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4067cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4068cf4e594eSJouni Malinen */ 40696ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 40706ff57cf8SJohannes Berg const u8 *buf, size_t len); 4071cf4e594eSJouni Malinen 4072cf4e594eSJouni Malinen /** 4073a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4074a3b8b056SJouni Malinen * @dev: network device 4075a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4076a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4077a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4078a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4079e6d6e342SJohannes Berg * @gfp: allocation flags 4080a3b8b056SJouni Malinen * 4081a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4082a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4083a3b8b056SJouni Malinen * primitive. 4084a3b8b056SJouni Malinen */ 4085a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4086a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4087e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4088a3b8b056SJouni Malinen 408904a773adSJohannes Berg /** 409004a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 409104a773adSJohannes Berg * 409204a773adSJohannes Berg * @dev: network device 409304a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4094fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 409504a773adSJohannes Berg * @gfp: allocation flags 409604a773adSJohannes Berg * 409704a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 409804a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 409904a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 410004a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 410104a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 410204a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 410304a773adSJohannes Berg */ 4104fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4105fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 410604a773adSJohannes Berg 41071f87f7d3SJohannes Berg /** 4108c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4109c93b5e71SJavier Cardona * 4110c93b5e71SJavier Cardona * @dev: network device 4111c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4112c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4113c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4114c93b5e71SJavier Cardona * @gfp: allocation flags 4115c93b5e71SJavier Cardona * 4116c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4117c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4118c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4119c93b5e71SJavier Cardona */ 4120c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4121c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4122c93b5e71SJavier Cardona 4123c93b5e71SJavier Cardona /** 4124d70e9693SJohannes Berg * DOC: RFkill integration 4125d70e9693SJohannes Berg * 4126d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4127d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4128d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4129d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4130d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4131d70e9693SJohannes Berg * 4132d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4133d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4134d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4135d70e9693SJohannes Berg */ 4136d70e9693SJohannes Berg 4137d70e9693SJohannes Berg /** 41381f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 41391f87f7d3SJohannes Berg * @wiphy: the wiphy 41401f87f7d3SJohannes Berg * @blocked: block status 41411f87f7d3SJohannes Berg */ 41421f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 41431f87f7d3SJohannes Berg 41441f87f7d3SJohannes Berg /** 41451f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 41461f87f7d3SJohannes Berg * @wiphy: the wiphy 41471f87f7d3SJohannes Berg */ 41481f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 41491f87f7d3SJohannes Berg 41501f87f7d3SJohannes Berg /** 41511f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 41521f87f7d3SJohannes Berg * @wiphy: the wiphy 41531f87f7d3SJohannes Berg */ 41541f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 41551f87f7d3SJohannes Berg 4156ad7e718cSJohannes Berg /** 4157ad7e718cSJohannes Berg * DOC: Vendor commands 4158ad7e718cSJohannes Berg * 4159ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4160ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4161ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4162ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4163ad7e718cSJohannes Berg * the configuration mechanism. 4164ad7e718cSJohannes Berg * 4165ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4166ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4167ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4168ad7e718cSJohannes Berg * 4169ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4170ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4171ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4172ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4173ad7e718cSJohannes Berg * managers etc. need. 4174ad7e718cSJohannes Berg */ 4175ad7e718cSJohannes Berg 4176ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4177ad7e718cSJohannes Berg enum nl80211_commands cmd, 4178ad7e718cSJohannes Berg enum nl80211_attrs attr, 4179ad7e718cSJohannes Berg int approxlen); 4180ad7e718cSJohannes Berg 4181567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 4182567ffc35SJohannes Berg enum nl80211_commands cmd, 4183567ffc35SJohannes Berg enum nl80211_attrs attr, 4184567ffc35SJohannes Berg int vendor_event_idx, 4185567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4186567ffc35SJohannes Berg 4187567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4188567ffc35SJohannes Berg 4189ad7e718cSJohannes Berg /** 4190ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4191ad7e718cSJohannes Berg * @wiphy: the wiphy 4192ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4193ad7e718cSJohannes Berg * be put into the skb 4194ad7e718cSJohannes Berg * 4195ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4196ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4197ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4198ad7e718cSJohannes Berg * 4199ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4200ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4201ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4202ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4203ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4204ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4205ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4206ad7e718cSJohannes Berg * 4207ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4208ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4209ad7e718cSJohannes Berg * 4210ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4211ad7e718cSJohannes Berg */ 4212ad7e718cSJohannes Berg static inline struct sk_buff * 4213ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4214ad7e718cSJohannes Berg { 4215ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4216ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4217ad7e718cSJohannes Berg } 4218ad7e718cSJohannes Berg 4219ad7e718cSJohannes Berg /** 4220ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4221ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4222ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4223ad7e718cSJohannes Berg * 4224ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4225ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4226ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4227ad7e718cSJohannes Berg * skb regardless of the return value. 4228ad7e718cSJohannes Berg * 4229ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4230ad7e718cSJohannes Berg */ 4231ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4232ad7e718cSJohannes Berg 4233567ffc35SJohannes Berg /** 4234567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4235567ffc35SJohannes Berg * @wiphy: the wiphy 4236567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4237567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4238567ffc35SJohannes Berg * be put into the skb 4239567ffc35SJohannes Berg * @gfp: allocation flags 4240567ffc35SJohannes Berg * 4241567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4242567ffc35SJohannes Berg * vendor-specific multicast group. 4243567ffc35SJohannes Berg * 4244567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4245567ffc35SJohannes Berg * skb to send the event. 4246567ffc35SJohannes Berg * 4247567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4248567ffc35SJohannes Berg */ 4249567ffc35SJohannes Berg static inline struct sk_buff * 4250567ffc35SJohannes Berg cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen, 4251567ffc35SJohannes Berg int event_idx, gfp_t gfp) 4252567ffc35SJohannes Berg { 4253567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR, 4254567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4255567ffc35SJohannes Berg event_idx, approxlen, gfp); 4256567ffc35SJohannes Berg } 4257567ffc35SJohannes Berg 4258567ffc35SJohannes Berg /** 4259567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4260567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4261567ffc35SJohannes Berg * @gfp: allocation flags 4262567ffc35SJohannes Berg * 4263567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4264567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4265567ffc35SJohannes Berg */ 4266567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4267567ffc35SJohannes Berg { 4268567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4269567ffc35SJohannes Berg } 4270567ffc35SJohannes Berg 4271aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4272aff89a9bSJohannes Berg /** 4273d70e9693SJohannes Berg * DOC: Test mode 4274d70e9693SJohannes Berg * 4275d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4276d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4277d70e9693SJohannes Berg * factory programming. 4278d70e9693SJohannes Berg * 4279d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4280d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4281d70e9693SJohannes Berg */ 4282d70e9693SJohannes Berg 4283d70e9693SJohannes Berg /** 4284aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4285aff89a9bSJohannes Berg * @wiphy: the wiphy 4286aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4287aff89a9bSJohannes Berg * be put into the skb 4288aff89a9bSJohannes Berg * 4289aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4290aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4291aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4292aff89a9bSJohannes Berg * 42930ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 42940ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 42950ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 42960ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 42970ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 42980ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 42990ae997dcSYacine Belkadi * must not modify the skb in any other way. 4300aff89a9bSJohannes Berg * 4301aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4302aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 43030ae997dcSYacine Belkadi * 43040ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4305aff89a9bSJohannes Berg */ 4306ad7e718cSJohannes Berg static inline struct sk_buff * 4307ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4308ad7e718cSJohannes Berg { 4309ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4310ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4311ad7e718cSJohannes Berg } 4312aff89a9bSJohannes Berg 4313aff89a9bSJohannes Berg /** 4314aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4315aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4316aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4317aff89a9bSJohannes Berg * 43180ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 43190ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 43200ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 43210ae997dcSYacine Belkadi * regardless of the return value. 43220ae997dcSYacine Belkadi * 43230ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4324aff89a9bSJohannes Berg */ 4325ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4326ad7e718cSJohannes Berg { 4327ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4328ad7e718cSJohannes Berg } 4329aff89a9bSJohannes Berg 4330aff89a9bSJohannes Berg /** 4331aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4332aff89a9bSJohannes Berg * @wiphy: the wiphy 4333aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4334aff89a9bSJohannes Berg * be put into the skb 4335aff89a9bSJohannes Berg * @gfp: allocation flags 4336aff89a9bSJohannes Berg * 4337aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4338aff89a9bSJohannes Berg * testmode multicast group. 4339aff89a9bSJohannes Berg * 43400ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 43410ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 43420ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 43430ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 43440ae997dcSYacine Belkadi * in any other way. 4345aff89a9bSJohannes Berg * 4346aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4347aff89a9bSJohannes Berg * skb to send the event. 43480ae997dcSYacine Belkadi * 43490ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4350aff89a9bSJohannes Berg */ 4351567ffc35SJohannes Berg static inline struct sk_buff * 4352567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4353567ffc35SJohannes Berg { 4354567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE, 4355567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4356567ffc35SJohannes Berg approxlen, gfp); 4357567ffc35SJohannes Berg } 4358aff89a9bSJohannes Berg 4359aff89a9bSJohannes Berg /** 4360aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4361aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4362aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4363aff89a9bSJohannes Berg * @gfp: allocation flags 4364aff89a9bSJohannes Berg * 4365aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4366aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4367aff89a9bSJohannes Berg * consumes it. 4368aff89a9bSJohannes Berg */ 4369567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4370567ffc35SJohannes Berg { 4371567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4372567ffc35SJohannes Berg } 4373aff89a9bSJohannes Berg 4374aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 437571063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4376aff89a9bSJohannes Berg #else 4377aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 437871063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 4379aff89a9bSJohannes Berg #endif 4380aff89a9bSJohannes Berg 4381b23aa676SSamuel Ortiz /** 4382b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 4383b23aa676SSamuel Ortiz * 4384b23aa676SSamuel Ortiz * @dev: network device 4385b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 4386b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4387b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4388b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4389b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4390b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 4391b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4392b23aa676SSamuel Ortiz * the real status code for failures. 4393b23aa676SSamuel Ortiz * @gfp: allocation flags 4394b23aa676SSamuel Ortiz * 4395b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 4396b23aa676SSamuel Ortiz * succeeded. 4397b23aa676SSamuel Ortiz */ 4398b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 4399b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4400b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 4401b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 4402b23aa676SSamuel Ortiz 4403b23aa676SSamuel Ortiz /** 4404b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 4405b23aa676SSamuel Ortiz * 4406b23aa676SSamuel Ortiz * @dev: network device 4407ed9d0102SJouni Malinen * @channel: the channel of the new AP 4408b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 4409b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4410b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4411b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4412b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4413b23aa676SSamuel Ortiz * @gfp: allocation flags 4414b23aa676SSamuel Ortiz * 4415b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 4416b23aa676SSamuel Ortiz * from one AP to another while connected. 4417b23aa676SSamuel Ortiz */ 4418ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 4419ed9d0102SJouni Malinen struct ieee80211_channel *channel, 4420ed9d0102SJouni Malinen const u8 *bssid, 4421b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4422b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4423b23aa676SSamuel Ortiz 4424b23aa676SSamuel Ortiz /** 4425adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 4426adbde344SVasanthakumar Thiagarajan * 4427adbde344SVasanthakumar Thiagarajan * @dev: network device 4428adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 4429adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 4430adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 4431adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 4432adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 4433adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 4434adbde344SVasanthakumar Thiagarajan * 4435adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 4436adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 4437adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 4438adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 4439adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 4440adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 4441adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 4442adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 4443adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 4444adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 4445adbde344SVasanthakumar Thiagarajan */ 4446adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 4447adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 4448adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4449adbde344SVasanthakumar Thiagarajan 4450adbde344SVasanthakumar Thiagarajan /** 4451b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 4452b23aa676SSamuel Ortiz * 4453b23aa676SSamuel Ortiz * @dev: network device 4454b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 4455b23aa676SSamuel Ortiz * @ie_len: length of IEs 4456b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 4457b23aa676SSamuel Ortiz * @gfp: allocation flags 4458b23aa676SSamuel Ortiz * 4459b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 4460b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 4461b23aa676SSamuel Ortiz */ 4462b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 4463c1e5f471SJohannes Berg const u8 *ie, size_t ie_len, gfp_t gfp); 4464b23aa676SSamuel Ortiz 44659588bbd5SJouni Malinen /** 44669588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 446771bbc994SJohannes Berg * @wdev: wireless device 44689588bbd5SJouni Malinen * @cookie: the request cookie 44699588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 44709588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 44719588bbd5SJouni Malinen * channel 44729588bbd5SJouni Malinen * @gfp: allocation flags 44739588bbd5SJouni Malinen */ 447471bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 44759588bbd5SJouni Malinen struct ieee80211_channel *chan, 44769588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 44779588bbd5SJouni Malinen 44789588bbd5SJouni Malinen /** 44799588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 448071bbc994SJohannes Berg * @wdev: wireless device 44819588bbd5SJouni Malinen * @cookie: the request cookie 44829588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 44839588bbd5SJouni Malinen * @gfp: allocation flags 44849588bbd5SJouni Malinen */ 448571bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 44869588bbd5SJouni Malinen struct ieee80211_channel *chan, 44879588bbd5SJouni Malinen gfp_t gfp); 4488b23aa676SSamuel Ortiz 448998b62183SJohannes Berg 449098b62183SJohannes Berg /** 449198b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 449298b62183SJohannes Berg * 449398b62183SJohannes Berg * @dev: the netdev 449498b62183SJohannes Berg * @mac_addr: the station's address 449598b62183SJohannes Berg * @sinfo: the station information 449698b62183SJohannes Berg * @gfp: allocation flags 449798b62183SJohannes Berg */ 449898b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 449998b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 450098b62183SJohannes Berg 4501026331c4SJouni Malinen /** 4502ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 4503ec15e68bSJouni Malinen * 4504ec15e68bSJouni Malinen * @dev: the netdev 4505ec15e68bSJouni Malinen * @mac_addr: the station's address 4506ec15e68bSJouni Malinen * @gfp: allocation flags 4507ec15e68bSJouni Malinen */ 4508ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 4509ec15e68bSJouni Malinen 4510ec15e68bSJouni Malinen /** 4511ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 4512ed44a951SPandiyarajan Pitchaimuthu * 4513ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 4514ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 4515ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 4516ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 4517ed44a951SPandiyarajan Pitchaimuthu * 4518ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 4519ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 4520ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 4521ed44a951SPandiyarajan Pitchaimuthu * 4522ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 4523ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 4524ed44a951SPandiyarajan Pitchaimuthu */ 4525ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 4526ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 4527ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 4528ed44a951SPandiyarajan Pitchaimuthu 4529ed44a951SPandiyarajan Pitchaimuthu /** 45302e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 453171bbc994SJohannes Berg * @wdev: wireless device receiving the frame 4532026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 4533804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 45342e161f78SJohannes Berg * @buf: Management frame (header + body) 4535026331c4SJouni Malinen * @len: length of the frame data 453619504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 45372e161f78SJohannes Berg * 45380ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 45390ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 45400ae997dcSYacine Belkadi * 45410ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 45422e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 45432e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 45442e161f78SJohannes Berg * driver is responsible for rejecting the frame. 4545026331c4SJouni Malinen */ 454671bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 4547970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 4548026331c4SJouni Malinen 4549026331c4SJouni Malinen /** 45502e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 455171bbc994SJohannes Berg * @wdev: wireless device receiving the frame 45522e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 45532e161f78SJohannes Berg * @buf: Management frame (header + body) 4554026331c4SJouni Malinen * @len: length of the frame data 4555026331c4SJouni Malinen * @ack: Whether frame was acknowledged 4556026331c4SJouni Malinen * @gfp: context flags 4557026331c4SJouni Malinen * 45582e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 45592e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 4560026331c4SJouni Malinen * transmission attempt. 4561026331c4SJouni Malinen */ 456271bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 4563026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 4564026331c4SJouni Malinen 4565d6dc1a38SJuuso Oikarinen 4566d6dc1a38SJuuso Oikarinen /** 4567d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 4568d6dc1a38SJuuso Oikarinen * @dev: network device 4569d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 4570d6dc1a38SJuuso Oikarinen * @gfp: context flags 4571d6dc1a38SJuuso Oikarinen * 4572d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 4573d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 4574d6dc1a38SJuuso Oikarinen */ 4575d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 4576d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 4577d6dc1a38SJuuso Oikarinen gfp_t gfp); 4578d6dc1a38SJuuso Oikarinen 4579c063dbf5SJohannes Berg /** 458004f39047SSimon Wunderlich * cfg80211_radar_event - radar detection event 458104f39047SSimon Wunderlich * @wiphy: the wiphy 458204f39047SSimon Wunderlich * @chandef: chandef for the current channel 458304f39047SSimon Wunderlich * @gfp: context flags 458404f39047SSimon Wunderlich * 458504f39047SSimon Wunderlich * This function is called when a radar is detected on the current chanenl. 458604f39047SSimon Wunderlich */ 458704f39047SSimon Wunderlich void cfg80211_radar_event(struct wiphy *wiphy, 458804f39047SSimon Wunderlich struct cfg80211_chan_def *chandef, gfp_t gfp); 458904f39047SSimon Wunderlich 459004f39047SSimon Wunderlich /** 459104f39047SSimon Wunderlich * cfg80211_cac_event - Channel availability check (CAC) event 459204f39047SSimon Wunderlich * @netdev: network device 4593d2859df5SJanusz Dziedzic * @chandef: chandef for the current channel 459404f39047SSimon Wunderlich * @event: type of event 459504f39047SSimon Wunderlich * @gfp: context flags 459604f39047SSimon Wunderlich * 459704f39047SSimon Wunderlich * This function is called when a Channel availability check (CAC) is finished 459804f39047SSimon Wunderlich * or aborted. This must be called to notify the completion of a CAC process, 459904f39047SSimon Wunderlich * also by full-MAC drivers. 460004f39047SSimon Wunderlich */ 460104f39047SSimon Wunderlich void cfg80211_cac_event(struct net_device *netdev, 4602d2859df5SJanusz Dziedzic const struct cfg80211_chan_def *chandef, 460304f39047SSimon Wunderlich enum nl80211_radar_event event, gfp_t gfp); 460404f39047SSimon Wunderlich 460504f39047SSimon Wunderlich 460604f39047SSimon Wunderlich /** 4607c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 4608c063dbf5SJohannes Berg * @dev: network device 4609c063dbf5SJohannes Berg * @peer: peer's MAC address 4610c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 4611c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 4612c063dbf5SJohannes Berg * threshold (to account for temporary interference) 4613c063dbf5SJohannes Berg * @gfp: context flags 4614c063dbf5SJohannes Berg */ 4615c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 4616c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 4617c063dbf5SJohannes Berg 4618e5497d76SJohannes Berg /** 461984f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 462084f10708SThomas Pedersen * @dev: network device 462184f10708SThomas Pedersen * @peer: peer's MAC address 462284f10708SThomas Pedersen * @num_packets: how many packets were lost 462384f10708SThomas Pedersen * @rate: % of packets which failed transmission 462484f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 462584f10708SThomas Pedersen * @gfp: context flags 462684f10708SThomas Pedersen * 462784f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 462884f10708SThomas Pedersen * given interval is exceeded. 462984f10708SThomas Pedersen */ 463084f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 463184f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 463284f10708SThomas Pedersen 463384f10708SThomas Pedersen /** 4634e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 4635e5497d76SJohannes Berg * @dev: network device 4636e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 4637e5497d76SJohannes Berg * @replay_ctr: new replay counter 4638af71ff85SJohannes Berg * @gfp: allocation flags 4639e5497d76SJohannes Berg */ 4640e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 4641e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 4642e5497d76SJohannes Berg 4643c9df56b4SJouni Malinen /** 4644c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 4645c9df56b4SJouni Malinen * @dev: network device 4646c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 4647c9df56b4SJouni Malinen * @bssid: BSSID of AP 4648c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 4649c9df56b4SJouni Malinen * @gfp: allocation flags 4650c9df56b4SJouni Malinen */ 4651c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 4652c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 4653c9df56b4SJouni Malinen 465428946da7SJohannes Berg /** 465528946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 465628946da7SJohannes Berg * @dev: The device the frame matched to 465728946da7SJohannes Berg * @addr: the transmitter address 465828946da7SJohannes Berg * @gfp: context flags 465928946da7SJohannes Berg * 466028946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 466128946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 466228946da7SJohannes Berg * sender. 46630ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 466428946da7SJohannes Berg * for a reason other than not having a subscription.) 466528946da7SJohannes Berg */ 466628946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 466728946da7SJohannes Berg const u8 *addr, gfp_t gfp); 466828946da7SJohannes Berg 46697f6cf311SJohannes Berg /** 4670b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 4671b92ab5d8SJohannes Berg * @dev: The device the frame matched to 4672b92ab5d8SJohannes Berg * @addr: the transmitter address 4673b92ab5d8SJohannes Berg * @gfp: context flags 4674b92ab5d8SJohannes Berg * 4675b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 4676b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 4677b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 4678b92ab5d8SJohannes Berg * station to avoid event flooding. 46790ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 4680b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 4681b92ab5d8SJohannes Berg */ 4682b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 4683b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 4684b92ab5d8SJohannes Berg 4685b92ab5d8SJohannes Berg /** 46867f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 46877f6cf311SJohannes Berg * @dev: the device the probe was sent on 46887f6cf311SJohannes Berg * @addr: the address of the peer 46897f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 46907f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 46917f6cf311SJohannes Berg * @gfp: allocation flags 46927f6cf311SJohannes Berg */ 46937f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 46947f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 46957f6cf311SJohannes Berg 46965e760230SJohannes Berg /** 46975e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 46985e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 46995e760230SJohannes Berg * @frame: the frame 47005e760230SJohannes Berg * @len: length of the frame 47015e760230SJohannes Berg * @freq: frequency the frame was received on 4702804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 47035e760230SJohannes Berg * 47045e760230SJohannes Berg * Use this function to report to userspace when a beacon was 47055e760230SJohannes Berg * received. It is not useful to call this when there is no 47065e760230SJohannes Berg * netdev that is in AP/GO mode. 47075e760230SJohannes Berg */ 47085e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 47095e760230SJohannes Berg const u8 *frame, size_t len, 471037c73b5fSBen Greear int freq, int sig_dbm); 47115e760230SJohannes Berg 4712d58e7e37SJohannes Berg /** 4713683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 471454858ee5SAlexander Simon * @wiphy: the wiphy 4715683b6d3bSJohannes Berg * @chandef: the channel definition 4716174e0cd2SIlan Peer * @iftype: interface type 4717d58e7e37SJohannes Berg * 47180ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 47190ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 472054858ee5SAlexander Simon */ 4721683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4722174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 4723174e0cd2SIlan Peer enum nl80211_iftype iftype); 472454858ee5SAlexander Simon 47258097e149SThomas Pedersen /* 47265314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 47275314526bSThomas Pedersen * @dev: the device which switched channels 4728683b6d3bSJohannes Berg * @chandef: the new channel definition 47295314526bSThomas Pedersen * 4730e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 4731e487eaebSSimon Wunderlich * driver context! 47325314526bSThomas Pedersen */ 4733683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 4734683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 47355314526bSThomas Pedersen 4736f8d7552eSLuciano Coelho /* 4737f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 4738f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 4739f8d7552eSLuciano Coelho * @chandef: the future channel definition 4740f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 4741f8d7552eSLuciano Coelho * 4742f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 4743f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 4744f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 4745f8d7552eSLuciano Coelho */ 4746f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 4747f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 4748f8d7552eSLuciano Coelho u8 count); 4749f8d7552eSLuciano Coelho 47501ce3e82bSJohannes Berg /** 47511ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 47521ce3e82bSJohannes Berg * 47531ce3e82bSJohannes Berg * @operating_class: the operating class to convert 47541ce3e82bSJohannes Berg * @band: band pointer to fill 47551ce3e82bSJohannes Berg * 47561ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 47571ce3e82bSJohannes Berg */ 47581ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 47591ce3e82bSJohannes Berg enum ieee80211_band *band); 47601ce3e82bSJohannes Berg 47615314526bSThomas Pedersen /* 47623475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 47633475b094SJouni Malinen * @dev: the device on which the operation is requested 47643475b094SJouni Malinen * @peer: the MAC address of the peer device 47653475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 47663475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 47673475b094SJouni Malinen * @reason_code: the reason code for teardown request 47683475b094SJouni Malinen * @gfp: allocation flags 47693475b094SJouni Malinen * 47703475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 47713475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 47723475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 47733475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 47743475b094SJouni Malinen * based on traffic and signal strength for a peer). 47753475b094SJouni Malinen */ 47763475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 47773475b094SJouni Malinen enum nl80211_tdls_operation oper, 47783475b094SJouni Malinen u16 reason_code, gfp_t gfp); 47793475b094SJouni Malinen 47803475b094SJouni Malinen /* 47818097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 47828097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 47838097e149SThomas Pedersen * 47848097e149SThomas Pedersen * return 0 if MCS index >= 32 47858097e149SThomas Pedersen */ 47868eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 47878097e149SThomas Pedersen 478898104fdeSJohannes Berg /** 478998104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 479098104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 479198104fdeSJohannes Berg * 479298104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 479398104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 479498104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 479598104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 479698104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 479798104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 479898104fdeSJohannes Berg * when the device is unbound from the driver. 479998104fdeSJohannes Berg * 480098104fdeSJohannes Berg * Requires the RTNL to be held. 480198104fdeSJohannes Berg */ 480298104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 480398104fdeSJohannes Berg 48040ee45355SJohannes Berg /** 4805355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 4806355199e0SJouni Malinen * @ies: FT IEs 4807355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 4808355199e0SJouni Malinen * @target_ap: target AP's MAC address 4809355199e0SJouni Malinen * @ric_ies: RIC IE 4810355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 4811355199e0SJouni Malinen */ 4812355199e0SJouni Malinen struct cfg80211_ft_event_params { 4813355199e0SJouni Malinen const u8 *ies; 4814355199e0SJouni Malinen size_t ies_len; 4815355199e0SJouni Malinen const u8 *target_ap; 4816355199e0SJouni Malinen const u8 *ric_ies; 4817355199e0SJouni Malinen size_t ric_ies_len; 4818355199e0SJouni Malinen }; 4819355199e0SJouni Malinen 4820355199e0SJouni Malinen /** 4821355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 4822355199e0SJouni Malinen * @netdev: network device 4823355199e0SJouni Malinen * @ft_event: IE information 4824355199e0SJouni Malinen */ 4825355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 4826355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 4827355199e0SJouni Malinen 4828355199e0SJouni Malinen /** 48290ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 48300ee45355SJohannes Berg * @ies: the input IE buffer 48310ee45355SJohannes Berg * @len: the input length 48320ee45355SJohannes Berg * @attr: the attribute ID to find 48330ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 48340ee45355SJohannes Berg * if the function is only called to get the needed buffer size 48350ee45355SJohannes Berg * @bufsize: size of the output buffer 48360ee45355SJohannes Berg * 48370ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 48380ee45355SJohannes Berg * copies its contents to the given buffer. 48390ee45355SJohannes Berg * 48400ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 48410ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 48420ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 48430ee45355SJohannes Berg */ 4844c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 4845c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 4846c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 48470ee45355SJohannes Berg 4848cd8f7cb4SJohannes Berg /** 4849cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 4850cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 4851cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 4852cd8f7cb4SJohannes Berg * @gfp: allocation flags 4853cd8f7cb4SJohannes Berg * 4854cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 4855cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 4856cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 4857cd8f7cb4SJohannes Berg * else caused the wakeup. 4858cd8f7cb4SJohannes Berg */ 4859cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 4860cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 4861cd8f7cb4SJohannes Berg gfp_t gfp); 4862cd8f7cb4SJohannes Berg 48635de17984SArend van Spriel /** 48645de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 48655de17984SArend van Spriel * 48665de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 486703f831a6SRobert P. J. Day * @gfp: allocation flags 48685de17984SArend van Spriel * 48695de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 48705de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 48715de17984SArend van Spriel * by .crit_proto_start() has expired. 48725de17984SArend van Spriel */ 48735de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 48745de17984SArend van Spriel 4875bdfbec2dSIlan Peer /** 4876bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 4877bdfbec2dSIlan Peer * @wiphy: the wiphy 4878bdfbec2dSIlan Peer * 4879bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 4880bdfbec2dSIlan Peer */ 4881bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 4882bdfbec2dSIlan Peer 4883cb2d956dSLuciano Coelho /** 4884cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 4885cb2d956dSLuciano Coelho * 4886cb2d956dSLuciano Coelho * @wiphy: the wiphy 4887cb2d956dSLuciano Coelho * @num_different_channels: the number of different channels we want 4888cb2d956dSLuciano Coelho * to use for verification 4889cb2d956dSLuciano Coelho * @radar_detect: a bitmap where each bit corresponds to a channel 4890cb2d956dSLuciano Coelho * width where radar detection is needed, as in the definition of 4891cb2d956dSLuciano Coelho * &struct ieee80211_iface_combination.@radar_detect_widths 4892cb2d956dSLuciano Coelho * @iftype_num: array with the numbers of interfaces of each interface 4893cb2d956dSLuciano Coelho * type. The index is the interface type as specified in &enum 4894cb2d956dSLuciano Coelho * nl80211_iftype. 4895cb2d956dSLuciano Coelho * 4896cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 4897cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 4898cb2d956dSLuciano Coelho * the interface combinations. 4899cb2d956dSLuciano Coelho */ 4900cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 4901cb2d956dSLuciano Coelho const int num_different_channels, 4902cb2d956dSLuciano Coelho const u8 radar_detect, 4903cb2d956dSLuciano Coelho const int iftype_num[NUM_NL80211_IFTYPES]); 4904cb2d956dSLuciano Coelho 490565a124ddSMichal Kazior /** 490665a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 490765a124ddSMichal Kazior * 490865a124ddSMichal Kazior * @wiphy: the wiphy 490965a124ddSMichal Kazior * @num_different_channels: the number of different channels we want 491065a124ddSMichal Kazior * to use for verification 491165a124ddSMichal Kazior * @radar_detect: a bitmap where each bit corresponds to a channel 491265a124ddSMichal Kazior * width where radar detection is needed, as in the definition of 491365a124ddSMichal Kazior * &struct ieee80211_iface_combination.@radar_detect_widths 491465a124ddSMichal Kazior * @iftype_num: array with the numbers of interfaces of each interface 491565a124ddSMichal Kazior * type. The index is the interface type as specified in &enum 491665a124ddSMichal Kazior * nl80211_iftype. 491765a124ddSMichal Kazior * @iter: function to call for each matching combination 491865a124ddSMichal Kazior * @data: pointer to pass to iter function 491965a124ddSMichal Kazior * 492065a124ddSMichal Kazior * This function can be called by the driver to check what possible 492165a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 492265a124ddSMichal Kazior * purposes. 492365a124ddSMichal Kazior */ 492465a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 492565a124ddSMichal Kazior const int num_different_channels, 492665a124ddSMichal Kazior const u8 radar_detect, 492765a124ddSMichal Kazior const int iftype_num[NUM_NL80211_IFTYPES], 492865a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 492965a124ddSMichal Kazior void *data), 493065a124ddSMichal Kazior void *data); 493165a124ddSMichal Kazior 4932f04c2203SMichal Kazior /* 4933f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 4934f04c2203SMichal Kazior * 4935f04c2203SMichal Kazior * @wiphy: the wiphy 4936f04c2203SMichal Kazior * @wdev: wireless device 4937f04c2203SMichal Kazior * @gfp: context flags 4938f04c2203SMichal Kazior * 4939f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 4940f04c2203SMichal Kazior * disconnected. 4941f04c2203SMichal Kazior * 4942f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 4943f04c2203SMichal Kazior */ 4944f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 4945f04c2203SMichal Kazior gfp_t gfp); 4946f04c2203SMichal Kazior 4947f6837ba8SJohannes Berg /** 4948f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 4949f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 4950f6837ba8SJohannes Berg * 4951f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 4952f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 4953f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 4954f6837ba8SJohannes Berg * that really can't be recovered in any other way. 4955f6837ba8SJohannes Berg * 4956f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 4957f6837ba8SJohannes Berg * the driver while the function is running. 4958f6837ba8SJohannes Berg */ 4959f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 4960f6837ba8SJohannes Berg 4961b7ffbd7eSJohannes Berg 4962b7ffbd7eSJohannes Berg /* ethtool helper */ 4963b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 4964b7ffbd7eSJohannes Berg 4965e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 4966e1db74fcSJoe Perches 4967e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 4968e1db74fcSJoe Perches 4969e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 49709c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 4971e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 49729c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 4973e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 49749c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 4975e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 49769c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 4977e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 49789c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 4979e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 49809c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 4981e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 49829c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 4983e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 49849c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 4985073730d7SJoe Perches 49869c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 4987e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 49889c376639SJoe Perches 4989e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 49909c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 4991e1db74fcSJoe Perches 4992e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 4993e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 4994e1db74fcSJoe Perches #else 4995e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 4996e1db74fcSJoe Perches ({ \ 4997e1db74fcSJoe Perches if (0) \ 4998e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 4999e1db74fcSJoe Perches 0; \ 5000e1db74fcSJoe Perches }) 5001e1db74fcSJoe Perches #endif 5002e1db74fcSJoe Perches 5003e1db74fcSJoe Perches /* 5004e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5005e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5006e1db74fcSJoe Perches * file/line information and a backtrace. 5007e1db74fcSJoe Perches */ 5008e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5009e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5010e1db74fcSJoe Perches 5011704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5012