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 5234ed20bebSJohannes Berg * @SURVEY_INFO_TIME: active time (in ms) was filled in 5244ed20bebSJohannes Berg * @SURVEY_INFO_TIME_BUSY: busy time was filled in 5254ed20bebSJohannes Berg * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 5264ed20bebSJohannes Berg * @SURVEY_INFO_TIME_RX: receive time was filled in 5274ed20bebSJohannes Berg * @SURVEY_INFO_TIME_TX: transmit time was filled in 528052536abSJohannes Berg * @SURVEY_INFO_TIME_SCAN: scan time was filled in 529abe37c4bSJohannes Berg * 53061fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 53161fa713cSHolger Schurig * it has filled in during the get_survey(). 53261fa713cSHolger Schurig */ 53361fa713cSHolger Schurig enum survey_info_flags { 5344ed20bebSJohannes Berg SURVEY_INFO_NOISE_DBM = BIT(0), 5354ed20bebSJohannes Berg SURVEY_INFO_IN_USE = BIT(1), 5364ed20bebSJohannes Berg SURVEY_INFO_TIME = BIT(2), 5374ed20bebSJohannes Berg SURVEY_INFO_TIME_BUSY = BIT(3), 5384ed20bebSJohannes Berg SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 5394ed20bebSJohannes Berg SURVEY_INFO_TIME_RX = BIT(5), 5404ed20bebSJohannes Berg SURVEY_INFO_TIME_TX = BIT(6), 541052536abSJohannes Berg SURVEY_INFO_TIME_SCAN = BIT(7), 54261fa713cSHolger Schurig }; 54361fa713cSHolger Schurig 54461fa713cSHolger Schurig /** 54561fa713cSHolger Schurig * struct survey_info - channel survey response 54661fa713cSHolger Schurig * 54711f78ac3SJohannes Berg * @channel: the channel this survey record reports, may be %NULL for a single 54811f78ac3SJohannes Berg * record to report global statistics 54961fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 55061fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 55161fa713cSHolger Schurig * optional 5524ed20bebSJohannes Berg * @time: amount of time in ms the radio was turn on (on the channel) 5534ed20bebSJohannes Berg * @time_busy: amount of time the primary channel was sensed busy 5544ed20bebSJohannes Berg * @time_ext_busy: amount of time the extension channel was sensed busy 5554ed20bebSJohannes Berg * @time_rx: amount of time the radio spent receiving data 5564ed20bebSJohannes Berg * @time_tx: amount of time the radio spent transmitting data 557052536abSJohannes Berg * @time_scan: amount of time the radio spent for scanning 55861fa713cSHolger Schurig * 559abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 560abe37c4bSJohannes Berg * 56161fa713cSHolger Schurig * This structure can later be expanded with things like 56261fa713cSHolger Schurig * channel duty cycle etc. 56361fa713cSHolger Schurig */ 56461fa713cSHolger Schurig struct survey_info { 56561fa713cSHolger Schurig struct ieee80211_channel *channel; 5664ed20bebSJohannes Berg u64 time; 5674ed20bebSJohannes Berg u64 time_busy; 5684ed20bebSJohannes Berg u64 time_ext_busy; 5694ed20bebSJohannes Berg u64 time_rx; 5704ed20bebSJohannes Berg u64 time_tx; 571052536abSJohannes Berg u64 time_scan; 57261fa713cSHolger Schurig u32 filled; 57361fa713cSHolger Schurig s8 noise; 57461fa713cSHolger Schurig }; 57561fa713cSHolger Schurig 57661fa713cSHolger Schurig /** 5775fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 5785fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 5795fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 5805fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 5815fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 5825fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 5835fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 5845fb628e9SJouni Malinen * @akm_suites: AKM suites 5855fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 5865fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 5875fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 5885fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 5895fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 5905fb628e9SJouni Malinen * allowed through even on unauthorized ports 5915fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 5925fb628e9SJouni Malinen * protocol frames. 5935fb628e9SJouni Malinen */ 5945fb628e9SJouni Malinen struct cfg80211_crypto_settings { 5955fb628e9SJouni Malinen u32 wpa_versions; 5965fb628e9SJouni Malinen u32 cipher_group; 5975fb628e9SJouni Malinen int n_ciphers_pairwise; 5985fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 5995fb628e9SJouni Malinen int n_akm_suites; 6005fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 6015fb628e9SJouni Malinen bool control_port; 6025fb628e9SJouni Malinen __be16 control_port_ethertype; 6035fb628e9SJouni Malinen bool control_port_no_encrypt; 6045fb628e9SJouni Malinen }; 6055fb628e9SJouni Malinen 6065fb628e9SJouni Malinen /** 6078860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 608ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 609ed1b6cc7SJohannes Berg * or %NULL if not changed 610ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 611ed1b6cc7SJohannes Berg * or %NULL if not changed 612ed1b6cc7SJohannes Berg * @head_len: length of @head 613ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6149946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6159946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6169946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6179946ecfbSJouni Malinen * frames or %NULL 6189946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6199946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6209946ecfbSJouni Malinen * Response frames or %NULL 6219946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 62200f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 62300f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 624ed1b6cc7SJohannes Berg */ 6258860020eSJohannes Berg struct cfg80211_beacon_data { 6268860020eSJohannes Berg const u8 *head, *tail; 6278860020eSJohannes Berg const u8 *beacon_ies; 6288860020eSJohannes Berg const u8 *proberesp_ies; 6298860020eSJohannes Berg const u8 *assocresp_ies; 6308860020eSJohannes Berg const u8 *probe_resp; 6318860020eSJohannes Berg 6328860020eSJohannes Berg size_t head_len, tail_len; 6338860020eSJohannes Berg size_t beacon_ies_len; 6348860020eSJohannes Berg size_t proberesp_ies_len; 6358860020eSJohannes Berg size_t assocresp_ies_len; 6368860020eSJohannes Berg size_t probe_resp_len; 6378860020eSJohannes Berg }; 6388860020eSJohannes Berg 6396d45a74bSVasanthakumar Thiagarajan struct mac_address { 6406d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 6416d45a74bSVasanthakumar Thiagarajan }; 6426d45a74bSVasanthakumar Thiagarajan 6438860020eSJohannes Berg /** 64477765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 64577765eafSVasanthakumar Thiagarajan * 64677765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 647077f897aSJohannes Berg * entry specified by mac_addr 64877765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 64977765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 65077765eafSVasanthakumar Thiagarajan */ 65177765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 65277765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 65377765eafSVasanthakumar Thiagarajan int n_acl_entries; 65477765eafSVasanthakumar Thiagarajan 65577765eafSVasanthakumar Thiagarajan /* Keep it last */ 65677765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 65777765eafSVasanthakumar Thiagarajan }; 65877765eafSVasanthakumar Thiagarajan 6598860020eSJohannes Berg /** 6608860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 6618860020eSJohannes Berg * 6628860020eSJohannes Berg * Used to configure an AP interface. 6638860020eSJohannes Berg * 664683b6d3bSJohannes Berg * @chandef: defines the channel to use 6658860020eSJohannes Berg * @beacon: beacon data 6668860020eSJohannes Berg * @beacon_interval: beacon interval 6678860020eSJohannes Berg * @dtim_period: DTIM period 6688860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 6698860020eSJohannes Berg * user space) 6708860020eSJohannes Berg * @ssid_len: length of @ssid 6718860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 6728860020eSJohannes Berg * @crypto: crypto settings 6738860020eSJohannes Berg * @privacy: the BSS uses privacy 6748860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 67518998c38SEliad Peller * @smps_mode: SMPS mode 6761b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 67753cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 67853cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 67977765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 68077765eafSVasanthakumar Thiagarajan * MAC address based access control 6818860020eSJohannes Berg */ 6828860020eSJohannes Berg struct cfg80211_ap_settings { 683683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 684aa430da4SJohannes Berg 6858860020eSJohannes Berg struct cfg80211_beacon_data beacon; 6868860020eSJohannes Berg 6878860020eSJohannes Berg int beacon_interval, dtim_period; 68832e9de84SJouni Malinen const u8 *ssid; 68932e9de84SJouni Malinen size_t ssid_len; 69032e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 6915fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 6925fb628e9SJouni Malinen bool privacy; 6935fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 69418998c38SEliad Peller enum nl80211_smps_mode smps_mode; 6951b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 69653cabad7SJohannes Berg u8 p2p_ctwindow; 69753cabad7SJohannes Berg bool p2p_opp_ps; 69877765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 699ed1b6cc7SJohannes Berg }; 700ed1b6cc7SJohannes Berg 7015727ef1bSJohannes Berg /** 70216ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 70316ef1fe2SSimon Wunderlich * 70416ef1fe2SSimon Wunderlich * Used for channel switch 70516ef1fe2SSimon Wunderlich * 70616ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 70716ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7089a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7099a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7109a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7119a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 71216ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 71316ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 71416ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 71516ef1fe2SSimon Wunderlich * @count: number of beacons until switch 71616ef1fe2SSimon Wunderlich */ 71716ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 71816ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 71916ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 7209a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 7219a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 7229a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 7239a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 72416ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 72516ef1fe2SSimon Wunderlich bool radar_required; 72616ef1fe2SSimon Wunderlich bool block_tx; 72716ef1fe2SSimon Wunderlich u8 count; 72816ef1fe2SSimon Wunderlich }; 72916ef1fe2SSimon Wunderlich 73016ef1fe2SSimon Wunderlich /** 7313b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 7323b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 7339d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 734f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 7353b9ce80cSJohannes Berg * 7363b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 7373b9ce80cSJohannes Berg * for those that don't these flags will are used. 7383b9ce80cSJohannes Berg */ 7393b9ce80cSJohannes Berg enum station_parameters_apply_mask { 7403b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 7419d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 742f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 7433b9ce80cSJohannes Berg }; 7443b9ce80cSJohannes Berg 7453b9ce80cSJohannes Berg /** 7465727ef1bSJohannes Berg * struct station_parameters - station parameters 7475727ef1bSJohannes Berg * 7485727ef1bSJohannes Berg * Used to change and create a new station. 7495727ef1bSJohannes Berg * 7505727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 7515727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 7525727ef1bSJohannes Berg * (or NULL for no change) 7535727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 754eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 755eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 756eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 757eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 7585727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 7595727ef1bSJohannes Berg * @aid: AID or zero for no change 760abe37c4bSJohannes Berg * @plink_action: plink action to take 7619c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 762abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 763f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 764910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 765910868dbSEliad Peller * as the AC bitmap in the QoS info field 766910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 767910868dbSEliad Peller * QoS info field (but already shifted down) 768c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 769c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 770c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 7713b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 7723b1c5a53SMarco Porsch * to unknown) 7739d62a986SJouni Malinen * @capability: station capability 7749d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 7759d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 776c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 777c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 778c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 779c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 78060f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 78160f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 7825727ef1bSJohannes Berg */ 7835727ef1bSJohannes Berg struct station_parameters { 7842c1aabf3SJohannes Berg const u8 *supported_rates; 7855727ef1bSJohannes Berg struct net_device *vlan; 786eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 7873b9ce80cSJohannes Berg u32 sta_modify_mask; 7885727ef1bSJohannes Berg int listen_interval; 7895727ef1bSJohannes Berg u16 aid; 7905727ef1bSJohannes Berg u8 supported_rates_len; 7912ec600d6SLuis Carlos Cobo u8 plink_action; 7929c3990aaSJavier Cardona u8 plink_state; 7932c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 7942c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 795c75786c9SEliad Peller u8 uapsd_queues; 796c75786c9SEliad Peller u8 max_sp; 7973b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 7989d62a986SJouni Malinen u16 capability; 7992c1aabf3SJohannes Berg const u8 *ext_capab; 8009d62a986SJouni Malinen u8 ext_capab_len; 801c01fc9adSSunil Dutt const u8 *supported_channels; 802c01fc9adSSunil Dutt u8 supported_channels_len; 803c01fc9adSSunil Dutt const u8 *supported_oper_classes; 804c01fc9adSSunil Dutt u8 supported_oper_classes_len; 80560f4a7b1SMarek Kwaczynski u8 opmode_notif; 80660f4a7b1SMarek Kwaczynski bool opmode_notif_used; 8075727ef1bSJohannes Berg }; 8085727ef1bSJohannes Berg 809fd5b74dcSJohannes Berg /** 81089c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 81189c771e5SJouni Malinen * 81289c771e5SJouni Malinen * Used to delete a station entry (or all stations). 81389c771e5SJouni Malinen * 81489c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 81598856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 81698856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 81798856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 81889c771e5SJouni Malinen */ 81989c771e5SJouni Malinen struct station_del_parameters { 82089c771e5SJouni Malinen const u8 *mac; 82198856866SJouni Malinen u8 subtype; 82298856866SJouni Malinen u16 reason_code; 82389c771e5SJouni Malinen }; 82489c771e5SJouni Malinen 82589c771e5SJouni Malinen /** 82677ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 82777ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 82877ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 82977ee7c89SJohannes Berg * the AP MLME in the device 83077ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 83177ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 83277ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 83377ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 83477ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 83577ee7c89SJohannes Berg * supported/used) 83677ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 83777ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 838eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 839eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 84077ee7c89SJohannes Berg */ 84177ee7c89SJohannes Berg enum cfg80211_station_type { 84277ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 84377ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 84477ee7c89SJohannes Berg CFG80211_STA_AP_STA, 84577ee7c89SJohannes Berg CFG80211_STA_IBSS, 84677ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 84777ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 848eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 849eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 85077ee7c89SJohannes Berg }; 85177ee7c89SJohannes Berg 85277ee7c89SJohannes Berg /** 85377ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 85477ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 85577ee7c89SJohannes Berg * @params: the new parameters for a station 85677ee7c89SJohannes Berg * @statype: the type of station being modified 85777ee7c89SJohannes Berg * 85877ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 85977ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 86077ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 86177ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 86277ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 86377ee7c89SJohannes Berg */ 86477ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 86577ee7c89SJohannes Berg struct station_parameters *params, 86677ee7c89SJohannes Berg enum cfg80211_station_type statype); 86777ee7c89SJohannes Berg 86877ee7c89SJohannes Berg /** 8692ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 870fd5b74dcSJohannes Berg * 8712ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 8722ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 873fd5b74dcSJohannes Berg * 8742ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 8752ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 8762ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 877077f897aSJohannes Berg * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value 878077f897aSJohannes Berg * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value 8792ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 8802ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 8812ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 882420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 883c8dcfd8aSFelix Fietkau * @STATION_INFO_TX_BITRATE: @txrate fields are filled 884420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 88542745e03SVladimir Kondratiev * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value 88642745e03SVladimir Kondratiev * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value 887b206b4efSBruno Randolf * @STATION_INFO_TX_RETRIES: @tx_retries filled 888b206b4efSBruno Randolf * @STATION_INFO_TX_FAILED: @tx_failed filled 8895a5c731aSBen Greear * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 890541a45a1SBruno Randolf * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 891c8dcfd8aSFelix Fietkau * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 892f4263c98SPaul Stewart * @STATION_INFO_BSS_PARAM: @bss_param filled 893ebe27c91SMohammed Shafi Shajakhan * @STATION_INFO_CONNECTED_TIME: @connected_time filled 894040bdf71SFelix Fietkau * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 895bb6e753eSHelmut Schaa * @STATION_INFO_STA_FLAGS: @sta_flags filled 896a85e1d55SPaul Stewart * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 897d299a1f2SJavier Cardona * @STATION_INFO_T_OFFSET: @t_offset filled 8983b1c5a53SMarco Porsch * @STATION_INFO_LOCAL_PM: @local_pm filled 8993b1c5a53SMarco Porsch * @STATION_INFO_PEER_PM: @peer_pm filled 9003b1c5a53SMarco Porsch * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 901119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 902119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 903867d849fSAntonio Quartulli * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled 904fd5b74dcSJohannes Berg */ 9052ec600d6SLuis Carlos Cobo enum station_info_flags { 906867d849fSAntonio Quartulli STATION_INFO_INACTIVE_TIME = BIT(0), 907867d849fSAntonio Quartulli STATION_INFO_RX_BYTES = BIT(1), 908867d849fSAntonio Quartulli STATION_INFO_TX_BYTES = BIT(2), 909867d849fSAntonio Quartulli STATION_INFO_LLID = BIT(3), 910867d849fSAntonio Quartulli STATION_INFO_PLID = BIT(4), 911867d849fSAntonio Quartulli STATION_INFO_PLINK_STATE = BIT(5), 912867d849fSAntonio Quartulli STATION_INFO_SIGNAL = BIT(6), 913867d849fSAntonio Quartulli STATION_INFO_TX_BITRATE = BIT(7), 914867d849fSAntonio Quartulli STATION_INFO_RX_PACKETS = BIT(8), 915867d849fSAntonio Quartulli STATION_INFO_TX_PACKETS = BIT(9), 916867d849fSAntonio Quartulli STATION_INFO_TX_RETRIES = BIT(10), 917867d849fSAntonio Quartulli STATION_INFO_TX_FAILED = BIT(11), 918867d849fSAntonio Quartulli STATION_INFO_RX_DROP_MISC = BIT(12), 919867d849fSAntonio Quartulli STATION_INFO_SIGNAL_AVG = BIT(13), 920867d849fSAntonio Quartulli STATION_INFO_RX_BITRATE = BIT(14), 921867d849fSAntonio Quartulli STATION_INFO_BSS_PARAM = BIT(15), 922867d849fSAntonio Quartulli STATION_INFO_CONNECTED_TIME = BIT(16), 923867d849fSAntonio Quartulli STATION_INFO_ASSOC_REQ_IES = BIT(17), 924867d849fSAntonio Quartulli STATION_INFO_STA_FLAGS = BIT(18), 925867d849fSAntonio Quartulli STATION_INFO_BEACON_LOSS_COUNT = BIT(19), 926867d849fSAntonio Quartulli STATION_INFO_T_OFFSET = BIT(20), 927867d849fSAntonio Quartulli STATION_INFO_LOCAL_PM = BIT(21), 928867d849fSAntonio Quartulli STATION_INFO_PEER_PM = BIT(22), 929867d849fSAntonio Quartulli STATION_INFO_NONPEER_PM = BIT(23), 930867d849fSAntonio Quartulli STATION_INFO_RX_BYTES64 = BIT(24), 931867d849fSAntonio Quartulli STATION_INFO_TX_BYTES64 = BIT(25), 932867d849fSAntonio Quartulli STATION_INFO_CHAIN_SIGNAL = BIT(26), 933867d849fSAntonio Quartulli STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), 934867d849fSAntonio Quartulli STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), 935420e7fabSHenning Rogge }; 936420e7fabSHenning Rogge 937420e7fabSHenning Rogge /** 938420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 939420e7fabSHenning Rogge * 940420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 941420e7fabSHenning Rogge * type for 802.11n transmissions. 942420e7fabSHenning Rogge * 943db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 944db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 945db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission 946db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission 947db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission 948db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission 949420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 950db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 951420e7fabSHenning Rogge */ 952420e7fabSHenning Rogge enum rate_info_flags { 953db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 954db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 955db9c64cfSJohannes Berg RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2), 956db9c64cfSJohannes Berg RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3), 957db9c64cfSJohannes Berg RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4), 958db9c64cfSJohannes Berg RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5), 959db9c64cfSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(6), 960db9c64cfSJohannes Berg RATE_INFO_FLAGS_60G = BIT(7), 961420e7fabSHenning Rogge }; 962420e7fabSHenning Rogge 963420e7fabSHenning Rogge /** 964420e7fabSHenning Rogge * struct rate_info - bitrate information 965420e7fabSHenning Rogge * 966420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 967420e7fabSHenning Rogge * 968420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 969420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 970420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 971db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 972420e7fabSHenning Rogge */ 973420e7fabSHenning Rogge struct rate_info { 974420e7fabSHenning Rogge u8 flags; 975420e7fabSHenning Rogge u8 mcs; 976420e7fabSHenning Rogge u16 legacy; 977db9c64cfSJohannes Berg u8 nss; 978fd5b74dcSJohannes Berg }; 979fd5b74dcSJohannes Berg 980fd5b74dcSJohannes Berg /** 981f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 982f4263c98SPaul Stewart * 983f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 984f4263c98SPaul Stewart * type for 802.11n transmissions. 985f4263c98SPaul Stewart * 986f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 987f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 988f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 989f4263c98SPaul Stewart */ 990f4263c98SPaul Stewart enum bss_param_flags { 991f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 992f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 993f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 994f4263c98SPaul Stewart }; 995f4263c98SPaul Stewart 996f4263c98SPaul Stewart /** 997f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 998f4263c98SPaul Stewart * 999f4263c98SPaul Stewart * Information about the currently associated BSS 1000f4263c98SPaul Stewart * 1001f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1002f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1003f4263c98SPaul Stewart * @beacon_interval: beacon interval 1004f4263c98SPaul Stewart */ 1005f4263c98SPaul Stewart struct sta_bss_parameters { 1006f4263c98SPaul Stewart u8 flags; 1007f4263c98SPaul Stewart u8 dtim_period; 1008f4263c98SPaul Stewart u16 beacon_interval; 1009f4263c98SPaul Stewart }; 1010f4263c98SPaul Stewart 1011119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1012119363c7SFelix Fietkau 1013f4263c98SPaul Stewart /** 10142ec600d6SLuis Carlos Cobo * struct station_info - station information 1015fd5b74dcSJohannes Berg * 10162ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1017fd5b74dcSJohannes Berg * 10182ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 1019ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1020fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 1021fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 1022fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 10232ec600d6SLuis Carlos Cobo * @llid: mesh local link id 10242ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 10252ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 102673c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 102773c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 102873c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 102973c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1030119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1031119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1032119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1033858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1034858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 103598c8a60aSJouni Malinen * @rx_packets: packets received from this station 103698c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 1037b206b4efSBruno Randolf * @tx_retries: cumulative retry counts 1038b206b4efSBruno Randolf * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 10395a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 10401ba01458SRandy Dunlap * @bss_param: current BSS parameters 1041f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1042f5ea9120SJohannes Berg * This number should increase every time the list of stations 1043f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1044f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 104550d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 104650d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 104750d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 104850d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 104950d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1050c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1051a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1052d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 10533b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 10543b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 10553b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1056867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1057867d849fSAntonio Quartulli * towards this station. 1058fd5b74dcSJohannes Berg */ 10592ec600d6SLuis Carlos Cobo struct station_info { 1060fd5b74dcSJohannes Berg u32 filled; 1061ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1062fd5b74dcSJohannes Berg u32 inactive_time; 106342745e03SVladimir Kondratiev u64 rx_bytes; 106442745e03SVladimir Kondratiev u64 tx_bytes; 10652ec600d6SLuis Carlos Cobo u16 llid; 10662ec600d6SLuis Carlos Cobo u16 plid; 10672ec600d6SLuis Carlos Cobo u8 plink_state; 1068420e7fabSHenning Rogge s8 signal; 1069541a45a1SBruno Randolf s8 signal_avg; 1070119363c7SFelix Fietkau 1071119363c7SFelix Fietkau u8 chains; 1072119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1073119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1074119363c7SFelix Fietkau 1075420e7fabSHenning Rogge struct rate_info txrate; 1076c8dcfd8aSFelix Fietkau struct rate_info rxrate; 107798c8a60aSJouni Malinen u32 rx_packets; 107898c8a60aSJouni Malinen u32 tx_packets; 1079b206b4efSBruno Randolf u32 tx_retries; 1080b206b4efSBruno Randolf u32 tx_failed; 10815a5c731aSBen Greear u32 rx_dropped_misc; 1082f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1083bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1084f5ea9120SJohannes Berg 1085f5ea9120SJohannes Berg int generation; 108650d3dfb7SJouni Malinen 108750d3dfb7SJouni Malinen const u8 *assoc_req_ies; 108850d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1089f612cedfSJouni Malinen 1090a85e1d55SPaul Stewart u32 beacon_loss_count; 1091d299a1f2SJavier Cardona s64 t_offset; 10923b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 10933b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 10943b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1095a85e1d55SPaul Stewart 1096867d849fSAntonio Quartulli u32 expected_throughput; 1097867d849fSAntonio Quartulli 1098f612cedfSJouni Malinen /* 1099f612cedfSJouni Malinen * Note: Add a new enum station_info_flags value for each new field and 1100f612cedfSJouni Malinen * use it to check which fields are initialized. 1101f612cedfSJouni Malinen */ 1102fd5b74dcSJohannes Berg }; 1103fd5b74dcSJohannes Berg 110466f7ac50SMichael Wu /** 11057406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11067406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11077406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11087406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11097406353dSAntonio Quartulli * 11107406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 11117406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 11127406353dSAntonio Quartulli * considered undefined. 11137406353dSAntonio Quartulli */ 11147406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 11157406353dSAntonio Quartulli struct station_info *sinfo); 11167406353dSAntonio Quartulli 11177406353dSAntonio Quartulli /** 111866f7ac50SMichael Wu * enum monitor_flags - monitor flags 111966f7ac50SMichael Wu * 112066f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 112166f7ac50SMichael Wu * according to the nl80211 flags. 112266f7ac50SMichael Wu * 112366f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 112466f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 112566f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 112666f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 112766f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1128e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 112966f7ac50SMichael Wu */ 113066f7ac50SMichael Wu enum monitor_flags { 113166f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 113266f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 113366f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 113466f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 113566f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1136e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 113766f7ac50SMichael Wu }; 113866f7ac50SMichael Wu 11392ec600d6SLuis Carlos Cobo /** 11402ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 11412ec600d6SLuis Carlos Cobo * 11422ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 11432ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 11442ec600d6SLuis Carlos Cobo * 1145abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1146abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1147abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1148abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1149abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1150abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1151abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 11522ec600d6SLuis Carlos Cobo */ 11532ec600d6SLuis Carlos Cobo enum mpath_info_flags { 11542ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1155d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 11562ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 11572ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 11582ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 11592ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 11602ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 11612ec600d6SLuis Carlos Cobo }; 11622ec600d6SLuis Carlos Cobo 11632ec600d6SLuis Carlos Cobo /** 11642ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 11652ec600d6SLuis Carlos Cobo * 11662ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 11672ec600d6SLuis Carlos Cobo * 11682ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 11692ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1170d19b3bf6SRui Paulo * @sn: target sequence number 11712ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 11722ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 11732ec600d6SLuis Carlos Cobo * @flags: mesh path flags 11742ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 11752ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1176f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1177f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1178f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1179f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 11802ec600d6SLuis Carlos Cobo */ 11812ec600d6SLuis Carlos Cobo struct mpath_info { 11822ec600d6SLuis Carlos Cobo u32 filled; 11832ec600d6SLuis Carlos Cobo u32 frame_qlen; 1184d19b3bf6SRui Paulo u32 sn; 11852ec600d6SLuis Carlos Cobo u32 metric; 11862ec600d6SLuis Carlos Cobo u32 exptime; 11872ec600d6SLuis Carlos Cobo u32 discovery_timeout; 11882ec600d6SLuis Carlos Cobo u8 discovery_retries; 11892ec600d6SLuis Carlos Cobo u8 flags; 1190f5ea9120SJohannes Berg 1191f5ea9120SJohannes Berg int generation; 11922ec600d6SLuis Carlos Cobo }; 11932ec600d6SLuis Carlos Cobo 11949f1ba906SJouni Malinen /** 11959f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 11969f1ba906SJouni Malinen * 11979f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 11989f1ba906SJouni Malinen * 11999f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 12009f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12019f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 12029f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12039f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 12049f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 120590c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 120690c97a04SJouni Malinen * (or NULL for no change) 120790c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1208fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 120950b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 121050b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 121153cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 121253cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 12139f1ba906SJouni Malinen */ 12149f1ba906SJouni Malinen struct bss_parameters { 12159f1ba906SJouni Malinen int use_cts_prot; 12169f1ba906SJouni Malinen int use_short_preamble; 12179f1ba906SJouni Malinen int use_short_slot_time; 1218c1e5f471SJohannes Berg const u8 *basic_rates; 121990c97a04SJouni Malinen u8 basic_rates_len; 1220fd8aaaf3SFelix Fietkau int ap_isolate; 122150b12f59SHelmut Schaa int ht_opmode; 122253cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 12239f1ba906SJouni Malinen }; 12242ec600d6SLuis Carlos Cobo 12253ddd53f3SChun-Yeow Yeoh /** 122629cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 122729cbe68cSJohannes Berg * 122829cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 12293ddd53f3SChun-Yeow Yeoh * 12303ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 12313ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 12323ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 12333ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 12343ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 12353ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 12363ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 12373ddd53f3SChun-Yeow Yeoh * mesh interface 12383ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 12393ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 12403ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 12413ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 12423ddd53f3SChun-Yeow Yeoh * elements 12433ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 12443ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 12453ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 12463ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 12473ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 12483ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 12493ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 12503ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 12513ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 12523ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 12533ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 12543ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 12553ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 12563ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 12573ddd53f3SChun-Yeow Yeoh * element 12583ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 12593ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 12603ddd53f3SChun-Yeow Yeoh * element 12613ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 12623ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 12633ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 12643ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 12653ddd53f3SChun-Yeow Yeoh * announcements are transmitted 12663ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 12673ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 12683ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 12693ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 12703ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 12713ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 12723ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 12733ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 12743ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 12753ddd53f3SChun-Yeow Yeoh * station to establish a peer link 12763ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1277ac1073a6SChun-Yeow Yeoh * 1278ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1279ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1280ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1281ac1073a6SChun-Yeow Yeoh * 1282ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1283ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1284728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1285728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1286728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 12873b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 12883b1c5a53SMarco Porsch * setting for new peer links. 12893b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 12903b1c5a53SMarco Porsch * after transmitting its beacon. 12918e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 12928e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 12938e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 129429cbe68cSJohannes Berg */ 129593da9cc1Scolin@cozybit.com struct mesh_config { 129693da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 129793da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 129893da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 129993da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 130093da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 130193da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 130245904f21SJavier Cardona u8 element_ttl; 130393da9cc1Scolin@cozybit.com bool auto_open_plinks; 1304d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 130593da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 130693da9cc1Scolin@cozybit.com u32 path_refresh_time; 130793da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 130893da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 130993da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1310dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 131193da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 131263c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 13130507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 131416dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 131594f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 131655335137SAshok Nagarajan s32 rssi_threshold; 131770c33eaaSAshok Nagarajan u16 ht_opmode; 1318ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1319ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1320728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 13213b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 13223b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 13238e7c0538SColleen Twitty u32 plink_timeout; 132493da9cc1Scolin@cozybit.com }; 132593da9cc1Scolin@cozybit.com 132631888487SJouni Malinen /** 132729cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1328683b6d3bSJohannes Berg * @chandef: defines the channel to use 132929cbe68cSJohannes Berg * @mesh_id: the mesh ID 133029cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1331d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1332c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1333c80d545dSJavier Cardona * @path_metric: which metric to use 13346e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1335581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1336581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1337b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1338b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1339bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 13409bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 13419bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 13424bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1343ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 134429cbe68cSJohannes Berg * 134529cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 134629cbe68cSJohannes Berg */ 134729cbe68cSJohannes Berg struct mesh_setup { 1348683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 134929cbe68cSJohannes Berg const u8 *mesh_id; 135029cbe68cSJohannes Berg u8 mesh_id_len; 1351d299a1f2SJavier Cardona u8 sync_method; 1352c80d545dSJavier Cardona u8 path_sel_proto; 1353c80d545dSJavier Cardona u8 path_metric; 13546e16d90bSColleen Twitty u8 auth_id; 1355581a8b0fSJavier Cardona const u8 *ie; 1356581a8b0fSJavier Cardona u8 ie_len; 1357b130e5ceSJavier Cardona bool is_authenticated; 135815d5dda6SJavier Cardona bool is_secure; 1359bb2798d4SThomas Pedersen bool user_mpm; 13609bdbf04dSMarco Porsch u8 dtim_period; 13619bdbf04dSMarco Porsch u16 beacon_interval; 13624bb62344SChun-Yeow Yeoh int mcast_rate[IEEE80211_NUM_BANDS]; 1363ffb3cf30SAshok Nagarajan u32 basic_rates; 136429cbe68cSJohannes Berg }; 136529cbe68cSJohannes Berg 136629cbe68cSJohannes Berg /** 13676e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 13686e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 13696e0bd6c3SRostislav Lisovy * 13706e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 13716e0bd6c3SRostislav Lisovy */ 13726e0bd6c3SRostislav Lisovy struct ocb_setup { 13736e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 13746e0bd6c3SRostislav Lisovy }; 13756e0bd6c3SRostislav Lisovy 13766e0bd6c3SRostislav Lisovy /** 137731888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1378a3304b0aSJohannes Berg * @ac: AC identifier 137931888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 138031888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 138131888487SJouni Malinen * 1..32767] 138231888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 138331888487SJouni Malinen * 1..32767] 138431888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 138531888487SJouni Malinen */ 138631888487SJouni Malinen struct ieee80211_txq_params { 1387a3304b0aSJohannes Berg enum nl80211_ac ac; 138831888487SJouni Malinen u16 txop; 138931888487SJouni Malinen u16 cwmin; 139031888487SJouni Malinen u16 cwmax; 139131888487SJouni Malinen u8 aifs; 139231888487SJouni Malinen }; 139331888487SJouni Malinen 1394d70e9693SJohannes Berg /** 1395d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1396d70e9693SJohannes Berg * 1397d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1398d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1399d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1400d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1401d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1402d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1403d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1404d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1405d70e9693SJohannes Berg * in the wiphy structure. 1406d70e9693SJohannes Berg * 1407d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1408d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1409d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1410d70e9693SJohannes Berg * 1411d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1412d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1413d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1414d70e9693SJohannes Berg * to userspace. 1415d70e9693SJohannes Berg */ 141672bdcf34SJouni Malinen 1417704232c2SJohannes Berg /** 14182a519311SJohannes Berg * struct cfg80211_ssid - SSID description 14192a519311SJohannes Berg * @ssid: the SSID 14202a519311SJohannes Berg * @ssid_len: length of the ssid 14212a519311SJohannes Berg */ 14222a519311SJohannes Berg struct cfg80211_ssid { 14232a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 14242a519311SJohannes Berg u8 ssid_len; 14252a519311SJohannes Berg }; 14262a519311SJohannes Berg 14272a519311SJohannes Berg /** 14282a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 14292a519311SJohannes Berg * 14302a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 14312a519311SJohannes Berg * @n_ssids: number of SSIDs 14322a519311SJohannes Berg * @channels: channels to scan on. 1433ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1434dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 143570692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 143670692ad2SJouni Malinen * @ie_len: length of ie in octets 1437ed473771SSam Leffler * @flags: bit field of flags controlling operation 143834850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 14392a519311SJohannes Berg * @wiphy: the wiphy this was for 144015d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1441fd014284SJohannes Berg * @wdev: the wireless device to scan for 1442abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 14435fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1444e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1445ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1446ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1447ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1448ad2b26abSJohannes Berg * be taken from the @mac_addr 14492a519311SJohannes Berg */ 14502a519311SJohannes Berg struct cfg80211_scan_request { 14512a519311SJohannes Berg struct cfg80211_ssid *ssids; 14522a519311SJohannes Berg int n_ssids; 14532a519311SJohannes Berg u32 n_channels; 1454dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1455de95a54bSJohannes Berg const u8 *ie; 145670692ad2SJouni Malinen size_t ie_len; 1457ed473771SSam Leffler u32 flags; 14582a519311SJohannes Berg 145934850ab2SJohannes Berg u32 rates[IEEE80211_NUM_BANDS]; 146034850ab2SJohannes Berg 1461fd014284SJohannes Berg struct wireless_dev *wdev; 1462fd014284SJohannes Berg 1463ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1464ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1465ad2b26abSJohannes Berg 14662a519311SJohannes Berg /* internal */ 14672a519311SJohannes Berg struct wiphy *wiphy; 146815d6030bSSam Leffler unsigned long scan_start; 14695fe231e8SJohannes Berg bool aborted, notified; 1470e9f935e3SRajkumar Manoharan bool no_cck; 14715ba63533SJohannes Berg 14725ba63533SJohannes Berg /* keep last */ 14735ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 14742a519311SJohannes Berg }; 14752a519311SJohannes Berg 1476ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1477ad2b26abSJohannes Berg { 1478ad2b26abSJohannes Berg int i; 1479ad2b26abSJohannes Berg 1480ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1481ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1482ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1483ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1484ad2b26abSJohannes Berg } 1485ad2b26abSJohannes Berg } 1486ad2b26abSJohannes Berg 14872a519311SJohannes Berg /** 1488a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1489a1f1c21cSLuciano Coelho * 1490ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1491ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1492a1f1c21cSLuciano Coelho */ 1493a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1494a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1495ea73cbceSJohannes Berg s32 rssi_thold; 1496a1f1c21cSLuciano Coelho }; 1497a1f1c21cSLuciano Coelho 1498a1f1c21cSLuciano Coelho /** 1499807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1500807f8a8cSLuciano Coelho * 1501807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1502807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1503807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1504dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1505bbe6ad6dSLuciano Coelho * @interval: interval between each scheduled scan cycle 1506807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1507807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1508ed473771SSam Leffler * @flags: bit field of flags controlling operation 1509a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1510a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1511a1f1c21cSLuciano Coelho * (others are filtered out). 1512a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1513a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1514807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1515807f8a8cSLuciano Coelho * @dev: the interface 1516077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1517807f8a8cSLuciano Coelho * @channels: channels to scan 1518ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1519ea73cbceSJohannes Berg * contains the minimum over all matchsets 1520ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1521ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1522ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1523ad2b26abSJohannes Berg * be taken from the @mac_addr 152431a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 152593a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 152693a1e86cSJukka Rissanen * owned by a particular socket) 1527807f8a8cSLuciano Coelho */ 1528807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1529807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1530807f8a8cSLuciano Coelho int n_ssids; 1531807f8a8cSLuciano Coelho u32 n_channels; 1532dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1533bbe6ad6dSLuciano Coelho u32 interval; 1534807f8a8cSLuciano Coelho const u8 *ie; 1535807f8a8cSLuciano Coelho size_t ie_len; 1536ed473771SSam Leffler u32 flags; 1537a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1538a1f1c21cSLuciano Coelho int n_match_sets; 1539ea73cbceSJohannes Berg s32 min_rssi_thold; 1540807f8a8cSLuciano Coelho 1541ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1542ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1543ad2b26abSJohannes Berg 1544807f8a8cSLuciano Coelho /* internal */ 1545807f8a8cSLuciano Coelho struct wiphy *wiphy; 1546807f8a8cSLuciano Coelho struct net_device *dev; 154715d6030bSSam Leffler unsigned long scan_start; 154831a60ed1SJukka Rissanen struct rcu_head rcu_head; 154993a1e86cSJukka Rissanen u32 owner_nlportid; 1550807f8a8cSLuciano Coelho 1551807f8a8cSLuciano Coelho /* keep last */ 1552807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1553807f8a8cSLuciano Coelho }; 1554807f8a8cSLuciano Coelho 1555807f8a8cSLuciano Coelho /** 15562a519311SJohannes Berg * enum cfg80211_signal_type - signal type 15572a519311SJohannes Berg * 15582a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 15592a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 15602a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 15612a519311SJohannes Berg */ 15622a519311SJohannes Berg enum cfg80211_signal_type { 15632a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 15642a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 15652a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 15662a519311SJohannes Berg }; 15672a519311SJohannes Berg 15682a519311SJohannes Berg /** 15699caf0364SJohannes Berg * struct cfg80211_bss_ie_data - BSS entry IE data 15708cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 15719caf0364SJohannes Berg * @rcu_head: internal use, for freeing 15729caf0364SJohannes Berg * @len: length of the IEs 15730e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 15749caf0364SJohannes Berg * @data: IE data 15759caf0364SJohannes Berg */ 15769caf0364SJohannes Berg struct cfg80211_bss_ies { 15778cef2c9dSJohannes Berg u64 tsf; 15789caf0364SJohannes Berg struct rcu_head rcu_head; 15799caf0364SJohannes Berg int len; 15800e227084SJohannes Berg bool from_beacon; 15819caf0364SJohannes Berg u8 data[]; 15829caf0364SJohannes Berg }; 15839caf0364SJohannes Berg 15849caf0364SJohannes Berg /** 15852a519311SJohannes Berg * struct cfg80211_bss - BSS description 15862a519311SJohannes Berg * 15872a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 15882a519311SJohannes Berg * for use in scan results and similar. 15892a519311SJohannes Berg * 1590abe37c4bSJohannes Berg * @channel: channel this BSS is on 1591dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 15922a519311SJohannes Berg * @bssid: BSSID of the BSS 15932a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 15942a519311SJohannes Berg * @capability: the capability field in host byte order 159583c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 159683c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 159783c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 159883c7aa1aSJohannes Berg * received. It is always non-%NULL. 159934a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1600776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1601776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1602776b3580SJohannes Berg * @hidden_beacon_bss struct) 160334a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1604776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1605776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1606776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1607776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 160877965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 16092a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 16102a519311SJohannes Berg */ 16112a519311SJohannes Berg struct cfg80211_bss { 16122a519311SJohannes Berg struct ieee80211_channel *channel; 1613dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 16142a519311SJohannes Berg 16159caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 16169caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 16179caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 16189caf0364SJohannes Berg 1619776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 16202a519311SJohannes Berg 16212a519311SJohannes Berg s32 signal; 16222a519311SJohannes Berg 16239caf0364SJohannes Berg u16 beacon_interval; 16249caf0364SJohannes Berg u16 capability; 16259caf0364SJohannes Berg 16269caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 16279caf0364SJohannes Berg 16281c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 16292a519311SJohannes Berg }; 16302a519311SJohannes Berg 16312a519311SJohannes Berg /** 1632517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1633517357c6SJohannes Berg * @bss: the bss to search 1634517357c6SJohannes Berg * @ie: the IE ID 16359caf0364SJohannes Berg * 16369caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 16379caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 16380ae997dcSYacine Belkadi * Return: %NULL if not found. 1639517357c6SJohannes Berg */ 1640517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1641517357c6SJohannes Berg 1642517357c6SJohannes Berg 1643517357c6SJohannes Berg /** 1644636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1645636a5d36SJouni Malinen * 1646636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1647636a5d36SJouni Malinen * authentication. 1648636a5d36SJouni Malinen * 1649959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1650959867faSJohannes Berg * to it if it needs to keep it. 1651636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1652636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1653636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1654fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1655fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1656fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1657e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1658e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1659e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1660636a5d36SJouni Malinen */ 1661636a5d36SJouni Malinen struct cfg80211_auth_request { 166219957bb3SJohannes Berg struct cfg80211_bss *bss; 1663636a5d36SJouni Malinen const u8 *ie; 1664636a5d36SJouni Malinen size_t ie_len; 166519957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1666fffd0934SJohannes Berg const u8 *key; 1667fffd0934SJohannes Berg u8 key_len, key_idx; 1668e39e5b5eSJouni Malinen const u8 *sae_data; 1669e39e5b5eSJouni Malinen size_t sae_data_len; 1670636a5d36SJouni Malinen }; 1671636a5d36SJouni Malinen 1672636a5d36SJouni Malinen /** 16737e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 16747e7c8926SBen Greear * 16757e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1676ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1677bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 16787e7c8926SBen Greear */ 16797e7c8926SBen Greear enum cfg80211_assoc_req_flags { 16807e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1681ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1682bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 16837e7c8926SBen Greear }; 16847e7c8926SBen Greear 16857e7c8926SBen Greear /** 1686636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1687636a5d36SJouni Malinen * 1688636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1689636a5d36SJouni Malinen * (re)association. 1690959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1691959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1692959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1693959867faSJohannes Berg * association requests while already associating must be rejected. 1694636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1695636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1696dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1697b23aa676SSamuel Ortiz * @crypto: crypto settings 16983e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 16997e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 17007e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 17017e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 17027e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1703ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1704ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1705636a5d36SJouni Malinen */ 1706636a5d36SJouni Malinen struct cfg80211_assoc_request { 170719957bb3SJohannes Berg struct cfg80211_bss *bss; 17083e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1709636a5d36SJouni Malinen size_t ie_len; 1710b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 171119957bb3SJohannes Berg bool use_mfp; 17127e7c8926SBen Greear u32 flags; 17137e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 17147e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1715ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1716636a5d36SJouni Malinen }; 1717636a5d36SJouni Malinen 1718636a5d36SJouni Malinen /** 1719636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1720636a5d36SJouni Malinen * 1721636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1722636a5d36SJouni Malinen * deauthentication. 1723636a5d36SJouni Malinen * 172495de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1725636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1726636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 172719957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1728077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1729077f897aSJohannes Berg * do not set a deauth frame 1730636a5d36SJouni Malinen */ 1731636a5d36SJouni Malinen struct cfg80211_deauth_request { 173295de817bSJohannes Berg const u8 *bssid; 1733636a5d36SJouni Malinen const u8 *ie; 1734636a5d36SJouni Malinen size_t ie_len; 173519957bb3SJohannes Berg u16 reason_code; 17366863255bSStanislaw Gruszka bool local_state_change; 1737636a5d36SJouni Malinen }; 1738636a5d36SJouni Malinen 1739636a5d36SJouni Malinen /** 1740636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1741636a5d36SJouni Malinen * 1742636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1743636a5d36SJouni Malinen * disassocation. 1744636a5d36SJouni Malinen * 174519957bb3SJohannes Berg * @bss: the BSS to disassociate from 1746636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1747636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 174819957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1749d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1750d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1751636a5d36SJouni Malinen */ 1752636a5d36SJouni Malinen struct cfg80211_disassoc_request { 175319957bb3SJohannes Berg struct cfg80211_bss *bss; 1754636a5d36SJouni Malinen const u8 *ie; 1755636a5d36SJouni Malinen size_t ie_len; 175619957bb3SJohannes Berg u16 reason_code; 1757d5cdfacbSJouni Malinen bool local_state_change; 1758636a5d36SJouni Malinen }; 1759636a5d36SJouni Malinen 1760636a5d36SJouni Malinen /** 176104a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 176204a773adSJohannes Berg * 176304a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 176404a773adSJohannes Berg * method. 176504a773adSJohannes Berg * 176604a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 176704a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 176804a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 176904a773adSJohannes Berg * search for IBSSs with a different BSSID. 1770683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 177104a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 177204a773adSJohannes Berg * IBSSs to join on other channels. 177304a773adSJohannes Berg * @ie: information element(s) to include in the beacon 177404a773adSJohannes Berg * @ie_len: length of that 17758e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1776fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1777fffd0934SJohannes Berg * after joining 1778267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1779267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1780267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1781267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 17825336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 17835336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 17845336fa88SSimon Wunderlich * to operate on DFS channels. 1785fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1786dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1787803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1788803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1789803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 179004a773adSJohannes Berg */ 179104a773adSJohannes Berg struct cfg80211_ibss_params { 1792c1e5f471SJohannes Berg const u8 *ssid; 1793c1e5f471SJohannes Berg const u8 *bssid; 1794683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1795c1e5f471SJohannes Berg const u8 *ie; 179604a773adSJohannes Berg u8 ssid_len, ie_len; 17978e30bc55SJohannes Berg u16 beacon_interval; 1798fbd2c8dcSTeemu Paasikivi u32 basic_rates; 179904a773adSJohannes Berg bool channel_fixed; 1800fffd0934SJohannes Berg bool privacy; 1801267335d6SAntonio Quartulli bool control_port; 18025336fa88SSimon Wunderlich bool userspace_handles_dfs; 1803dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 1804803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1805803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 180604a773adSJohannes Berg }; 180704a773adSJohannes Berg 180804a773adSJohannes Berg /** 1809b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1810b23aa676SSamuel Ortiz * 1811b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1812b23aa676SSamuel Ortiz * authentication and association. 1813b23aa676SSamuel Ortiz * 1814b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1815b23aa676SSamuel Ortiz * on scan results) 18161df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 18171df4a510SJouni Malinen * %NULL if not specified 1818b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1819b23aa676SSamuel Ortiz * results) 18201df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 18211df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 18221df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 18231df4a510SJouni Malinen * to use. 1824b23aa676SSamuel Ortiz * @ssid: SSID 1825b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1826b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1827abe37c4bSJohannes Berg * @ie: IEs for association request 1828abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1829b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1830cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1831b23aa676SSamuel Ortiz * @crypto: crypto settings 1832fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1833fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1834fffd0934SJohannes Berg * @key: WEP key for shared key authentication 18357e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 18364486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 18374486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 18387e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 18397e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 18407e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1841ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 1842ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 1843b23aa676SSamuel Ortiz */ 1844b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1845b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 18461df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 1847664834deSJouni Malinen const u8 *bssid; 18481df4a510SJouni Malinen const u8 *bssid_hint; 1849664834deSJouni Malinen const u8 *ssid; 1850b23aa676SSamuel Ortiz size_t ssid_len; 1851b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 18524b5800feSJohannes Berg const u8 *ie; 1853b23aa676SSamuel Ortiz size_t ie_len; 1854b23aa676SSamuel Ortiz bool privacy; 1855cee00a95SJouni Malinen enum nl80211_mfp mfp; 1856b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1857fffd0934SJohannes Berg const u8 *key; 1858fffd0934SJohannes Berg u8 key_len, key_idx; 18597e7c8926SBen Greear u32 flags; 18604486ea98SBala Shanmugam int bg_scan_period; 18617e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 18627e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1863ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 1864ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 1865b23aa676SSamuel Ortiz }; 1866b23aa676SSamuel Ortiz 1867b23aa676SSamuel Ortiz /** 1868b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1869abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1870abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1871abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1872abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1873abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 18743057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 1875b9a5f8caSJouni Malinen */ 1876b9a5f8caSJouni Malinen enum wiphy_params_flags { 1877b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1878b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1879b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1880b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 188181077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 18823057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 1883b9a5f8caSJouni Malinen }; 1884b9a5f8caSJouni Malinen 18859930380fSJohannes Berg /* 18869930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 18879930380fSJohannes Berg */ 18889930380fSJohannes Berg struct cfg80211_bitrate_mask { 18899930380fSJohannes Berg struct { 18909930380fSJohannes Berg u32 legacy; 1891d1e33e65SJanusz Dziedzic u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1892204e35a9SJanusz Dziedzic u16 vht_mcs[NL80211_VHT_NSS_MAX]; 18930b9323f6SJanusz Dziedzic enum nl80211_txrate_gi gi; 18949930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 18959930380fSJohannes Berg }; 189667fbb16bSSamuel Ortiz /** 189767fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 189867fbb16bSSamuel Ortiz * 189967fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 190067fbb16bSSamuel Ortiz * caching. 190167fbb16bSSamuel Ortiz * 190267fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 190367fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 190467fbb16bSSamuel Ortiz */ 190567fbb16bSSamuel Ortiz struct cfg80211_pmksa { 1906c1e5f471SJohannes Berg const u8 *bssid; 1907c1e5f471SJohannes Berg const u8 *pmkid; 190867fbb16bSSamuel Ortiz }; 19099930380fSJohannes Berg 19107643a2c3SJohannes Berg /** 191150ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 1912ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 1913ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 1914ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 1915ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 1916bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 1917ff1b6e69SJohannes Berg * 1918ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 1919ff1b6e69SJohannes Berg * memory, free @mask only! 1920ff1b6e69SJohannes Berg */ 192150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 1922922bd80fSJohannes Berg const u8 *mask, *pattern; 1923ff1b6e69SJohannes Berg int pattern_len; 1924bb92d199SAmitkumar Karwar int pkt_offset; 1925ff1b6e69SJohannes Berg }; 1926ff1b6e69SJohannes Berg 1927ff1b6e69SJohannes Berg /** 19282a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 19292a0e047eSJohannes Berg * 19302a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 19312a0e047eSJohannes Berg * @src: source IP address 19322a0e047eSJohannes Berg * @dst: destination IP address 19332a0e047eSJohannes Berg * @dst_mac: destination MAC address 19342a0e047eSJohannes Berg * @src_port: source port 19352a0e047eSJohannes Berg * @dst_port: destination port 19362a0e047eSJohannes Berg * @payload_len: data payload length 19372a0e047eSJohannes Berg * @payload: data payload buffer 19382a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 19392a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 19402a0e047eSJohannes Berg * @wake_len: wakeup payload match length 19412a0e047eSJohannes Berg * @wake_data: wakeup payload match data 19422a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 19432a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 19442a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 19452a0e047eSJohannes Berg */ 19462a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 19472a0e047eSJohannes Berg struct socket *sock; 19482a0e047eSJohannes Berg __be32 src, dst; 19492a0e047eSJohannes Berg u16 src_port, dst_port; 19502a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 19512a0e047eSJohannes Berg int payload_len; 19522a0e047eSJohannes Berg const u8 *payload; 19532a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 19542a0e047eSJohannes Berg u32 data_interval; 19552a0e047eSJohannes Berg u32 wake_len; 19562a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 19572a0e047eSJohannes Berg u32 tokens_size; 19582a0e047eSJohannes Berg /* must be last, variable member */ 19592a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 1960ff1b6e69SJohannes Berg }; 1961ff1b6e69SJohannes Berg 1962ff1b6e69SJohannes Berg /** 1963ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 1964ff1b6e69SJohannes Berg * 1965ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 1966ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 1967ff1b6e69SJohannes Berg * operating as normal during suspend 1968ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 1969ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 1970ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 1971ff1b6e69SJohannes Berg * @n_patterns: number of patterns 197277dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 197377dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 197477dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 197577dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 19762a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 19772a0e047eSJohannes Berg * NULL if not configured. 19788cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 1979ff1b6e69SJohannes Berg */ 1980ff1b6e69SJohannes Berg struct cfg80211_wowlan { 198177dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 198277dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 198377dbbb13SJohannes Berg rfkill_release; 198450ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 19852a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 1986ff1b6e69SJohannes Berg int n_patterns; 19878cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 1988ff1b6e69SJohannes Berg }; 1989ff1b6e69SJohannes Berg 1990ff1b6e69SJohannes Berg /** 1991be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 1992be29b99aSAmitkumar Karwar * 1993be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 1994be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 1995be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 1996be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 1997be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 1998be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 1999be29b99aSAmitkumar Karwar */ 2000be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2001be29b99aSAmitkumar Karwar int delay; 2002be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2003be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2004be29b99aSAmitkumar Karwar int n_patterns; 2005be29b99aSAmitkumar Karwar }; 2006be29b99aSAmitkumar Karwar 2007be29b99aSAmitkumar Karwar /** 2008be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2009be29b99aSAmitkumar Karwar * 2010be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2011be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2012be29b99aSAmitkumar Karwar * @n_rules: number of rules 2013be29b99aSAmitkumar Karwar */ 2014be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2015be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2016be29b99aSAmitkumar Karwar int n_rules; 2017be29b99aSAmitkumar Karwar }; 2018be29b99aSAmitkumar Karwar 2019be29b99aSAmitkumar Karwar /** 20208cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 20218cd4d456SLuciano Coelho * 20228cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 20238cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 20248cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 20258cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 20268cd4d456SLuciano Coelho * occurred (in MHz) 20278cd4d456SLuciano Coelho */ 20288cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 20298cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 20308cd4d456SLuciano Coelho int n_channels; 20318cd4d456SLuciano Coelho u32 channels[]; 20328cd4d456SLuciano Coelho }; 20338cd4d456SLuciano Coelho 20348cd4d456SLuciano Coelho /** 20358cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 20368cd4d456SLuciano Coelho * 20378cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 20388cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 20398cd4d456SLuciano Coelho * match information. 20408cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 20418cd4d456SLuciano Coelho * the matches that triggered the wake up. 20428cd4d456SLuciano Coelho */ 20438cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 20448cd4d456SLuciano Coelho int n_matches; 20458cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 20468cd4d456SLuciano Coelho }; 20478cd4d456SLuciano Coelho 20488cd4d456SLuciano Coelho /** 2049cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2050cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2051cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2052cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2053cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2054cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2055cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2056cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2057cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2058cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2059cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2060cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2061cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2062cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2063cd8f7cb4SJohannes Berg * it is. 20642a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 20652a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 20662a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 20678cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2068cd8f7cb4SJohannes Berg */ 2069cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2070cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2071cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 20722a0e047eSJohannes Berg rfkill_release, packet_80211, 20732a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2074cd8f7cb4SJohannes Berg s32 pattern_idx; 2075cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2076cd8f7cb4SJohannes Berg const void *packet; 20778cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2078cd8f7cb4SJohannes Berg }; 2079cd8f7cb4SJohannes Berg 2080cd8f7cb4SJohannes Berg /** 2081e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 208278f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 208378f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 208478f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2085e5497d76SJohannes Berg */ 2086e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 208778f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2088e5497d76SJohannes Berg }; 2089e5497d76SJohannes Berg 2090e5497d76SJohannes Berg /** 2091355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2092355199e0SJouni Malinen * 2093355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2094355199e0SJouni Malinen * 2095355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2096355199e0SJouni Malinen * @ie: Fast Transition IEs 2097355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2098355199e0SJouni Malinen */ 2099355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2100355199e0SJouni Malinen u16 md; 2101355199e0SJouni Malinen const u8 *ie; 2102355199e0SJouni Malinen size_t ie_len; 2103355199e0SJouni Malinen }; 2104355199e0SJouni Malinen 2105355199e0SJouni Malinen /** 2106b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2107b176e629SAndrei Otcheretianski * 2108b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2109b176e629SAndrei Otcheretianski * 2110b176e629SAndrei Otcheretianski * @chan: channel to use 2111b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2112b176e629SAndrei Otcheretianski * @wait: duration for ROC 2113b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2114b176e629SAndrei Otcheretianski * @len: buffer length 2115b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2116b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 211734d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 211834d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2119b176e629SAndrei Otcheretianski */ 2120b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2121b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2122b176e629SAndrei Otcheretianski bool offchan; 2123b176e629SAndrei Otcheretianski unsigned int wait; 2124b176e629SAndrei Otcheretianski const u8 *buf; 2125b176e629SAndrei Otcheretianski size_t len; 2126b176e629SAndrei Otcheretianski bool no_cck; 2127b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 212834d22ce2SAndrei Otcheretianski int n_csa_offsets; 212934d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2130b176e629SAndrei Otcheretianski }; 2131b176e629SAndrei Otcheretianski 2132b176e629SAndrei Otcheretianski /** 2133fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2134fa9ffc74SKyeyoon Park * 2135fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2136fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2137fa9ffc74SKyeyoon Park */ 2138fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2139fa9ffc74SKyeyoon Park u8 dscp; 2140fa9ffc74SKyeyoon Park u8 up; 2141fa9ffc74SKyeyoon Park }; 2142fa9ffc74SKyeyoon Park 2143fa9ffc74SKyeyoon Park /** 2144fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2145fa9ffc74SKyeyoon Park * 2146fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2147fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2148fa9ffc74SKyeyoon Park */ 2149fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2150fa9ffc74SKyeyoon Park u8 low; 2151fa9ffc74SKyeyoon Park u8 high; 2152fa9ffc74SKyeyoon Park }; 2153fa9ffc74SKyeyoon Park 2154fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2155fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2156fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2157fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2158fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2159fa9ffc74SKyeyoon Park 2160fa9ffc74SKyeyoon Park /** 2161fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2162fa9ffc74SKyeyoon Park * 2163fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2164fa9ffc74SKyeyoon Park * 2165fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2166fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2167fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2168fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2169fa9ffc74SKyeyoon Park */ 2170fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2171fa9ffc74SKyeyoon Park u8 num_des; 2172fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2173fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2174fa9ffc74SKyeyoon Park }; 2175fa9ffc74SKyeyoon Park 2176fa9ffc74SKyeyoon Park /** 2177704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2178704232c2SJohannes Berg * 2179704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2180704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2181704232c2SJohannes Berg * 2182704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2183704232c2SJohannes Berg * on success or a negative error code. 2184704232c2SJohannes Berg * 218543fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 218643fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 218743fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 218843fb45cbSJohannes Berg * 2189ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2190ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2191ff1b6e69SJohannes Berg * configured for the device. 21920378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 21936d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 21946d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 21956d52563fSJohannes Berg * the device. 21960378b3f1SJohannes Berg * 219760719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2198463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 219984efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 220098104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 220198104fdeSJohannes Berg * also set the address member in the wdev. 2202704232c2SJohannes Berg * 220384efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 220455682965SJohannes Berg * 220560719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 220660719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 220755682965SJohannes Berg * 220841ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 220941ade00fSJohannes Berg * when adding a group key. 221041ade00fSJohannes Berg * 221141ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 221241ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 221341ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2214e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2215e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 221641ade00fSJohannes Berg * 221741ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2218e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 221941ade00fSJohannes Berg * 222041ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2221ed1b6cc7SJohannes Berg * 22223cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 22233cfcf6acSJouni Malinen * 2224e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2225e5497d76SJohannes Berg * 2226c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2227c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2228c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2229c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 22305727ef1bSJohannes Berg * 22315727ef1bSJohannes Berg * @add_station: Add a new station. 223289c771e5SJouni Malinen * @del_station: Remove a station 2233bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2234bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2235bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 223677ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 223777ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2238abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2239abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2240abe37c4bSJohannes Berg * 2241abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2242abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2243abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2244abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2245abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 224666be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 224766be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2248f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 22498d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2250f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 22518d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 22522ec600d6SLuis Carlos Cobo * 225324bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 225493da9cc1Scolin@cozybit.com * 225524bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 225693da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 225793da9cc1Scolin@cozybit.com * set, and which to leave alone. 225893da9cc1Scolin@cozybit.com * 22599f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 226031888487SJouni Malinen * 226131888487SJouni Malinen * @set_txq_params: Set TX queue parameters 226272bdcf34SJouni Malinen * 2263e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2264e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2265e8c9bd5bSJohannes Berg * join the mesh instead. 2266e8c9bd5bSJohannes Berg * 2267e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2268e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2269e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2270e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 22719aed3cc1SJouni Malinen * 22722a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 22732a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 22742a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 22752a519311SJohannes Berg * the scan/scan_done bracket too. 2276636a5d36SJouni Malinen * 2277636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 22788d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2279636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 22808d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2281636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 22828d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2283636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 22848d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 228504a773adSJohannes Berg * 2286b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2287b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 2288b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 2289b23aa676SSamuel Ortiz * with the status from the AP. 22908d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2291b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 22928d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2293b23aa676SSamuel Ortiz * 229404a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 229504a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 229604a773adSJohannes Berg * to a merge. 22978d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 229804a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 22998d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2300b9a5f8caSJouni Malinen * 2301f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2302f4e583c8SAntonio Quartulli * MESH mode) 2303f4e583c8SAntonio Quartulli * 2304b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2305b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2306b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2307b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 23087643a2c3SJohannes Berg * 23091432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2310c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2311c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2312c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2313c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 23147643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 23151f87f7d3SJohannes Berg * return 0 if successful 23161f87f7d3SJohannes Berg * 2317abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2318abe37c4bSJohannes Berg * 23191f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 23201f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2321aff89a9bSJohannes Berg * 232261fa713cSHolger Schurig * @dump_survey: get site survey information. 232361fa713cSHolger Schurig * 23249588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 23259588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 23269588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 23279588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 23289588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 23299588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 23309588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 23319588bbd5SJouni Malinen * the duration value. 2332f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2333f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2334f7ca38dfSJohannes Berg * frame on another channel 23359588bbd5SJouni Malinen * 2336fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 233771063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 233871063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 233971063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 234071063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 234171063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 234271063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 234367fbb16bSSamuel Ortiz * 2344abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2345abe37c4bSJohannes Berg * 234667fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 234767fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 234867fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 234967fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 235067fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 23519043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 23529043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2353d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 235484f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 235584f10708SThomas Pedersen * thresholds. 2356807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2357d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2358d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2359d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2360d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2361d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2362d9b8396aSJohannes Berg * method returns 0.) 236367fbb16bSSamuel Ortiz * 2364271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 2365271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 2366271733cfSJohannes Berg * concurrently with itself. 2367547025d5SBruno Randolf * 2368547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2369547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2370547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2371547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2372547025d5SBruno Randolf * 2373547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 23743677713bSJohn W. Linville * 2375109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2376109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 23777f6cf311SJohannes Berg * 23787f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 23797f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 23801d9d9213SSimon Wunderlich * 23811d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2382d6199218SBen Greear * 23835b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 23845b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 23855b7ccaf3SJohannes Berg * current monitoring channel. 238698104fdeSJohannes Berg * 238798104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 238898104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 238977765eafSVasanthakumar Thiagarajan * 239077765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 239177765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 239277765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 239377765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 239477765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 239577765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 239604f39047SSimon Wunderlich * 239704f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 23988bf24293SJouni Malinen * 23998bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 24008bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 24018bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 24025de17984SArend van Spriel * 24035de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 24045de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 24055de17984SArend van Spriel * driver can take the most appropriate actions. 24065de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 24075de17984SArend van Spriel * reliability. This operation can not fail. 2408be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 240916ef1fe2SSimon Wunderlich * 241097dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 241197dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 241297dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 241397dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 241497dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 241597dc94f1SMichal Kazior * as soon as possible. 2416fa9ffc74SKyeyoon Park * 2417fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2418e16821bcSJouni Malinen * 2419e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2420e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2421e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2422960d01acSJohannes Berg * 2423960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2424960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2425960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2426960d01acSJohannes Berg * account. 2427960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2428960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2429960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2430960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2431960d01acSJohannes Berg * rejected) 2432960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 24336e0bd6c3SRostislav Lisovy * 24346e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 24356e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 24366e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 24376e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 24381057d35eSArik Nemtsov * 24391057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 24401057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 24411057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 24421057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 24431057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2444704232c2SJohannes Berg */ 2445704232c2SJohannes Berg struct cfg80211_ops { 2446ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 24470378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 24486d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 24490378b3f1SJohannes Berg 245084efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2451552bff0cSJohannes Berg const char *name, 2452f9e10ce4SJohannes Berg enum nl80211_iftype type, 2453f9e10ce4SJohannes Berg u32 *flags, 24542ec600d6SLuis Carlos Cobo struct vif_params *params); 245584efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 245684efbb84SJohannes Berg struct wireless_dev *wdev); 2457e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2458e36d56b6SJohannes Berg struct net_device *dev, 24592ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 24602ec600d6SLuis Carlos Cobo struct vif_params *params); 246141ade00fSJohannes Berg 246241ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2463e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 246441ade00fSJohannes Berg struct key_params *params); 246541ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2466e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2467e31b8213SJohannes Berg void *cookie, 246841ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 246941ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2470e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 247141ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 247241ade00fSJohannes Berg struct net_device *netdev, 2473dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 24743cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 24753cfcf6acSJouni Malinen struct net_device *netdev, 24763cfcf6acSJouni Malinen u8 key_index); 2477ed1b6cc7SJohannes Berg 24788860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 24798860020eSJohannes Berg struct cfg80211_ap_settings *settings); 24808860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 24818860020eSJohannes Berg struct cfg80211_beacon_data *info); 24828860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 24835727ef1bSJohannes Berg 24845727ef1bSJohannes Berg 24855727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 24863b3a0162SJohannes Berg const u8 *mac, 24873b3a0162SJohannes Berg struct station_parameters *params); 24885727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 248989c771e5SJouni Malinen struct station_del_parameters *params); 24905727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 24913b3a0162SJohannes Berg const u8 *mac, 24923b3a0162SJohannes Berg struct station_parameters *params); 2493fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 24943b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 24952ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 24962ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 24972ec600d6SLuis Carlos Cobo 24982ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 24993b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 25002ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 25013b3a0162SJohannes Berg const u8 *dst); 25022ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 25033b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 25042ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 25053b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 25062ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 25072ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 25082ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 250966be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 251066be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 251166be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 251266be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 251366be7d2bSHenning Rogge struct mpath_info *pinfo); 251424bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 251593da9cc1Scolin@cozybit.com struct net_device *dev, 251693da9cc1Scolin@cozybit.com struct mesh_config *conf); 251724bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 251829cbe68cSJohannes Berg struct net_device *dev, u32 mask, 251929cbe68cSJohannes Berg const struct mesh_config *nconf); 252029cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 252129cbe68cSJohannes Berg const struct mesh_config *conf, 252229cbe68cSJohannes Berg const struct mesh_setup *setup); 252329cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 252429cbe68cSJohannes Berg 25256e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 25266e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 25276e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 25286e0bd6c3SRostislav Lisovy 25299f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 25309f1ba906SJouni Malinen struct bss_parameters *params); 253131888487SJouni Malinen 2532f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 253331888487SJouni Malinen struct ieee80211_txq_params *params); 253472bdcf34SJouni Malinen 2535e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2536e8c9bd5bSJohannes Berg struct net_device *dev, 2537e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2538e8c9bd5bSJohannes Berg 2539e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2540683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 25419aed3cc1SJouni Malinen 2542fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 25432a519311SJohannes Berg struct cfg80211_scan_request *request); 2544636a5d36SJouni Malinen 2545636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2546636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2547636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2548636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2549636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 255063c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2551636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 255263c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 255304a773adSJohannes Berg 2554b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2555b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2556b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2557b23aa676SSamuel Ortiz u16 reason_code); 2558b23aa676SSamuel Ortiz 255904a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 256004a773adSJohannes Berg struct cfg80211_ibss_params *params); 256104a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2562b9a5f8caSJouni Malinen 2563f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 2564f4e583c8SAntonio Quartulli int rate[IEEE80211_NUM_BANDS]); 2565f4e583c8SAntonio Quartulli 2566b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 25677643a2c3SJohannes Berg 2568c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2569fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2570c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2571c8442118SJohannes Berg int *dbm); 25721f87f7d3SJohannes Berg 2573ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2574388ac775SJohannes Berg const u8 *addr); 2575ab737a4fSJohannes Berg 25761f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2577aff89a9bSJohannes Berg 2578aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2579fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2580fc73f11fSDavid Spinadel void *data, int len); 258171063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 258271063f0eSWey-Yi Guy struct netlink_callback *cb, 258371063f0eSWey-Yi Guy void *data, int len); 2584aff89a9bSJohannes Berg #endif 2585bc92afd9SJohannes Berg 25869930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 25879930380fSJohannes Berg struct net_device *dev, 25889930380fSJohannes Berg const u8 *peer, 25899930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 25909930380fSJohannes Berg 259161fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 259261fa713cSHolger Schurig int idx, struct survey_info *info); 259361fa713cSHolger Schurig 259467fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 259567fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 259667fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 259767fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 259867fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 259967fbb16bSSamuel Ortiz 26009588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 260171bbc994SJohannes Berg struct wireless_dev *wdev, 26029588bbd5SJouni Malinen struct ieee80211_channel *chan, 26039588bbd5SJouni Malinen unsigned int duration, 26049588bbd5SJouni Malinen u64 *cookie); 26059588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 260671bbc994SJohannes Berg struct wireless_dev *wdev, 26079588bbd5SJouni Malinen u64 cookie); 26089588bbd5SJouni Malinen 260971bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2610b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2611b176e629SAndrei Otcheretianski u64 *cookie); 2612f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 261371bbc994SJohannes Berg struct wireless_dev *wdev, 2614f7ca38dfSJohannes Berg u64 cookie); 2615026331c4SJouni Malinen 2616bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2617bc92afd9SJohannes Berg bool enabled, int timeout); 2618d6dc1a38SJuuso Oikarinen 2619d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2620d6dc1a38SJuuso Oikarinen struct net_device *dev, 2621d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2622271733cfSJohannes Berg 262384f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 262484f10708SThomas Pedersen struct net_device *dev, 262584f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 262684f10708SThomas Pedersen 2627271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 262871bbc994SJohannes Berg struct wireless_dev *wdev, 2629271733cfSJohannes Berg u16 frame_type, bool reg); 2630afe0cbf8SBruno Randolf 2631afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2632afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 26333677713bSJohn W. Linville 2634807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2635807f8a8cSLuciano Coelho struct net_device *dev, 2636807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 263785a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2638e5497d76SJohannes Berg 2639e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2640e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2641109086ceSArik Nemtsov 2642109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 26433b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2644df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 264531fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2646109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 26473b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 26487f6cf311SJohannes Berg 26497f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 26507f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2651e999882aSJohannes Berg 26521d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 26531d9d9213SSimon Wunderlich struct net_device *dev, 26541d9d9213SSimon Wunderlich u16 noack_map); 26551d9d9213SSimon Wunderlich 2656683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 26575b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2658683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 265998104fdeSJohannes Berg 266098104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 266198104fdeSJohannes Berg struct wireless_dev *wdev); 266298104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 266398104fdeSJohannes Berg struct wireless_dev *wdev); 266477765eafSVasanthakumar Thiagarajan 266577765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 266677765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 266704f39047SSimon Wunderlich 266804f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 266904f39047SSimon Wunderlich struct net_device *dev, 267031559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 267131559f35SJanusz Dziedzic u32 cac_time_ms); 2672355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2673355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 26745de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 26755de17984SArend van Spriel struct wireless_dev *wdev, 26765de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 26775de17984SArend van Spriel u16 duration); 26785de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 26795de17984SArend van Spriel struct wireless_dev *wdev); 2680be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 2681be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 268216ef1fe2SSimon Wunderlich 268316ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 268416ef1fe2SSimon Wunderlich struct net_device *dev, 268516ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 2686e16821bcSJouni Malinen 2687fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 2688fa9ffc74SKyeyoon Park struct net_device *dev, 2689fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 2690e16821bcSJouni Malinen 2691e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2692e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 2693960d01acSJohannes Berg 2694960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2695960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 2696960d01acSJohannes Berg u16 admitted_time); 2697960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2698960d01acSJohannes Berg u8 tsid, const u8 *peer); 26991057d35eSArik Nemtsov 27001057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 27011057d35eSArik Nemtsov struct net_device *dev, 27021057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 27031057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 27041057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 27051057d35eSArik Nemtsov struct net_device *dev, 27061057d35eSArik Nemtsov const u8 *addr); 2707704232c2SJohannes Berg }; 2708704232c2SJohannes Berg 2709d3236553SJohannes Berg /* 2710d3236553SJohannes Berg * wireless hardware and networking interfaces structures 2711d3236553SJohannes Berg * and registration/helper functions 2712d3236553SJohannes Berg */ 2713d3236553SJohannes Berg 2714d3236553SJohannes Berg /** 27155be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 27165be83de5SJohannes Berg * 27175be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 27185be83de5SJohannes Berg * wiphy at all 27195be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 27205be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 27215be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 27225be83de5SJohannes Berg * reason to override the default 27239bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 27249bc383deSJohannes Berg * on a VLAN interface) 27259bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 2726c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 2727c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 2728c0692b8fSJohannes Berg * control_port_no_encrypt flag. 2729e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 273015d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 273115d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 27321ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 2733f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 2734f4b34b55SVivek Natarajan * firmware. 2735cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 2736109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 2737109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 2738109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 2739109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 2740109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 2741109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 2742562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 27435e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 27445e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 27455e760230SJohannes Berg * cfg80211_report_obss_beacon(). 274687bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 274787bbbe22SArik Nemtsov * responds to probe-requests in hardware. 27487c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 27497c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 27502f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 275116ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 275216ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 27535be83de5SJohannes Berg */ 27545be83de5SJohannes Berg enum wiphy_flags { 2755723e73acSJohannes Berg /* use hole at 0 */ 2756a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 2757a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 27585be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 27595be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 27609bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 27619bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 2762c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 2763309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 276415d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 2765807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 27668e8b41f9SJohannes Berg /* use hole at 12 */ 2767f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 2768cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 2769109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 2770109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 2771562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 27725e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 277387bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 27747c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 27757c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 27762f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 277716ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 27787527a782SJohannes Berg }; 27797527a782SJohannes Berg 27807527a782SJohannes Berg /** 27817527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 27827527a782SJohannes Berg * @max: maximum number of interfaces of these types 27837527a782SJohannes Berg * @types: interface types (bits) 27847527a782SJohannes Berg */ 27857527a782SJohannes Berg struct ieee80211_iface_limit { 27867527a782SJohannes Berg u16 max; 27877527a782SJohannes Berg u16 types; 27887527a782SJohannes Berg }; 27897527a782SJohannes Berg 27907527a782SJohannes Berg /** 27917527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 27927527a782SJohannes Berg * @limits: limits for the given interface types 27937527a782SJohannes Berg * @n_limits: number of limitations 27947527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 27957527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 27967527a782SJohannes Berg * group 27977527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 27987527a782SJohannes Berg * between infrastructure and AP types must match. This is required 27997527a782SJohannes Berg * only in special cases. 280011c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 28018c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 28027527a782SJohannes Berg * 2803b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 2804b80edbc1SLuciano Coelho * combinations it supports concurrently. 28057527a782SJohannes Berg * 2806b80edbc1SLuciano Coelho * Examples: 2807b80edbc1SLuciano Coelho * 2808b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 28097527a782SJohannes Berg * 28107527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 28117527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 28127527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 28137527a782SJohannes Berg * }; 28147527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 28157527a782SJohannes Berg * .limits = limits1, 28167527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 28177527a782SJohannes Berg * .max_interfaces = 2, 28187527a782SJohannes Berg * .beacon_int_infra_match = true, 28197527a782SJohannes Berg * }; 28207527a782SJohannes Berg * 28217527a782SJohannes Berg * 2822b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 28237527a782SJohannes Berg * 28247527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 28257527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 28267527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 28277527a782SJohannes Berg * }; 28287527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 28297527a782SJohannes Berg * .limits = limits2, 28307527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 28317527a782SJohannes Berg * .max_interfaces = 8, 28327527a782SJohannes Berg * .num_different_channels = 1, 28337527a782SJohannes Berg * }; 28347527a782SJohannes Berg * 28357527a782SJohannes Berg * 2836b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2837b80edbc1SLuciano Coelho * 28387527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 28397527a782SJohannes Berg * 28407527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 28417527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 28427527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 28437527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 28447527a782SJohannes Berg * }; 28457527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 28467527a782SJohannes Berg * .limits = limits3, 28477527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 28487527a782SJohannes Berg * .max_interfaces = 4, 28497527a782SJohannes Berg * .num_different_channels = 2, 28507527a782SJohannes Berg * }; 28517527a782SJohannes Berg */ 28527527a782SJohannes Berg struct ieee80211_iface_combination { 28537527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 28547527a782SJohannes Berg u32 num_different_channels; 28557527a782SJohannes Berg u16 max_interfaces; 28567527a782SJohannes Berg u8 n_limits; 28577527a782SJohannes Berg bool beacon_int_infra_match; 285811c4a075SSimon Wunderlich u8 radar_detect_widths; 28598c48b50aSFelix Fietkau u8 radar_detect_regions; 28605be83de5SJohannes Berg }; 28615be83de5SJohannes Berg 28622e161f78SJohannes Berg struct ieee80211_txrx_stypes { 28632e161f78SJohannes Berg u16 tx, rx; 28642e161f78SJohannes Berg }; 28652e161f78SJohannes Berg 28665be83de5SJohannes Berg /** 2867ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 2868ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 2869ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 2870ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 2871ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 2872ff1b6e69SJohannes Berg * packet should be preserved in that case 2873ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 2874ff1b6e69SJohannes Berg * (see nl80211.h) 2875ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 287677dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 287777dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 287877dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 287977dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 288077dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 28818cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 2882ff1b6e69SJohannes Berg */ 2883ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 2884ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 2885ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 2886ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 288777dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 288877dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 288977dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 289077dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 289177dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 28928cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 2893ff1b6e69SJohannes Berg }; 2894ff1b6e69SJohannes Berg 28952a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 28962a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 28972a0e047eSJohannes Berg u32 data_payload_max; 28982a0e047eSJohannes Berg u32 data_interval_max; 28992a0e047eSJohannes Berg u32 wake_payload_max; 29002a0e047eSJohannes Berg bool seq; 29012a0e047eSJohannes Berg }; 29022a0e047eSJohannes Berg 2903ff1b6e69SJohannes Berg /** 2904ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 2905ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 2906ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 2907ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 2908ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 2909ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 2910bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 29118cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 29128cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 29138cd4d456SLuciano Coelho * scheduled scans. 29148cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 29158cd4d456SLuciano Coelho * details. 29162a0e047eSJohannes Berg * @tcp: TCP wakeup support information 2917ff1b6e69SJohannes Berg */ 2918ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 2919ff1b6e69SJohannes Berg u32 flags; 2920ff1b6e69SJohannes Berg int n_patterns; 2921ff1b6e69SJohannes Berg int pattern_max_len; 2922ff1b6e69SJohannes Berg int pattern_min_len; 2923bb92d199SAmitkumar Karwar int max_pkt_offset; 29248cd4d456SLuciano Coelho int max_nd_match_sets; 29252a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 2926ff1b6e69SJohannes Berg }; 2927ff1b6e69SJohannes Berg 2928ff1b6e69SJohannes Berg /** 2929be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 2930be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 2931be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 2932be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 2933be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 2934be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 2935be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 2936be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 2937be29b99aSAmitkumar Karwar */ 2938be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 2939be29b99aSAmitkumar Karwar int n_rules; 2940be29b99aSAmitkumar Karwar int max_delay; 2941be29b99aSAmitkumar Karwar int n_patterns; 2942be29b99aSAmitkumar Karwar int pattern_max_len; 2943be29b99aSAmitkumar Karwar int pattern_min_len; 2944be29b99aSAmitkumar Karwar int max_pkt_offset; 2945be29b99aSAmitkumar Karwar }; 2946be29b99aSAmitkumar Karwar 2947be29b99aSAmitkumar Karwar /** 2948ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 2949ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 2950ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 2951ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 2952ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 2953ad7e718cSJohannes Berg */ 2954ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 2955ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 2956ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 2957ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 2958ad7e718cSJohannes Berg }; 2959ad7e718cSJohannes Berg 2960ad7e718cSJohannes Berg /** 2961ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 2962ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 2963ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 2964ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 2965ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 2966ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 2967ad7e718cSJohannes Berg */ 2968ad7e718cSJohannes Berg struct wiphy_vendor_command { 2969ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 2970ad7e718cSJohannes Berg u32 flags; 2971ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 2972ad7e718cSJohannes Berg const void *data, int data_len); 2973ad7e718cSJohannes Berg }; 2974ad7e718cSJohannes Berg 2975ad7e718cSJohannes Berg /** 29765be83de5SJohannes Berg * struct wiphy - wireless hardware description 29772784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 29782784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 29792784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 2980d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 2981d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 2982d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 2983d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 2984d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 2985d3236553SJohannes Berg * @cipher_suites: supported cipher suites 2986d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 2987b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 2988b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 2989b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 2990b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 2991b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 2992abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 2993ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 2994ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 2995ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 29960fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 2997ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 2998ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 2999ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 3000ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 3001ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 3002ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 3003ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 3004ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3005fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3006fd235913SRandy Dunlap * unregister hardware 3007abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3008abe37c4bSJohannes Berg * automatically on wiphy renames 3009abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 30104a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3011abe37c4bSJohannes Berg * @wext: wireless extension handlers 3012abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3013abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3014abe37c4bSJohannes Berg * must be set by driver 30157527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 30167527a782SJohannes Berg * list single interface types. 30177527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 30187527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 30197527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3020abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3021a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3022a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 30231f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3024d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 3025d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 3026abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3027abe37c4bSJohannes Berg * this variable determines its size 3028abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3029abe37c4bSJohannes Berg * any given scan 303093b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 303193b6aa69SLuciano Coelho * for in any given scheduled scan 3032a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3033a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3034a1f1c21cSLuciano Coelho * supported. 3035abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3036abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3037abe37c4bSJohannes Berg * include fixed IEs like supported rates 30385a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 30395a865badSLuciano Coelho * scans 3040abe37c4bSJohannes Berg * @coverage_class: current coverage class 3041abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3042abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3043abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3044abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3045abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3046abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 30472e161f78SJohannes Berg * 30482e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 30492e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 30502e161f78SJohannes Berg * type 3051a7ffac95SBruno Randolf * 30527f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 30537f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 30547f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 30557f531e03SBruno Randolf * 30567f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 30577f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 30587f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3059a293911dSJohannes Berg * 306015f0ebc2SRandy Dunlap * @probe_resp_offload: 306115f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 306215f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 306315f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 306415f0ebc2SRandy Dunlap * 3065a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3066a293911dSJohannes Berg * may request, if implemented. 3067ff1b6e69SJohannes Berg * 3068ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 30696abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 30706abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 30716abb9cb9SJohannes Berg * to the suspend() operation instead. 3072562a7480SJohannes Berg * 3073562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 30747e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 30757e7c8926SBen Greear * If null, then none can be over-ridden. 3076ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3077ee2aca34SJohannes Berg * If null, then none can be over-ridden. 307877765eafSVasanthakumar Thiagarajan * 307977765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 308077765eafSVasanthakumar Thiagarajan * supports for ACL. 3081a50df0c4SJohannes Berg * 3082a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3083a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3084a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3085a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3086a50df0c4SJohannes Berg * 802.11-2012 8.4.2.29 for the defined fields. 3087a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3088a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3089be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3090ad7e718cSJohannes Berg * 3091ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3092ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3093567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3094567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3095b43504cfSJouni Malinen * 3096b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3097b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3098b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3099b43504cfSJouni Malinen * some cases, but may not always reach. 3100c2e4323bSLuciano Coelho * 3101c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3102c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3103c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3104c2e4323bSLuciano Coelho * infinite. 310567af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 310667af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 310767af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 310867af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 310967af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 311067af9811SEmmanuel Grumbach * This value should be set in MHz. 3111d3236553SJohannes Berg */ 3112d3236553SJohannes Berg struct wiphy { 3113d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3114d3236553SJohannes Berg 3115ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3116d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3117ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3118ef15aac6SJohannes Berg 3119ef15aac6SJohannes Berg struct mac_address *addresses; 3120d3236553SJohannes Berg 31212e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 31222e161f78SJohannes Berg 31237527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 31247527a782SJohannes Berg int n_iface_combinations; 31257527a782SJohannes Berg u16 software_iftypes; 31267527a782SJohannes Berg 31272e161f78SJohannes Berg u16 n_addresses; 31282e161f78SJohannes Berg 3129d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3130d3236553SJohannes Berg u16 interface_modes; 3131d3236553SJohannes Berg 313277765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 313377765eafSVasanthakumar Thiagarajan 3134a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3135d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3136463d0183SJohannes Berg 3137562a7480SJohannes Berg u32 ap_sme_capa; 3138562a7480SJohannes Berg 3139d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3140d3236553SJohannes Berg 3141d3236553SJohannes Berg int bss_priv_size; 3142d3236553SJohannes Berg u8 max_scan_ssids; 314393b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3144a1f1c21cSLuciano Coelho u8 max_match_sets; 3145d3236553SJohannes Berg u16 max_scan_ie_len; 31465a865badSLuciano Coelho u16 max_sched_scan_ie_len; 3147d3236553SJohannes Berg 3148d3236553SJohannes Berg int n_cipher_suites; 3149d3236553SJohannes Berg const u32 *cipher_suites; 3150d3236553SJohannes Berg 3151b9a5f8caSJouni Malinen u8 retry_short; 3152b9a5f8caSJouni Malinen u8 retry_long; 3153b9a5f8caSJouni Malinen u32 frag_threshold; 3154b9a5f8caSJouni Malinen u32 rts_threshold; 315581077e82SLukáš Turek u8 coverage_class; 3156b9a5f8caSJouni Malinen 315781135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3158dfce95f5SKalle Valo u32 hw_version; 3159dfce95f5SKalle Valo 3160dfb89c56SJohannes Berg #ifdef CONFIG_PM 3161964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 31626abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3163dfb89c56SJohannes Berg #endif 3164ff1b6e69SJohannes Berg 3165a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3166a293911dSJohannes Berg 316767fbb16bSSamuel Ortiz u8 max_num_pmkids; 316867fbb16bSSamuel Ortiz 31697f531e03SBruno Randolf u32 available_antennas_tx; 31707f531e03SBruno Randolf u32 available_antennas_rx; 3171a7ffac95SBruno Randolf 317287bbbe22SArik Nemtsov /* 317387bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 317487bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 317587bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 317687bbbe22SArik Nemtsov */ 317787bbbe22SArik Nemtsov u32 probe_resp_offload; 317887bbbe22SArik Nemtsov 3179a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3180a50df0c4SJohannes Berg u8 extended_capabilities_len; 3181a50df0c4SJohannes Berg 3182d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3183d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3184d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3185d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3186d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3187cf5aa2f1SDavid Kilroy const void *privid; 3188d3236553SJohannes Berg 3189d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 3190d3236553SJohannes Berg 3191d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 31920c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3193d3236553SJohannes Berg struct regulatory_request *request); 3194d3236553SJohannes Berg 3195d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3196d3236553SJohannes Berg 3197458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3198d3236553SJohannes Berg 3199d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3200d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3201d3236553SJohannes Berg struct device dev; 3202d3236553SJohannes Berg 3203ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3204ecb44335SStanislaw Gruszka bool registered; 3205ecb44335SStanislaw Gruszka 3206d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3207d3236553SJohannes Berg struct dentry *debugfsdir; 3208d3236553SJohannes Berg 32097e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3210ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 32117e7c8926SBen Greear 3212463d0183SJohannes Berg #ifdef CONFIG_NET_NS 3213463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 3214463d0183SJohannes Berg struct net *_net; 3215463d0183SJohannes Berg #endif 3216463d0183SJohannes Berg 32173d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 32183d23e349SJohannes Berg const struct iw_handler_def *wext; 32193d23e349SJohannes Berg #endif 32203d23e349SJohannes Berg 3221be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3222be29b99aSAmitkumar Karwar 3223ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3224567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3225567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3226ad7e718cSJohannes Berg 3227b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3228b43504cfSJouni Malinen 32299a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 323067af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 32319a774c78SAndrei Otcheretianski 32321c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3233d3236553SJohannes Berg }; 3234d3236553SJohannes Berg 3235463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3236463d0183SJohannes Berg { 3237c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3238463d0183SJohannes Berg } 3239463d0183SJohannes Berg 3240463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3241463d0183SJohannes Berg { 3242c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3243463d0183SJohannes Berg } 3244463d0183SJohannes Berg 3245d3236553SJohannes Berg /** 3246d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3247d3236553SJohannes Berg * 3248d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 32490ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3250d3236553SJohannes Berg */ 3251d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3252d3236553SJohannes Berg { 3253d3236553SJohannes Berg BUG_ON(!wiphy); 3254d3236553SJohannes Berg return &wiphy->priv; 3255d3236553SJohannes Berg } 3256d3236553SJohannes Berg 3257d3236553SJohannes Berg /** 3258f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3259f1f74825SDavid Kilroy * 3260f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 32610ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3262f1f74825SDavid Kilroy */ 3263f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3264f1f74825SDavid Kilroy { 3265f1f74825SDavid Kilroy BUG_ON(!priv); 3266f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3267f1f74825SDavid Kilroy } 3268f1f74825SDavid Kilroy 3269f1f74825SDavid Kilroy /** 3270d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3271d3236553SJohannes Berg * 3272d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3273d3236553SJohannes Berg * @dev: The device to parent it to 3274d3236553SJohannes Berg */ 3275d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3276d3236553SJohannes Berg { 3277d3236553SJohannes Berg wiphy->dev.parent = dev; 3278d3236553SJohannes Berg } 3279d3236553SJohannes Berg 3280d3236553SJohannes Berg /** 3281d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3282d3236553SJohannes Berg * 3283d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 32840ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3285d3236553SJohannes Berg */ 3286d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3287d3236553SJohannes Berg { 3288d3236553SJohannes Berg return wiphy->dev.parent; 3289d3236553SJohannes Berg } 3290d3236553SJohannes Berg 3291d3236553SJohannes Berg /** 3292d3236553SJohannes Berg * wiphy_name - get wiphy name 3293d3236553SJohannes Berg * 3294d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 32950ae997dcSYacine Belkadi * Return: The name of @wiphy. 3296d3236553SJohannes Berg */ 3297e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3298d3236553SJohannes Berg { 3299d3236553SJohannes Berg return dev_name(&wiphy->dev); 3300d3236553SJohannes Berg } 3301d3236553SJohannes Berg 3302d3236553SJohannes Berg /** 33031998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 33041998d90aSBen Greear * 33051998d90aSBen Greear * @ops: The configuration operations for this device 33061998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 33071998d90aSBen Greear * @requested_name: Request a particular name. 33081998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 33091998d90aSBen Greear * 33101998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 33111998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 33121998d90aSBen Greear * 33131998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 33141998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 33151998d90aSBen Greear */ 33161998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 33171998d90aSBen Greear const char *requested_name); 33181998d90aSBen Greear 33191998d90aSBen Greear /** 3320d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3321d3236553SJohannes Berg * 3322d3236553SJohannes Berg * @ops: The configuration operations for this device 3323d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3324d3236553SJohannes Berg * 3325d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3326d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3327d3236553SJohannes Berg * 33280ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 33290ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3330d3236553SJohannes Berg */ 33311998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 33321998d90aSBen Greear int sizeof_priv) 33331998d90aSBen Greear { 33341998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 33351998d90aSBen Greear } 3336d3236553SJohannes Berg 3337d3236553SJohannes Berg /** 3338d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3339d3236553SJohannes Berg * 3340d3236553SJohannes Berg * @wiphy: The wiphy to register. 3341d3236553SJohannes Berg * 33420ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3343d3236553SJohannes Berg */ 334410dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3345d3236553SJohannes Berg 3346d3236553SJohannes Berg /** 3347d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3348d3236553SJohannes Berg * 3349d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3350d3236553SJohannes Berg * 3351d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3352d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3353d3236553SJohannes Berg * request that is being handled. 3354d3236553SJohannes Berg */ 335510dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3356d3236553SJohannes Berg 3357d3236553SJohannes Berg /** 3358d3236553SJohannes Berg * wiphy_free - free wiphy 3359d3236553SJohannes Berg * 3360d3236553SJohannes Berg * @wiphy: The wiphy to free 3361d3236553SJohannes Berg */ 336210dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3363d3236553SJohannes Berg 3364fffd0934SJohannes Berg /* internal structs */ 33656829c878SJohannes Berg struct cfg80211_conn; 336619957bb3SJohannes Berg struct cfg80211_internal_bss; 3367fffd0934SJohannes Berg struct cfg80211_cached_keys; 336819957bb3SJohannes Berg 3369d3236553SJohannes Berg /** 337089a54e48SJohannes Berg * struct wireless_dev - wireless device state 3371d3236553SJohannes Berg * 337289a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 337389a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 337489a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 337589a54e48SJohannes Berg * It need not be registered then as netdev registration will 337689a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 337789a54e48SJohannes Berg * 337889a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 337989a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 338089a54e48SJohannes Berg * there's no netdev registration in that case it may not be 338189a54e48SJohannes Berg * allocated outside of callback operations that return it. 3382d3236553SJohannes Berg * 3383d3236553SJohannes Berg * @wiphy: pointer to hardware description 3384d3236553SJohannes Berg * @iftype: interface type 3385d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 338689a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 338789a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 338889a54e48SJohannes Berg * wireless device if it has no netdev 3389d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 33909e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 33919e0e2961SMichal Kazior * the user-set channel definition. 3392780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3393aa430da4SJohannes Berg * track the channel to be used for AP later 3394d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3395d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3396d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 339729cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 339829cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3399d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 34009bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 34019bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 34029bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 34039bc383deSJohannes Berg * by cfg80211 on change_interface 34042e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 34052e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 34068d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 34078d61ffa5SJohannes Berg * and some API functions require it held 340856d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 340956d1893dSJohannes Berg * beacons, 0 when not valid 341098104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 341198104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 341204f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 341304f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 341431559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3415780b40dfSJohannes Berg * @ps: powersave mode is enabled 3416780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3417780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3418780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3419780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3420780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 3421780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 34225336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3423780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3424780b40dfSJohannes Berg * @event_lock: (private) lock for event list 342578f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3426d3236553SJohannes Berg */ 3427d3236553SJohannes Berg struct wireless_dev { 3428d3236553SJohannes Berg struct wiphy *wiphy; 3429d3236553SJohannes Berg enum nl80211_iftype iftype; 3430d3236553SJohannes Berg 3431667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3432d3236553SJohannes Berg struct list_head list; 3433d3236553SJohannes Berg struct net_device *netdev; 3434d3236553SJohannes Berg 343589a54e48SJohannes Berg u32 identifier; 343689a54e48SJohannes Berg 34372e161f78SJohannes Berg struct list_head mgmt_registrations; 34382e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3439026331c4SJouni Malinen 3440667503ddSJohannes Berg struct mutex mtx; 3441667503ddSJohannes Berg 344298104fdeSJohannes Berg bool use_4addr, p2p_started; 344398104fdeSJohannes Berg 344498104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 34459bc383deSJohannes Berg 3446b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3447d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 344829cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 34496829c878SJohannes Berg struct cfg80211_conn *conn; 3450fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 3451d3236553SJohannes Berg 3452667503ddSJohannes Berg struct list_head event_list; 3453667503ddSJohannes Berg spinlock_t event_lock; 3454667503ddSJohannes Berg 345519957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3456683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 34579e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3458f4489ebeSMichal Kazior 3459c30a3d38SMichal Kazior bool ibss_fixed; 34605336fa88SSimon Wunderlich bool ibss_dfs_possible; 3461c30a3d38SMichal Kazior 3462ffb9eb3dSKalle Valo bool ps; 3463ffb9eb3dSKalle Valo int ps_timeout; 3464ffb9eb3dSKalle Valo 346556d1893dSJohannes Berg int beacon_interval; 346656d1893dSJohannes Berg 346715e47304SEric W. Biederman u32 ap_unexpected_nlportid; 346828946da7SJohannes Berg 346904f39047SSimon Wunderlich bool cac_started; 347004f39047SSimon Wunderlich unsigned long cac_start_time; 347131559f35SJanusz Dziedzic unsigned int cac_time_ms; 347204f39047SSimon Wunderlich 347378f22b6aSJohannes Berg u32 owner_nlportid; 347478f22b6aSJohannes Berg 34753d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3476d3236553SJohannes Berg /* wext data */ 3477cbe8fa9cSJohannes Berg struct { 3478cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3479f2129354SJohannes Berg struct cfg80211_connect_params connect; 3480fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3481c1e5f471SJohannes Berg const u8 *ie; 3482f2129354SJohannes Berg size_t ie_len; 3483f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3484f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 348508645126SJohannes Berg s8 default_key, default_mgmt_key; 3486ffb9eb3dSKalle Valo bool prev_bssid_valid; 3487cbe8fa9cSJohannes Berg } wext; 3488d3236553SJohannes Berg #endif 3489d3236553SJohannes Berg }; 3490d3236553SJohannes Berg 349198104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 349298104fdeSJohannes Berg { 349398104fdeSJohannes Berg if (wdev->netdev) 349498104fdeSJohannes Berg return wdev->netdev->dev_addr; 349598104fdeSJohannes Berg return wdev->address; 349698104fdeSJohannes Berg } 349798104fdeSJohannes Berg 3498d3236553SJohannes Berg /** 3499d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3500d3236553SJohannes Berg * 3501d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 35020ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3503d3236553SJohannes Berg */ 3504d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3505d3236553SJohannes Berg { 3506d3236553SJohannes Berg BUG_ON(!wdev); 3507d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3508d3236553SJohannes Berg } 3509d3236553SJohannes Berg 3510d70e9693SJohannes Berg /** 3511d70e9693SJohannes Berg * DOC: Utility functions 3512d70e9693SJohannes Berg * 3513d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3514d3236553SJohannes Berg */ 3515d3236553SJohannes Berg 3516d3236553SJohannes Berg /** 3517d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3518abe37c4bSJohannes Berg * @chan: channel number 351959eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 35200ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3521d3236553SJohannes Berg */ 352210dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 3523d3236553SJohannes Berg 3524d3236553SJohannes Berg /** 3525d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3526abe37c4bSJohannes Berg * @freq: center frequency 35270ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3528d3236553SJohannes Berg */ 352910dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3530d3236553SJohannes Berg 3531d3236553SJohannes Berg /* 3532d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3533d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3534d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3535d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3536d3236553SJohannes Berg * clash. 3537d3236553SJohannes Berg */ 353810dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3539d3236553SJohannes Berg int freq); 3540d3236553SJohannes Berg /** 3541d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3542abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3543abe37c4bSJohannes Berg * @freq: the center frequency of the channel 35440ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3545d3236553SJohannes Berg */ 3546d3236553SJohannes Berg static inline struct ieee80211_channel * 3547d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3548d3236553SJohannes Berg { 3549d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3550d3236553SJohannes Berg } 3551d3236553SJohannes Berg 3552d3236553SJohannes Berg /** 3553d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3554d3236553SJohannes Berg * 3555d3236553SJohannes Berg * @sband: the band to look for rates in 3556d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3557d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3558d3236553SJohannes Berg * 35590ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 35600ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 35610ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 35620ae997dcSYacine Belkadi * rates in the band's bitrate table. 3563d3236553SJohannes Berg */ 3564d3236553SJohannes Berg struct ieee80211_rate * 3565d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3566d3236553SJohannes Berg u32 basic_rates, int bitrate); 3567d3236553SJohannes Berg 3568b422c6cdSAshok Nagarajan /** 3569b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3570b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 357174608acaSSimon Wunderlich * @scan_width: width of the control channel 3572b422c6cdSAshok Nagarajan * 3573b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3574b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3575b422c6cdSAshok Nagarajan */ 357674608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 357774608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3578b422c6cdSAshok Nagarajan 3579d3236553SJohannes Berg /* 3580d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3581d3236553SJohannes Berg * 3582d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3583d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3584d3236553SJohannes Berg */ 3585d3236553SJohannes Berg 358633e5a2f7SJohannes Berg struct radiotap_align_size { 358733e5a2f7SJohannes Berg uint8_t align:4, size:4; 358833e5a2f7SJohannes Berg }; 358933e5a2f7SJohannes Berg 359033e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 359133e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 359233e5a2f7SJohannes Berg int n_bits; 359333e5a2f7SJohannes Berg uint32_t oui; 359433e5a2f7SJohannes Berg uint8_t subns; 359533e5a2f7SJohannes Berg }; 359633e5a2f7SJohannes Berg 359733e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 359833e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 359933e5a2f7SJohannes Berg int n_ns; 360033e5a2f7SJohannes Berg }; 360133e5a2f7SJohannes Berg 3602d3236553SJohannes Berg /** 3603d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 360433e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 360533e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 360633e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 360733e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 360833e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 360933e5a2f7SJohannes Berg * the beginning of the actual data portion 361033e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 361133e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 361233e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 361333e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 361433e5a2f7SJohannes Berg * radiotap namespace or not 361533e5a2f7SJohannes Berg * 361633e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 361733e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 361833e5a2f7SJohannes Berg * @_arg_index: next argument index 361933e5a2f7SJohannes Berg * @_arg: next argument pointer 362033e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 362133e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 362233e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 362333e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 362433e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 362533e5a2f7SJohannes Berg * next bitmap word 362633e5a2f7SJohannes Berg * 362733e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 362833e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 3629d3236553SJohannes Berg */ 3630d3236553SJohannes Berg 3631d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 363233e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 363333e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 363433e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 3635d3236553SJohannes Berg 363633e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 363767272440SJohannes Berg __le32 *_next_bitmap; 363833e5a2f7SJohannes Berg 363933e5a2f7SJohannes Berg unsigned char *this_arg; 364033e5a2f7SJohannes Berg int this_arg_index; 364133e5a2f7SJohannes Berg int this_arg_size; 364233e5a2f7SJohannes Berg 364333e5a2f7SJohannes Berg int is_radiotap_ns; 364433e5a2f7SJohannes Berg 364533e5a2f7SJohannes Berg int _max_length; 364633e5a2f7SJohannes Berg int _arg_index; 364733e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 364833e5a2f7SJohannes Berg int _reset_on_ext; 3649d3236553SJohannes Berg }; 3650d3236553SJohannes Berg 365110dd9b7cSJoe Perches int 365210dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 3653d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 365410dd9b7cSJoe Perches int max_length, 365510dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 3656d3236553SJohannes Berg 365710dd9b7cSJoe Perches int 365810dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 3659d3236553SJohannes Berg 366033e5a2f7SJohannes Berg 3661e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 3662e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 3663e31a16d6SZhu Yi 3664e31a16d6SZhu Yi /** 3665e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 3666e31a16d6SZhu Yi * 3667e31a16d6SZhu Yi * @skb: the frame 36680ae997dcSYacine Belkadi * 36690ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 36700ae997dcSYacine Belkadi * returns the 802.11 header length. 36710ae997dcSYacine Belkadi * 36720ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 36730ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 36740ae997dcSYacine Belkadi * 802.11 header. 3675e31a16d6SZhu Yi */ 3676e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3677e31a16d6SZhu Yi 3678e31a16d6SZhu Yi /** 3679e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 3680e31a16d6SZhu Yi * @fc: frame control field in little-endian format 36810ae997dcSYacine Belkadi * Return: The header length in bytes. 3682e31a16d6SZhu Yi */ 3683633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3684e31a16d6SZhu Yi 3685e31a16d6SZhu Yi /** 36869b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 36879b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 36889b395bc3SJohannes Berg * (first byte) will be accessed 36890ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 36909b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 36919b395bc3SJohannes Berg */ 36929b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 36939b395bc3SJohannes Berg 36949b395bc3SJohannes Berg /** 3695d70e9693SJohannes Berg * DOC: Data path helpers 3696d70e9693SJohannes Berg * 3697d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 3698d70e9693SJohannes Berg * functions that help implement the data path for devices 3699d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 3700d70e9693SJohannes Berg */ 3701d70e9693SJohannes Berg 3702d70e9693SJohannes Berg /** 3703e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 3704e31a16d6SZhu Yi * @skb: the 802.11 data frame 3705e31a16d6SZhu Yi * @addr: the device MAC address 3706e31a16d6SZhu Yi * @iftype: the virtual interface type 37070ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 3708e31a16d6SZhu Yi */ 3709eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3710e31a16d6SZhu Yi enum nl80211_iftype iftype); 3711e31a16d6SZhu Yi 3712e31a16d6SZhu Yi /** 3713e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 3714e31a16d6SZhu Yi * @skb: the 802.3 frame 3715e31a16d6SZhu Yi * @addr: the device MAC address 3716e31a16d6SZhu Yi * @iftype: the virtual interface type 3717e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3718e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 37190ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 3720e31a16d6SZhu Yi */ 3721eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3722c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 3723c1e5f471SJohannes Berg bool qos); 3724e31a16d6SZhu Yi 3725e31a16d6SZhu Yi /** 3726eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3727eaf85ca7SZhu Yi * 3728eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 3729eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 3730eaf85ca7SZhu Yi * @skb is consumed after the function returns. 3731eaf85ca7SZhu Yi * 3732eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 3733eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 3734eaf85ca7SZhu Yi * initialized by by the caller. 3735eaf85ca7SZhu Yi * @addr: The device MAC address. 3736eaf85ca7SZhu Yi * @iftype: The device interface type. 3737eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 37388b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 3739eaf85ca7SZhu Yi */ 3740eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 3741eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 37428b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 37438b3becadSYogesh Ashok Powar bool has_80211_header); 3744eaf85ca7SZhu Yi 3745eaf85ca7SZhu Yi /** 3746e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3747e31a16d6SZhu Yi * @skb: the data frame 3748fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 37490ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 3750e31a16d6SZhu Yi */ 3751fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 3752fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3753e31a16d6SZhu Yi 3754c21dbf92SJohannes Berg /** 3755c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 3756c21dbf92SJohannes Berg * 3757c21dbf92SJohannes Berg * @eid: element ID 3758c21dbf92SJohannes Berg * @ies: data consisting of IEs 3759c21dbf92SJohannes Berg * @len: length of data 3760c21dbf92SJohannes Berg * 37610ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 37620ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 37630ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 37640ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 37650ae997dcSYacine Belkadi * 37660ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 37670ae997dcSYacine Belkadi * having to fit into the given data. 3768c21dbf92SJohannes Berg */ 3769c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3770c21dbf92SJohannes Berg 3771d70e9693SJohannes Berg /** 37720c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 37730c28ec58SEliad Peller * 37740c28ec58SEliad Peller * @oui: vendor OUI 37750c28ec58SEliad Peller * @oui_type: vendor-specific OUI type 37760c28ec58SEliad Peller * @ies: data consisting of IEs 37770c28ec58SEliad Peller * @len: length of data 37780c28ec58SEliad Peller * 37790ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 37800ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 37810ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 37820ae997dcSYacine Belkadi * element ID. 37830ae997dcSYacine Belkadi * 37840ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 37850ae997dcSYacine Belkadi * the given data. 37860c28ec58SEliad Peller */ 37870c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 37880c28ec58SEliad Peller const u8 *ies, int len); 37890c28ec58SEliad Peller 37900c28ec58SEliad Peller /** 3791d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 3792d70e9693SJohannes Berg * 3793d70e9693SJohannes Berg * TODO 3794d3236553SJohannes Berg */ 3795d3236553SJohannes Berg 3796d3236553SJohannes Berg /** 3797d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 3798d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 3799d3236553SJohannes Berg * conflicts) 3800d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 3801d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 3802d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 3803d3236553SJohannes Berg * alpha2. 3804d3236553SJohannes Berg * 3805d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 3806d3236553SJohannes Berg * what it believes should be the current regulatory domain by 3807d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 3808d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 3809d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 3810d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 3811d3236553SJohannes Berg * 3812d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 3813d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 3814d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 3815d3236553SJohannes Berg * 3816d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 3817d3236553SJohannes Berg * an -ENOMEM. 38180ae997dcSYacine Belkadi * 38190ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 3820d3236553SJohannes Berg */ 382110dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3822d3236553SJohannes Berg 3823d3236553SJohannes Berg /** 3824b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 3825b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 3826b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 3827b0d7aa59SJonathan Doron * 3828b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 3829b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 3830b0d7aa59SJonathan Doron * information. 3831b0d7aa59SJonathan Doron * 3832b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 3833b0d7aa59SJonathan Doron */ 3834b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 3835b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 3836b0d7aa59SJonathan Doron 3837b0d7aa59SJonathan Doron /** 3838d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 3839d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 3840d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 3841d3236553SJohannes Berg * 3842d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 3843d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 3844d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 3845d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 3846d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 3847d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 3848222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 3849ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 3850222ea581SLuis R. Rodriguez * that called this helper. 3851d3236553SJohannes Berg */ 385210dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 3853d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 3854d3236553SJohannes Berg 3855d3236553SJohannes Berg /** 3856d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 3857d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 3858d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 3859d3236553SJohannes Berg * 3860d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 3861d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 3862d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 3863d3236553SJohannes Berg * and processed already. 3864d3236553SJohannes Berg * 38650ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 38660ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 38670ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 38680ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 38690ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 38700ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 38710ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 3872d3236553SJohannes Berg */ 3873361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3874361c9c8bSJohannes Berg u32 center_freq); 3875d3236553SJohannes Berg 3876034c6d6eSLuis R. Rodriguez /** 3877034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 3878034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 3879034c6d6eSLuis R. Rodriguez * 3880034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 3881034c6d6eSLuis R. Rodriguez * proper string representation. 3882034c6d6eSLuis R. Rodriguez */ 3883034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 3884034c6d6eSLuis R. Rodriguez 3885d3236553SJohannes Berg /* 3886d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 3887d3236553SJohannes Berg * functions and BSS handling helpers 3888d3236553SJohannes Berg */ 3889d3236553SJohannes Berg 38902a519311SJohannes Berg /** 38912a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 38922a519311SJohannes Berg * 38932a519311SJohannes Berg * @request: the corresponding scan request 38942a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 38952a519311SJohannes Berg * userspace will be notified of that 38962a519311SJohannes Berg */ 38972a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 38982a519311SJohannes Berg 38992a519311SJohannes Berg /** 3900807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 3901807f8a8cSLuciano Coelho * 3902807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 3903807f8a8cSLuciano Coelho */ 3904807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 3905807f8a8cSLuciano Coelho 3906807f8a8cSLuciano Coelho /** 3907807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 3908807f8a8cSLuciano Coelho * 3909807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 3910807f8a8cSLuciano Coelho * 3911807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 3912807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 3913807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 3914807f8a8cSLuciano Coelho */ 3915807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3916807f8a8cSLuciano Coelho 3917807f8a8cSLuciano Coelho /** 3918792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 3919792e6aa7SEliad Peller * 3920792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 3921792e6aa7SEliad Peller * 3922792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 3923792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 3924792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 3925792e6aa7SEliad Peller * This function should be called with rtnl locked. 3926792e6aa7SEliad Peller */ 3927792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 3928792e6aa7SEliad Peller 3929792e6aa7SEliad Peller /** 3930dcd6eac1SSimon Wunderlich * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 39312a519311SJohannes Berg * 39322a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 39333afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3934dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 3935abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 3936abe37c4bSJohannes Berg * @len: length of the management frame 393777965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 39382a519311SJohannes Berg * @gfp: context flags 39392a519311SJohannes Berg * 39402a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 39412a519311SJohannes Berg * the BSS should be updated/added. 3942ef100682SJohannes Berg * 39430ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39440ae997dcSYacine Belkadi * Or %NULL on error. 39452a519311SJohannes Berg */ 3946ef100682SJohannes Berg struct cfg80211_bss * __must_check 3947dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 39483afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3949dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 3950dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 3951dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3952dcd6eac1SSimon Wunderlich 3953dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 39542a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 39553afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 39562a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 3957dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 3958dcd6eac1SSimon Wunderlich { 39593afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width_frame(wiphy, rx_channel, 3960dcd6eac1SSimon Wunderlich NL80211_BSS_CHAN_WIDTH_20, 3961dcd6eac1SSimon Wunderlich mgmt, len, signal, gfp); 3962dcd6eac1SSimon Wunderlich } 39632a519311SJohannes Berg 3964abe37c4bSJohannes Berg /** 39655bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 39665bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 39675bc8c1f2SJohannes Berg * from a beacon or probe response 39685bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 39695bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 39705bc8c1f2SJohannes Berg */ 39715bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 39725bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 39735bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 39745bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 39755bc8c1f2SJohannes Berg }; 39765bc8c1f2SJohannes Berg 39775bc8c1f2SJohannes Berg /** 39785bc8c1f2SJohannes Berg * cfg80211_inform_bss_width - inform cfg80211 of a new BSS 3979abe37c4bSJohannes Berg * 3980abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 39813afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3982dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 39835bc8c1f2SJohannes Berg * @ftype: frame type (if known) 3984abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 39857b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3986abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 3987abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 3988abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 3989abe37c4bSJohannes Berg * @ielen: length of the additional IEs 3990abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 3991abe37c4bSJohannes Berg * @gfp: context flags 3992abe37c4bSJohannes Berg * 3993abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 3994abe37c4bSJohannes Berg * the BSS should be updated/added. 3995ef100682SJohannes Berg * 39960ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39970ae997dcSYacine Belkadi * Or %NULL on error. 3998abe37c4bSJohannes Berg */ 3999ef100682SJohannes Berg struct cfg80211_bss * __must_check 4000dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 40013afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4002dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 40035bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 4004dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 4005dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 4006dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 4007dcd6eac1SSimon Wunderlich 4008dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 400906aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 40103afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 40115bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 40127b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 40137b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4014dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4015dcd6eac1SSimon Wunderlich { 40163afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width(wiphy, rx_channel, 40175bc8c1f2SJohannes Berg NL80211_BSS_CHAN_WIDTH_20, ftype, 4018dcd6eac1SSimon Wunderlich bssid, tsf, capability, 4019dcd6eac1SSimon Wunderlich beacon_interval, ie, ielen, signal, 4020dcd6eac1SSimon Wunderlich gfp); 4021dcd6eac1SSimon Wunderlich } 402206aa7afaSJussi Kivilinna 40232a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 40242a519311SJohannes Berg struct ieee80211_channel *channel, 40252a519311SJohannes Berg const u8 *bssid, 402679420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 402779420f09SJohannes Berg u16 capa_mask, u16 capa_val); 402879420f09SJohannes Berg static inline struct cfg80211_bss * 402979420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 403079420f09SJohannes Berg struct ieee80211_channel *channel, 403179420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 403279420f09SJohannes Berg { 403379420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 403479420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 403579420f09SJohannes Berg } 403679420f09SJohannes Berg 40374c0c0b75SJohannes Berg /** 40384c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 40395b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 40404c0c0b75SJohannes Berg * @bss: the BSS struct to reference 40414c0c0b75SJohannes Berg * 40424c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 40434c0c0b75SJohannes Berg */ 40445b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 40454c0c0b75SJohannes Berg 40464c0c0b75SJohannes Berg /** 40474c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 40485b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 40494c0c0b75SJohannes Berg * @bss: the BSS struct 40504c0c0b75SJohannes Berg * 40514c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 40524c0c0b75SJohannes Berg */ 40535b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4054d3236553SJohannes Berg 4055d491af19SJohannes Berg /** 4056d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4057d491af19SJohannes Berg * @wiphy: the wiphy 4058d491af19SJohannes Berg * @bss: the bss to remove 4059d491af19SJohannes Berg * 4060d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4061d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4062d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4063d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4064d491af19SJohannes Berg */ 4065d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4066fee52678SJohannes Berg 4067dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4068dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4069dcd6eac1SSimon Wunderlich { 4070dcd6eac1SSimon Wunderlich switch (chandef->width) { 4071dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4072dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4073dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4074dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4075dcd6eac1SSimon Wunderlich default: 4076dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4077dcd6eac1SSimon Wunderlich } 4078dcd6eac1SSimon Wunderlich } 4079dcd6eac1SSimon Wunderlich 40806039f6d2SJouni Malinen /** 40816ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 40826039f6d2SJouni Malinen * @dev: network device 40836039f6d2SJouni Malinen * @buf: authentication frame (header + body) 40846039f6d2SJouni Malinen * @len: length of the frame data 40856039f6d2SJouni Malinen * 40866ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 40876ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 40886ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 40896ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40906ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 40916ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40926ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 40936ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 40946ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 40956ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 40966ff57cf8SJohannes Berg * 40976ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 40986039f6d2SJouni Malinen */ 40996ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 41006039f6d2SJouni Malinen 41016039f6d2SJouni Malinen /** 41026ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 41031965c853SJouni Malinen * @dev: network device 41041965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4105cb0b4bebSJohannes Berg * 41068d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 41078d61ffa5SJohannes Berg * mutex. 41081965c853SJouni Malinen */ 41096ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 41101965c853SJouni Malinen 41111965c853SJouni Malinen /** 41126ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 41136039f6d2SJouni Malinen * @dev: network device 41146ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 41156ff57cf8SJohannes Berg * moves to cfg80211 in this call 41166ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 41176039f6d2SJouni Malinen * @len: length of the frame data 4118b0b6aa2cSEliad Peller * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a. 41196039f6d2SJouni Malinen * 41206ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 41216ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 41226ff57cf8SJohannes Berg * 41236ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 41246039f6d2SJouni Malinen */ 41256ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 41266ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4127b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4128b0b6aa2cSEliad Peller int uapsd_queues); 41296039f6d2SJouni Malinen 41306039f6d2SJouni Malinen /** 41316ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 41321965c853SJouni Malinen * @dev: network device 4133959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4134cb0b4bebSJohannes Berg * 41358d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 41361965c853SJouni Malinen */ 4137959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 41381965c853SJouni Malinen 41391965c853SJouni Malinen /** 41406ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 41416039f6d2SJouni Malinen * @dev: network device 41426ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 41436039f6d2SJouni Malinen * @len: length of the frame data 41446039f6d2SJouni Malinen * 41456039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 414653b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 41478d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 41488d61ffa5SJohannes Berg * corresponding wdev's mutex. 41496039f6d2SJouni Malinen */ 41506ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4151ce470613SHolger Schurig 4152ce470613SHolger Schurig /** 41536ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4154cf4e594eSJouni Malinen * @dev: network device 4155cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4156cf4e594eSJouni Malinen * @len: length of the frame data 4157cf4e594eSJouni Malinen * 41586ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 41596ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4160cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4161cf4e594eSJouni Malinen */ 41626ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 41636ff57cf8SJohannes Berg const u8 *buf, size_t len); 4164cf4e594eSJouni Malinen 4165cf4e594eSJouni Malinen /** 4166a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4167a3b8b056SJouni Malinen * @dev: network device 4168a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4169a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4170a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4171a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4172e6d6e342SJohannes Berg * @gfp: allocation flags 4173a3b8b056SJouni Malinen * 4174a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4175a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4176a3b8b056SJouni Malinen * primitive. 4177a3b8b056SJouni Malinen */ 4178a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4179a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4180e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4181a3b8b056SJouni Malinen 418204a773adSJohannes Berg /** 418304a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 418404a773adSJohannes Berg * 418504a773adSJohannes Berg * @dev: network device 418604a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4187fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 418804a773adSJohannes Berg * @gfp: allocation flags 418904a773adSJohannes Berg * 419004a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 419104a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 419204a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 419304a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 419404a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 419504a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 419604a773adSJohannes Berg */ 4197fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4198fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 419904a773adSJohannes Berg 42001f87f7d3SJohannes Berg /** 4201c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4202c93b5e71SJavier Cardona * 4203c93b5e71SJavier Cardona * @dev: network device 4204c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4205c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4206c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4207c93b5e71SJavier Cardona * @gfp: allocation flags 4208c93b5e71SJavier Cardona * 4209c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4210c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4211c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4212c93b5e71SJavier Cardona */ 4213c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4214c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4215c93b5e71SJavier Cardona 4216c93b5e71SJavier Cardona /** 4217d70e9693SJohannes Berg * DOC: RFkill integration 4218d70e9693SJohannes Berg * 4219d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4220d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4221d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4222d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4223d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4224d70e9693SJohannes Berg * 4225d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4226d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4227d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4228d70e9693SJohannes Berg */ 4229d70e9693SJohannes Berg 4230d70e9693SJohannes Berg /** 42311f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 42321f87f7d3SJohannes Berg * @wiphy: the wiphy 42331f87f7d3SJohannes Berg * @blocked: block status 42341f87f7d3SJohannes Berg */ 42351f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 42361f87f7d3SJohannes Berg 42371f87f7d3SJohannes Berg /** 42381f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 42391f87f7d3SJohannes Berg * @wiphy: the wiphy 42401f87f7d3SJohannes Berg */ 42411f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 42421f87f7d3SJohannes Berg 42431f87f7d3SJohannes Berg /** 42441f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 42451f87f7d3SJohannes Berg * @wiphy: the wiphy 42461f87f7d3SJohannes Berg */ 42471f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 42481f87f7d3SJohannes Berg 4249ad7e718cSJohannes Berg /** 4250ad7e718cSJohannes Berg * DOC: Vendor commands 4251ad7e718cSJohannes Berg * 4252ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4253ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4254ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4255ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4256ad7e718cSJohannes Berg * the configuration mechanism. 4257ad7e718cSJohannes Berg * 4258ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4259ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4260ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4261ad7e718cSJohannes Berg * 4262ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4263ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4264ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4265ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4266ad7e718cSJohannes Berg * managers etc. need. 4267ad7e718cSJohannes Berg */ 4268ad7e718cSJohannes Berg 4269ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4270ad7e718cSJohannes Berg enum nl80211_commands cmd, 4271ad7e718cSJohannes Berg enum nl80211_attrs attr, 4272ad7e718cSJohannes Berg int approxlen); 4273ad7e718cSJohannes Berg 4274567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 4275567ffc35SJohannes Berg enum nl80211_commands cmd, 4276567ffc35SJohannes Berg enum nl80211_attrs attr, 4277567ffc35SJohannes Berg int vendor_event_idx, 4278567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4279567ffc35SJohannes Berg 4280567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4281567ffc35SJohannes Berg 4282ad7e718cSJohannes Berg /** 4283ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4284ad7e718cSJohannes Berg * @wiphy: the wiphy 4285ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4286ad7e718cSJohannes Berg * be put into the skb 4287ad7e718cSJohannes Berg * 4288ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4289ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4290ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4291ad7e718cSJohannes Berg * 4292ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4293ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4294ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4295ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4296ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4297ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4298ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4299ad7e718cSJohannes Berg * 4300ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4301ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4302ad7e718cSJohannes Berg * 4303ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4304ad7e718cSJohannes Berg */ 4305ad7e718cSJohannes Berg static inline struct sk_buff * 4306ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4307ad7e718cSJohannes Berg { 4308ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4309ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4310ad7e718cSJohannes Berg } 4311ad7e718cSJohannes Berg 4312ad7e718cSJohannes Berg /** 4313ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4314ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4315ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4316ad7e718cSJohannes Berg * 4317ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4318ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4319ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4320ad7e718cSJohannes Berg * skb regardless of the return value. 4321ad7e718cSJohannes Berg * 4322ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4323ad7e718cSJohannes Berg */ 4324ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4325ad7e718cSJohannes Berg 4326567ffc35SJohannes Berg /** 4327567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4328567ffc35SJohannes Berg * @wiphy: the wiphy 4329567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4330567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4331567ffc35SJohannes Berg * be put into the skb 4332567ffc35SJohannes Berg * @gfp: allocation flags 4333567ffc35SJohannes Berg * 4334567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4335567ffc35SJohannes Berg * vendor-specific multicast group. 4336567ffc35SJohannes Berg * 4337567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4338567ffc35SJohannes Berg * skb to send the event. 4339567ffc35SJohannes Berg * 4340567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4341567ffc35SJohannes Berg */ 4342567ffc35SJohannes Berg static inline struct sk_buff * 4343567ffc35SJohannes Berg cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen, 4344567ffc35SJohannes Berg int event_idx, gfp_t gfp) 4345567ffc35SJohannes Berg { 4346567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR, 4347567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4348567ffc35SJohannes Berg event_idx, approxlen, gfp); 4349567ffc35SJohannes Berg } 4350567ffc35SJohannes Berg 4351567ffc35SJohannes Berg /** 4352567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4353567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4354567ffc35SJohannes Berg * @gfp: allocation flags 4355567ffc35SJohannes Berg * 4356567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4357567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4358567ffc35SJohannes Berg */ 4359567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4360567ffc35SJohannes Berg { 4361567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4362567ffc35SJohannes Berg } 4363567ffc35SJohannes Berg 4364aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4365aff89a9bSJohannes Berg /** 4366d70e9693SJohannes Berg * DOC: Test mode 4367d70e9693SJohannes Berg * 4368d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4369d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4370d70e9693SJohannes Berg * factory programming. 4371d70e9693SJohannes Berg * 4372d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4373d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4374d70e9693SJohannes Berg */ 4375d70e9693SJohannes Berg 4376d70e9693SJohannes Berg /** 4377aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4378aff89a9bSJohannes Berg * @wiphy: the wiphy 4379aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4380aff89a9bSJohannes Berg * be put into the skb 4381aff89a9bSJohannes Berg * 4382aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4383aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4384aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4385aff89a9bSJohannes Berg * 43860ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 43870ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 43880ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 43890ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 43900ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 43910ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 43920ae997dcSYacine Belkadi * must not modify the skb in any other way. 4393aff89a9bSJohannes Berg * 4394aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4395aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 43960ae997dcSYacine Belkadi * 43970ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4398aff89a9bSJohannes Berg */ 4399ad7e718cSJohannes Berg static inline struct sk_buff * 4400ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4401ad7e718cSJohannes Berg { 4402ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4403ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4404ad7e718cSJohannes Berg } 4405aff89a9bSJohannes Berg 4406aff89a9bSJohannes Berg /** 4407aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4408aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4409aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4410aff89a9bSJohannes Berg * 44110ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 44120ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 44130ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 44140ae997dcSYacine Belkadi * regardless of the return value. 44150ae997dcSYacine Belkadi * 44160ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4417aff89a9bSJohannes Berg */ 4418ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4419ad7e718cSJohannes Berg { 4420ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4421ad7e718cSJohannes Berg } 4422aff89a9bSJohannes Berg 4423aff89a9bSJohannes Berg /** 4424aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4425aff89a9bSJohannes Berg * @wiphy: the wiphy 4426aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4427aff89a9bSJohannes Berg * be put into the skb 4428aff89a9bSJohannes Berg * @gfp: allocation flags 4429aff89a9bSJohannes Berg * 4430aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4431aff89a9bSJohannes Berg * testmode multicast group. 4432aff89a9bSJohannes Berg * 44330ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 44340ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 44350ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 44360ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 44370ae997dcSYacine Belkadi * in any other way. 4438aff89a9bSJohannes Berg * 4439aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4440aff89a9bSJohannes Berg * skb to send the event. 44410ae997dcSYacine Belkadi * 44420ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4443aff89a9bSJohannes Berg */ 4444567ffc35SJohannes Berg static inline struct sk_buff * 4445567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4446567ffc35SJohannes Berg { 4447567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE, 4448567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4449567ffc35SJohannes Berg approxlen, gfp); 4450567ffc35SJohannes Berg } 4451aff89a9bSJohannes Berg 4452aff89a9bSJohannes Berg /** 4453aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4454aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4455aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4456aff89a9bSJohannes Berg * @gfp: allocation flags 4457aff89a9bSJohannes Berg * 4458aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4459aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4460aff89a9bSJohannes Berg * consumes it. 4461aff89a9bSJohannes Berg */ 4462567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4463567ffc35SJohannes Berg { 4464567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4465567ffc35SJohannes Berg } 4466aff89a9bSJohannes Berg 4467aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 446871063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4469aff89a9bSJohannes Berg #else 4470aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 447171063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 4472aff89a9bSJohannes Berg #endif 4473aff89a9bSJohannes Berg 4474b23aa676SSamuel Ortiz /** 4475b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 4476b23aa676SSamuel Ortiz * 4477b23aa676SSamuel Ortiz * @dev: network device 4478b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 4479b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4480b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4481b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4482b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4483b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 4484b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4485b23aa676SSamuel Ortiz * the real status code for failures. 4486b23aa676SSamuel Ortiz * @gfp: allocation flags 4487b23aa676SSamuel Ortiz * 4488b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 4489b23aa676SSamuel Ortiz * succeeded. 4490b23aa676SSamuel Ortiz */ 4491b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 4492b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4493b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 4494b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 4495b23aa676SSamuel Ortiz 4496b23aa676SSamuel Ortiz /** 4497b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 4498b23aa676SSamuel Ortiz * 4499b23aa676SSamuel Ortiz * @dev: network device 4500ed9d0102SJouni Malinen * @channel: the channel of the new AP 4501b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 4502b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4503b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4504b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4505b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4506b23aa676SSamuel Ortiz * @gfp: allocation flags 4507b23aa676SSamuel Ortiz * 4508b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 4509b23aa676SSamuel Ortiz * from one AP to another while connected. 4510b23aa676SSamuel Ortiz */ 4511ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 4512ed9d0102SJouni Malinen struct ieee80211_channel *channel, 4513ed9d0102SJouni Malinen const u8 *bssid, 4514b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4515b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4516b23aa676SSamuel Ortiz 4517b23aa676SSamuel Ortiz /** 4518adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 4519adbde344SVasanthakumar Thiagarajan * 4520adbde344SVasanthakumar Thiagarajan * @dev: network device 4521adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 4522adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 4523adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 4524adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 4525adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 4526adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 4527adbde344SVasanthakumar Thiagarajan * 4528adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 4529adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 4530adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 4531adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 4532adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 4533adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 4534adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 4535adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 4536adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 4537adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 4538adbde344SVasanthakumar Thiagarajan */ 4539adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 4540adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 4541adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4542adbde344SVasanthakumar Thiagarajan 4543adbde344SVasanthakumar Thiagarajan /** 4544b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 4545b23aa676SSamuel Ortiz * 4546b23aa676SSamuel Ortiz * @dev: network device 4547b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 4548b23aa676SSamuel Ortiz * @ie_len: length of IEs 4549b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 4550b23aa676SSamuel Ortiz * @gfp: allocation flags 4551b23aa676SSamuel Ortiz * 4552b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 4553b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 4554b23aa676SSamuel Ortiz */ 4555b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 4556c1e5f471SJohannes Berg const u8 *ie, size_t ie_len, gfp_t gfp); 4557b23aa676SSamuel Ortiz 45589588bbd5SJouni Malinen /** 45599588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 456071bbc994SJohannes Berg * @wdev: wireless device 45619588bbd5SJouni Malinen * @cookie: the request cookie 45629588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 45639588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 45649588bbd5SJouni Malinen * channel 45659588bbd5SJouni Malinen * @gfp: allocation flags 45669588bbd5SJouni Malinen */ 456771bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 45689588bbd5SJouni Malinen struct ieee80211_channel *chan, 45699588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 45709588bbd5SJouni Malinen 45719588bbd5SJouni Malinen /** 45729588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 457371bbc994SJohannes Berg * @wdev: wireless device 45749588bbd5SJouni Malinen * @cookie: the request cookie 45759588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 45769588bbd5SJouni Malinen * @gfp: allocation flags 45779588bbd5SJouni Malinen */ 457871bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 45799588bbd5SJouni Malinen struct ieee80211_channel *chan, 45809588bbd5SJouni Malinen gfp_t gfp); 4581b23aa676SSamuel Ortiz 458298b62183SJohannes Berg 458398b62183SJohannes Berg /** 458498b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 458598b62183SJohannes Berg * 458698b62183SJohannes Berg * @dev: the netdev 458798b62183SJohannes Berg * @mac_addr: the station's address 458898b62183SJohannes Berg * @sinfo: the station information 458998b62183SJohannes Berg * @gfp: allocation flags 459098b62183SJohannes Berg */ 459198b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 459298b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 459398b62183SJohannes Berg 4594026331c4SJouni Malinen /** 4595*cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 4596*cf5ead82SJohannes Berg * @dev: the netdev 4597*cf5ead82SJohannes Berg * @mac_addr: the station's address 4598*cf5ead82SJohannes Berg * @sinfo: the station information/statistics 4599*cf5ead82SJohannes Berg * @gfp: allocation flags 4600*cf5ead82SJohannes Berg */ 4601*cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 4602*cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 4603*cf5ead82SJohannes Berg 4604*cf5ead82SJohannes Berg /** 4605ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 4606ec15e68bSJouni Malinen * 4607ec15e68bSJouni Malinen * @dev: the netdev 4608ec15e68bSJouni Malinen * @mac_addr: the station's address 4609ec15e68bSJouni Malinen * @gfp: allocation flags 4610ec15e68bSJouni Malinen */ 4611*cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 4612*cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 4613*cf5ead82SJohannes Berg { 4614*cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 4615*cf5ead82SJohannes Berg } 4616ec15e68bSJouni Malinen 4617ec15e68bSJouni Malinen /** 4618ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 4619ed44a951SPandiyarajan Pitchaimuthu * 4620ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 4621ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 4622ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 4623ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 4624ed44a951SPandiyarajan Pitchaimuthu * 4625ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 4626ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 4627ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 4628ed44a951SPandiyarajan Pitchaimuthu * 4629ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 4630ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 4631ed44a951SPandiyarajan Pitchaimuthu */ 4632ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 4633ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 4634ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 4635ed44a951SPandiyarajan Pitchaimuthu 4636ed44a951SPandiyarajan Pitchaimuthu /** 46372e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 463871bbc994SJohannes Berg * @wdev: wireless device receiving the frame 4639026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 4640804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 46412e161f78SJohannes Berg * @buf: Management frame (header + body) 4642026331c4SJouni Malinen * @len: length of the frame data 464319504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 46442e161f78SJohannes Berg * 46450ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 46460ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 46470ae997dcSYacine Belkadi * 46480ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 46492e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 46502e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 46512e161f78SJohannes Berg * driver is responsible for rejecting the frame. 4652026331c4SJouni Malinen */ 465371bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 4654970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 4655026331c4SJouni Malinen 4656026331c4SJouni Malinen /** 46572e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 465871bbc994SJohannes Berg * @wdev: wireless device receiving the frame 46592e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 46602e161f78SJohannes Berg * @buf: Management frame (header + body) 4661026331c4SJouni Malinen * @len: length of the frame data 4662026331c4SJouni Malinen * @ack: Whether frame was acknowledged 4663026331c4SJouni Malinen * @gfp: context flags 4664026331c4SJouni Malinen * 46652e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 46662e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 4667026331c4SJouni Malinen * transmission attempt. 4668026331c4SJouni Malinen */ 466971bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 4670026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 4671026331c4SJouni Malinen 4672d6dc1a38SJuuso Oikarinen 4673d6dc1a38SJuuso Oikarinen /** 4674d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 4675d6dc1a38SJuuso Oikarinen * @dev: network device 4676d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 4677d6dc1a38SJuuso Oikarinen * @gfp: context flags 4678d6dc1a38SJuuso Oikarinen * 4679d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 4680d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 4681d6dc1a38SJuuso Oikarinen */ 4682d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 4683d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 4684d6dc1a38SJuuso Oikarinen gfp_t gfp); 4685d6dc1a38SJuuso Oikarinen 4686c063dbf5SJohannes Berg /** 4687c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 4688c063dbf5SJohannes Berg * @dev: network device 4689c063dbf5SJohannes Berg * @peer: peer's MAC address 4690c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 4691c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 4692c063dbf5SJohannes Berg * threshold (to account for temporary interference) 4693c063dbf5SJohannes Berg * @gfp: context flags 4694c063dbf5SJohannes Berg */ 4695c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 4696c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 4697c063dbf5SJohannes Berg 4698e5497d76SJohannes Berg /** 469984f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 470084f10708SThomas Pedersen * @dev: network device 470184f10708SThomas Pedersen * @peer: peer's MAC address 470284f10708SThomas Pedersen * @num_packets: how many packets were lost 470384f10708SThomas Pedersen * @rate: % of packets which failed transmission 470484f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 470584f10708SThomas Pedersen * @gfp: context flags 470684f10708SThomas Pedersen * 470784f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 470884f10708SThomas Pedersen * given interval is exceeded. 470984f10708SThomas Pedersen */ 471084f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 471184f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 471284f10708SThomas Pedersen 471384f10708SThomas Pedersen /** 471498f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 471598f03342SJohannes Berg * @dev: network device 471698f03342SJohannes Berg * @gfp: context flags 471798f03342SJohannes Berg * 471898f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 471998f03342SJohannes Berg */ 472098f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 472198f03342SJohannes Berg 472298f03342SJohannes Berg /** 47235b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 47245b97f49dSJohannes Berg * @wiphy: the wiphy 47255b97f49dSJohannes Berg * @chandef: chandef for the current channel 47265b97f49dSJohannes Berg * @gfp: context flags 47275b97f49dSJohannes Berg * 47285b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 47295b97f49dSJohannes Berg */ 47305b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 47315b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 47325b97f49dSJohannes Berg 47335b97f49dSJohannes Berg /** 47345b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 47355b97f49dSJohannes Berg * @netdev: network device 47365b97f49dSJohannes Berg * @chandef: chandef for the current channel 47375b97f49dSJohannes Berg * @event: type of event 47385b97f49dSJohannes Berg * @gfp: context flags 47395b97f49dSJohannes Berg * 47405b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 47415b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 47425b97f49dSJohannes Berg * also by full-MAC drivers. 47435b97f49dSJohannes Berg */ 47445b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 47455b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 47465b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 47475b97f49dSJohannes Berg 47485b97f49dSJohannes Berg 47495b97f49dSJohannes Berg /** 4750e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 4751e5497d76SJohannes Berg * @dev: network device 4752e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 4753e5497d76SJohannes Berg * @replay_ctr: new replay counter 4754af71ff85SJohannes Berg * @gfp: allocation flags 4755e5497d76SJohannes Berg */ 4756e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 4757e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 4758e5497d76SJohannes Berg 4759c9df56b4SJouni Malinen /** 4760c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 4761c9df56b4SJouni Malinen * @dev: network device 4762c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 4763c9df56b4SJouni Malinen * @bssid: BSSID of AP 4764c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 4765c9df56b4SJouni Malinen * @gfp: allocation flags 4766c9df56b4SJouni Malinen */ 4767c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 4768c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 4769c9df56b4SJouni Malinen 477028946da7SJohannes Berg /** 477128946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 477228946da7SJohannes Berg * @dev: The device the frame matched to 477328946da7SJohannes Berg * @addr: the transmitter address 477428946da7SJohannes Berg * @gfp: context flags 477528946da7SJohannes Berg * 477628946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 477728946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 477828946da7SJohannes Berg * sender. 47790ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 478028946da7SJohannes Berg * for a reason other than not having a subscription.) 478128946da7SJohannes Berg */ 478228946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 478328946da7SJohannes Berg const u8 *addr, gfp_t gfp); 478428946da7SJohannes Berg 47857f6cf311SJohannes Berg /** 4786b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 4787b92ab5d8SJohannes Berg * @dev: The device the frame matched to 4788b92ab5d8SJohannes Berg * @addr: the transmitter address 4789b92ab5d8SJohannes Berg * @gfp: context flags 4790b92ab5d8SJohannes Berg * 4791b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 4792b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 4793b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 4794b92ab5d8SJohannes Berg * station to avoid event flooding. 47950ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 4796b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 4797b92ab5d8SJohannes Berg */ 4798b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 4799b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 4800b92ab5d8SJohannes Berg 4801b92ab5d8SJohannes Berg /** 48027f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 48037f6cf311SJohannes Berg * @dev: the device the probe was sent on 48047f6cf311SJohannes Berg * @addr: the address of the peer 48057f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 48067f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 48077f6cf311SJohannes Berg * @gfp: allocation flags 48087f6cf311SJohannes Berg */ 48097f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 48107f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 48117f6cf311SJohannes Berg 48125e760230SJohannes Berg /** 48135e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 48145e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 48155e760230SJohannes Berg * @frame: the frame 48165e760230SJohannes Berg * @len: length of the frame 48175e760230SJohannes Berg * @freq: frequency the frame was received on 4818804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 48195e760230SJohannes Berg * 48205e760230SJohannes Berg * Use this function to report to userspace when a beacon was 48215e760230SJohannes Berg * received. It is not useful to call this when there is no 48225e760230SJohannes Berg * netdev that is in AP/GO mode. 48235e760230SJohannes Berg */ 48245e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 48255e760230SJohannes Berg const u8 *frame, size_t len, 482637c73b5fSBen Greear int freq, int sig_dbm); 48275e760230SJohannes Berg 4828d58e7e37SJohannes Berg /** 4829683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 483054858ee5SAlexander Simon * @wiphy: the wiphy 4831683b6d3bSJohannes Berg * @chandef: the channel definition 4832174e0cd2SIlan Peer * @iftype: interface type 4833d58e7e37SJohannes Berg * 48340ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 48350ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 483654858ee5SAlexander Simon */ 4837683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4838174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 4839174e0cd2SIlan Peer enum nl80211_iftype iftype); 484054858ee5SAlexander Simon 48418097e149SThomas Pedersen /* 48425314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 48435314526bSThomas Pedersen * @dev: the device which switched channels 4844683b6d3bSJohannes Berg * @chandef: the new channel definition 48455314526bSThomas Pedersen * 4846e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 4847e487eaebSSimon Wunderlich * driver context! 48485314526bSThomas Pedersen */ 4849683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 4850683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 48515314526bSThomas Pedersen 4852f8d7552eSLuciano Coelho /* 4853f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 4854f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 4855f8d7552eSLuciano Coelho * @chandef: the future channel definition 4856f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 4857f8d7552eSLuciano Coelho * 4858f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 4859f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 4860f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 4861f8d7552eSLuciano Coelho */ 4862f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 4863f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 4864f8d7552eSLuciano Coelho u8 count); 4865f8d7552eSLuciano Coelho 48661ce3e82bSJohannes Berg /** 48671ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 48681ce3e82bSJohannes Berg * 48691ce3e82bSJohannes Berg * @operating_class: the operating class to convert 48701ce3e82bSJohannes Berg * @band: band pointer to fill 48711ce3e82bSJohannes Berg * 48721ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 48731ce3e82bSJohannes Berg */ 48741ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 48751ce3e82bSJohannes Berg enum ieee80211_band *band); 48761ce3e82bSJohannes Berg 48775314526bSThomas Pedersen /* 48783475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 48793475b094SJouni Malinen * @dev: the device on which the operation is requested 48803475b094SJouni Malinen * @peer: the MAC address of the peer device 48813475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 48823475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 48833475b094SJouni Malinen * @reason_code: the reason code for teardown request 48843475b094SJouni Malinen * @gfp: allocation flags 48853475b094SJouni Malinen * 48863475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 48873475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 48883475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 48893475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 48903475b094SJouni Malinen * based on traffic and signal strength for a peer). 48913475b094SJouni Malinen */ 48923475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 48933475b094SJouni Malinen enum nl80211_tdls_operation oper, 48943475b094SJouni Malinen u16 reason_code, gfp_t gfp); 48953475b094SJouni Malinen 48963475b094SJouni Malinen /* 48978097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 48988097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 48998097e149SThomas Pedersen * 49008097e149SThomas Pedersen * return 0 if MCS index >= 32 49018097e149SThomas Pedersen */ 49028eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 49038097e149SThomas Pedersen 490498104fdeSJohannes Berg /** 490598104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 490698104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 490798104fdeSJohannes Berg * 490898104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 490998104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 491098104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 491198104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 491298104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 491398104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 491498104fdeSJohannes Berg * when the device is unbound from the driver. 491598104fdeSJohannes Berg * 491698104fdeSJohannes Berg * Requires the RTNL to be held. 491798104fdeSJohannes Berg */ 491898104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 491998104fdeSJohannes Berg 49200ee45355SJohannes Berg /** 4921355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 4922355199e0SJouni Malinen * @ies: FT IEs 4923355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 4924355199e0SJouni Malinen * @target_ap: target AP's MAC address 4925355199e0SJouni Malinen * @ric_ies: RIC IE 4926355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 4927355199e0SJouni Malinen */ 4928355199e0SJouni Malinen struct cfg80211_ft_event_params { 4929355199e0SJouni Malinen const u8 *ies; 4930355199e0SJouni Malinen size_t ies_len; 4931355199e0SJouni Malinen const u8 *target_ap; 4932355199e0SJouni Malinen const u8 *ric_ies; 4933355199e0SJouni Malinen size_t ric_ies_len; 4934355199e0SJouni Malinen }; 4935355199e0SJouni Malinen 4936355199e0SJouni Malinen /** 4937355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 4938355199e0SJouni Malinen * @netdev: network device 4939355199e0SJouni Malinen * @ft_event: IE information 4940355199e0SJouni Malinen */ 4941355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 4942355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 4943355199e0SJouni Malinen 4944355199e0SJouni Malinen /** 49450ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 49460ee45355SJohannes Berg * @ies: the input IE buffer 49470ee45355SJohannes Berg * @len: the input length 49480ee45355SJohannes Berg * @attr: the attribute ID to find 49490ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 49500ee45355SJohannes Berg * if the function is only called to get the needed buffer size 49510ee45355SJohannes Berg * @bufsize: size of the output buffer 49520ee45355SJohannes Berg * 49530ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 49540ee45355SJohannes Berg * copies its contents to the given buffer. 49550ee45355SJohannes Berg * 49560ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 49570ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 49580ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 49590ee45355SJohannes Berg */ 4960c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 4961c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 4962c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 49630ee45355SJohannes Berg 4964cd8f7cb4SJohannes Berg /** 4965cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 4966cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 4967cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 4968cd8f7cb4SJohannes Berg * @gfp: allocation flags 4969cd8f7cb4SJohannes Berg * 4970cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 4971cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 4972cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 4973cd8f7cb4SJohannes Berg * else caused the wakeup. 4974cd8f7cb4SJohannes Berg */ 4975cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 4976cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 4977cd8f7cb4SJohannes Berg gfp_t gfp); 4978cd8f7cb4SJohannes Berg 49795de17984SArend van Spriel /** 49805de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 49815de17984SArend van Spriel * 49825de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 498303f831a6SRobert P. J. Day * @gfp: allocation flags 49845de17984SArend van Spriel * 49855de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 49865de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 49875de17984SArend van Spriel * by .crit_proto_start() has expired. 49885de17984SArend van Spriel */ 49895de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 49905de17984SArend van Spriel 4991bdfbec2dSIlan Peer /** 4992bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 4993bdfbec2dSIlan Peer * @wiphy: the wiphy 4994bdfbec2dSIlan Peer * 4995bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 4996bdfbec2dSIlan Peer */ 4997bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 4998bdfbec2dSIlan Peer 4999cb2d956dSLuciano Coelho /** 5000cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 5001cb2d956dSLuciano Coelho * 5002cb2d956dSLuciano Coelho * @wiphy: the wiphy 5003cb2d956dSLuciano Coelho * @num_different_channels: the number of different channels we want 5004cb2d956dSLuciano Coelho * to use for verification 5005cb2d956dSLuciano Coelho * @radar_detect: a bitmap where each bit corresponds to a channel 5006cb2d956dSLuciano Coelho * width where radar detection is needed, as in the definition of 5007cb2d956dSLuciano Coelho * &struct ieee80211_iface_combination.@radar_detect_widths 5008cb2d956dSLuciano Coelho * @iftype_num: array with the numbers of interfaces of each interface 5009cb2d956dSLuciano Coelho * type. The index is the interface type as specified in &enum 5010cb2d956dSLuciano Coelho * nl80211_iftype. 5011cb2d956dSLuciano Coelho * 5012cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 5013cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 5014cb2d956dSLuciano Coelho * the interface combinations. 5015cb2d956dSLuciano Coelho */ 5016cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 5017cb2d956dSLuciano Coelho const int num_different_channels, 5018cb2d956dSLuciano Coelho const u8 radar_detect, 5019cb2d956dSLuciano Coelho const int iftype_num[NUM_NL80211_IFTYPES]); 5020cb2d956dSLuciano Coelho 502165a124ddSMichal Kazior /** 502265a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 502365a124ddSMichal Kazior * 502465a124ddSMichal Kazior * @wiphy: the wiphy 502565a124ddSMichal Kazior * @num_different_channels: the number of different channels we want 502665a124ddSMichal Kazior * to use for verification 502765a124ddSMichal Kazior * @radar_detect: a bitmap where each bit corresponds to a channel 502865a124ddSMichal Kazior * width where radar detection is needed, as in the definition of 502965a124ddSMichal Kazior * &struct ieee80211_iface_combination.@radar_detect_widths 503065a124ddSMichal Kazior * @iftype_num: array with the numbers of interfaces of each interface 503165a124ddSMichal Kazior * type. The index is the interface type as specified in &enum 503265a124ddSMichal Kazior * nl80211_iftype. 503365a124ddSMichal Kazior * @iter: function to call for each matching combination 503465a124ddSMichal Kazior * @data: pointer to pass to iter function 503565a124ddSMichal Kazior * 503665a124ddSMichal Kazior * This function can be called by the driver to check what possible 503765a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 503865a124ddSMichal Kazior * purposes. 503965a124ddSMichal Kazior */ 504065a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 504165a124ddSMichal Kazior const int num_different_channels, 504265a124ddSMichal Kazior const u8 radar_detect, 504365a124ddSMichal Kazior const int iftype_num[NUM_NL80211_IFTYPES], 504465a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 504565a124ddSMichal Kazior void *data), 504665a124ddSMichal Kazior void *data); 504765a124ddSMichal Kazior 5048f04c2203SMichal Kazior /* 5049f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 5050f04c2203SMichal Kazior * 5051f04c2203SMichal Kazior * @wiphy: the wiphy 5052f04c2203SMichal Kazior * @wdev: wireless device 5053f04c2203SMichal Kazior * @gfp: context flags 5054f04c2203SMichal Kazior * 5055f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 5056f04c2203SMichal Kazior * disconnected. 5057f04c2203SMichal Kazior * 5058f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 5059f04c2203SMichal Kazior */ 5060f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 5061f04c2203SMichal Kazior gfp_t gfp); 5062f04c2203SMichal Kazior 5063f6837ba8SJohannes Berg /** 5064f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 5065f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 5066f6837ba8SJohannes Berg * 5067f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 5068f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 5069f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 5070f6837ba8SJohannes Berg * that really can't be recovered in any other way. 5071f6837ba8SJohannes Berg * 5072f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 5073f6837ba8SJohannes Berg * the driver while the function is running. 5074f6837ba8SJohannes Berg */ 5075f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5076f6837ba8SJohannes Berg 5077d75bb06bSGautam Kumar Shukla /** 5078d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 5079d75bb06bSGautam Kumar Shukla * 5080d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5081d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5082d75bb06bSGautam Kumar Shukla * 5083d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5084d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5085d75bb06bSGautam Kumar Shukla */ 5086d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 5087d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5088d75bb06bSGautam Kumar Shukla { 5089d75bb06bSGautam Kumar Shukla u8 *ft_byte; 5090d75bb06bSGautam Kumar Shukla 5091d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 5092d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 5093d75bb06bSGautam Kumar Shukla } 5094d75bb06bSGautam Kumar Shukla 5095d75bb06bSGautam Kumar Shukla /** 5096d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 5097d75bb06bSGautam Kumar Shukla * 5098d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5099d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5100d75bb06bSGautam Kumar Shukla * 5101d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5102d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5103d75bb06bSGautam Kumar Shukla */ 5104d75bb06bSGautam Kumar Shukla static inline bool 5105d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 5106d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5107d75bb06bSGautam Kumar Shukla { 5108d75bb06bSGautam Kumar Shukla u8 ft_byte; 5109d75bb06bSGautam Kumar Shukla 5110d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 5111d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 5112d75bb06bSGautam Kumar Shukla } 5113b7ffbd7eSJohannes Berg 5114b7ffbd7eSJohannes Berg /* ethtool helper */ 5115b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 5116b7ffbd7eSJohannes Berg 5117e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 5118e1db74fcSJoe Perches 5119e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 5120e1db74fcSJoe Perches 5121e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 51229c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 5123e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 51249c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 5125e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 51269c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 5127e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 51289c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 5129e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 51309c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 5131e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 51329c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 5133e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 51349c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 5135e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 51369c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 5137073730d7SJoe Perches 51389c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 5139e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 51409c376639SJoe Perches 5141e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 51429c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 5143e1db74fcSJoe Perches 5144e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 5145e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 5146e1db74fcSJoe Perches #else 5147e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 5148e1db74fcSJoe Perches ({ \ 5149e1db74fcSJoe Perches if (0) \ 5150e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 5151e1db74fcSJoe Perches 0; \ 5152e1db74fcSJoe Perches }) 5153e1db74fcSJoe Perches #endif 5154e1db74fcSJoe Perches 5155e1db74fcSJoe Perches /* 5156e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5157e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5158e1db74fcSJoe Perches * file/line information and a backtrace. 5159e1db74fcSJoe Perches */ 5160e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5161e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5162e1db74fcSJoe Perches 5163704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5164