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 1440ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1441ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1442ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1443ad2b26abSJohannes Berg * be taken from the @mac_addr 14442a519311SJohannes Berg */ 14452a519311SJohannes Berg struct cfg80211_scan_request { 14462a519311SJohannes Berg struct cfg80211_ssid *ssids; 14472a519311SJohannes Berg int n_ssids; 14482a519311SJohannes Berg u32 n_channels; 1449dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1450de95a54bSJohannes Berg const u8 *ie; 145170692ad2SJouni Malinen size_t ie_len; 1452ed473771SSam Leffler u32 flags; 14532a519311SJohannes Berg 145434850ab2SJohannes Berg u32 rates[IEEE80211_NUM_BANDS]; 145534850ab2SJohannes Berg 1456fd014284SJohannes Berg struct wireless_dev *wdev; 1457fd014284SJohannes Berg 1458ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1459ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1460ad2b26abSJohannes Berg 14612a519311SJohannes Berg /* internal */ 14622a519311SJohannes Berg struct wiphy *wiphy; 146315d6030bSSam Leffler unsigned long scan_start; 14645fe231e8SJohannes Berg bool aborted, notified; 1465e9f935e3SRajkumar Manoharan bool no_cck; 14665ba63533SJohannes Berg 14675ba63533SJohannes Berg /* keep last */ 14685ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 14692a519311SJohannes Berg }; 14702a519311SJohannes Berg 1471ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1472ad2b26abSJohannes Berg { 1473ad2b26abSJohannes Berg int i; 1474ad2b26abSJohannes Berg 1475ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1476ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1477ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1478ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1479ad2b26abSJohannes Berg } 1480ad2b26abSJohannes Berg } 1481ad2b26abSJohannes Berg 14822a519311SJohannes Berg /** 1483a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1484a1f1c21cSLuciano Coelho * 1485ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1486ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1487a1f1c21cSLuciano Coelho */ 1488a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1489a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1490ea73cbceSJohannes Berg s32 rssi_thold; 1491a1f1c21cSLuciano Coelho }; 1492a1f1c21cSLuciano Coelho 1493a1f1c21cSLuciano Coelho /** 1494807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1495807f8a8cSLuciano Coelho * 1496807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1497807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1498807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1499dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1500bbe6ad6dSLuciano Coelho * @interval: interval between each scheduled scan cycle 1501807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1502807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1503ed473771SSam Leffler * @flags: bit field of flags controlling operation 1504a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1505a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1506a1f1c21cSLuciano Coelho * (others are filtered out). 1507a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1508a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1509807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1510807f8a8cSLuciano Coelho * @dev: the interface 1511077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1512807f8a8cSLuciano Coelho * @channels: channels to scan 1513ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1514ea73cbceSJohannes Berg * contains the minimum over all matchsets 1515ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1516ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1517ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1518ad2b26abSJohannes Berg * be taken from the @mac_addr 1519*31a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 1520807f8a8cSLuciano Coelho */ 1521807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1522807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1523807f8a8cSLuciano Coelho int n_ssids; 1524807f8a8cSLuciano Coelho u32 n_channels; 1525dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1526bbe6ad6dSLuciano Coelho u32 interval; 1527807f8a8cSLuciano Coelho const u8 *ie; 1528807f8a8cSLuciano Coelho size_t ie_len; 1529ed473771SSam Leffler u32 flags; 1530a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1531a1f1c21cSLuciano Coelho int n_match_sets; 1532ea73cbceSJohannes Berg s32 min_rssi_thold; 1533807f8a8cSLuciano Coelho 1534ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1535ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1536ad2b26abSJohannes Berg 1537807f8a8cSLuciano Coelho /* internal */ 1538807f8a8cSLuciano Coelho struct wiphy *wiphy; 1539807f8a8cSLuciano Coelho struct net_device *dev; 154015d6030bSSam Leffler unsigned long scan_start; 1541*31a60ed1SJukka Rissanen struct rcu_head rcu_head; 1542807f8a8cSLuciano Coelho 1543807f8a8cSLuciano Coelho /* keep last */ 1544807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1545807f8a8cSLuciano Coelho }; 1546807f8a8cSLuciano Coelho 1547807f8a8cSLuciano Coelho /** 15482a519311SJohannes Berg * enum cfg80211_signal_type - signal type 15492a519311SJohannes Berg * 15502a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 15512a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 15522a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 15532a519311SJohannes Berg */ 15542a519311SJohannes Berg enum cfg80211_signal_type { 15552a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 15562a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 15572a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 15582a519311SJohannes Berg }; 15592a519311SJohannes Berg 15602a519311SJohannes Berg /** 15619caf0364SJohannes Berg * struct cfg80211_bss_ie_data - BSS entry IE data 15628cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 15639caf0364SJohannes Berg * @rcu_head: internal use, for freeing 15649caf0364SJohannes Berg * @len: length of the IEs 15650e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 15669caf0364SJohannes Berg * @data: IE data 15679caf0364SJohannes Berg */ 15689caf0364SJohannes Berg struct cfg80211_bss_ies { 15698cef2c9dSJohannes Berg u64 tsf; 15709caf0364SJohannes Berg struct rcu_head rcu_head; 15719caf0364SJohannes Berg int len; 15720e227084SJohannes Berg bool from_beacon; 15739caf0364SJohannes Berg u8 data[]; 15749caf0364SJohannes Berg }; 15759caf0364SJohannes Berg 15769caf0364SJohannes Berg /** 15772a519311SJohannes Berg * struct cfg80211_bss - BSS description 15782a519311SJohannes Berg * 15792a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 15802a519311SJohannes Berg * for use in scan results and similar. 15812a519311SJohannes Berg * 1582abe37c4bSJohannes Berg * @channel: channel this BSS is on 1583dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 15842a519311SJohannes Berg * @bssid: BSSID of the BSS 15852a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 15862a519311SJohannes Berg * @capability: the capability field in host byte order 158783c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 158883c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 158983c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 159083c7aa1aSJohannes Berg * received. It is always non-%NULL. 159134a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1592776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1593776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1594776b3580SJohannes Berg * @hidden_beacon_bss struct) 159534a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1596776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1597776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1598776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1599776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 160077965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 16012a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 16022a519311SJohannes Berg */ 16032a519311SJohannes Berg struct cfg80211_bss { 16042a519311SJohannes Berg struct ieee80211_channel *channel; 1605dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 16062a519311SJohannes Berg 16079caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 16089caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 16099caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 16109caf0364SJohannes Berg 1611776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 16122a519311SJohannes Berg 16132a519311SJohannes Berg s32 signal; 16142a519311SJohannes Berg 16159caf0364SJohannes Berg u16 beacon_interval; 16169caf0364SJohannes Berg u16 capability; 16179caf0364SJohannes Berg 16189caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 16199caf0364SJohannes Berg 16201c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 16212a519311SJohannes Berg }; 16222a519311SJohannes Berg 16232a519311SJohannes Berg /** 1624517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1625517357c6SJohannes Berg * @bss: the bss to search 1626517357c6SJohannes Berg * @ie: the IE ID 16279caf0364SJohannes Berg * 16289caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 16299caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 16300ae997dcSYacine Belkadi * Return: %NULL if not found. 1631517357c6SJohannes Berg */ 1632517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1633517357c6SJohannes Berg 1634517357c6SJohannes Berg 1635517357c6SJohannes Berg /** 1636636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1637636a5d36SJouni Malinen * 1638636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1639636a5d36SJouni Malinen * authentication. 1640636a5d36SJouni Malinen * 1641959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1642959867faSJohannes Berg * to it if it needs to keep it. 1643636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1644636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1645636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1646fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1647fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1648fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1649e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1650e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1651e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1652636a5d36SJouni Malinen */ 1653636a5d36SJouni Malinen struct cfg80211_auth_request { 165419957bb3SJohannes Berg struct cfg80211_bss *bss; 1655636a5d36SJouni Malinen const u8 *ie; 1656636a5d36SJouni Malinen size_t ie_len; 165719957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1658fffd0934SJohannes Berg const u8 *key; 1659fffd0934SJohannes Berg u8 key_len, key_idx; 1660e39e5b5eSJouni Malinen const u8 *sae_data; 1661e39e5b5eSJouni Malinen size_t sae_data_len; 1662636a5d36SJouni Malinen }; 1663636a5d36SJouni Malinen 1664636a5d36SJouni Malinen /** 16657e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 16667e7c8926SBen Greear * 16677e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1668ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1669bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 16707e7c8926SBen Greear */ 16717e7c8926SBen Greear enum cfg80211_assoc_req_flags { 16727e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1673ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1674bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 16757e7c8926SBen Greear }; 16767e7c8926SBen Greear 16777e7c8926SBen Greear /** 1678636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1679636a5d36SJouni Malinen * 1680636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1681636a5d36SJouni Malinen * (re)association. 1682959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1683959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1684959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1685959867faSJohannes Berg * association requests while already associating must be rejected. 1686636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1687636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1688dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1689b23aa676SSamuel Ortiz * @crypto: crypto settings 16903e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 16917e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 16927e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 16937e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 16947e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1695ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1696ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1697636a5d36SJouni Malinen */ 1698636a5d36SJouni Malinen struct cfg80211_assoc_request { 169919957bb3SJohannes Berg struct cfg80211_bss *bss; 17003e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1701636a5d36SJouni Malinen size_t ie_len; 1702b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 170319957bb3SJohannes Berg bool use_mfp; 17047e7c8926SBen Greear u32 flags; 17057e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 17067e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1707ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1708636a5d36SJouni Malinen }; 1709636a5d36SJouni Malinen 1710636a5d36SJouni Malinen /** 1711636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1712636a5d36SJouni Malinen * 1713636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1714636a5d36SJouni Malinen * deauthentication. 1715636a5d36SJouni Malinen * 171695de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1717636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1718636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 171919957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1720077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1721077f897aSJohannes Berg * do not set a deauth frame 1722636a5d36SJouni Malinen */ 1723636a5d36SJouni Malinen struct cfg80211_deauth_request { 172495de817bSJohannes Berg const u8 *bssid; 1725636a5d36SJouni Malinen const u8 *ie; 1726636a5d36SJouni Malinen size_t ie_len; 172719957bb3SJohannes Berg u16 reason_code; 17286863255bSStanislaw Gruszka bool local_state_change; 1729636a5d36SJouni Malinen }; 1730636a5d36SJouni Malinen 1731636a5d36SJouni Malinen /** 1732636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1733636a5d36SJouni Malinen * 1734636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1735636a5d36SJouni Malinen * disassocation. 1736636a5d36SJouni Malinen * 173719957bb3SJohannes Berg * @bss: the BSS to disassociate from 1738636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1739636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 174019957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1741d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1742d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1743636a5d36SJouni Malinen */ 1744636a5d36SJouni Malinen struct cfg80211_disassoc_request { 174519957bb3SJohannes Berg struct cfg80211_bss *bss; 1746636a5d36SJouni Malinen const u8 *ie; 1747636a5d36SJouni Malinen size_t ie_len; 174819957bb3SJohannes Berg u16 reason_code; 1749d5cdfacbSJouni Malinen bool local_state_change; 1750636a5d36SJouni Malinen }; 1751636a5d36SJouni Malinen 1752636a5d36SJouni Malinen /** 175304a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 175404a773adSJohannes Berg * 175504a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 175604a773adSJohannes Berg * method. 175704a773adSJohannes Berg * 175804a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 175904a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 176004a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 176104a773adSJohannes Berg * search for IBSSs with a different BSSID. 1762683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 176304a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 176404a773adSJohannes Berg * IBSSs to join on other channels. 176504a773adSJohannes Berg * @ie: information element(s) to include in the beacon 176604a773adSJohannes Berg * @ie_len: length of that 17678e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1768fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1769fffd0934SJohannes Berg * after joining 1770267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1771267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1772267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1773267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 17745336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 17755336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 17765336fa88SSimon Wunderlich * to operate on DFS channels. 1777fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1778dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1779803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1780803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1781803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 178204a773adSJohannes Berg */ 178304a773adSJohannes Berg struct cfg80211_ibss_params { 1784c1e5f471SJohannes Berg const u8 *ssid; 1785c1e5f471SJohannes Berg const u8 *bssid; 1786683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1787c1e5f471SJohannes Berg const u8 *ie; 178804a773adSJohannes Berg u8 ssid_len, ie_len; 17898e30bc55SJohannes Berg u16 beacon_interval; 1790fbd2c8dcSTeemu Paasikivi u32 basic_rates; 179104a773adSJohannes Berg bool channel_fixed; 1792fffd0934SJohannes Berg bool privacy; 1793267335d6SAntonio Quartulli bool control_port; 17945336fa88SSimon Wunderlich bool userspace_handles_dfs; 1795dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 1796803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1797803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 179804a773adSJohannes Berg }; 179904a773adSJohannes Berg 180004a773adSJohannes Berg /** 1801b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1802b23aa676SSamuel Ortiz * 1803b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1804b23aa676SSamuel Ortiz * authentication and association. 1805b23aa676SSamuel Ortiz * 1806b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1807b23aa676SSamuel Ortiz * on scan results) 18081df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 18091df4a510SJouni Malinen * %NULL if not specified 1810b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1811b23aa676SSamuel Ortiz * results) 18121df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 18131df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 18141df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 18151df4a510SJouni Malinen * to use. 1816b23aa676SSamuel Ortiz * @ssid: SSID 1817b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1818b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1819abe37c4bSJohannes Berg * @ie: IEs for association request 1820abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1821b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1822cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1823b23aa676SSamuel Ortiz * @crypto: crypto settings 1824fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1825fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1826fffd0934SJohannes Berg * @key: WEP key for shared key authentication 18277e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 18284486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 18294486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 18307e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 18317e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 18327e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1833ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 1834ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 1835b23aa676SSamuel Ortiz */ 1836b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1837b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 18381df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 1839664834deSJouni Malinen const u8 *bssid; 18401df4a510SJouni Malinen const u8 *bssid_hint; 1841664834deSJouni Malinen const u8 *ssid; 1842b23aa676SSamuel Ortiz size_t ssid_len; 1843b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 18444b5800feSJohannes Berg const u8 *ie; 1845b23aa676SSamuel Ortiz size_t ie_len; 1846b23aa676SSamuel Ortiz bool privacy; 1847cee00a95SJouni Malinen enum nl80211_mfp mfp; 1848b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1849fffd0934SJohannes Berg const u8 *key; 1850fffd0934SJohannes Berg u8 key_len, key_idx; 18517e7c8926SBen Greear u32 flags; 18524486ea98SBala Shanmugam int bg_scan_period; 18537e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 18547e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1855ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 1856ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 1857b23aa676SSamuel Ortiz }; 1858b23aa676SSamuel Ortiz 1859b23aa676SSamuel Ortiz /** 1860b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1861abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1862abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1863abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1864abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1865abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 18663057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 1867b9a5f8caSJouni Malinen */ 1868b9a5f8caSJouni Malinen enum wiphy_params_flags { 1869b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1870b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1871b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1872b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 187381077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 18743057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 1875b9a5f8caSJouni Malinen }; 1876b9a5f8caSJouni Malinen 18779930380fSJohannes Berg /* 18789930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 18799930380fSJohannes Berg */ 18809930380fSJohannes Berg struct cfg80211_bitrate_mask { 18819930380fSJohannes Berg struct { 18829930380fSJohannes Berg u32 legacy; 1883d1e33e65SJanusz Dziedzic u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1884204e35a9SJanusz Dziedzic u16 vht_mcs[NL80211_VHT_NSS_MAX]; 18850b9323f6SJanusz Dziedzic enum nl80211_txrate_gi gi; 18869930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 18879930380fSJohannes Berg }; 188867fbb16bSSamuel Ortiz /** 188967fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 189067fbb16bSSamuel Ortiz * 189167fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 189267fbb16bSSamuel Ortiz * caching. 189367fbb16bSSamuel Ortiz * 189467fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 189567fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 189667fbb16bSSamuel Ortiz */ 189767fbb16bSSamuel Ortiz struct cfg80211_pmksa { 1898c1e5f471SJohannes Berg const u8 *bssid; 1899c1e5f471SJohannes Berg const u8 *pmkid; 190067fbb16bSSamuel Ortiz }; 19019930380fSJohannes Berg 19027643a2c3SJohannes Berg /** 190350ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 1904ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 1905ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 1906ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 1907ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 1908bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 1909ff1b6e69SJohannes Berg * 1910ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 1911ff1b6e69SJohannes Berg * memory, free @mask only! 1912ff1b6e69SJohannes Berg */ 191350ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 1914922bd80fSJohannes Berg const u8 *mask, *pattern; 1915ff1b6e69SJohannes Berg int pattern_len; 1916bb92d199SAmitkumar Karwar int pkt_offset; 1917ff1b6e69SJohannes Berg }; 1918ff1b6e69SJohannes Berg 1919ff1b6e69SJohannes Berg /** 19202a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 19212a0e047eSJohannes Berg * 19222a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 19232a0e047eSJohannes Berg * @src: source IP address 19242a0e047eSJohannes Berg * @dst: destination IP address 19252a0e047eSJohannes Berg * @dst_mac: destination MAC address 19262a0e047eSJohannes Berg * @src_port: source port 19272a0e047eSJohannes Berg * @dst_port: destination port 19282a0e047eSJohannes Berg * @payload_len: data payload length 19292a0e047eSJohannes Berg * @payload: data payload buffer 19302a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 19312a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 19322a0e047eSJohannes Berg * @wake_len: wakeup payload match length 19332a0e047eSJohannes Berg * @wake_data: wakeup payload match data 19342a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 19352a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 19362a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 19372a0e047eSJohannes Berg */ 19382a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 19392a0e047eSJohannes Berg struct socket *sock; 19402a0e047eSJohannes Berg __be32 src, dst; 19412a0e047eSJohannes Berg u16 src_port, dst_port; 19422a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 19432a0e047eSJohannes Berg int payload_len; 19442a0e047eSJohannes Berg const u8 *payload; 19452a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 19462a0e047eSJohannes Berg u32 data_interval; 19472a0e047eSJohannes Berg u32 wake_len; 19482a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 19492a0e047eSJohannes Berg u32 tokens_size; 19502a0e047eSJohannes Berg /* must be last, variable member */ 19512a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 1952ff1b6e69SJohannes Berg }; 1953ff1b6e69SJohannes Berg 1954ff1b6e69SJohannes Berg /** 1955ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 1956ff1b6e69SJohannes Berg * 1957ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 1958ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 1959ff1b6e69SJohannes Berg * operating as normal during suspend 1960ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 1961ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 1962ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 1963ff1b6e69SJohannes Berg * @n_patterns: number of patterns 196477dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 196577dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 196677dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 196777dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 19682a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 19692a0e047eSJohannes Berg * NULL if not configured. 19708cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 1971ff1b6e69SJohannes Berg */ 1972ff1b6e69SJohannes Berg struct cfg80211_wowlan { 197377dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 197477dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 197577dbbb13SJohannes Berg rfkill_release; 197650ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 19772a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 1978ff1b6e69SJohannes Berg int n_patterns; 19798cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 1980ff1b6e69SJohannes Berg }; 1981ff1b6e69SJohannes Berg 1982ff1b6e69SJohannes Berg /** 1983be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 1984be29b99aSAmitkumar Karwar * 1985be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 1986be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 1987be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 1988be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 1989be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 1990be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 1991be29b99aSAmitkumar Karwar */ 1992be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 1993be29b99aSAmitkumar Karwar int delay; 1994be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 1995be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 1996be29b99aSAmitkumar Karwar int n_patterns; 1997be29b99aSAmitkumar Karwar }; 1998be29b99aSAmitkumar Karwar 1999be29b99aSAmitkumar Karwar /** 2000be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2001be29b99aSAmitkumar Karwar * 2002be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2003be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2004be29b99aSAmitkumar Karwar * @n_rules: number of rules 2005be29b99aSAmitkumar Karwar */ 2006be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2007be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2008be29b99aSAmitkumar Karwar int n_rules; 2009be29b99aSAmitkumar Karwar }; 2010be29b99aSAmitkumar Karwar 2011be29b99aSAmitkumar Karwar /** 20128cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 20138cd4d456SLuciano Coelho * 20148cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 20158cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 20168cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 20178cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 20188cd4d456SLuciano Coelho * occurred (in MHz) 20198cd4d456SLuciano Coelho */ 20208cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 20218cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 20228cd4d456SLuciano Coelho int n_channels; 20238cd4d456SLuciano Coelho u32 channels[]; 20248cd4d456SLuciano Coelho }; 20258cd4d456SLuciano Coelho 20268cd4d456SLuciano Coelho /** 20278cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 20288cd4d456SLuciano Coelho * 20298cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 20308cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 20318cd4d456SLuciano Coelho * match information. 20328cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 20338cd4d456SLuciano Coelho * the matches that triggered the wake up. 20348cd4d456SLuciano Coelho */ 20358cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 20368cd4d456SLuciano Coelho int n_matches; 20378cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 20388cd4d456SLuciano Coelho }; 20398cd4d456SLuciano Coelho 20408cd4d456SLuciano Coelho /** 2041cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2042cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2043cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2044cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2045cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2046cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2047cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2048cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2049cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2050cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2051cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2052cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2053cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2054cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2055cd8f7cb4SJohannes Berg * it is. 20562a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 20572a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 20582a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 20598cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2060cd8f7cb4SJohannes Berg */ 2061cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2062cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2063cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 20642a0e047eSJohannes Berg rfkill_release, packet_80211, 20652a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2066cd8f7cb4SJohannes Berg s32 pattern_idx; 2067cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2068cd8f7cb4SJohannes Berg const void *packet; 20698cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2070cd8f7cb4SJohannes Berg }; 2071cd8f7cb4SJohannes Berg 2072cd8f7cb4SJohannes Berg /** 2073e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 207478f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 207578f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 207678f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2077e5497d76SJohannes Berg */ 2078e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 207978f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2080e5497d76SJohannes Berg }; 2081e5497d76SJohannes Berg 2082e5497d76SJohannes Berg /** 2083355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2084355199e0SJouni Malinen * 2085355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2086355199e0SJouni Malinen * 2087355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2088355199e0SJouni Malinen * @ie: Fast Transition IEs 2089355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2090355199e0SJouni Malinen */ 2091355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2092355199e0SJouni Malinen u16 md; 2093355199e0SJouni Malinen const u8 *ie; 2094355199e0SJouni Malinen size_t ie_len; 2095355199e0SJouni Malinen }; 2096355199e0SJouni Malinen 2097355199e0SJouni Malinen /** 2098b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2099b176e629SAndrei Otcheretianski * 2100b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2101b176e629SAndrei Otcheretianski * 2102b176e629SAndrei Otcheretianski * @chan: channel to use 2103b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2104b176e629SAndrei Otcheretianski * @wait: duration for ROC 2105b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2106b176e629SAndrei Otcheretianski * @len: buffer length 2107b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2108b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 210934d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 211034d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2111b176e629SAndrei Otcheretianski */ 2112b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2113b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2114b176e629SAndrei Otcheretianski bool offchan; 2115b176e629SAndrei Otcheretianski unsigned int wait; 2116b176e629SAndrei Otcheretianski const u8 *buf; 2117b176e629SAndrei Otcheretianski size_t len; 2118b176e629SAndrei Otcheretianski bool no_cck; 2119b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 212034d22ce2SAndrei Otcheretianski int n_csa_offsets; 212134d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2122b176e629SAndrei Otcheretianski }; 2123b176e629SAndrei Otcheretianski 2124b176e629SAndrei Otcheretianski /** 2125fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2126fa9ffc74SKyeyoon Park * 2127fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2128fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2129fa9ffc74SKyeyoon Park */ 2130fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2131fa9ffc74SKyeyoon Park u8 dscp; 2132fa9ffc74SKyeyoon Park u8 up; 2133fa9ffc74SKyeyoon Park }; 2134fa9ffc74SKyeyoon Park 2135fa9ffc74SKyeyoon Park /** 2136fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2137fa9ffc74SKyeyoon Park * 2138fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2139fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2140fa9ffc74SKyeyoon Park */ 2141fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2142fa9ffc74SKyeyoon Park u8 low; 2143fa9ffc74SKyeyoon Park u8 high; 2144fa9ffc74SKyeyoon Park }; 2145fa9ffc74SKyeyoon Park 2146fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2147fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2148fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2149fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2150fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2151fa9ffc74SKyeyoon Park 2152fa9ffc74SKyeyoon Park /** 2153fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2154fa9ffc74SKyeyoon Park * 2155fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2156fa9ffc74SKyeyoon Park * 2157fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2158fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2159fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2160fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2161fa9ffc74SKyeyoon Park */ 2162fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2163fa9ffc74SKyeyoon Park u8 num_des; 2164fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2165fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2166fa9ffc74SKyeyoon Park }; 2167fa9ffc74SKyeyoon Park 2168fa9ffc74SKyeyoon Park /** 2169704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2170704232c2SJohannes Berg * 2171704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2172704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2173704232c2SJohannes Berg * 2174704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2175704232c2SJohannes Berg * on success or a negative error code. 2176704232c2SJohannes Berg * 217743fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 217843fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 217943fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 218043fb45cbSJohannes Berg * 2181ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2182ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2183ff1b6e69SJohannes Berg * configured for the device. 21840378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 21856d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 21866d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 21876d52563fSJohannes Berg * the device. 21880378b3f1SJohannes Berg * 218960719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2190463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 219184efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 219298104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 219398104fdeSJohannes Berg * also set the address member in the wdev. 2194704232c2SJohannes Berg * 219584efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 219655682965SJohannes Berg * 219760719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 219860719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 219955682965SJohannes Berg * 220041ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 220141ade00fSJohannes Berg * when adding a group key. 220241ade00fSJohannes Berg * 220341ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 220441ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 220541ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2206e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2207e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 220841ade00fSJohannes Berg * 220941ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2210e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 221141ade00fSJohannes Berg * 221241ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2213ed1b6cc7SJohannes Berg * 22143cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 22153cfcf6acSJouni Malinen * 2216e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2217e5497d76SJohannes Berg * 2218c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2219c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2220c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2221c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 22225727ef1bSJohannes Berg * 22235727ef1bSJohannes Berg * @add_station: Add a new station. 222489c771e5SJouni Malinen * @del_station: Remove a station 2225bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2226bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2227bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 222877ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 222977ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2230abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2231abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2232abe37c4bSJohannes Berg * 2233abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2234abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2235abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2236abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2237abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 223866be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 223966be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2240f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 22418d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2242f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 22438d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 22442ec600d6SLuis Carlos Cobo * 224524bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 224693da9cc1Scolin@cozybit.com * 224724bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 224893da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 224993da9cc1Scolin@cozybit.com * set, and which to leave alone. 225093da9cc1Scolin@cozybit.com * 22519f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 225231888487SJouni Malinen * 225331888487SJouni Malinen * @set_txq_params: Set TX queue parameters 225472bdcf34SJouni Malinen * 2255e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2256e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2257e8c9bd5bSJohannes Berg * join the mesh instead. 2258e8c9bd5bSJohannes Berg * 2259e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2260e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2261e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2262e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 22639aed3cc1SJouni Malinen * 22642a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 22652a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 22662a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 22672a519311SJohannes Berg * the scan/scan_done bracket too. 2268636a5d36SJouni Malinen * 2269636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 22708d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2271636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 22728d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2273636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 22748d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2275636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 22768d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 227704a773adSJohannes Berg * 2278b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2279b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 2280b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 2281b23aa676SSamuel Ortiz * with the status from the AP. 22828d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2283b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 22848d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2285b23aa676SSamuel Ortiz * 228604a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 228704a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 228804a773adSJohannes Berg * to a merge. 22898d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 229004a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 22918d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2292b9a5f8caSJouni Malinen * 2293f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2294f4e583c8SAntonio Quartulli * MESH mode) 2295f4e583c8SAntonio Quartulli * 2296b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2297b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2298b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2299b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 23007643a2c3SJohannes Berg * 23011432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2302c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2303c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2304c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2305c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 23067643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 23071f87f7d3SJohannes Berg * return 0 if successful 23081f87f7d3SJohannes Berg * 2309abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2310abe37c4bSJohannes Berg * 23111f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 23121f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2313aff89a9bSJohannes Berg * 231461fa713cSHolger Schurig * @dump_survey: get site survey information. 231561fa713cSHolger Schurig * 23169588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 23179588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 23189588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 23199588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 23209588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 23219588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 23229588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 23239588bbd5SJouni Malinen * the duration value. 2324f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2325f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2326f7ca38dfSJohannes Berg * frame on another channel 23279588bbd5SJouni Malinen * 2328fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 232971063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 233071063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 233171063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 233271063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 233371063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 233471063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 233567fbb16bSSamuel Ortiz * 2336abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2337abe37c4bSJohannes Berg * 233867fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 233967fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 234067fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 234167fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 234267fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 23439043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 23449043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2345d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 234684f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 234784f10708SThomas Pedersen * thresholds. 2348807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2349d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2350d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2351d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2352d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2353d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2354d9b8396aSJohannes Berg * method returns 0.) 235567fbb16bSSamuel Ortiz * 2356271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 2357271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 2358271733cfSJohannes Berg * concurrently with itself. 2359547025d5SBruno Randolf * 2360547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2361547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2362547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2363547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2364547025d5SBruno Randolf * 2365547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 23663677713bSJohn W. Linville * 2367109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2368109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 23697f6cf311SJohannes Berg * 23707f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 23717f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 23721d9d9213SSimon Wunderlich * 23731d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2374d6199218SBen Greear * 23755b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 23765b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 23775b7ccaf3SJohannes Berg * current monitoring channel. 237898104fdeSJohannes Berg * 237998104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 238098104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 238177765eafSVasanthakumar Thiagarajan * 238277765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 238377765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 238477765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 238577765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 238677765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 238777765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 238804f39047SSimon Wunderlich * 238904f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 23908bf24293SJouni Malinen * 23918bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 23928bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 23938bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 23945de17984SArend van Spriel * 23955de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 23965de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 23975de17984SArend van Spriel * driver can take the most appropriate actions. 23985de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 23995de17984SArend van Spriel * reliability. This operation can not fail. 2400be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 240116ef1fe2SSimon Wunderlich * 240297dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 240397dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 240497dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 240597dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 240697dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 240797dc94f1SMichal Kazior * as soon as possible. 2408fa9ffc74SKyeyoon Park * 2409fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2410e16821bcSJouni Malinen * 2411e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2412e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2413e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2414960d01acSJohannes Berg * 2415960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2416960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2417960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2418960d01acSJohannes Berg * account. 2419960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2420960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2421960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2422960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2423960d01acSJohannes Berg * rejected) 2424960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 24256e0bd6c3SRostislav Lisovy * 24266e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 24276e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 24286e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 24296e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 24301057d35eSArik Nemtsov * 24311057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 24321057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 24331057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 24341057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 24351057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2436704232c2SJohannes Berg */ 2437704232c2SJohannes Berg struct cfg80211_ops { 2438ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 24390378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 24406d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 24410378b3f1SJohannes Berg 244284efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2443552bff0cSJohannes Berg const char *name, 2444f9e10ce4SJohannes Berg enum nl80211_iftype type, 2445f9e10ce4SJohannes Berg u32 *flags, 24462ec600d6SLuis Carlos Cobo struct vif_params *params); 244784efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 244884efbb84SJohannes Berg struct wireless_dev *wdev); 2449e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2450e36d56b6SJohannes Berg struct net_device *dev, 24512ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 24522ec600d6SLuis Carlos Cobo struct vif_params *params); 245341ade00fSJohannes Berg 245441ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2455e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 245641ade00fSJohannes Berg struct key_params *params); 245741ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2458e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2459e31b8213SJohannes Berg void *cookie, 246041ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 246141ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2462e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 246341ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 246441ade00fSJohannes Berg struct net_device *netdev, 2465dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 24663cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 24673cfcf6acSJouni Malinen struct net_device *netdev, 24683cfcf6acSJouni Malinen u8 key_index); 2469ed1b6cc7SJohannes Berg 24708860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 24718860020eSJohannes Berg struct cfg80211_ap_settings *settings); 24728860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 24738860020eSJohannes Berg struct cfg80211_beacon_data *info); 24748860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 24755727ef1bSJohannes Berg 24765727ef1bSJohannes Berg 24775727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 24783b3a0162SJohannes Berg const u8 *mac, 24793b3a0162SJohannes Berg struct station_parameters *params); 24805727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 248189c771e5SJouni Malinen struct station_del_parameters *params); 24825727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 24833b3a0162SJohannes Berg const u8 *mac, 24843b3a0162SJohannes Berg struct station_parameters *params); 2485fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 24863b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 24872ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 24882ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 24892ec600d6SLuis Carlos Cobo 24902ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 24913b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 24922ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 24933b3a0162SJohannes Berg const u8 *dst); 24942ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 24953b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 24962ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 24973b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 24982ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 24992ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 25002ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 250166be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 250266be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 250366be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 250466be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 250566be7d2bSHenning Rogge struct mpath_info *pinfo); 250624bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 250793da9cc1Scolin@cozybit.com struct net_device *dev, 250893da9cc1Scolin@cozybit.com struct mesh_config *conf); 250924bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 251029cbe68cSJohannes Berg struct net_device *dev, u32 mask, 251129cbe68cSJohannes Berg const struct mesh_config *nconf); 251229cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 251329cbe68cSJohannes Berg const struct mesh_config *conf, 251429cbe68cSJohannes Berg const struct mesh_setup *setup); 251529cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 251629cbe68cSJohannes Berg 25176e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 25186e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 25196e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 25206e0bd6c3SRostislav Lisovy 25219f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 25229f1ba906SJouni Malinen struct bss_parameters *params); 252331888487SJouni Malinen 2524f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 252531888487SJouni Malinen struct ieee80211_txq_params *params); 252672bdcf34SJouni Malinen 2527e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2528e8c9bd5bSJohannes Berg struct net_device *dev, 2529e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2530e8c9bd5bSJohannes Berg 2531e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2532683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 25339aed3cc1SJouni Malinen 2534fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 25352a519311SJohannes Berg struct cfg80211_scan_request *request); 2536636a5d36SJouni Malinen 2537636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2538636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2539636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2540636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2541636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 254263c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2543636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 254463c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 254504a773adSJohannes Berg 2546b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2547b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2548b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2549b23aa676SSamuel Ortiz u16 reason_code); 2550b23aa676SSamuel Ortiz 255104a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 255204a773adSJohannes Berg struct cfg80211_ibss_params *params); 255304a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2554b9a5f8caSJouni Malinen 2555f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 2556f4e583c8SAntonio Quartulli int rate[IEEE80211_NUM_BANDS]); 2557f4e583c8SAntonio Quartulli 2558b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 25597643a2c3SJohannes Berg 2560c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2561fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2562c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2563c8442118SJohannes Berg int *dbm); 25641f87f7d3SJohannes Berg 2565ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2566388ac775SJohannes Berg const u8 *addr); 2567ab737a4fSJohannes Berg 25681f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2569aff89a9bSJohannes Berg 2570aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2571fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2572fc73f11fSDavid Spinadel void *data, int len); 257371063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 257471063f0eSWey-Yi Guy struct netlink_callback *cb, 257571063f0eSWey-Yi Guy void *data, int len); 2576aff89a9bSJohannes Berg #endif 2577bc92afd9SJohannes Berg 25789930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 25799930380fSJohannes Berg struct net_device *dev, 25809930380fSJohannes Berg const u8 *peer, 25819930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 25829930380fSJohannes Berg 258361fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 258461fa713cSHolger Schurig int idx, struct survey_info *info); 258561fa713cSHolger Schurig 258667fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 258767fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 258867fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 258967fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 259067fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 259167fbb16bSSamuel Ortiz 25929588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 259371bbc994SJohannes Berg struct wireless_dev *wdev, 25949588bbd5SJouni Malinen struct ieee80211_channel *chan, 25959588bbd5SJouni Malinen unsigned int duration, 25969588bbd5SJouni Malinen u64 *cookie); 25979588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 259871bbc994SJohannes Berg struct wireless_dev *wdev, 25999588bbd5SJouni Malinen u64 cookie); 26009588bbd5SJouni Malinen 260171bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2602b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2603b176e629SAndrei Otcheretianski u64 *cookie); 2604f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 260571bbc994SJohannes Berg struct wireless_dev *wdev, 2606f7ca38dfSJohannes Berg u64 cookie); 2607026331c4SJouni Malinen 2608bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2609bc92afd9SJohannes Berg bool enabled, int timeout); 2610d6dc1a38SJuuso Oikarinen 2611d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2612d6dc1a38SJuuso Oikarinen struct net_device *dev, 2613d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2614271733cfSJohannes Berg 261584f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 261684f10708SThomas Pedersen struct net_device *dev, 261784f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 261884f10708SThomas Pedersen 2619271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 262071bbc994SJohannes Berg struct wireless_dev *wdev, 2621271733cfSJohannes Berg u16 frame_type, bool reg); 2622afe0cbf8SBruno Randolf 2623afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2624afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 26253677713bSJohn W. Linville 2626807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2627807f8a8cSLuciano Coelho struct net_device *dev, 2628807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 262985a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2630e5497d76SJohannes Berg 2631e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2632e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2633109086ceSArik Nemtsov 2634109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 26353b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2636df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 263731fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2638109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 26393b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 26407f6cf311SJohannes Berg 26417f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 26427f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2643e999882aSJohannes Berg 26441d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 26451d9d9213SSimon Wunderlich struct net_device *dev, 26461d9d9213SSimon Wunderlich u16 noack_map); 26471d9d9213SSimon Wunderlich 2648683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 26495b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2650683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 265198104fdeSJohannes Berg 265298104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 265398104fdeSJohannes Berg struct wireless_dev *wdev); 265498104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 265598104fdeSJohannes Berg struct wireless_dev *wdev); 265677765eafSVasanthakumar Thiagarajan 265777765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 265877765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 265904f39047SSimon Wunderlich 266004f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 266104f39047SSimon Wunderlich struct net_device *dev, 266231559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 266331559f35SJanusz Dziedzic u32 cac_time_ms); 2664355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2665355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 26665de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 26675de17984SArend van Spriel struct wireless_dev *wdev, 26685de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 26695de17984SArend van Spriel u16 duration); 26705de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 26715de17984SArend van Spriel struct wireless_dev *wdev); 2672be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 2673be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 267416ef1fe2SSimon Wunderlich 267516ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 267616ef1fe2SSimon Wunderlich struct net_device *dev, 267716ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 2678e16821bcSJouni Malinen 2679fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 2680fa9ffc74SKyeyoon Park struct net_device *dev, 2681fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 2682e16821bcSJouni Malinen 2683e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2684e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 2685960d01acSJohannes Berg 2686960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2687960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 2688960d01acSJohannes Berg u16 admitted_time); 2689960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2690960d01acSJohannes Berg u8 tsid, const u8 *peer); 26911057d35eSArik Nemtsov 26921057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 26931057d35eSArik Nemtsov struct net_device *dev, 26941057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 26951057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 26961057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 26971057d35eSArik Nemtsov struct net_device *dev, 26981057d35eSArik Nemtsov const u8 *addr); 2699704232c2SJohannes Berg }; 2700704232c2SJohannes Berg 2701d3236553SJohannes Berg /* 2702d3236553SJohannes Berg * wireless hardware and networking interfaces structures 2703d3236553SJohannes Berg * and registration/helper functions 2704d3236553SJohannes Berg */ 2705d3236553SJohannes Berg 2706d3236553SJohannes Berg /** 27075be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 27085be83de5SJohannes Berg * 27095be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 27105be83de5SJohannes Berg * wiphy at all 27115be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 27125be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 27135be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 27145be83de5SJohannes Berg * reason to override the default 27159bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 27169bc383deSJohannes Berg * on a VLAN interface) 27179bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 2718c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 2719c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 2720c0692b8fSJohannes Berg * control_port_no_encrypt flag. 2721e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 272215d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 272315d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 27241ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 2725f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 2726f4b34b55SVivek Natarajan * firmware. 2727cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 2728109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 2729109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 2730109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 2731109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 2732109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 2733109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 2734562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 27355e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 27365e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 27375e760230SJohannes Berg * cfg80211_report_obss_beacon(). 273887bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 273987bbbe22SArik Nemtsov * responds to probe-requests in hardware. 27407c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 27417c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 27422f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 274316ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 274416ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 27455be83de5SJohannes Berg */ 27465be83de5SJohannes Berg enum wiphy_flags { 2747723e73acSJohannes Berg /* use hole at 0 */ 2748a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 2749a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 27505be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 27515be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 27529bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 27539bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 2754c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 2755309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 275615d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 2757807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 27588e8b41f9SJohannes Berg /* use hole at 12 */ 2759f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 2760cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 2761109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 2762109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 2763562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 27645e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 276587bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 27667c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 27677c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 27682f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 276916ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 27707527a782SJohannes Berg }; 27717527a782SJohannes Berg 27727527a782SJohannes Berg /** 27737527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 27747527a782SJohannes Berg * @max: maximum number of interfaces of these types 27757527a782SJohannes Berg * @types: interface types (bits) 27767527a782SJohannes Berg */ 27777527a782SJohannes Berg struct ieee80211_iface_limit { 27787527a782SJohannes Berg u16 max; 27797527a782SJohannes Berg u16 types; 27807527a782SJohannes Berg }; 27817527a782SJohannes Berg 27827527a782SJohannes Berg /** 27837527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 27847527a782SJohannes Berg * @limits: limits for the given interface types 27857527a782SJohannes Berg * @n_limits: number of limitations 27867527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 27877527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 27887527a782SJohannes Berg * group 27897527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 27907527a782SJohannes Berg * between infrastructure and AP types must match. This is required 27917527a782SJohannes Berg * only in special cases. 279211c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 27938c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 27947527a782SJohannes Berg * 2795b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 2796b80edbc1SLuciano Coelho * combinations it supports concurrently. 27977527a782SJohannes Berg * 2798b80edbc1SLuciano Coelho * Examples: 2799b80edbc1SLuciano Coelho * 2800b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 28017527a782SJohannes Berg * 28027527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 28037527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 28047527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 28057527a782SJohannes Berg * }; 28067527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 28077527a782SJohannes Berg * .limits = limits1, 28087527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 28097527a782SJohannes Berg * .max_interfaces = 2, 28107527a782SJohannes Berg * .beacon_int_infra_match = true, 28117527a782SJohannes Berg * }; 28127527a782SJohannes Berg * 28137527a782SJohannes Berg * 2814b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 28157527a782SJohannes Berg * 28167527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 28177527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 28187527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 28197527a782SJohannes Berg * }; 28207527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 28217527a782SJohannes Berg * .limits = limits2, 28227527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 28237527a782SJohannes Berg * .max_interfaces = 8, 28247527a782SJohannes Berg * .num_different_channels = 1, 28257527a782SJohannes Berg * }; 28267527a782SJohannes Berg * 28277527a782SJohannes Berg * 2828b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2829b80edbc1SLuciano Coelho * 28307527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 28317527a782SJohannes Berg * 28327527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 28337527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 28347527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 28357527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 28367527a782SJohannes Berg * }; 28377527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 28387527a782SJohannes Berg * .limits = limits3, 28397527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 28407527a782SJohannes Berg * .max_interfaces = 4, 28417527a782SJohannes Berg * .num_different_channels = 2, 28427527a782SJohannes Berg * }; 28437527a782SJohannes Berg */ 28447527a782SJohannes Berg struct ieee80211_iface_combination { 28457527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 28467527a782SJohannes Berg u32 num_different_channels; 28477527a782SJohannes Berg u16 max_interfaces; 28487527a782SJohannes Berg u8 n_limits; 28497527a782SJohannes Berg bool beacon_int_infra_match; 285011c4a075SSimon Wunderlich u8 radar_detect_widths; 28518c48b50aSFelix Fietkau u8 radar_detect_regions; 28525be83de5SJohannes Berg }; 28535be83de5SJohannes Berg 28542e161f78SJohannes Berg struct ieee80211_txrx_stypes { 28552e161f78SJohannes Berg u16 tx, rx; 28562e161f78SJohannes Berg }; 28572e161f78SJohannes Berg 28585be83de5SJohannes Berg /** 2859ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 2860ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 2861ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 2862ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 2863ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 2864ff1b6e69SJohannes Berg * packet should be preserved in that case 2865ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 2866ff1b6e69SJohannes Berg * (see nl80211.h) 2867ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 286877dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 286977dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 287077dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 287177dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 287277dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 28738cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 2874ff1b6e69SJohannes Berg */ 2875ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 2876ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 2877ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 2878ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 287977dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 288077dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 288177dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 288277dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 288377dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 28848cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 2885ff1b6e69SJohannes Berg }; 2886ff1b6e69SJohannes Berg 28872a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 28882a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 28892a0e047eSJohannes Berg u32 data_payload_max; 28902a0e047eSJohannes Berg u32 data_interval_max; 28912a0e047eSJohannes Berg u32 wake_payload_max; 28922a0e047eSJohannes Berg bool seq; 28932a0e047eSJohannes Berg }; 28942a0e047eSJohannes Berg 2895ff1b6e69SJohannes Berg /** 2896ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 2897ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 2898ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 2899ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 2900ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 2901ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 2902bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 29038cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 29048cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 29058cd4d456SLuciano Coelho * scheduled scans. 29068cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 29078cd4d456SLuciano Coelho * details. 29082a0e047eSJohannes Berg * @tcp: TCP wakeup support information 2909ff1b6e69SJohannes Berg */ 2910ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 2911ff1b6e69SJohannes Berg u32 flags; 2912ff1b6e69SJohannes Berg int n_patterns; 2913ff1b6e69SJohannes Berg int pattern_max_len; 2914ff1b6e69SJohannes Berg int pattern_min_len; 2915bb92d199SAmitkumar Karwar int max_pkt_offset; 29168cd4d456SLuciano Coelho int max_nd_match_sets; 29172a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 2918ff1b6e69SJohannes Berg }; 2919ff1b6e69SJohannes Berg 2920ff1b6e69SJohannes Berg /** 2921be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 2922be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 2923be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 2924be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 2925be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 2926be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 2927be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 2928be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 2929be29b99aSAmitkumar Karwar */ 2930be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 2931be29b99aSAmitkumar Karwar int n_rules; 2932be29b99aSAmitkumar Karwar int max_delay; 2933be29b99aSAmitkumar Karwar int n_patterns; 2934be29b99aSAmitkumar Karwar int pattern_max_len; 2935be29b99aSAmitkumar Karwar int pattern_min_len; 2936be29b99aSAmitkumar Karwar int max_pkt_offset; 2937be29b99aSAmitkumar Karwar }; 2938be29b99aSAmitkumar Karwar 2939be29b99aSAmitkumar Karwar /** 2940ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 2941ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 2942ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 2943ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 2944ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 2945ad7e718cSJohannes Berg */ 2946ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 2947ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 2948ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 2949ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 2950ad7e718cSJohannes Berg }; 2951ad7e718cSJohannes Berg 2952ad7e718cSJohannes Berg /** 2953ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 2954ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 2955ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 2956ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 2957ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 2958ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 2959ad7e718cSJohannes Berg */ 2960ad7e718cSJohannes Berg struct wiphy_vendor_command { 2961ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 2962ad7e718cSJohannes Berg u32 flags; 2963ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 2964ad7e718cSJohannes Berg const void *data, int data_len); 2965ad7e718cSJohannes Berg }; 2966ad7e718cSJohannes Berg 2967ad7e718cSJohannes Berg /** 29685be83de5SJohannes Berg * struct wiphy - wireless hardware description 29692784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 29702784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 29712784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 2972d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 2973d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 2974d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 2975d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 2976d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 2977d3236553SJohannes Berg * @cipher_suites: supported cipher suites 2978d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 2979b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 2980b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 2981b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 2982b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 2983b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 2984abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 2985ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 2986ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 2987ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 29880fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 2989ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 2990ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 2991ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 2992ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 2993ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 2994ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 2995ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 2996ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 2997fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 2998fd235913SRandy Dunlap * unregister hardware 2999abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3000abe37c4bSJohannes Berg * automatically on wiphy renames 3001abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 30024a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3003abe37c4bSJohannes Berg * @wext: wireless extension handlers 3004abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3005abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3006abe37c4bSJohannes Berg * must be set by driver 30077527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 30087527a782SJohannes Berg * list single interface types. 30097527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 30107527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 30117527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3012abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3013a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3014a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 30151f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3016abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3017abe37c4bSJohannes Berg * this variable determines its size 3018abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3019abe37c4bSJohannes Berg * any given scan 302093b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 302193b6aa69SLuciano Coelho * for in any given scheduled scan 3022a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3023a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3024a1f1c21cSLuciano Coelho * supported. 3025abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3026abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3027abe37c4bSJohannes Berg * include fixed IEs like supported rates 30285a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 30295a865badSLuciano Coelho * scans 3030abe37c4bSJohannes Berg * @coverage_class: current coverage class 3031abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3032abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3033abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3034abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3035abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3036abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 30372e161f78SJohannes Berg * 30382e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 30392e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 30402e161f78SJohannes Berg * type 3041a7ffac95SBruno Randolf * 30427f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 30437f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 30447f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 30457f531e03SBruno Randolf * 30467f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 30477f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 30487f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3049a293911dSJohannes Berg * 305015f0ebc2SRandy Dunlap * @probe_resp_offload: 305115f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 305215f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 305315f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 305415f0ebc2SRandy Dunlap * 3055a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3056a293911dSJohannes Berg * may request, if implemented. 3057ff1b6e69SJohannes Berg * 3058ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 30596abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 30606abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 30616abb9cb9SJohannes Berg * to the suspend() operation instead. 3062562a7480SJohannes Berg * 3063562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 30647e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 30657e7c8926SBen Greear * If null, then none can be over-ridden. 3066ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3067ee2aca34SJohannes Berg * If null, then none can be over-ridden. 306877765eafSVasanthakumar Thiagarajan * 306977765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 307077765eafSVasanthakumar Thiagarajan * supports for ACL. 3071a50df0c4SJohannes Berg * 3072a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3073a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3074a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3075a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3076a50df0c4SJohannes Berg * 802.11-2012 8.4.2.29 for the defined fields. 3077a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3078a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3079be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3080ad7e718cSJohannes Berg * 3081ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3082ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3083567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3084567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3085b43504cfSJouni Malinen * 3086b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3087b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3088b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3089b43504cfSJouni Malinen * some cases, but may not always reach. 3090c2e4323bSLuciano Coelho * 3091c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3092c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3093c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3094c2e4323bSLuciano Coelho * infinite. 309567af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 309667af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 309767af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 309867af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 309967af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 310067af9811SEmmanuel Grumbach * This value should be set in MHz. 3101d3236553SJohannes Berg */ 3102d3236553SJohannes Berg struct wiphy { 3103d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3104d3236553SJohannes Berg 3105ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3106d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3107ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3108ef15aac6SJohannes Berg 3109ef15aac6SJohannes Berg struct mac_address *addresses; 3110d3236553SJohannes Berg 31112e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 31122e161f78SJohannes Berg 31137527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 31147527a782SJohannes Berg int n_iface_combinations; 31157527a782SJohannes Berg u16 software_iftypes; 31167527a782SJohannes Berg 31172e161f78SJohannes Berg u16 n_addresses; 31182e161f78SJohannes Berg 3119d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3120d3236553SJohannes Berg u16 interface_modes; 3121d3236553SJohannes Berg 312277765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 312377765eafSVasanthakumar Thiagarajan 3124a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3125463d0183SJohannes Berg 3126562a7480SJohannes Berg u32 ap_sme_capa; 3127562a7480SJohannes Berg 3128d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3129d3236553SJohannes Berg 3130d3236553SJohannes Berg int bss_priv_size; 3131d3236553SJohannes Berg u8 max_scan_ssids; 313293b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3133a1f1c21cSLuciano Coelho u8 max_match_sets; 3134d3236553SJohannes Berg u16 max_scan_ie_len; 31355a865badSLuciano Coelho u16 max_sched_scan_ie_len; 3136d3236553SJohannes Berg 3137d3236553SJohannes Berg int n_cipher_suites; 3138d3236553SJohannes Berg const u32 *cipher_suites; 3139d3236553SJohannes Berg 3140b9a5f8caSJouni Malinen u8 retry_short; 3141b9a5f8caSJouni Malinen u8 retry_long; 3142b9a5f8caSJouni Malinen u32 frag_threshold; 3143b9a5f8caSJouni Malinen u32 rts_threshold; 314481077e82SLukáš Turek u8 coverage_class; 3145b9a5f8caSJouni Malinen 314681135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3147dfce95f5SKalle Valo u32 hw_version; 3148dfce95f5SKalle Valo 3149dfb89c56SJohannes Berg #ifdef CONFIG_PM 3150964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 31516abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3152dfb89c56SJohannes Berg #endif 3153ff1b6e69SJohannes Berg 3154a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3155a293911dSJohannes Berg 315667fbb16bSSamuel Ortiz u8 max_num_pmkids; 315767fbb16bSSamuel Ortiz 31587f531e03SBruno Randolf u32 available_antennas_tx; 31597f531e03SBruno Randolf u32 available_antennas_rx; 3160a7ffac95SBruno Randolf 316187bbbe22SArik Nemtsov /* 316287bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 316387bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 316487bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 316587bbbe22SArik Nemtsov */ 316687bbbe22SArik Nemtsov u32 probe_resp_offload; 316787bbbe22SArik Nemtsov 3168a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3169a50df0c4SJohannes Berg u8 extended_capabilities_len; 3170a50df0c4SJohannes Berg 3171d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3172d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3173d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3174d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3175d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3176cf5aa2f1SDavid Kilroy const void *privid; 3177d3236553SJohannes Berg 3178d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 3179d3236553SJohannes Berg 3180d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 31810c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3182d3236553SJohannes Berg struct regulatory_request *request); 3183d3236553SJohannes Berg 3184d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3185d3236553SJohannes Berg 3186458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3187d3236553SJohannes Berg 3188d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3189d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3190d3236553SJohannes Berg struct device dev; 3191d3236553SJohannes Berg 3192ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3193ecb44335SStanislaw Gruszka bool registered; 3194ecb44335SStanislaw Gruszka 3195d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3196d3236553SJohannes Berg struct dentry *debugfsdir; 3197d3236553SJohannes Berg 31987e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3199ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 32007e7c8926SBen Greear 3201463d0183SJohannes Berg #ifdef CONFIG_NET_NS 3202463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 3203463d0183SJohannes Berg struct net *_net; 3204463d0183SJohannes Berg #endif 3205463d0183SJohannes Berg 32063d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 32073d23e349SJohannes Berg const struct iw_handler_def *wext; 32083d23e349SJohannes Berg #endif 32093d23e349SJohannes Berg 3210be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3211be29b99aSAmitkumar Karwar 3212ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3213567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3214567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3215ad7e718cSJohannes Berg 3216b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3217b43504cfSJouni Malinen 32189a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 321967af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 32209a774c78SAndrei Otcheretianski 32211c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3222d3236553SJohannes Berg }; 3223d3236553SJohannes Berg 3224463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3225463d0183SJohannes Berg { 3226c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3227463d0183SJohannes Berg } 3228463d0183SJohannes Berg 3229463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3230463d0183SJohannes Berg { 3231c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3232463d0183SJohannes Berg } 3233463d0183SJohannes Berg 3234d3236553SJohannes Berg /** 3235d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3236d3236553SJohannes Berg * 3237d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 32380ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3239d3236553SJohannes Berg */ 3240d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3241d3236553SJohannes Berg { 3242d3236553SJohannes Berg BUG_ON(!wiphy); 3243d3236553SJohannes Berg return &wiphy->priv; 3244d3236553SJohannes Berg } 3245d3236553SJohannes Berg 3246d3236553SJohannes Berg /** 3247f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3248f1f74825SDavid Kilroy * 3249f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 32500ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3251f1f74825SDavid Kilroy */ 3252f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3253f1f74825SDavid Kilroy { 3254f1f74825SDavid Kilroy BUG_ON(!priv); 3255f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3256f1f74825SDavid Kilroy } 3257f1f74825SDavid Kilroy 3258f1f74825SDavid Kilroy /** 3259d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3260d3236553SJohannes Berg * 3261d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3262d3236553SJohannes Berg * @dev: The device to parent it to 3263d3236553SJohannes Berg */ 3264d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3265d3236553SJohannes Berg { 3266d3236553SJohannes Berg wiphy->dev.parent = dev; 3267d3236553SJohannes Berg } 3268d3236553SJohannes Berg 3269d3236553SJohannes Berg /** 3270d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3271d3236553SJohannes Berg * 3272d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 32730ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3274d3236553SJohannes Berg */ 3275d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3276d3236553SJohannes Berg { 3277d3236553SJohannes Berg return wiphy->dev.parent; 3278d3236553SJohannes Berg } 3279d3236553SJohannes Berg 3280d3236553SJohannes Berg /** 3281d3236553SJohannes Berg * wiphy_name - get wiphy name 3282d3236553SJohannes Berg * 3283d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 32840ae997dcSYacine Belkadi * Return: The name of @wiphy. 3285d3236553SJohannes Berg */ 3286e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3287d3236553SJohannes Berg { 3288d3236553SJohannes Berg return dev_name(&wiphy->dev); 3289d3236553SJohannes Berg } 3290d3236553SJohannes Berg 3291d3236553SJohannes Berg /** 32921998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 32931998d90aSBen Greear * 32941998d90aSBen Greear * @ops: The configuration operations for this device 32951998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 32961998d90aSBen Greear * @requested_name: Request a particular name. 32971998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 32981998d90aSBen Greear * 32991998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 33001998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 33011998d90aSBen Greear * 33021998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 33031998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 33041998d90aSBen Greear */ 33051998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 33061998d90aSBen Greear const char *requested_name); 33071998d90aSBen Greear 33081998d90aSBen Greear /** 3309d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3310d3236553SJohannes Berg * 3311d3236553SJohannes Berg * @ops: The configuration operations for this device 3312d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3313d3236553SJohannes Berg * 3314d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3315d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3316d3236553SJohannes Berg * 33170ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 33180ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3319d3236553SJohannes Berg */ 33201998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 33211998d90aSBen Greear int sizeof_priv) 33221998d90aSBen Greear { 33231998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 33241998d90aSBen Greear } 3325d3236553SJohannes Berg 3326d3236553SJohannes Berg /** 3327d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3328d3236553SJohannes Berg * 3329d3236553SJohannes Berg * @wiphy: The wiphy to register. 3330d3236553SJohannes Berg * 33310ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3332d3236553SJohannes Berg */ 333310dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3334d3236553SJohannes Berg 3335d3236553SJohannes Berg /** 3336d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3337d3236553SJohannes Berg * 3338d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3339d3236553SJohannes Berg * 3340d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3341d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3342d3236553SJohannes Berg * request that is being handled. 3343d3236553SJohannes Berg */ 334410dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3345d3236553SJohannes Berg 3346d3236553SJohannes Berg /** 3347d3236553SJohannes Berg * wiphy_free - free wiphy 3348d3236553SJohannes Berg * 3349d3236553SJohannes Berg * @wiphy: The wiphy to free 3350d3236553SJohannes Berg */ 335110dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3352d3236553SJohannes Berg 3353fffd0934SJohannes Berg /* internal structs */ 33546829c878SJohannes Berg struct cfg80211_conn; 335519957bb3SJohannes Berg struct cfg80211_internal_bss; 3356fffd0934SJohannes Berg struct cfg80211_cached_keys; 335719957bb3SJohannes Berg 3358d3236553SJohannes Berg /** 335989a54e48SJohannes Berg * struct wireless_dev - wireless device state 3360d3236553SJohannes Berg * 336189a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 336289a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 336389a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 336489a54e48SJohannes Berg * It need not be registered then as netdev registration will 336589a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 336689a54e48SJohannes Berg * 336789a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 336889a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 336989a54e48SJohannes Berg * there's no netdev registration in that case it may not be 337089a54e48SJohannes Berg * allocated outside of callback operations that return it. 3371d3236553SJohannes Berg * 3372d3236553SJohannes Berg * @wiphy: pointer to hardware description 3373d3236553SJohannes Berg * @iftype: interface type 3374d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 337589a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 337689a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 337789a54e48SJohannes Berg * wireless device if it has no netdev 3378d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 33799e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 33809e0e2961SMichal Kazior * the user-set channel definition. 3381780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3382aa430da4SJohannes Berg * track the channel to be used for AP later 3383d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3384d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3385d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 338629cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 338729cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3388d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 33899bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 33909bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 33919bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 33929bc383deSJohannes Berg * by cfg80211 on change_interface 33932e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 33942e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 33958d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 33968d61ffa5SJohannes Berg * and some API functions require it held 339756d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 339856d1893dSJohannes Berg * beacons, 0 when not valid 339998104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 340098104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 340104f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 340204f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 340331559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3404780b40dfSJohannes Berg * @ps: powersave mode is enabled 3405780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3406780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3407780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3408780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3409780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 3410780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 34115336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3412780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3413780b40dfSJohannes Berg * @event_lock: (private) lock for event list 341478f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3415d3236553SJohannes Berg */ 3416d3236553SJohannes Berg struct wireless_dev { 3417d3236553SJohannes Berg struct wiphy *wiphy; 3418d3236553SJohannes Berg enum nl80211_iftype iftype; 3419d3236553SJohannes Berg 3420667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3421d3236553SJohannes Berg struct list_head list; 3422d3236553SJohannes Berg struct net_device *netdev; 3423d3236553SJohannes Berg 342489a54e48SJohannes Berg u32 identifier; 342589a54e48SJohannes Berg 34262e161f78SJohannes Berg struct list_head mgmt_registrations; 34272e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3428026331c4SJouni Malinen 3429667503ddSJohannes Berg struct mutex mtx; 3430667503ddSJohannes Berg 343198104fdeSJohannes Berg bool use_4addr, p2p_started; 343298104fdeSJohannes Berg 343398104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 34349bc383deSJohannes Berg 3435b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3436d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 343729cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 34386829c878SJohannes Berg struct cfg80211_conn *conn; 3439fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 3440d3236553SJohannes Berg 3441667503ddSJohannes Berg struct list_head event_list; 3442667503ddSJohannes Berg spinlock_t event_lock; 3443667503ddSJohannes Berg 344419957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3445683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 34469e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3447f4489ebeSMichal Kazior 3448c30a3d38SMichal Kazior bool ibss_fixed; 34495336fa88SSimon Wunderlich bool ibss_dfs_possible; 3450c30a3d38SMichal Kazior 3451ffb9eb3dSKalle Valo bool ps; 3452ffb9eb3dSKalle Valo int ps_timeout; 3453ffb9eb3dSKalle Valo 345456d1893dSJohannes Berg int beacon_interval; 345556d1893dSJohannes Berg 345615e47304SEric W. Biederman u32 ap_unexpected_nlportid; 345728946da7SJohannes Berg 345804f39047SSimon Wunderlich bool cac_started; 345904f39047SSimon Wunderlich unsigned long cac_start_time; 346031559f35SJanusz Dziedzic unsigned int cac_time_ms; 346104f39047SSimon Wunderlich 346278f22b6aSJohannes Berg u32 owner_nlportid; 346378f22b6aSJohannes Berg 34643d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3465d3236553SJohannes Berg /* wext data */ 3466cbe8fa9cSJohannes Berg struct { 3467cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3468f2129354SJohannes Berg struct cfg80211_connect_params connect; 3469fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3470c1e5f471SJohannes Berg const u8 *ie; 3471f2129354SJohannes Berg size_t ie_len; 3472f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3473f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 347408645126SJohannes Berg s8 default_key, default_mgmt_key; 3475ffb9eb3dSKalle Valo bool prev_bssid_valid; 3476cbe8fa9cSJohannes Berg } wext; 3477d3236553SJohannes Berg #endif 3478d3236553SJohannes Berg }; 3479d3236553SJohannes Berg 348098104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 348198104fdeSJohannes Berg { 348298104fdeSJohannes Berg if (wdev->netdev) 348398104fdeSJohannes Berg return wdev->netdev->dev_addr; 348498104fdeSJohannes Berg return wdev->address; 348598104fdeSJohannes Berg } 348698104fdeSJohannes Berg 3487d3236553SJohannes Berg /** 3488d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3489d3236553SJohannes Berg * 3490d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 34910ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3492d3236553SJohannes Berg */ 3493d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3494d3236553SJohannes Berg { 3495d3236553SJohannes Berg BUG_ON(!wdev); 3496d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3497d3236553SJohannes Berg } 3498d3236553SJohannes Berg 3499d70e9693SJohannes Berg /** 3500d70e9693SJohannes Berg * DOC: Utility functions 3501d70e9693SJohannes Berg * 3502d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3503d3236553SJohannes Berg */ 3504d3236553SJohannes Berg 3505d3236553SJohannes Berg /** 3506d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3507abe37c4bSJohannes Berg * @chan: channel number 350859eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 35090ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3510d3236553SJohannes Berg */ 351110dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 3512d3236553SJohannes Berg 3513d3236553SJohannes Berg /** 3514d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3515abe37c4bSJohannes Berg * @freq: center frequency 35160ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3517d3236553SJohannes Berg */ 351810dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3519d3236553SJohannes Berg 3520d3236553SJohannes Berg /* 3521d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3522d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3523d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3524d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3525d3236553SJohannes Berg * clash. 3526d3236553SJohannes Berg */ 352710dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3528d3236553SJohannes Berg int freq); 3529d3236553SJohannes Berg /** 3530d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3531abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3532abe37c4bSJohannes Berg * @freq: the center frequency of the channel 35330ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3534d3236553SJohannes Berg */ 3535d3236553SJohannes Berg static inline struct ieee80211_channel * 3536d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3537d3236553SJohannes Berg { 3538d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3539d3236553SJohannes Berg } 3540d3236553SJohannes Berg 3541d3236553SJohannes Berg /** 3542d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3543d3236553SJohannes Berg * 3544d3236553SJohannes Berg * @sband: the band to look for rates in 3545d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3546d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3547d3236553SJohannes Berg * 35480ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 35490ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 35500ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 35510ae997dcSYacine Belkadi * rates in the band's bitrate table. 3552d3236553SJohannes Berg */ 3553d3236553SJohannes Berg struct ieee80211_rate * 3554d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3555d3236553SJohannes Berg u32 basic_rates, int bitrate); 3556d3236553SJohannes Berg 3557b422c6cdSAshok Nagarajan /** 3558b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3559b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 356074608acaSSimon Wunderlich * @scan_width: width of the control channel 3561b422c6cdSAshok Nagarajan * 3562b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3563b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3564b422c6cdSAshok Nagarajan */ 356574608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 356674608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3567b422c6cdSAshok Nagarajan 3568d3236553SJohannes Berg /* 3569d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3570d3236553SJohannes Berg * 3571d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3572d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3573d3236553SJohannes Berg */ 3574d3236553SJohannes Berg 357533e5a2f7SJohannes Berg struct radiotap_align_size { 357633e5a2f7SJohannes Berg uint8_t align:4, size:4; 357733e5a2f7SJohannes Berg }; 357833e5a2f7SJohannes Berg 357933e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 358033e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 358133e5a2f7SJohannes Berg int n_bits; 358233e5a2f7SJohannes Berg uint32_t oui; 358333e5a2f7SJohannes Berg uint8_t subns; 358433e5a2f7SJohannes Berg }; 358533e5a2f7SJohannes Berg 358633e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 358733e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 358833e5a2f7SJohannes Berg int n_ns; 358933e5a2f7SJohannes Berg }; 359033e5a2f7SJohannes Berg 3591d3236553SJohannes Berg /** 3592d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 359333e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 359433e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 359533e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 359633e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 359733e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 359833e5a2f7SJohannes Berg * the beginning of the actual data portion 359933e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 360033e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 360133e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 360233e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 360333e5a2f7SJohannes Berg * radiotap namespace or not 360433e5a2f7SJohannes Berg * 360533e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 360633e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 360733e5a2f7SJohannes Berg * @_arg_index: next argument index 360833e5a2f7SJohannes Berg * @_arg: next argument pointer 360933e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 361033e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 361133e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 361233e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 361333e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 361433e5a2f7SJohannes Berg * next bitmap word 361533e5a2f7SJohannes Berg * 361633e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 361733e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 3618d3236553SJohannes Berg */ 3619d3236553SJohannes Berg 3620d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 362133e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 362233e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 362333e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 3624d3236553SJohannes Berg 362533e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 362667272440SJohannes Berg __le32 *_next_bitmap; 362733e5a2f7SJohannes Berg 362833e5a2f7SJohannes Berg unsigned char *this_arg; 362933e5a2f7SJohannes Berg int this_arg_index; 363033e5a2f7SJohannes Berg int this_arg_size; 363133e5a2f7SJohannes Berg 363233e5a2f7SJohannes Berg int is_radiotap_ns; 363333e5a2f7SJohannes Berg 363433e5a2f7SJohannes Berg int _max_length; 363533e5a2f7SJohannes Berg int _arg_index; 363633e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 363733e5a2f7SJohannes Berg int _reset_on_ext; 3638d3236553SJohannes Berg }; 3639d3236553SJohannes Berg 364010dd9b7cSJoe Perches int 364110dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 3642d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 364310dd9b7cSJoe Perches int max_length, 364410dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 3645d3236553SJohannes Berg 364610dd9b7cSJoe Perches int 364710dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 3648d3236553SJohannes Berg 364933e5a2f7SJohannes Berg 3650e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 3651e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 3652e31a16d6SZhu Yi 3653e31a16d6SZhu Yi /** 3654e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 3655e31a16d6SZhu Yi * 3656e31a16d6SZhu Yi * @skb: the frame 36570ae997dcSYacine Belkadi * 36580ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 36590ae997dcSYacine Belkadi * returns the 802.11 header length. 36600ae997dcSYacine Belkadi * 36610ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 36620ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 36630ae997dcSYacine Belkadi * 802.11 header. 3664e31a16d6SZhu Yi */ 3665e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3666e31a16d6SZhu Yi 3667e31a16d6SZhu Yi /** 3668e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 3669e31a16d6SZhu Yi * @fc: frame control field in little-endian format 36700ae997dcSYacine Belkadi * Return: The header length in bytes. 3671e31a16d6SZhu Yi */ 3672633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3673e31a16d6SZhu Yi 3674e31a16d6SZhu Yi /** 36759b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 36769b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 36779b395bc3SJohannes Berg * (first byte) will be accessed 36780ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 36799b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 36809b395bc3SJohannes Berg */ 36819b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 36829b395bc3SJohannes Berg 36839b395bc3SJohannes Berg /** 3684d70e9693SJohannes Berg * DOC: Data path helpers 3685d70e9693SJohannes Berg * 3686d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 3687d70e9693SJohannes Berg * functions that help implement the data path for devices 3688d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 3689d70e9693SJohannes Berg */ 3690d70e9693SJohannes Berg 3691d70e9693SJohannes Berg /** 3692e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 3693e31a16d6SZhu Yi * @skb: the 802.11 data frame 3694e31a16d6SZhu Yi * @addr: the device MAC address 3695e31a16d6SZhu Yi * @iftype: the virtual interface type 36960ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 3697e31a16d6SZhu Yi */ 3698eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3699e31a16d6SZhu Yi enum nl80211_iftype iftype); 3700e31a16d6SZhu Yi 3701e31a16d6SZhu Yi /** 3702e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 3703e31a16d6SZhu Yi * @skb: the 802.3 frame 3704e31a16d6SZhu Yi * @addr: the device MAC address 3705e31a16d6SZhu Yi * @iftype: the virtual interface type 3706e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3707e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 37080ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 3709e31a16d6SZhu Yi */ 3710eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3711c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 3712c1e5f471SJohannes Berg bool qos); 3713e31a16d6SZhu Yi 3714e31a16d6SZhu Yi /** 3715eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3716eaf85ca7SZhu Yi * 3717eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 3718eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 3719eaf85ca7SZhu Yi * @skb is consumed after the function returns. 3720eaf85ca7SZhu Yi * 3721eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 3722eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 3723eaf85ca7SZhu Yi * initialized by by the caller. 3724eaf85ca7SZhu Yi * @addr: The device MAC address. 3725eaf85ca7SZhu Yi * @iftype: The device interface type. 3726eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 37278b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 3728eaf85ca7SZhu Yi */ 3729eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 3730eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 37318b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 37328b3becadSYogesh Ashok Powar bool has_80211_header); 3733eaf85ca7SZhu Yi 3734eaf85ca7SZhu Yi /** 3735e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3736e31a16d6SZhu Yi * @skb: the data frame 3737fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 37380ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 3739e31a16d6SZhu Yi */ 3740fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 3741fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3742e31a16d6SZhu Yi 3743c21dbf92SJohannes Berg /** 3744c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 3745c21dbf92SJohannes Berg * 3746c21dbf92SJohannes Berg * @eid: element ID 3747c21dbf92SJohannes Berg * @ies: data consisting of IEs 3748c21dbf92SJohannes Berg * @len: length of data 3749c21dbf92SJohannes Berg * 37500ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 37510ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 37520ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 37530ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 37540ae997dcSYacine Belkadi * 37550ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 37560ae997dcSYacine Belkadi * having to fit into the given data. 3757c21dbf92SJohannes Berg */ 3758c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3759c21dbf92SJohannes Berg 3760d70e9693SJohannes Berg /** 37610c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 37620c28ec58SEliad Peller * 37630c28ec58SEliad Peller * @oui: vendor OUI 37640c28ec58SEliad Peller * @oui_type: vendor-specific OUI type 37650c28ec58SEliad Peller * @ies: data consisting of IEs 37660c28ec58SEliad Peller * @len: length of data 37670c28ec58SEliad Peller * 37680ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 37690ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 37700ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 37710ae997dcSYacine Belkadi * element ID. 37720ae997dcSYacine Belkadi * 37730ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 37740ae997dcSYacine Belkadi * the given data. 37750c28ec58SEliad Peller */ 37760c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 37770c28ec58SEliad Peller const u8 *ies, int len); 37780c28ec58SEliad Peller 37790c28ec58SEliad Peller /** 3780d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 3781d70e9693SJohannes Berg * 3782d70e9693SJohannes Berg * TODO 3783d3236553SJohannes Berg */ 3784d3236553SJohannes Berg 3785d3236553SJohannes Berg /** 3786d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 3787d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 3788d3236553SJohannes Berg * conflicts) 3789d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 3790d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 3791d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 3792d3236553SJohannes Berg * alpha2. 3793d3236553SJohannes Berg * 3794d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 3795d3236553SJohannes Berg * what it believes should be the current regulatory domain by 3796d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 3797d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 3798d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 3799d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 3800d3236553SJohannes Berg * 3801d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 3802d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 3803d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 3804d3236553SJohannes Berg * 3805d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 3806d3236553SJohannes Berg * an -ENOMEM. 38070ae997dcSYacine Belkadi * 38080ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 3809d3236553SJohannes Berg */ 381010dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3811d3236553SJohannes Berg 3812d3236553SJohannes Berg /** 3813b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 3814b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 3815b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 3816b0d7aa59SJonathan Doron * 3817b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 3818b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 3819b0d7aa59SJonathan Doron * information. 3820b0d7aa59SJonathan Doron * 3821b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 3822b0d7aa59SJonathan Doron */ 3823b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 3824b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 3825b0d7aa59SJonathan Doron 3826b0d7aa59SJonathan Doron /** 3827d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 3828d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 3829d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 3830d3236553SJohannes Berg * 3831d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 3832d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 3833d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 3834d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 3835d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 3836d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 3837222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 3838ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 3839222ea581SLuis R. Rodriguez * that called this helper. 3840d3236553SJohannes Berg */ 384110dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 3842d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 3843d3236553SJohannes Berg 3844d3236553SJohannes Berg /** 3845d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 3846d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 3847d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 3848d3236553SJohannes Berg * 3849d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 3850d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 3851d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 3852d3236553SJohannes Berg * and processed already. 3853d3236553SJohannes Berg * 38540ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 38550ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 38560ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 38570ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 38580ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 38590ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 38600ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 3861d3236553SJohannes Berg */ 3862361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3863361c9c8bSJohannes Berg u32 center_freq); 3864d3236553SJohannes Berg 3865034c6d6eSLuis R. Rodriguez /** 3866034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 3867034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 3868034c6d6eSLuis R. Rodriguez * 3869034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 3870034c6d6eSLuis R. Rodriguez * proper string representation. 3871034c6d6eSLuis R. Rodriguez */ 3872034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 3873034c6d6eSLuis R. Rodriguez 3874d3236553SJohannes Berg /* 3875d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 3876d3236553SJohannes Berg * functions and BSS handling helpers 3877d3236553SJohannes Berg */ 3878d3236553SJohannes Berg 38792a519311SJohannes Berg /** 38802a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 38812a519311SJohannes Berg * 38822a519311SJohannes Berg * @request: the corresponding scan request 38832a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 38842a519311SJohannes Berg * userspace will be notified of that 38852a519311SJohannes Berg */ 38862a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 38872a519311SJohannes Berg 38882a519311SJohannes Berg /** 3889807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 3890807f8a8cSLuciano Coelho * 3891807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 3892807f8a8cSLuciano Coelho */ 3893807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 3894807f8a8cSLuciano Coelho 3895807f8a8cSLuciano Coelho /** 3896807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 3897807f8a8cSLuciano Coelho * 3898807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 3899807f8a8cSLuciano Coelho * 3900807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 3901807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 3902807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 3903807f8a8cSLuciano Coelho */ 3904807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3905807f8a8cSLuciano Coelho 3906807f8a8cSLuciano Coelho /** 3907792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 3908792e6aa7SEliad Peller * 3909792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 3910792e6aa7SEliad Peller * 3911792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 3912792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 3913792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 3914792e6aa7SEliad Peller * This function should be called with rtnl locked. 3915792e6aa7SEliad Peller */ 3916792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 3917792e6aa7SEliad Peller 3918792e6aa7SEliad Peller /** 3919dcd6eac1SSimon Wunderlich * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 39202a519311SJohannes Berg * 39212a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 39223afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3923dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 3924abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 3925abe37c4bSJohannes Berg * @len: length of the management frame 392677965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 39272a519311SJohannes Berg * @gfp: context flags 39282a519311SJohannes Berg * 39292a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 39302a519311SJohannes Berg * the BSS should be updated/added. 3931ef100682SJohannes Berg * 39320ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39330ae997dcSYacine Belkadi * Or %NULL on error. 39342a519311SJohannes Berg */ 3935ef100682SJohannes Berg struct cfg80211_bss * __must_check 3936dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 39373afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3938dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 3939dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 3940dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3941dcd6eac1SSimon Wunderlich 3942dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 39432a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 39443afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 39452a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 3946dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 3947dcd6eac1SSimon Wunderlich { 39483afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width_frame(wiphy, rx_channel, 3949dcd6eac1SSimon Wunderlich NL80211_BSS_CHAN_WIDTH_20, 3950dcd6eac1SSimon Wunderlich mgmt, len, signal, gfp); 3951dcd6eac1SSimon Wunderlich } 39522a519311SJohannes Berg 3953abe37c4bSJohannes Berg /** 39545bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 39555bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 39565bc8c1f2SJohannes Berg * from a beacon or probe response 39575bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 39585bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 39595bc8c1f2SJohannes Berg */ 39605bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 39615bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 39625bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 39635bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 39645bc8c1f2SJohannes Berg }; 39655bc8c1f2SJohannes Berg 39665bc8c1f2SJohannes Berg /** 39675bc8c1f2SJohannes Berg * cfg80211_inform_bss_width - inform cfg80211 of a new BSS 3968abe37c4bSJohannes Berg * 3969abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 39703afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3971dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 39725bc8c1f2SJohannes Berg * @ftype: frame type (if known) 3973abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 39747b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3975abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 3976abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 3977abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 3978abe37c4bSJohannes Berg * @ielen: length of the additional IEs 3979abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 3980abe37c4bSJohannes Berg * @gfp: context flags 3981abe37c4bSJohannes Berg * 3982abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 3983abe37c4bSJohannes Berg * the BSS should be updated/added. 3984ef100682SJohannes Berg * 39850ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39860ae997dcSYacine Belkadi * Or %NULL on error. 3987abe37c4bSJohannes Berg */ 3988ef100682SJohannes Berg struct cfg80211_bss * __must_check 3989dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 39903afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3991dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 39925bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 3993dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 3994dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 3995dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3996dcd6eac1SSimon Wunderlich 3997dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 399806aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 39993afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 40005bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 40017b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 40027b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4003dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4004dcd6eac1SSimon Wunderlich { 40053afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width(wiphy, rx_channel, 40065bc8c1f2SJohannes Berg NL80211_BSS_CHAN_WIDTH_20, ftype, 4007dcd6eac1SSimon Wunderlich bssid, tsf, capability, 4008dcd6eac1SSimon Wunderlich beacon_interval, ie, ielen, signal, 4009dcd6eac1SSimon Wunderlich gfp); 4010dcd6eac1SSimon Wunderlich } 401106aa7afaSJussi Kivilinna 40122a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 40132a519311SJohannes Berg struct ieee80211_channel *channel, 40142a519311SJohannes Berg const u8 *bssid, 401579420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 401679420f09SJohannes Berg u16 capa_mask, u16 capa_val); 401779420f09SJohannes Berg static inline struct cfg80211_bss * 401879420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 401979420f09SJohannes Berg struct ieee80211_channel *channel, 402079420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 402179420f09SJohannes Berg { 402279420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 402379420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 402479420f09SJohannes Berg } 402579420f09SJohannes Berg 40264c0c0b75SJohannes Berg /** 40274c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 40285b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 40294c0c0b75SJohannes Berg * @bss: the BSS struct to reference 40304c0c0b75SJohannes Berg * 40314c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 40324c0c0b75SJohannes Berg */ 40335b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 40344c0c0b75SJohannes Berg 40354c0c0b75SJohannes Berg /** 40364c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 40375b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 40384c0c0b75SJohannes Berg * @bss: the BSS struct 40394c0c0b75SJohannes Berg * 40404c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 40414c0c0b75SJohannes Berg */ 40425b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4043d3236553SJohannes Berg 4044d491af19SJohannes Berg /** 4045d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4046d491af19SJohannes Berg * @wiphy: the wiphy 4047d491af19SJohannes Berg * @bss: the bss to remove 4048d491af19SJohannes Berg * 4049d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4050d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4051d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4052d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4053d491af19SJohannes Berg */ 4054d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4055fee52678SJohannes Berg 4056dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4057dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4058dcd6eac1SSimon Wunderlich { 4059dcd6eac1SSimon Wunderlich switch (chandef->width) { 4060dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4061dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4062dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4063dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4064dcd6eac1SSimon Wunderlich default: 4065dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4066dcd6eac1SSimon Wunderlich } 4067dcd6eac1SSimon Wunderlich } 4068dcd6eac1SSimon Wunderlich 40696039f6d2SJouni Malinen /** 40706ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 40716039f6d2SJouni Malinen * @dev: network device 40726039f6d2SJouni Malinen * @buf: authentication frame (header + body) 40736039f6d2SJouni Malinen * @len: length of the frame data 40746039f6d2SJouni Malinen * 40756ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 40766ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 40776ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 40786ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40796ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 40806ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40816ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 40826ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 40836ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 40846ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 40856ff57cf8SJohannes Berg * 40866ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 40876039f6d2SJouni Malinen */ 40886ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 40896039f6d2SJouni Malinen 40906039f6d2SJouni Malinen /** 40916ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 40921965c853SJouni Malinen * @dev: network device 40931965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4094cb0b4bebSJohannes Berg * 40958d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 40968d61ffa5SJohannes Berg * mutex. 40971965c853SJouni Malinen */ 40986ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 40991965c853SJouni Malinen 41001965c853SJouni Malinen /** 41016ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 41026039f6d2SJouni Malinen * @dev: network device 41036ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 41046ff57cf8SJohannes Berg * moves to cfg80211 in this call 41056ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 41066039f6d2SJouni Malinen * @len: length of the frame data 4107b0b6aa2cSEliad Peller * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a. 41086039f6d2SJouni Malinen * 41096ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 41106ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 41116ff57cf8SJohannes Berg * 41126ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 41136039f6d2SJouni Malinen */ 41146ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 41156ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4116b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4117b0b6aa2cSEliad Peller int uapsd_queues); 41186039f6d2SJouni Malinen 41196039f6d2SJouni Malinen /** 41206ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 41211965c853SJouni Malinen * @dev: network device 4122959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4123cb0b4bebSJohannes Berg * 41248d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 41251965c853SJouni Malinen */ 4126959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 41271965c853SJouni Malinen 41281965c853SJouni Malinen /** 41296ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 41306039f6d2SJouni Malinen * @dev: network device 41316ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 41326039f6d2SJouni Malinen * @len: length of the frame data 41336039f6d2SJouni Malinen * 41346039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 413553b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 41368d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 41378d61ffa5SJohannes Berg * corresponding wdev's mutex. 41386039f6d2SJouni Malinen */ 41396ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4140ce470613SHolger Schurig 4141ce470613SHolger Schurig /** 41426ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4143cf4e594eSJouni Malinen * @dev: network device 4144cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4145cf4e594eSJouni Malinen * @len: length of the frame data 4146cf4e594eSJouni Malinen * 41476ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 41486ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4149cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4150cf4e594eSJouni Malinen */ 41516ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 41526ff57cf8SJohannes Berg const u8 *buf, size_t len); 4153cf4e594eSJouni Malinen 4154cf4e594eSJouni Malinen /** 4155a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4156a3b8b056SJouni Malinen * @dev: network device 4157a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4158a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4159a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4160a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4161e6d6e342SJohannes Berg * @gfp: allocation flags 4162a3b8b056SJouni Malinen * 4163a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4164a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4165a3b8b056SJouni Malinen * primitive. 4166a3b8b056SJouni Malinen */ 4167a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4168a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4169e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4170a3b8b056SJouni Malinen 417104a773adSJohannes Berg /** 417204a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 417304a773adSJohannes Berg * 417404a773adSJohannes Berg * @dev: network device 417504a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4176fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 417704a773adSJohannes Berg * @gfp: allocation flags 417804a773adSJohannes Berg * 417904a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 418004a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 418104a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 418204a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 418304a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 418404a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 418504a773adSJohannes Berg */ 4186fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4187fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 418804a773adSJohannes Berg 41891f87f7d3SJohannes Berg /** 4190c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4191c93b5e71SJavier Cardona * 4192c93b5e71SJavier Cardona * @dev: network device 4193c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4194c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4195c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4196c93b5e71SJavier Cardona * @gfp: allocation flags 4197c93b5e71SJavier Cardona * 4198c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4199c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4200c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4201c93b5e71SJavier Cardona */ 4202c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4203c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4204c93b5e71SJavier Cardona 4205c93b5e71SJavier Cardona /** 4206d70e9693SJohannes Berg * DOC: RFkill integration 4207d70e9693SJohannes Berg * 4208d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4209d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4210d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4211d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4212d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4213d70e9693SJohannes Berg * 4214d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4215d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4216d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4217d70e9693SJohannes Berg */ 4218d70e9693SJohannes Berg 4219d70e9693SJohannes Berg /** 42201f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 42211f87f7d3SJohannes Berg * @wiphy: the wiphy 42221f87f7d3SJohannes Berg * @blocked: block status 42231f87f7d3SJohannes Berg */ 42241f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 42251f87f7d3SJohannes Berg 42261f87f7d3SJohannes Berg /** 42271f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 42281f87f7d3SJohannes Berg * @wiphy: the wiphy 42291f87f7d3SJohannes Berg */ 42301f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 42311f87f7d3SJohannes Berg 42321f87f7d3SJohannes Berg /** 42331f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 42341f87f7d3SJohannes Berg * @wiphy: the wiphy 42351f87f7d3SJohannes Berg */ 42361f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 42371f87f7d3SJohannes Berg 4238ad7e718cSJohannes Berg /** 4239ad7e718cSJohannes Berg * DOC: Vendor commands 4240ad7e718cSJohannes Berg * 4241ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4242ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4243ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4244ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4245ad7e718cSJohannes Berg * the configuration mechanism. 4246ad7e718cSJohannes Berg * 4247ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4248ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4249ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4250ad7e718cSJohannes Berg * 4251ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4252ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4253ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4254ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4255ad7e718cSJohannes Berg * managers etc. need. 4256ad7e718cSJohannes Berg */ 4257ad7e718cSJohannes Berg 4258ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4259ad7e718cSJohannes Berg enum nl80211_commands cmd, 4260ad7e718cSJohannes Berg enum nl80211_attrs attr, 4261ad7e718cSJohannes Berg int approxlen); 4262ad7e718cSJohannes Berg 4263567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 4264567ffc35SJohannes Berg enum nl80211_commands cmd, 4265567ffc35SJohannes Berg enum nl80211_attrs attr, 4266567ffc35SJohannes Berg int vendor_event_idx, 4267567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4268567ffc35SJohannes Berg 4269567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4270567ffc35SJohannes Berg 4271ad7e718cSJohannes Berg /** 4272ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4273ad7e718cSJohannes Berg * @wiphy: the wiphy 4274ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4275ad7e718cSJohannes Berg * be put into the skb 4276ad7e718cSJohannes Berg * 4277ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4278ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4279ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4280ad7e718cSJohannes Berg * 4281ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4282ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4283ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4284ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4285ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4286ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4287ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4288ad7e718cSJohannes Berg * 4289ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4290ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4291ad7e718cSJohannes Berg * 4292ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4293ad7e718cSJohannes Berg */ 4294ad7e718cSJohannes Berg static inline struct sk_buff * 4295ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4296ad7e718cSJohannes Berg { 4297ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4298ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4299ad7e718cSJohannes Berg } 4300ad7e718cSJohannes Berg 4301ad7e718cSJohannes Berg /** 4302ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4303ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4304ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4305ad7e718cSJohannes Berg * 4306ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4307ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4308ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4309ad7e718cSJohannes Berg * skb regardless of the return value. 4310ad7e718cSJohannes Berg * 4311ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4312ad7e718cSJohannes Berg */ 4313ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4314ad7e718cSJohannes Berg 4315567ffc35SJohannes Berg /** 4316567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4317567ffc35SJohannes Berg * @wiphy: the wiphy 4318567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4319567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4320567ffc35SJohannes Berg * be put into the skb 4321567ffc35SJohannes Berg * @gfp: allocation flags 4322567ffc35SJohannes Berg * 4323567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4324567ffc35SJohannes Berg * vendor-specific multicast group. 4325567ffc35SJohannes Berg * 4326567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4327567ffc35SJohannes Berg * skb to send the event. 4328567ffc35SJohannes Berg * 4329567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4330567ffc35SJohannes Berg */ 4331567ffc35SJohannes Berg static inline struct sk_buff * 4332567ffc35SJohannes Berg cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen, 4333567ffc35SJohannes Berg int event_idx, gfp_t gfp) 4334567ffc35SJohannes Berg { 4335567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR, 4336567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4337567ffc35SJohannes Berg event_idx, approxlen, gfp); 4338567ffc35SJohannes Berg } 4339567ffc35SJohannes Berg 4340567ffc35SJohannes Berg /** 4341567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4342567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4343567ffc35SJohannes Berg * @gfp: allocation flags 4344567ffc35SJohannes Berg * 4345567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4346567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4347567ffc35SJohannes Berg */ 4348567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4349567ffc35SJohannes Berg { 4350567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4351567ffc35SJohannes Berg } 4352567ffc35SJohannes Berg 4353aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4354aff89a9bSJohannes Berg /** 4355d70e9693SJohannes Berg * DOC: Test mode 4356d70e9693SJohannes Berg * 4357d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4358d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4359d70e9693SJohannes Berg * factory programming. 4360d70e9693SJohannes Berg * 4361d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4362d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4363d70e9693SJohannes Berg */ 4364d70e9693SJohannes Berg 4365d70e9693SJohannes Berg /** 4366aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4367aff89a9bSJohannes Berg * @wiphy: the wiphy 4368aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4369aff89a9bSJohannes Berg * be put into the skb 4370aff89a9bSJohannes Berg * 4371aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4372aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4373aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4374aff89a9bSJohannes Berg * 43750ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 43760ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 43770ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 43780ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 43790ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 43800ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 43810ae997dcSYacine Belkadi * must not modify the skb in any other way. 4382aff89a9bSJohannes Berg * 4383aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4384aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 43850ae997dcSYacine Belkadi * 43860ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4387aff89a9bSJohannes Berg */ 4388ad7e718cSJohannes Berg static inline struct sk_buff * 4389ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4390ad7e718cSJohannes Berg { 4391ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4392ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4393ad7e718cSJohannes Berg } 4394aff89a9bSJohannes Berg 4395aff89a9bSJohannes Berg /** 4396aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4397aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4398aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4399aff89a9bSJohannes Berg * 44000ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 44010ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 44020ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 44030ae997dcSYacine Belkadi * regardless of the return value. 44040ae997dcSYacine Belkadi * 44050ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4406aff89a9bSJohannes Berg */ 4407ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4408ad7e718cSJohannes Berg { 4409ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4410ad7e718cSJohannes Berg } 4411aff89a9bSJohannes Berg 4412aff89a9bSJohannes Berg /** 4413aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4414aff89a9bSJohannes Berg * @wiphy: the wiphy 4415aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4416aff89a9bSJohannes Berg * be put into the skb 4417aff89a9bSJohannes Berg * @gfp: allocation flags 4418aff89a9bSJohannes Berg * 4419aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4420aff89a9bSJohannes Berg * testmode multicast group. 4421aff89a9bSJohannes Berg * 44220ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 44230ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 44240ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 44250ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 44260ae997dcSYacine Belkadi * in any other way. 4427aff89a9bSJohannes Berg * 4428aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4429aff89a9bSJohannes Berg * skb to send the event. 44300ae997dcSYacine Belkadi * 44310ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4432aff89a9bSJohannes Berg */ 4433567ffc35SJohannes Berg static inline struct sk_buff * 4434567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4435567ffc35SJohannes Berg { 4436567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE, 4437567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4438567ffc35SJohannes Berg approxlen, gfp); 4439567ffc35SJohannes Berg } 4440aff89a9bSJohannes Berg 4441aff89a9bSJohannes Berg /** 4442aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4443aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4444aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4445aff89a9bSJohannes Berg * @gfp: allocation flags 4446aff89a9bSJohannes Berg * 4447aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4448aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4449aff89a9bSJohannes Berg * consumes it. 4450aff89a9bSJohannes Berg */ 4451567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4452567ffc35SJohannes Berg { 4453567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4454567ffc35SJohannes Berg } 4455aff89a9bSJohannes Berg 4456aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 445771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4458aff89a9bSJohannes Berg #else 4459aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 446071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 4461aff89a9bSJohannes Berg #endif 4462aff89a9bSJohannes Berg 4463b23aa676SSamuel Ortiz /** 4464b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 4465b23aa676SSamuel Ortiz * 4466b23aa676SSamuel Ortiz * @dev: network device 4467b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 4468b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4469b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4470b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4471b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4472b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 4473b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4474b23aa676SSamuel Ortiz * the real status code for failures. 4475b23aa676SSamuel Ortiz * @gfp: allocation flags 4476b23aa676SSamuel Ortiz * 4477b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 4478b23aa676SSamuel Ortiz * succeeded. 4479b23aa676SSamuel Ortiz */ 4480b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 4481b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4482b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 4483b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 4484b23aa676SSamuel Ortiz 4485b23aa676SSamuel Ortiz /** 4486b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 4487b23aa676SSamuel Ortiz * 4488b23aa676SSamuel Ortiz * @dev: network device 4489ed9d0102SJouni Malinen * @channel: the channel of the new AP 4490b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 4491b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4492b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4493b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4494b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4495b23aa676SSamuel Ortiz * @gfp: allocation flags 4496b23aa676SSamuel Ortiz * 4497b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 4498b23aa676SSamuel Ortiz * from one AP to another while connected. 4499b23aa676SSamuel Ortiz */ 4500ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 4501ed9d0102SJouni Malinen struct ieee80211_channel *channel, 4502ed9d0102SJouni Malinen const u8 *bssid, 4503b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4504b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4505b23aa676SSamuel Ortiz 4506b23aa676SSamuel Ortiz /** 4507adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 4508adbde344SVasanthakumar Thiagarajan * 4509adbde344SVasanthakumar Thiagarajan * @dev: network device 4510adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 4511adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 4512adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 4513adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 4514adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 4515adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 4516adbde344SVasanthakumar Thiagarajan * 4517adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 4518adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 4519adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 4520adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 4521adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 4522adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 4523adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 4524adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 4525adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 4526adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 4527adbde344SVasanthakumar Thiagarajan */ 4528adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 4529adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 4530adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4531adbde344SVasanthakumar Thiagarajan 4532adbde344SVasanthakumar Thiagarajan /** 4533b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 4534b23aa676SSamuel Ortiz * 4535b23aa676SSamuel Ortiz * @dev: network device 4536b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 4537b23aa676SSamuel Ortiz * @ie_len: length of IEs 4538b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 4539b23aa676SSamuel Ortiz * @gfp: allocation flags 4540b23aa676SSamuel Ortiz * 4541b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 4542b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 4543b23aa676SSamuel Ortiz */ 4544b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 4545c1e5f471SJohannes Berg const u8 *ie, size_t ie_len, gfp_t gfp); 4546b23aa676SSamuel Ortiz 45479588bbd5SJouni Malinen /** 45489588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 454971bbc994SJohannes Berg * @wdev: wireless device 45509588bbd5SJouni Malinen * @cookie: the request cookie 45519588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 45529588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 45539588bbd5SJouni Malinen * channel 45549588bbd5SJouni Malinen * @gfp: allocation flags 45559588bbd5SJouni Malinen */ 455671bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 45579588bbd5SJouni Malinen struct ieee80211_channel *chan, 45589588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 45599588bbd5SJouni Malinen 45609588bbd5SJouni Malinen /** 45619588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 456271bbc994SJohannes Berg * @wdev: wireless device 45639588bbd5SJouni Malinen * @cookie: the request cookie 45649588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 45659588bbd5SJouni Malinen * @gfp: allocation flags 45669588bbd5SJouni Malinen */ 456771bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 45689588bbd5SJouni Malinen struct ieee80211_channel *chan, 45699588bbd5SJouni Malinen gfp_t gfp); 4570b23aa676SSamuel Ortiz 457198b62183SJohannes Berg 457298b62183SJohannes Berg /** 457398b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 457498b62183SJohannes Berg * 457598b62183SJohannes Berg * @dev: the netdev 457698b62183SJohannes Berg * @mac_addr: the station's address 457798b62183SJohannes Berg * @sinfo: the station information 457898b62183SJohannes Berg * @gfp: allocation flags 457998b62183SJohannes Berg */ 458098b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 458198b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 458298b62183SJohannes Berg 4583026331c4SJouni Malinen /** 4584ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 4585ec15e68bSJouni Malinen * 4586ec15e68bSJouni Malinen * @dev: the netdev 4587ec15e68bSJouni Malinen * @mac_addr: the station's address 4588ec15e68bSJouni Malinen * @gfp: allocation flags 4589ec15e68bSJouni Malinen */ 4590ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 4591ec15e68bSJouni Malinen 4592ec15e68bSJouni Malinen /** 4593ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 4594ed44a951SPandiyarajan Pitchaimuthu * 4595ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 4596ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 4597ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 4598ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 4599ed44a951SPandiyarajan Pitchaimuthu * 4600ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 4601ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 4602ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 4603ed44a951SPandiyarajan Pitchaimuthu * 4604ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 4605ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 4606ed44a951SPandiyarajan Pitchaimuthu */ 4607ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 4608ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 4609ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 4610ed44a951SPandiyarajan Pitchaimuthu 4611ed44a951SPandiyarajan Pitchaimuthu /** 46122e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 461371bbc994SJohannes Berg * @wdev: wireless device receiving the frame 4614026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 4615804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 46162e161f78SJohannes Berg * @buf: Management frame (header + body) 4617026331c4SJouni Malinen * @len: length of the frame data 461819504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 46192e161f78SJohannes Berg * 46200ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 46210ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 46220ae997dcSYacine Belkadi * 46230ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 46242e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 46252e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 46262e161f78SJohannes Berg * driver is responsible for rejecting the frame. 4627026331c4SJouni Malinen */ 462871bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 4629970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 4630026331c4SJouni Malinen 4631026331c4SJouni Malinen /** 46322e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 463371bbc994SJohannes Berg * @wdev: wireless device receiving the frame 46342e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 46352e161f78SJohannes Berg * @buf: Management frame (header + body) 4636026331c4SJouni Malinen * @len: length of the frame data 4637026331c4SJouni Malinen * @ack: Whether frame was acknowledged 4638026331c4SJouni Malinen * @gfp: context flags 4639026331c4SJouni Malinen * 46402e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 46412e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 4642026331c4SJouni Malinen * transmission attempt. 4643026331c4SJouni Malinen */ 464471bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 4645026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 4646026331c4SJouni Malinen 4647d6dc1a38SJuuso Oikarinen 4648d6dc1a38SJuuso Oikarinen /** 4649d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 4650d6dc1a38SJuuso Oikarinen * @dev: network device 4651d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 4652d6dc1a38SJuuso Oikarinen * @gfp: context flags 4653d6dc1a38SJuuso Oikarinen * 4654d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 4655d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 4656d6dc1a38SJuuso Oikarinen */ 4657d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 4658d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 4659d6dc1a38SJuuso Oikarinen gfp_t gfp); 4660d6dc1a38SJuuso Oikarinen 4661c063dbf5SJohannes Berg /** 4662c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 4663c063dbf5SJohannes Berg * @dev: network device 4664c063dbf5SJohannes Berg * @peer: peer's MAC address 4665c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 4666c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 4667c063dbf5SJohannes Berg * threshold (to account for temporary interference) 4668c063dbf5SJohannes Berg * @gfp: context flags 4669c063dbf5SJohannes Berg */ 4670c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 4671c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 4672c063dbf5SJohannes Berg 4673e5497d76SJohannes Berg /** 467484f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 467584f10708SThomas Pedersen * @dev: network device 467684f10708SThomas Pedersen * @peer: peer's MAC address 467784f10708SThomas Pedersen * @num_packets: how many packets were lost 467884f10708SThomas Pedersen * @rate: % of packets which failed transmission 467984f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 468084f10708SThomas Pedersen * @gfp: context flags 468184f10708SThomas Pedersen * 468284f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 468384f10708SThomas Pedersen * given interval is exceeded. 468484f10708SThomas Pedersen */ 468584f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 468684f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 468784f10708SThomas Pedersen 468884f10708SThomas Pedersen /** 468998f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 469098f03342SJohannes Berg * @dev: network device 469198f03342SJohannes Berg * @gfp: context flags 469298f03342SJohannes Berg * 469398f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 469498f03342SJohannes Berg */ 469598f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 469698f03342SJohannes Berg 469798f03342SJohannes Berg /** 46985b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 46995b97f49dSJohannes Berg * @wiphy: the wiphy 47005b97f49dSJohannes Berg * @chandef: chandef for the current channel 47015b97f49dSJohannes Berg * @gfp: context flags 47025b97f49dSJohannes Berg * 47035b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 47045b97f49dSJohannes Berg */ 47055b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 47065b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 47075b97f49dSJohannes Berg 47085b97f49dSJohannes Berg /** 47095b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 47105b97f49dSJohannes Berg * @netdev: network device 47115b97f49dSJohannes Berg * @chandef: chandef for the current channel 47125b97f49dSJohannes Berg * @event: type of event 47135b97f49dSJohannes Berg * @gfp: context flags 47145b97f49dSJohannes Berg * 47155b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 47165b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 47175b97f49dSJohannes Berg * also by full-MAC drivers. 47185b97f49dSJohannes Berg */ 47195b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 47205b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 47215b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 47225b97f49dSJohannes Berg 47235b97f49dSJohannes Berg 47245b97f49dSJohannes Berg /** 4725e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 4726e5497d76SJohannes Berg * @dev: network device 4727e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 4728e5497d76SJohannes Berg * @replay_ctr: new replay counter 4729af71ff85SJohannes Berg * @gfp: allocation flags 4730e5497d76SJohannes Berg */ 4731e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 4732e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 4733e5497d76SJohannes Berg 4734c9df56b4SJouni Malinen /** 4735c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 4736c9df56b4SJouni Malinen * @dev: network device 4737c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 4738c9df56b4SJouni Malinen * @bssid: BSSID of AP 4739c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 4740c9df56b4SJouni Malinen * @gfp: allocation flags 4741c9df56b4SJouni Malinen */ 4742c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 4743c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 4744c9df56b4SJouni Malinen 474528946da7SJohannes Berg /** 474628946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 474728946da7SJohannes Berg * @dev: The device the frame matched to 474828946da7SJohannes Berg * @addr: the transmitter address 474928946da7SJohannes Berg * @gfp: context flags 475028946da7SJohannes Berg * 475128946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 475228946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 475328946da7SJohannes Berg * sender. 47540ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 475528946da7SJohannes Berg * for a reason other than not having a subscription.) 475628946da7SJohannes Berg */ 475728946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 475828946da7SJohannes Berg const u8 *addr, gfp_t gfp); 475928946da7SJohannes Berg 47607f6cf311SJohannes Berg /** 4761b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 4762b92ab5d8SJohannes Berg * @dev: The device the frame matched to 4763b92ab5d8SJohannes Berg * @addr: the transmitter address 4764b92ab5d8SJohannes Berg * @gfp: context flags 4765b92ab5d8SJohannes Berg * 4766b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 4767b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 4768b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 4769b92ab5d8SJohannes Berg * station to avoid event flooding. 47700ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 4771b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 4772b92ab5d8SJohannes Berg */ 4773b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 4774b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 4775b92ab5d8SJohannes Berg 4776b92ab5d8SJohannes Berg /** 47777f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 47787f6cf311SJohannes Berg * @dev: the device the probe was sent on 47797f6cf311SJohannes Berg * @addr: the address of the peer 47807f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 47817f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 47827f6cf311SJohannes Berg * @gfp: allocation flags 47837f6cf311SJohannes Berg */ 47847f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 47857f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 47867f6cf311SJohannes Berg 47875e760230SJohannes Berg /** 47885e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 47895e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 47905e760230SJohannes Berg * @frame: the frame 47915e760230SJohannes Berg * @len: length of the frame 47925e760230SJohannes Berg * @freq: frequency the frame was received on 4793804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 47945e760230SJohannes Berg * 47955e760230SJohannes Berg * Use this function to report to userspace when a beacon was 47965e760230SJohannes Berg * received. It is not useful to call this when there is no 47975e760230SJohannes Berg * netdev that is in AP/GO mode. 47985e760230SJohannes Berg */ 47995e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 48005e760230SJohannes Berg const u8 *frame, size_t len, 480137c73b5fSBen Greear int freq, int sig_dbm); 48025e760230SJohannes Berg 4803d58e7e37SJohannes Berg /** 4804683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 480554858ee5SAlexander Simon * @wiphy: the wiphy 4806683b6d3bSJohannes Berg * @chandef: the channel definition 4807174e0cd2SIlan Peer * @iftype: interface type 4808d58e7e37SJohannes Berg * 48090ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 48100ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 481154858ee5SAlexander Simon */ 4812683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4813174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 4814174e0cd2SIlan Peer enum nl80211_iftype iftype); 481554858ee5SAlexander Simon 48168097e149SThomas Pedersen /* 48175314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 48185314526bSThomas Pedersen * @dev: the device which switched channels 4819683b6d3bSJohannes Berg * @chandef: the new channel definition 48205314526bSThomas Pedersen * 4821e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 4822e487eaebSSimon Wunderlich * driver context! 48235314526bSThomas Pedersen */ 4824683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 4825683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 48265314526bSThomas Pedersen 4827f8d7552eSLuciano Coelho /* 4828f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 4829f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 4830f8d7552eSLuciano Coelho * @chandef: the future channel definition 4831f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 4832f8d7552eSLuciano Coelho * 4833f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 4834f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 4835f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 4836f8d7552eSLuciano Coelho */ 4837f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 4838f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 4839f8d7552eSLuciano Coelho u8 count); 4840f8d7552eSLuciano Coelho 48411ce3e82bSJohannes Berg /** 48421ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 48431ce3e82bSJohannes Berg * 48441ce3e82bSJohannes Berg * @operating_class: the operating class to convert 48451ce3e82bSJohannes Berg * @band: band pointer to fill 48461ce3e82bSJohannes Berg * 48471ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 48481ce3e82bSJohannes Berg */ 48491ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 48501ce3e82bSJohannes Berg enum ieee80211_band *band); 48511ce3e82bSJohannes Berg 48525314526bSThomas Pedersen /* 48533475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 48543475b094SJouni Malinen * @dev: the device on which the operation is requested 48553475b094SJouni Malinen * @peer: the MAC address of the peer device 48563475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 48573475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 48583475b094SJouni Malinen * @reason_code: the reason code for teardown request 48593475b094SJouni Malinen * @gfp: allocation flags 48603475b094SJouni Malinen * 48613475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 48623475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 48633475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 48643475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 48653475b094SJouni Malinen * based on traffic and signal strength for a peer). 48663475b094SJouni Malinen */ 48673475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 48683475b094SJouni Malinen enum nl80211_tdls_operation oper, 48693475b094SJouni Malinen u16 reason_code, gfp_t gfp); 48703475b094SJouni Malinen 48713475b094SJouni Malinen /* 48728097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 48738097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 48748097e149SThomas Pedersen * 48758097e149SThomas Pedersen * return 0 if MCS index >= 32 48768097e149SThomas Pedersen */ 48778eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 48788097e149SThomas Pedersen 487998104fdeSJohannes Berg /** 488098104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 488198104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 488298104fdeSJohannes Berg * 488398104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 488498104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 488598104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 488698104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 488798104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 488898104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 488998104fdeSJohannes Berg * when the device is unbound from the driver. 489098104fdeSJohannes Berg * 489198104fdeSJohannes Berg * Requires the RTNL to be held. 489298104fdeSJohannes Berg */ 489398104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 489498104fdeSJohannes Berg 48950ee45355SJohannes Berg /** 4896355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 4897355199e0SJouni Malinen * @ies: FT IEs 4898355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 4899355199e0SJouni Malinen * @target_ap: target AP's MAC address 4900355199e0SJouni Malinen * @ric_ies: RIC IE 4901355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 4902355199e0SJouni Malinen */ 4903355199e0SJouni Malinen struct cfg80211_ft_event_params { 4904355199e0SJouni Malinen const u8 *ies; 4905355199e0SJouni Malinen size_t ies_len; 4906355199e0SJouni Malinen const u8 *target_ap; 4907355199e0SJouni Malinen const u8 *ric_ies; 4908355199e0SJouni Malinen size_t ric_ies_len; 4909355199e0SJouni Malinen }; 4910355199e0SJouni Malinen 4911355199e0SJouni Malinen /** 4912355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 4913355199e0SJouni Malinen * @netdev: network device 4914355199e0SJouni Malinen * @ft_event: IE information 4915355199e0SJouni Malinen */ 4916355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 4917355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 4918355199e0SJouni Malinen 4919355199e0SJouni Malinen /** 49200ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 49210ee45355SJohannes Berg * @ies: the input IE buffer 49220ee45355SJohannes Berg * @len: the input length 49230ee45355SJohannes Berg * @attr: the attribute ID to find 49240ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 49250ee45355SJohannes Berg * if the function is only called to get the needed buffer size 49260ee45355SJohannes Berg * @bufsize: size of the output buffer 49270ee45355SJohannes Berg * 49280ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 49290ee45355SJohannes Berg * copies its contents to the given buffer. 49300ee45355SJohannes Berg * 49310ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 49320ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 49330ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 49340ee45355SJohannes Berg */ 4935c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 4936c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 4937c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 49380ee45355SJohannes Berg 4939cd8f7cb4SJohannes Berg /** 4940cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 4941cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 4942cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 4943cd8f7cb4SJohannes Berg * @gfp: allocation flags 4944cd8f7cb4SJohannes Berg * 4945cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 4946cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 4947cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 4948cd8f7cb4SJohannes Berg * else caused the wakeup. 4949cd8f7cb4SJohannes Berg */ 4950cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 4951cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 4952cd8f7cb4SJohannes Berg gfp_t gfp); 4953cd8f7cb4SJohannes Berg 49545de17984SArend van Spriel /** 49555de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 49565de17984SArend van Spriel * 49575de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 495803f831a6SRobert P. J. Day * @gfp: allocation flags 49595de17984SArend van Spriel * 49605de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 49615de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 49625de17984SArend van Spriel * by .crit_proto_start() has expired. 49635de17984SArend van Spriel */ 49645de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 49655de17984SArend van Spriel 4966bdfbec2dSIlan Peer /** 4967bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 4968bdfbec2dSIlan Peer * @wiphy: the wiphy 4969bdfbec2dSIlan Peer * 4970bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 4971bdfbec2dSIlan Peer */ 4972bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 4973bdfbec2dSIlan Peer 4974cb2d956dSLuciano Coelho /** 4975cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 4976cb2d956dSLuciano Coelho * 4977cb2d956dSLuciano Coelho * @wiphy: the wiphy 4978cb2d956dSLuciano Coelho * @num_different_channels: the number of different channels we want 4979cb2d956dSLuciano Coelho * to use for verification 4980cb2d956dSLuciano Coelho * @radar_detect: a bitmap where each bit corresponds to a channel 4981cb2d956dSLuciano Coelho * width where radar detection is needed, as in the definition of 4982cb2d956dSLuciano Coelho * &struct ieee80211_iface_combination.@radar_detect_widths 4983cb2d956dSLuciano Coelho * @iftype_num: array with the numbers of interfaces of each interface 4984cb2d956dSLuciano Coelho * type. The index is the interface type as specified in &enum 4985cb2d956dSLuciano Coelho * nl80211_iftype. 4986cb2d956dSLuciano Coelho * 4987cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 4988cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 4989cb2d956dSLuciano Coelho * the interface combinations. 4990cb2d956dSLuciano Coelho */ 4991cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 4992cb2d956dSLuciano Coelho const int num_different_channels, 4993cb2d956dSLuciano Coelho const u8 radar_detect, 4994cb2d956dSLuciano Coelho const int iftype_num[NUM_NL80211_IFTYPES]); 4995cb2d956dSLuciano Coelho 499665a124ddSMichal Kazior /** 499765a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 499865a124ddSMichal Kazior * 499965a124ddSMichal Kazior * @wiphy: the wiphy 500065a124ddSMichal Kazior * @num_different_channels: the number of different channels we want 500165a124ddSMichal Kazior * to use for verification 500265a124ddSMichal Kazior * @radar_detect: a bitmap where each bit corresponds to a channel 500365a124ddSMichal Kazior * width where radar detection is needed, as in the definition of 500465a124ddSMichal Kazior * &struct ieee80211_iface_combination.@radar_detect_widths 500565a124ddSMichal Kazior * @iftype_num: array with the numbers of interfaces of each interface 500665a124ddSMichal Kazior * type. The index is the interface type as specified in &enum 500765a124ddSMichal Kazior * nl80211_iftype. 500865a124ddSMichal Kazior * @iter: function to call for each matching combination 500965a124ddSMichal Kazior * @data: pointer to pass to iter function 501065a124ddSMichal Kazior * 501165a124ddSMichal Kazior * This function can be called by the driver to check what possible 501265a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 501365a124ddSMichal Kazior * purposes. 501465a124ddSMichal Kazior */ 501565a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 501665a124ddSMichal Kazior const int num_different_channels, 501765a124ddSMichal Kazior const u8 radar_detect, 501865a124ddSMichal Kazior const int iftype_num[NUM_NL80211_IFTYPES], 501965a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 502065a124ddSMichal Kazior void *data), 502165a124ddSMichal Kazior void *data); 502265a124ddSMichal Kazior 5023f04c2203SMichal Kazior /* 5024f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 5025f04c2203SMichal Kazior * 5026f04c2203SMichal Kazior * @wiphy: the wiphy 5027f04c2203SMichal Kazior * @wdev: wireless device 5028f04c2203SMichal Kazior * @gfp: context flags 5029f04c2203SMichal Kazior * 5030f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 5031f04c2203SMichal Kazior * disconnected. 5032f04c2203SMichal Kazior * 5033f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 5034f04c2203SMichal Kazior */ 5035f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 5036f04c2203SMichal Kazior gfp_t gfp); 5037f04c2203SMichal Kazior 5038f6837ba8SJohannes Berg /** 5039f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 5040f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 5041f6837ba8SJohannes Berg * 5042f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 5043f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 5044f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 5045f6837ba8SJohannes Berg * that really can't be recovered in any other way. 5046f6837ba8SJohannes Berg * 5047f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 5048f6837ba8SJohannes Berg * the driver while the function is running. 5049f6837ba8SJohannes Berg */ 5050f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5051f6837ba8SJohannes Berg 5052b7ffbd7eSJohannes Berg 5053b7ffbd7eSJohannes Berg /* ethtool helper */ 5054b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 5055b7ffbd7eSJohannes Berg 5056e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 5057e1db74fcSJoe Perches 5058e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 5059e1db74fcSJoe Perches 5060e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 50619c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 5062e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 50639c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 5064e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 50659c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 5066e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 50679c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 5068e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 50699c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 5070e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 50719c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 5072e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 50739c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 5074e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 50759c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 5076073730d7SJoe Perches 50779c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 5078e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 50799c376639SJoe Perches 5080e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 50819c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 5082e1db74fcSJoe Perches 5083e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 5084e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 5085e1db74fcSJoe Perches #else 5086e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 5087e1db74fcSJoe Perches ({ \ 5088e1db74fcSJoe Perches if (0) \ 5089e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 5090e1db74fcSJoe Perches 0; \ 5091e1db74fcSJoe Perches }) 5092e1db74fcSJoe Perches #endif 5093e1db74fcSJoe Perches 5094e1db74fcSJoe Perches /* 5095e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5096e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5097e1db74fcSJoe Perches * file/line information and a backtrace. 5098e1db74fcSJoe Perches */ 5099e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5100e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5101e1db74fcSJoe Perches 5102704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5103