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 88585989dSLuca Coelho * Copyright 2015-2017 Intel Deutschland GmbH 9d3236553SJohannes Berg * 10d3236553SJohannes Berg * This program is free software; you can redistribute it and/or modify 11d3236553SJohannes Berg * it under the terms of the GNU General Public License version 2 as 12d3236553SJohannes Berg * published by the Free Software Foundation. 13d3236553SJohannes Berg */ 14704232c2SJohannes Berg 15d3236553SJohannes Berg #include <linux/netdevice.h> 16d3236553SJohannes Berg #include <linux/debugfs.h> 17d3236553SJohannes Berg #include <linux/list.h> 18187f1882SPaul Gortmaker #include <linux/bug.h> 19704232c2SJohannes Berg #include <linux/netlink.h> 20704232c2SJohannes Berg #include <linux/skbuff.h> 2155682965SJohannes Berg #include <linux/nl80211.h> 222a519311SJohannes Berg #include <linux/if_ether.h> 232a519311SJohannes Berg #include <linux/ieee80211.h> 242a0e047eSJohannes Berg #include <linux/net.h> 25d3236553SJohannes Berg #include <net/regulatory.h> 26d3236553SJohannes Berg 27d70e9693SJohannes Berg /** 28d70e9693SJohannes Berg * DOC: Introduction 29d70e9693SJohannes Berg * 30d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 31d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 32d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 33d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 34d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 35d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 36d70e9693SJohannes Berg * 37d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 38d70e9693SJohannes Berg * use restrictions. 39d70e9693SJohannes Berg */ 40d70e9693SJohannes Berg 41d70e9693SJohannes Berg 42d70e9693SJohannes Berg /** 43d70e9693SJohannes Berg * DOC: Device registration 44d70e9693SJohannes Berg * 45d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 46d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 47d70e9693SJohannes Berg * described below. 48d70e9693SJohannes Berg * 49d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 50d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 51d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 52d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 53d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 54d70e9693SJohannes Berg * the wireless part of the interface, normally this struct is embedded in the 55d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 56d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 57d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 58d70e9693SJohannes Berg * 59d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 60d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 61d70e9693SJohannes Berg * structures here describe these capabilities in detail. 62d70e9693SJohannes Berg */ 63d70e9693SJohannes Berg 649f5e8f6eSJohannes Berg struct wiphy; 659f5e8f6eSJohannes Berg 66704232c2SJohannes Berg /* 67d3236553SJohannes Berg * wireless hardware capability structures 68d3236553SJohannes Berg */ 69d3236553SJohannes Berg 70d3236553SJohannes Berg /** 71d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 72d3236553SJohannes Berg * 73d3236553SJohannes Berg * Channel flags set by the regulatory control code. 74d3236553SJohannes Berg * 75d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 768fe02e16SLuis R. Rodriguez * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 778fe02e16SLuis R. Rodriguez * sending probe requests or beaconing. 78d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 79689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 80d3236553SJohannes Berg * is not permitted. 81689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 82d3236553SJohannes Berg * is not permitted. 8303f6b084SSeth Forshee * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 84c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 85c7a6ee27SJohannes Berg * this flag indicates that an 80 MHz channel cannot use this 86c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 87c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 88c7a6ee27SJohannes Berg * restrictions. 89c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 90c7a6ee27SJohannes Berg * this flag indicates that an 160 MHz channel cannot use this 91c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 92c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 93c7a6ee27SJohannes Berg * restrictions. 94570dbde1SDavid Spinadel * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 9506f207fcSArik Nemtsov * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 96ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 97ea077c1cSRostislav Lisovy * on this channel. 98ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 99ea077c1cSRostislav Lisovy * on this channel. 100570dbde1SDavid Spinadel * 101d3236553SJohannes Berg */ 102d3236553SJohannes Berg enum ieee80211_channel_flags { 103d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 1048fe02e16SLuis R. Rodriguez IEEE80211_CHAN_NO_IR = 1<<1, 1058fe02e16SLuis R. Rodriguez /* hole at 1<<2 */ 106d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 107689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 108689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 10903f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 110c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 111c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 112570dbde1SDavid Spinadel IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 11306f207fcSArik Nemtsov IEEE80211_CHAN_IR_CONCURRENT = 1<<10, 114ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_20MHZ = 1<<11, 115ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_10MHZ = 1<<12, 116d3236553SJohannes Berg }; 117d3236553SJohannes Berg 118038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 119689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 120038659e7SLuis R. Rodriguez 12104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 12204f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 12304f39047SSimon Wunderlich 124d3236553SJohannes Berg /** 125d3236553SJohannes Berg * struct ieee80211_channel - channel definition 126d3236553SJohannes Berg * 127d3236553SJohannes Berg * This structure describes a single channel for use 128d3236553SJohannes Berg * with cfg80211. 129d3236553SJohannes Berg * 130d3236553SJohannes Berg * @center_freq: center frequency in MHz 131d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 132d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 133d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 134d3236553SJohannes Berg * code to support devices with additional restrictions 135d3236553SJohannes Berg * @band: band this channel belongs to. 136d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 137d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 138eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 139d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 140d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 14177c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 142d3236553SJohannes Berg * @orig_mag: internal use 143d3236553SJohannes Berg * @orig_mpwr: internal use 14404f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 14504f39047SSimon Wunderlich * on this channel. 14604f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 147089027e5SJanusz Dziedzic * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 148d3236553SJohannes Berg */ 149d3236553SJohannes Berg struct ieee80211_channel { 15057fbcce3SJohannes Berg enum nl80211_band band; 151d3236553SJohannes Berg u16 center_freq; 152d3236553SJohannes Berg u16 hw_value; 153d3236553SJohannes Berg u32 flags; 154d3236553SJohannes Berg int max_antenna_gain; 155d3236553SJohannes Berg int max_power; 156eccc068eSHong Wu int max_reg_power; 157d3236553SJohannes Berg bool beacon_found; 158d3236553SJohannes Berg u32 orig_flags; 159d3236553SJohannes Berg int orig_mag, orig_mpwr; 16004f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 16104f39047SSimon Wunderlich unsigned long dfs_state_entered; 162089027e5SJanusz Dziedzic unsigned int dfs_cac_ms; 163d3236553SJohannes Berg }; 164d3236553SJohannes Berg 165d3236553SJohannes Berg /** 166d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 167d3236553SJohannes Berg * 168d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 169d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 170d3236553SJohannes Berg * different bands/PHY modes. 171d3236553SJohannes Berg * 172d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 173d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 174d3236553SJohannes Berg * with CCK rates. 175d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 176d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 177d3236553SJohannes Berg * core code when registering the wiphy. 178d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 179d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 180d3236553SJohannes Berg * core code when registering the wiphy. 181d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 182d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 183d3236553SJohannes Berg * core code when registering the wiphy. 184d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 18530e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 18630e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 187d3236553SJohannes Berg */ 188d3236553SJohannes Berg enum ieee80211_rate_flags { 189d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 190d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 191d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 192d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 193d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 19430e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 19530e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 196d3236553SJohannes Berg }; 197d3236553SJohannes Berg 198d3236553SJohannes Berg /** 1996eb18137SDedy Lansky * enum ieee80211_bss_type - BSS type filter 2006eb18137SDedy Lansky * 2016eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS 2026eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_PBSS: Personal BSS 2036eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_IBSS: Independent BSS 2046eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS 2056eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type 2066eb18137SDedy Lansky */ 2076eb18137SDedy Lansky enum ieee80211_bss_type { 2086eb18137SDedy Lansky IEEE80211_BSS_TYPE_ESS, 2096eb18137SDedy Lansky IEEE80211_BSS_TYPE_PBSS, 2106eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 2116eb18137SDedy Lansky IEEE80211_BSS_TYPE_MBSS, 2126eb18137SDedy Lansky IEEE80211_BSS_TYPE_ANY 2136eb18137SDedy Lansky }; 2146eb18137SDedy Lansky 2156eb18137SDedy Lansky /** 2166eb18137SDedy Lansky * enum ieee80211_privacy - BSS privacy filter 2176eb18137SDedy Lansky * 2186eb18137SDedy Lansky * @IEEE80211_PRIVACY_ON: privacy bit set 2196eb18137SDedy Lansky * @IEEE80211_PRIVACY_OFF: privacy bit clear 2206eb18137SDedy Lansky * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting 2216eb18137SDedy Lansky */ 2226eb18137SDedy Lansky enum ieee80211_privacy { 2236eb18137SDedy Lansky IEEE80211_PRIVACY_ON, 2246eb18137SDedy Lansky IEEE80211_PRIVACY_OFF, 2256eb18137SDedy Lansky IEEE80211_PRIVACY_ANY 2266eb18137SDedy Lansky }; 2276eb18137SDedy Lansky 2286eb18137SDedy Lansky #define IEEE80211_PRIVACY(x) \ 2296eb18137SDedy Lansky ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) 2306eb18137SDedy Lansky 2316eb18137SDedy Lansky /** 232d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 233d3236553SJohannes Berg * 234d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 235d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 236d3236553SJohannes Berg * are only for driver use when pointers to this structure are 237d3236553SJohannes Berg * passed around. 238d3236553SJohannes Berg * 239d3236553SJohannes Berg * @flags: rate-specific flags 240d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 241d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 242d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 243d3236553SJohannes Berg * short preamble is used 244d3236553SJohannes Berg */ 245d3236553SJohannes Berg struct ieee80211_rate { 246d3236553SJohannes Berg u32 flags; 247d3236553SJohannes Berg u16 bitrate; 248d3236553SJohannes Berg u16 hw_value, hw_value_short; 249d3236553SJohannes Berg }; 250d3236553SJohannes Berg 251d3236553SJohannes Berg /** 252d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 253d3236553SJohannes Berg * 254d3236553SJohannes Berg * This structure describes most essential parameters needed 255d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 256d3236553SJohannes Berg * 257d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 258d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 259d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 260d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 261d3236553SJohannes Berg * @mcs: Supported MCS rates 262d3236553SJohannes Berg */ 263d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 264d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 265d3236553SJohannes Berg bool ht_supported; 266d3236553SJohannes Berg u8 ampdu_factor; 267d3236553SJohannes Berg u8 ampdu_density; 268d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 269d3236553SJohannes Berg }; 270d3236553SJohannes Berg 271d3236553SJohannes Berg /** 272bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 273bf0c111eSMahesh Palivela * 274bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 275bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 276bf0c111eSMahesh Palivela * 277bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 278bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 279bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 280bf0c111eSMahesh Palivela */ 281bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 282bf0c111eSMahesh Palivela bool vht_supported; 283bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 284bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 285bf0c111eSMahesh Palivela }; 286bf0c111eSMahesh Palivela 287bf0c111eSMahesh Palivela /** 288d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 289d3236553SJohannes Berg * 290d3236553SJohannes Berg * This structure describes a frequency band a wiphy 291d3236553SJohannes Berg * is able to operate in. 292d3236553SJohannes Berg * 293d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 294d3236553SJohannes Berg * in this band. 295d3236553SJohannes Berg * @band: the band this structure represents 296d3236553SJohannes Berg * @n_channels: Number of channels in @channels 297d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 298d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 299d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 300d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 301abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 302c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 303d3236553SJohannes Berg */ 304d3236553SJohannes Berg struct ieee80211_supported_band { 305d3236553SJohannes Berg struct ieee80211_channel *channels; 306d3236553SJohannes Berg struct ieee80211_rate *bitrates; 30757fbcce3SJohannes Berg enum nl80211_band band; 308d3236553SJohannes Berg int n_channels; 309d3236553SJohannes Berg int n_bitrates; 310d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 311bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 312d3236553SJohannes Berg }; 313d3236553SJohannes Berg 314e691ac2fSRafał Miłecki /** 315e691ac2fSRafał Miłecki * wiphy_read_of_freq_limits - read frequency limits from device tree 316e691ac2fSRafał Miłecki * 317e691ac2fSRafał Miłecki * @wiphy: the wireless device to get extra limits for 318e691ac2fSRafał Miłecki * 319e691ac2fSRafał Miłecki * Some devices may have extra limitations specified in DT. This may be useful 320e691ac2fSRafał Miłecki * for chipsets that normally support more bands but are limited due to board 321e691ac2fSRafał Miłecki * design (e.g. by antennas or external power amplifier). 322e691ac2fSRafał Miłecki * 323e691ac2fSRafał Miłecki * This function reads info from DT and uses it to *modify* channels (disable 324e691ac2fSRafał Miłecki * unavailable ones). It's usually a *bad* idea to use it in drivers with 325e691ac2fSRafał Miłecki * shared channel data as DT limitations are device specific. You should make 326e691ac2fSRafał Miłecki * sure to call it only if channels in wiphy are copied and can be modified 327e691ac2fSRafał Miłecki * without affecting other devices. 328e691ac2fSRafał Miłecki * 329e691ac2fSRafał Miłecki * As this function access device node it has to be called after set_wiphy_dev. 330e691ac2fSRafał Miłecki * It also modifies channels so they have to be set first. 331e691ac2fSRafał Miłecki * If using this helper, call it before wiphy_register(). 332e691ac2fSRafał Miłecki */ 333e691ac2fSRafał Miłecki #ifdef CONFIG_OF 334e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy); 335e691ac2fSRafał Miłecki #else /* CONFIG_OF */ 336e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) 337e691ac2fSRafał Miłecki { 338e691ac2fSRafał Miłecki } 339e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */ 340e691ac2fSRafał Miłecki 341e691ac2fSRafał Miłecki 342d3236553SJohannes Berg /* 343d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 344704232c2SJohannes Berg */ 345704232c2SJohannes Berg 3462ec600d6SLuis Carlos Cobo /** 347d70e9693SJohannes Berg * DOC: Actions and configuration 348d70e9693SJohannes Berg * 349d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 350d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 351d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 352d70e9693SJohannes Berg * operations use are described separately. 353d70e9693SJohannes Berg * 354d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 355d70e9693SJohannes Berg * information via some functions that drivers need to call. 356d70e9693SJohannes Berg * 357d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 358d70e9693SJohannes Berg * in a separate chapter. 359d70e9693SJohannes Berg */ 360d70e9693SJohannes Berg 361c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 362c6e6a0c8SAviya Erenfeld WLAN_USER_POSITION_LEN) 363c6e6a0c8SAviya Erenfeld 364d70e9693SJohannes Berg /** 3652ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 366818a986eSJohannes Berg * @flags: monitor interface flags, unchanged if 0, otherwise 367818a986eSJohannes Berg * %MONITOR_FLAG_CHANGED will be set 3688b787643SFelix Fietkau * @use_4addr: use 4-address frames 369e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 370e8f479b1SBen Greear * If this parameter is set to zero address the driver may 371e8f479b1SBen Greear * determine the address as needed. 372e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 373e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 374e8f479b1SBen Greear ** only p2p devices with specified MAC. 375b0265024SJohannes Berg * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets 376b0265024SJohannes Berg * belonging to that MU-MIMO groupID; %NULL if not changed 377b0265024SJohannes Berg * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring 378b0265024SJohannes Berg * MU-MIMO packets going to the specified station; %NULL if not changed 3792ec600d6SLuis Carlos Cobo */ 3802ec600d6SLuis Carlos Cobo struct vif_params { 381818a986eSJohannes Berg u32 flags; 3828b787643SFelix Fietkau int use_4addr; 3831c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 384b0265024SJohannes Berg const u8 *vht_mumimo_groups; 385b0265024SJohannes Berg const u8 *vht_mumimo_follow_addr; 3862ec600d6SLuis Carlos Cobo }; 3872ec600d6SLuis Carlos Cobo 38841ade00fSJohannes Berg /** 38941ade00fSJohannes Berg * struct key_params - key information 39041ade00fSJohannes Berg * 39141ade00fSJohannes Berg * Information about a key 39241ade00fSJohannes Berg * 39341ade00fSJohannes Berg * @key: key material 39441ade00fSJohannes Berg * @key_len: length of key material 39541ade00fSJohannes Berg * @cipher: cipher suite selector 39641ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 39741ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 39841ade00fSJohannes Berg * length given by @seq_len. 399abe37c4bSJohannes Berg * @seq_len: length of @seq. 40041ade00fSJohannes Berg */ 40141ade00fSJohannes Berg struct key_params { 402c1e5f471SJohannes Berg const u8 *key; 403c1e5f471SJohannes Berg const u8 *seq; 40441ade00fSJohannes Berg int key_len; 40541ade00fSJohannes Berg int seq_len; 40641ade00fSJohannes Berg u32 cipher; 40741ade00fSJohannes Berg }; 40841ade00fSJohannes Berg 409ed1b6cc7SJohannes Berg /** 410683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 411683b6d3bSJohannes Berg * @chan: the (control) channel 4123d9d1d66SJohannes Berg * @width: channel width 4133d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 4143d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 4153d9d1d66SJohannes Berg * (only with 80+80 MHz) 416683b6d3bSJohannes Berg */ 417683b6d3bSJohannes Berg struct cfg80211_chan_def { 418683b6d3bSJohannes Berg struct ieee80211_channel *chan; 4193d9d1d66SJohannes Berg enum nl80211_chan_width width; 4203d9d1d66SJohannes Berg u32 center_freq1; 4213d9d1d66SJohannes Berg u32 center_freq2; 422683b6d3bSJohannes Berg }; 423683b6d3bSJohannes Berg 4243d9d1d66SJohannes Berg /** 4253d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 4263d9d1d66SJohannes Berg * @chandef: the channel definition 4273d9d1d66SJohannes Berg * 4280ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 4293d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 4303d9d1d66SJohannes Berg */ 431683b6d3bSJohannes Berg static inline enum nl80211_channel_type 432683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 433683b6d3bSJohannes Berg { 4343d9d1d66SJohannes Berg switch (chandef->width) { 4353d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 4363d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 4373d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 4383d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 4393d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 4403d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 4413d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 4423d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 4433d9d1d66SJohannes Berg default: 4443d9d1d66SJohannes Berg WARN_ON(1); 4453d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 446683b6d3bSJohannes Berg } 4473d9d1d66SJohannes Berg } 4483d9d1d66SJohannes Berg 4493d9d1d66SJohannes Berg /** 4503d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 4513d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 4523d9d1d66SJohannes Berg * @channel: the control channel 4533d9d1d66SJohannes Berg * @chantype: the channel type 4543d9d1d66SJohannes Berg * 4553d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 4563d9d1d66SJohannes Berg */ 4573d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 4583d9d1d66SJohannes Berg struct ieee80211_channel *channel, 4593d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 4603d9d1d66SJohannes Berg 4613d9d1d66SJohannes Berg /** 4623d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 4633d9d1d66SJohannes Berg * @chandef1: first channel definition 4643d9d1d66SJohannes Berg * @chandef2: second channel definition 4653d9d1d66SJohannes Berg * 4660ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 4673d9d1d66SJohannes Berg * identical, %false otherwise. 4683d9d1d66SJohannes Berg */ 4693d9d1d66SJohannes Berg static inline bool 4703d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 4713d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 4723d9d1d66SJohannes Berg { 4733d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 4743d9d1d66SJohannes Berg chandef1->width == chandef2->width && 4753d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 4763d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 4773d9d1d66SJohannes Berg } 4783d9d1d66SJohannes Berg 4793d9d1d66SJohannes Berg /** 4803d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 4813d9d1d66SJohannes Berg * @chandef1: first channel definition 4823d9d1d66SJohannes Berg * @chandef2: second channel definition 4833d9d1d66SJohannes Berg * 4840ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 4853d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 4863d9d1d66SJohannes Berg */ 4873d9d1d66SJohannes Berg const struct cfg80211_chan_def * 4883d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 4893d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 490683b6d3bSJohannes Berg 491683b6d3bSJohannes Berg /** 4929f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 4939f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4940ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 4959f5e8f6eSJohannes Berg */ 4969f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 4979f5e8f6eSJohannes Berg 4989f5e8f6eSJohannes Berg /** 4999f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 5009f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 5019f5e8f6eSJohannes Berg * @chandef: the channel definition to check 5020ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 5030ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 5049f5e8f6eSJohannes Berg */ 5059f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 5069f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 5079f5e8f6eSJohannes Berg u32 prohibited_flags); 5089f5e8f6eSJohannes Berg 5099f5e8f6eSJohannes Berg /** 510774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 511774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 512774f0734SSimon Wunderlich * @chandef: the channel definition to check 5132beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 5142beb6dabSLuciano Coelho * Returns: 5152beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 516774f0734SSimon Wunderlich */ 517774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 5182beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 519c3d62036SLuciano Coelho enum nl80211_iftype iftype); 520774f0734SSimon Wunderlich 521774f0734SSimon Wunderlich /** 52230e74732SSimon Wunderlich * ieee80211_chandef_rate_flags - returns rate flags for a channel 52330e74732SSimon Wunderlich * 52430e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 52530e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 52630e74732SSimon Wunderlich * 52730e74732SSimon Wunderlich * @chandef: channel definition for the channel 52830e74732SSimon Wunderlich * 52930e74732SSimon Wunderlich * Returns: rate flags which apply for this channel 53030e74732SSimon Wunderlich */ 53130e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 53230e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 53330e74732SSimon Wunderlich { 53430e74732SSimon Wunderlich switch (chandef->width) { 53530e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 53630e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 53730e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 53830e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 53930e74732SSimon Wunderlich default: 54030e74732SSimon Wunderlich break; 54130e74732SSimon Wunderlich } 54230e74732SSimon Wunderlich return 0; 54330e74732SSimon Wunderlich } 54430e74732SSimon Wunderlich 54530e74732SSimon Wunderlich /** 5460430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 5470430c883SSimon Wunderlich * 5480430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 5490430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 5500430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 5510430c883SSimon Wunderlich * 5520430c883SSimon Wunderlich * @chandef: channel definition for the channel 5530430c883SSimon Wunderlich * 5540430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 5550430c883SSimon Wunderlich */ 5560430c883SSimon Wunderlich static inline int 5570430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 5580430c883SSimon Wunderlich { 5590430c883SSimon Wunderlich switch (chandef->width) { 5600430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 5610430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 5620430c883SSimon Wunderlich chandef->chan->max_power); 5630430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 5640430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 5650430c883SSimon Wunderlich chandef->chan->max_power); 5660430c883SSimon Wunderlich default: 5670430c883SSimon Wunderlich break; 5680430c883SSimon Wunderlich } 5690430c883SSimon Wunderlich return chandef->chan->max_power; 5700430c883SSimon Wunderlich } 5710430c883SSimon Wunderlich 5720430c883SSimon Wunderlich /** 57361fa713cSHolger Schurig * enum survey_info_flags - survey information flags 57461fa713cSHolger Schurig * 575abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 57617e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 5774ed20bebSJohannes Berg * @SURVEY_INFO_TIME: active time (in ms) was filled in 5784ed20bebSJohannes Berg * @SURVEY_INFO_TIME_BUSY: busy time was filled in 5794ed20bebSJohannes Berg * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 5804ed20bebSJohannes Berg * @SURVEY_INFO_TIME_RX: receive time was filled in 5814ed20bebSJohannes Berg * @SURVEY_INFO_TIME_TX: transmit time was filled in 582052536abSJohannes Berg * @SURVEY_INFO_TIME_SCAN: scan time was filled in 583abe37c4bSJohannes Berg * 58461fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 58561fa713cSHolger Schurig * it has filled in during the get_survey(). 58661fa713cSHolger Schurig */ 58761fa713cSHolger Schurig enum survey_info_flags { 5884ed20bebSJohannes Berg SURVEY_INFO_NOISE_DBM = BIT(0), 5894ed20bebSJohannes Berg SURVEY_INFO_IN_USE = BIT(1), 5904ed20bebSJohannes Berg SURVEY_INFO_TIME = BIT(2), 5914ed20bebSJohannes Berg SURVEY_INFO_TIME_BUSY = BIT(3), 5924ed20bebSJohannes Berg SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 5934ed20bebSJohannes Berg SURVEY_INFO_TIME_RX = BIT(5), 5944ed20bebSJohannes Berg SURVEY_INFO_TIME_TX = BIT(6), 595052536abSJohannes Berg SURVEY_INFO_TIME_SCAN = BIT(7), 59661fa713cSHolger Schurig }; 59761fa713cSHolger Schurig 59861fa713cSHolger Schurig /** 59961fa713cSHolger Schurig * struct survey_info - channel survey response 60061fa713cSHolger Schurig * 60111f78ac3SJohannes Berg * @channel: the channel this survey record reports, may be %NULL for a single 60211f78ac3SJohannes Berg * record to report global statistics 60361fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 60461fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 60561fa713cSHolger Schurig * optional 6064ed20bebSJohannes Berg * @time: amount of time in ms the radio was turn on (on the channel) 6074ed20bebSJohannes Berg * @time_busy: amount of time the primary channel was sensed busy 6084ed20bebSJohannes Berg * @time_ext_busy: amount of time the extension channel was sensed busy 6094ed20bebSJohannes Berg * @time_rx: amount of time the radio spent receiving data 6104ed20bebSJohannes Berg * @time_tx: amount of time the radio spent transmitting data 611052536abSJohannes Berg * @time_scan: amount of time the radio spent for scanning 61261fa713cSHolger Schurig * 613abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 614abe37c4bSJohannes Berg * 61561fa713cSHolger Schurig * This structure can later be expanded with things like 61661fa713cSHolger Schurig * channel duty cycle etc. 61761fa713cSHolger Schurig */ 61861fa713cSHolger Schurig struct survey_info { 61961fa713cSHolger Schurig struct ieee80211_channel *channel; 6204ed20bebSJohannes Berg u64 time; 6214ed20bebSJohannes Berg u64 time_busy; 6224ed20bebSJohannes Berg u64 time_ext_busy; 6234ed20bebSJohannes Berg u64 time_rx; 6244ed20bebSJohannes Berg u64 time_tx; 625052536abSJohannes Berg u64 time_scan; 62661fa713cSHolger Schurig u32 filled; 62761fa713cSHolger Schurig s8 noise; 62861fa713cSHolger Schurig }; 62961fa713cSHolger Schurig 630b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS 4 631b8676221SDavid Spinadel 63261fa713cSHolger Schurig /** 6335fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 6345fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 6355fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 6365fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 6375fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 6385fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 6395fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 6405fb628e9SJouni Malinen * @akm_suites: AKM suites 6415fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 6425fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 6435fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 6445fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 6455fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 6465fb628e9SJouni Malinen * allowed through even on unauthorized ports 6475fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 6485fb628e9SJouni Malinen * protocol frames. 649b8676221SDavid Spinadel * @wep_keys: static WEP keys, if not NULL points to an array of 650b8676221SDavid Spinadel * CFG80211_MAX_WEP_KEYS WEP keys 651b8676221SDavid Spinadel * @wep_tx_key: key index (0..3) of the default TX static WEP key 65291b5ab62SEliad Peller * @psk: PSK (for devices supporting 4-way-handshake offload) 6535fb628e9SJouni Malinen */ 6545fb628e9SJouni Malinen struct cfg80211_crypto_settings { 6555fb628e9SJouni Malinen u32 wpa_versions; 6565fb628e9SJouni Malinen u32 cipher_group; 6575fb628e9SJouni Malinen int n_ciphers_pairwise; 6585fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 6595fb628e9SJouni Malinen int n_akm_suites; 6605fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 6615fb628e9SJouni Malinen bool control_port; 6625fb628e9SJouni Malinen __be16 control_port_ethertype; 6635fb628e9SJouni Malinen bool control_port_no_encrypt; 664b8676221SDavid Spinadel struct key_params *wep_keys; 665b8676221SDavid Spinadel int wep_tx_key; 66691b5ab62SEliad Peller const u8 *psk; 6675fb628e9SJouni Malinen }; 6685fb628e9SJouni Malinen 6695fb628e9SJouni Malinen /** 6708860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 671ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 672ed1b6cc7SJohannes Berg * or %NULL if not changed 673ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 674ed1b6cc7SJohannes Berg * or %NULL if not changed 675ed1b6cc7SJohannes Berg * @head_len: length of @head 676ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6779946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6789946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6799946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6809946ecfbSJouni Malinen * frames or %NULL 6819946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6829946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6839946ecfbSJouni Malinen * Response frames or %NULL 6849946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 68500f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 68600f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 687ed1b6cc7SJohannes Berg */ 6888860020eSJohannes Berg struct cfg80211_beacon_data { 6898860020eSJohannes Berg const u8 *head, *tail; 6908860020eSJohannes Berg const u8 *beacon_ies; 6918860020eSJohannes Berg const u8 *proberesp_ies; 6928860020eSJohannes Berg const u8 *assocresp_ies; 6938860020eSJohannes Berg const u8 *probe_resp; 6948860020eSJohannes Berg 6958860020eSJohannes Berg size_t head_len, tail_len; 6968860020eSJohannes Berg size_t beacon_ies_len; 6978860020eSJohannes Berg size_t proberesp_ies_len; 6988860020eSJohannes Berg size_t assocresp_ies_len; 6998860020eSJohannes Berg size_t probe_resp_len; 7008860020eSJohannes Berg }; 7018860020eSJohannes Berg 7026d45a74bSVasanthakumar Thiagarajan struct mac_address { 7036d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 7046d45a74bSVasanthakumar Thiagarajan }; 7056d45a74bSVasanthakumar Thiagarajan 7068860020eSJohannes Berg /** 70777765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 70877765eafSVasanthakumar Thiagarajan * 70977765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 710077f897aSJohannes Berg * entry specified by mac_addr 71177765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 71277765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 71377765eafSVasanthakumar Thiagarajan */ 71477765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 71577765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 71677765eafSVasanthakumar Thiagarajan int n_acl_entries; 71777765eafSVasanthakumar Thiagarajan 71877765eafSVasanthakumar Thiagarajan /* Keep it last */ 71977765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 72077765eafSVasanthakumar Thiagarajan }; 72177765eafSVasanthakumar Thiagarajan 722a7c7fbffSPurushottam Kushwaha /* 723a7c7fbffSPurushottam Kushwaha * cfg80211_bitrate_mask - masks for bitrate control 724a7c7fbffSPurushottam Kushwaha */ 725a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask { 726a7c7fbffSPurushottam Kushwaha struct { 727a7c7fbffSPurushottam Kushwaha u32 legacy; 728a7c7fbffSPurushottam Kushwaha u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 729a7c7fbffSPurushottam Kushwaha u16 vht_mcs[NL80211_VHT_NSS_MAX]; 730a7c7fbffSPurushottam Kushwaha enum nl80211_txrate_gi gi; 731a7c7fbffSPurushottam Kushwaha } control[NUM_NL80211_BANDS]; 732a7c7fbffSPurushottam Kushwaha }; 733a7c7fbffSPurushottam Kushwaha 7348860020eSJohannes Berg /** 7358860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 7368860020eSJohannes Berg * 7378860020eSJohannes Berg * Used to configure an AP interface. 7388860020eSJohannes Berg * 739683b6d3bSJohannes Berg * @chandef: defines the channel to use 7408860020eSJohannes Berg * @beacon: beacon data 7418860020eSJohannes Berg * @beacon_interval: beacon interval 7428860020eSJohannes Berg * @dtim_period: DTIM period 7438860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 7448860020eSJohannes Berg * user space) 7458860020eSJohannes Berg * @ssid_len: length of @ssid 7468860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 7478860020eSJohannes Berg * @crypto: crypto settings 7488860020eSJohannes Berg * @privacy: the BSS uses privacy 7498860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 75018998c38SEliad Peller * @smps_mode: SMPS mode 7511b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 75253cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 75353cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 75477765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 75577765eafSVasanthakumar Thiagarajan * MAC address based access control 75634d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 75734d50519SLior David * networks. 7588564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 75966cd794eSJohannes Berg * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 76066cd794eSJohannes Berg * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 76166cd794eSJohannes Berg * @ht_required: stations must support HT 76266cd794eSJohannes Berg * @vht_required: stations must support VHT 7638860020eSJohannes Berg */ 7648860020eSJohannes Berg struct cfg80211_ap_settings { 765683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 766aa430da4SJohannes Berg 7678860020eSJohannes Berg struct cfg80211_beacon_data beacon; 7688860020eSJohannes Berg 7698860020eSJohannes Berg int beacon_interval, dtim_period; 77032e9de84SJouni Malinen const u8 *ssid; 77132e9de84SJouni Malinen size_t ssid_len; 77232e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 7735fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 7745fb628e9SJouni Malinen bool privacy; 7755fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 77618998c38SEliad Peller enum nl80211_smps_mode smps_mode; 7771b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 77853cabad7SJohannes Berg u8 p2p_ctwindow; 77953cabad7SJohannes Berg bool p2p_opp_ps; 78077765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 78134d50519SLior David bool pbss; 782a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask beacon_rate; 78366cd794eSJohannes Berg 78466cd794eSJohannes Berg const struct ieee80211_ht_cap *ht_cap; 78566cd794eSJohannes Berg const struct ieee80211_vht_cap *vht_cap; 78666cd794eSJohannes Berg bool ht_required, vht_required; 787ed1b6cc7SJohannes Berg }; 788ed1b6cc7SJohannes Berg 7895727ef1bSJohannes Berg /** 79016ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 79116ef1fe2SSimon Wunderlich * 79216ef1fe2SSimon Wunderlich * Used for channel switch 79316ef1fe2SSimon Wunderlich * 79416ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 79516ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7969a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7979a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7989a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7999a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 80016ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 80116ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 80216ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 80316ef1fe2SSimon Wunderlich * @count: number of beacons until switch 80416ef1fe2SSimon Wunderlich */ 80516ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 80616ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 80716ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 8089a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 8099a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 8109a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 8119a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 81216ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 81316ef1fe2SSimon Wunderlich bool radar_required; 81416ef1fe2SSimon Wunderlich bool block_tx; 81516ef1fe2SSimon Wunderlich u8 count; 81616ef1fe2SSimon Wunderlich }; 81716ef1fe2SSimon Wunderlich 81851a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 81951a1aaa6SJohannes Berg 82016ef1fe2SSimon Wunderlich /** 821e227300cSPurushottam Kushwaha * struct iface_combination_params - input parameters for interface combinations 822e227300cSPurushottam Kushwaha * 823e227300cSPurushottam Kushwaha * Used to pass interface combination parameters 824e227300cSPurushottam Kushwaha * 825e227300cSPurushottam Kushwaha * @num_different_channels: the number of different channels we want 826e227300cSPurushottam Kushwaha * to use for verification 827e227300cSPurushottam Kushwaha * @radar_detect: a bitmap where each bit corresponds to a channel 828e227300cSPurushottam Kushwaha * width where radar detection is needed, as in the definition of 829e227300cSPurushottam Kushwaha * &struct ieee80211_iface_combination.@radar_detect_widths 830e227300cSPurushottam Kushwaha * @iftype_num: array with the number of interfaces of each interface 831e227300cSPurushottam Kushwaha * type. The index is the interface type as specified in &enum 832e227300cSPurushottam Kushwaha * nl80211_iftype. 8334c8dea63SJohannes Berg * @new_beacon_int: set this to the beacon interval of a new interface 8344c8dea63SJohannes Berg * that's not operating yet, if such is to be checked as part of 8354c8dea63SJohannes Berg * the verification 836e227300cSPurushottam Kushwaha */ 837e227300cSPurushottam Kushwaha struct iface_combination_params { 838e227300cSPurushottam Kushwaha int num_different_channels; 839e227300cSPurushottam Kushwaha u8 radar_detect; 840e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 8414c8dea63SJohannes Berg u32 new_beacon_int; 842e227300cSPurushottam Kushwaha }; 843e227300cSPurushottam Kushwaha 844e227300cSPurushottam Kushwaha /** 8453b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 8463b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 8479d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 848f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 8493b9ce80cSJohannes Berg * 8503b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 8513b9ce80cSJohannes Berg * for those that don't these flags will are used. 8523b9ce80cSJohannes Berg */ 8533b9ce80cSJohannes Berg enum station_parameters_apply_mask { 8543b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 8559d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 856f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 8573b9ce80cSJohannes Berg }; 8583b9ce80cSJohannes Berg 8593b9ce80cSJohannes Berg /** 8605727ef1bSJohannes Berg * struct station_parameters - station parameters 8615727ef1bSJohannes Berg * 8625727ef1bSJohannes Berg * Used to change and create a new station. 8635727ef1bSJohannes Berg * 8645727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 8655727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 8665727ef1bSJohannes Berg * (or NULL for no change) 8675727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 868eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 869819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 870eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 871819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 8725727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 8735727ef1bSJohannes Berg * @aid: AID or zero for no change 8747d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 875abe37c4bSJohannes Berg * @plink_action: plink action to take 8769c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 877abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 878f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 879910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 880910868dbSEliad Peller * as the AC bitmap in the QoS info field 881910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 882910868dbSEliad Peller * QoS info field (but already shifted down) 883c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 884c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 885c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 8863b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 8873b1c5a53SMarco Porsch * to unknown) 8889d62a986SJouni Malinen * @capability: station capability 8899d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 8909d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 891c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 892c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 893c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 894c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 89560f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 89660f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 89717b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 8985727ef1bSJohannes Berg */ 8995727ef1bSJohannes Berg struct station_parameters { 9002c1aabf3SJohannes Berg const u8 *supported_rates; 9015727ef1bSJohannes Berg struct net_device *vlan; 902eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 9033b9ce80cSJohannes Berg u32 sta_modify_mask; 9045727ef1bSJohannes Berg int listen_interval; 9055727ef1bSJohannes Berg u16 aid; 9067d27a0baSMasashi Honma u16 peer_aid; 9075727ef1bSJohannes Berg u8 supported_rates_len; 9082ec600d6SLuis Carlos Cobo u8 plink_action; 9099c3990aaSJavier Cardona u8 plink_state; 9102c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 9112c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 912c75786c9SEliad Peller u8 uapsd_queues; 913c75786c9SEliad Peller u8 max_sp; 9143b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 9159d62a986SJouni Malinen u16 capability; 9162c1aabf3SJohannes Berg const u8 *ext_capab; 9179d62a986SJouni Malinen u8 ext_capab_len; 918c01fc9adSSunil Dutt const u8 *supported_channels; 919c01fc9adSSunil Dutt u8 supported_channels_len; 920c01fc9adSSunil Dutt const u8 *supported_oper_classes; 921c01fc9adSSunil Dutt u8 supported_oper_classes_len; 92260f4a7b1SMarek Kwaczynski u8 opmode_notif; 92360f4a7b1SMarek Kwaczynski bool opmode_notif_used; 92417b94247SAyala Beker int support_p2p_ps; 9255727ef1bSJohannes Berg }; 9265727ef1bSJohannes Berg 927fd5b74dcSJohannes Berg /** 92889c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 92989c771e5SJouni Malinen * 93089c771e5SJouni Malinen * Used to delete a station entry (or all stations). 93189c771e5SJouni Malinen * 93289c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 93398856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 93498856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 93598856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 93689c771e5SJouni Malinen */ 93789c771e5SJouni Malinen struct station_del_parameters { 93889c771e5SJouni Malinen const u8 *mac; 93998856866SJouni Malinen u8 subtype; 94098856866SJouni Malinen u16 reason_code; 94189c771e5SJouni Malinen }; 94289c771e5SJouni Malinen 94389c771e5SJouni Malinen /** 94477ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 94577ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 94647edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 94747edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 94877ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 94977ee7c89SJohannes Berg * the AP MLME in the device 95077ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 95177ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 95277ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 95377ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 95477ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 95577ee7c89SJohannes Berg * supported/used) 95677ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 95777ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 958eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 959eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 96077ee7c89SJohannes Berg */ 96177ee7c89SJohannes Berg enum cfg80211_station_type { 96277ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 96347edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 96477ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 96577ee7c89SJohannes Berg CFG80211_STA_AP_STA, 96677ee7c89SJohannes Berg CFG80211_STA_IBSS, 96777ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 96877ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 969eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 970eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 97177ee7c89SJohannes Berg }; 97277ee7c89SJohannes Berg 97377ee7c89SJohannes Berg /** 97477ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 97577ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 97677ee7c89SJohannes Berg * @params: the new parameters for a station 97777ee7c89SJohannes Berg * @statype: the type of station being modified 97877ee7c89SJohannes Berg * 97977ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 98077ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 98177ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 98277ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 98377ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 98477ee7c89SJohannes Berg */ 98577ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 98677ee7c89SJohannes Berg struct station_parameters *params, 98777ee7c89SJohannes Berg enum cfg80211_station_type statype); 98877ee7c89SJohannes Berg 98977ee7c89SJohannes Berg /** 990420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 991420e7fabSHenning Rogge * 992420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 993420e7fabSHenning Rogge * type for 802.11n transmissions. 994420e7fabSHenning Rogge * 995db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 996db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 997420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 998db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 999420e7fabSHenning Rogge */ 1000420e7fabSHenning Rogge enum rate_info_flags { 1001db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 1002db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 1003b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 1004b51f3beeSJohannes Berg RATE_INFO_FLAGS_60G = BIT(3), 1005b51f3beeSJohannes Berg }; 1006b51f3beeSJohannes Berg 1007b51f3beeSJohannes Berg /** 1008b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 1009b51f3beeSJohannes Berg * 1010b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 1011b51f3beeSJohannes Berg * 1012b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 1013b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 1014b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 1015b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 1016b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 1017b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 1018b51f3beeSJohannes Berg */ 1019b51f3beeSJohannes Berg enum rate_info_bw { 1020842be75cSJohannes Berg RATE_INFO_BW_20 = 0, 1021b51f3beeSJohannes Berg RATE_INFO_BW_5, 1022b51f3beeSJohannes Berg RATE_INFO_BW_10, 1023b51f3beeSJohannes Berg RATE_INFO_BW_40, 1024b51f3beeSJohannes Berg RATE_INFO_BW_80, 1025b51f3beeSJohannes Berg RATE_INFO_BW_160, 1026420e7fabSHenning Rogge }; 1027420e7fabSHenning Rogge 1028420e7fabSHenning Rogge /** 1029420e7fabSHenning Rogge * struct rate_info - bitrate information 1030420e7fabSHenning Rogge * 1031420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 1032420e7fabSHenning Rogge * 1033420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 1034420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 1035420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 1036db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 1037b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 1038420e7fabSHenning Rogge */ 1039420e7fabSHenning Rogge struct rate_info { 1040420e7fabSHenning Rogge u8 flags; 1041420e7fabSHenning Rogge u8 mcs; 1042420e7fabSHenning Rogge u16 legacy; 1043db9c64cfSJohannes Berg u8 nss; 1044b51f3beeSJohannes Berg u8 bw; 1045fd5b74dcSJohannes Berg }; 1046fd5b74dcSJohannes Berg 1047fd5b74dcSJohannes Berg /** 1048f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 1049f4263c98SPaul Stewart * 1050f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1051f4263c98SPaul Stewart * type for 802.11n transmissions. 1052f4263c98SPaul Stewart * 1053f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1054f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1055f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1056f4263c98SPaul Stewart */ 1057f4263c98SPaul Stewart enum bss_param_flags { 1058f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1059f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1060f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1061f4263c98SPaul Stewart }; 1062f4263c98SPaul Stewart 1063f4263c98SPaul Stewart /** 1064f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1065f4263c98SPaul Stewart * 1066f4263c98SPaul Stewart * Information about the currently associated BSS 1067f4263c98SPaul Stewart * 1068f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1069f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1070f4263c98SPaul Stewart * @beacon_interval: beacon interval 1071f4263c98SPaul Stewart */ 1072f4263c98SPaul Stewart struct sta_bss_parameters { 1073f4263c98SPaul Stewart u8 flags; 1074f4263c98SPaul Stewart u8 dtim_period; 1075f4263c98SPaul Stewart u16 beacon_interval; 1076f4263c98SPaul Stewart }; 1077f4263c98SPaul Stewart 10786de39808SJohannes Berg /** 10796de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 10806de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 10816de39808SJohannes Berg * indicate the relevant values in this struct are filled 10826de39808SJohannes Berg * @rx_msdu: number of received MSDUs 10836de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 10846de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 10856de39808SJohannes Berg * transmitted MSDUs 10866de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 10876de39808SJohannes Berg */ 10886de39808SJohannes Berg struct cfg80211_tid_stats { 10896de39808SJohannes Berg u32 filled; 10906de39808SJohannes Berg u64 rx_msdu; 10916de39808SJohannes Berg u64 tx_msdu; 10926de39808SJohannes Berg u64 tx_msdu_retries; 10936de39808SJohannes Berg u64 tx_msdu_failed; 10946de39808SJohannes Berg }; 10956de39808SJohannes Berg 1096119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1097119363c7SFelix Fietkau 1098f4263c98SPaul Stewart /** 10992ec600d6SLuis Carlos Cobo * struct station_info - station information 1100fd5b74dcSJohannes Berg * 11012ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1102fd5b74dcSJohannes Berg * 1103319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1104319090bfSJohannes Berg * indicate the relevant values in this struct for them 1105ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1106fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 11078d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 11088d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 11092ec600d6SLuis Carlos Cobo * @llid: mesh local link id 11102ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 11112ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 111273c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 111373c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 111473c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 111573c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1116119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1117119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1118119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1119858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1120858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 11218d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 11228d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 11238d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 11248d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 11255a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 11261ba01458SRandy Dunlap * @bss_param: current BSS parameters 1127f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1128f5ea9120SJohannes Berg * This number should increase every time the list of stations 1129f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1130f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 113150d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 113250d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 113350d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 113450d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 113550d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1136c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1137a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1138d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 11393b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 11403b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 11413b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1142867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1143867d849fSAntonio Quartulli * towards this station. 1144a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1145a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1146a76b1942SJohannes Berg * from this peer 1147739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 11486de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 11496de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1150c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the last ACK frame. 1151fd5b74dcSJohannes Berg */ 11522ec600d6SLuis Carlos Cobo struct station_info { 1153739960f1SMohammed Shafi Shajakhan u64 filled; 1154ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1155fd5b74dcSJohannes Berg u32 inactive_time; 115642745e03SVladimir Kondratiev u64 rx_bytes; 115742745e03SVladimir Kondratiev u64 tx_bytes; 11582ec600d6SLuis Carlos Cobo u16 llid; 11592ec600d6SLuis Carlos Cobo u16 plid; 11602ec600d6SLuis Carlos Cobo u8 plink_state; 1161420e7fabSHenning Rogge s8 signal; 1162541a45a1SBruno Randolf s8 signal_avg; 1163119363c7SFelix Fietkau 1164119363c7SFelix Fietkau u8 chains; 1165119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1166119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1167119363c7SFelix Fietkau 1168420e7fabSHenning Rogge struct rate_info txrate; 1169c8dcfd8aSFelix Fietkau struct rate_info rxrate; 117098c8a60aSJouni Malinen u32 rx_packets; 117198c8a60aSJouni Malinen u32 tx_packets; 1172b206b4efSBruno Randolf u32 tx_retries; 1173b206b4efSBruno Randolf u32 tx_failed; 11745a5c731aSBen Greear u32 rx_dropped_misc; 1175f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1176bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1177f5ea9120SJohannes Berg 1178f5ea9120SJohannes Berg int generation; 117950d3dfb7SJouni Malinen 118050d3dfb7SJouni Malinen const u8 *assoc_req_ies; 118150d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1182f612cedfSJouni Malinen 1183a85e1d55SPaul Stewart u32 beacon_loss_count; 1184d299a1f2SJavier Cardona s64 t_offset; 11853b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 11863b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 11873b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1188a85e1d55SPaul Stewart 1189867d849fSAntonio Quartulli u32 expected_throughput; 1190a76b1942SJohannes Berg 1191a76b1942SJohannes Berg u64 rx_beacon; 1192739960f1SMohammed Shafi Shajakhan u64 rx_duration; 1193a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 11946de39808SJohannes Berg struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1195c4b50cd3SVenkateswara Naralasetty s8 ack_signal; 1196fd5b74dcSJohannes Berg }; 1197fd5b74dcSJohannes Berg 119861aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 119966f7ac50SMichael Wu /** 12007406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 12017406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 12027406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 12037406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 12047406353dSAntonio Quartulli * 12057406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 12067406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 12077406353dSAntonio Quartulli * considered undefined. 12087406353dSAntonio Quartulli */ 12097406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 12107406353dSAntonio Quartulli struct station_info *sinfo); 121161aaa0e8SLinus Lüssing #else 121261aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 121361aaa0e8SLinus Lüssing const u8 *mac_addr, 121461aaa0e8SLinus Lüssing struct station_info *sinfo) 121561aaa0e8SLinus Lüssing { 121661aaa0e8SLinus Lüssing return -ENOENT; 121761aaa0e8SLinus Lüssing } 121861aaa0e8SLinus Lüssing #endif 12197406353dSAntonio Quartulli 12207406353dSAntonio Quartulli /** 122166f7ac50SMichael Wu * enum monitor_flags - monitor flags 122266f7ac50SMichael Wu * 122366f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 122466f7ac50SMichael Wu * according to the nl80211 flags. 122566f7ac50SMichael Wu * 1226818a986eSJohannes Berg * @MONITOR_FLAG_CHANGED: set if the flags were changed 122766f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 122866f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 122966f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 123066f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 123166f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1232e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 123366f7ac50SMichael Wu */ 123466f7ac50SMichael Wu enum monitor_flags { 1235818a986eSJohannes Berg MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID, 123666f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 123766f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 123866f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 123966f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 124066f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1241e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 124266f7ac50SMichael Wu }; 124366f7ac50SMichael Wu 12442ec600d6SLuis Carlos Cobo /** 12452ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 12462ec600d6SLuis Carlos Cobo * 12472ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 12482ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 12492ec600d6SLuis Carlos Cobo * 1250abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1251abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1252abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1253abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1254abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1255abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1256abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 12572ec600d6SLuis Carlos Cobo */ 12582ec600d6SLuis Carlos Cobo enum mpath_info_flags { 12592ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1260d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 12612ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 12622ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 12632ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 12642ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 12652ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 12662ec600d6SLuis Carlos Cobo }; 12672ec600d6SLuis Carlos Cobo 12682ec600d6SLuis Carlos Cobo /** 12692ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 12702ec600d6SLuis Carlos Cobo * 12712ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 12722ec600d6SLuis Carlos Cobo * 12732ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 12742ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1275d19b3bf6SRui Paulo * @sn: target sequence number 12762ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 12772ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 12782ec600d6SLuis Carlos Cobo * @flags: mesh path flags 12792ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 12802ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1281f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1282f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1283f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1284f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 12852ec600d6SLuis Carlos Cobo */ 12862ec600d6SLuis Carlos Cobo struct mpath_info { 12872ec600d6SLuis Carlos Cobo u32 filled; 12882ec600d6SLuis Carlos Cobo u32 frame_qlen; 1289d19b3bf6SRui Paulo u32 sn; 12902ec600d6SLuis Carlos Cobo u32 metric; 12912ec600d6SLuis Carlos Cobo u32 exptime; 12922ec600d6SLuis Carlos Cobo u32 discovery_timeout; 12932ec600d6SLuis Carlos Cobo u8 discovery_retries; 12942ec600d6SLuis Carlos Cobo u8 flags; 1295f5ea9120SJohannes Berg 1296f5ea9120SJohannes Berg int generation; 12972ec600d6SLuis Carlos Cobo }; 12982ec600d6SLuis Carlos Cobo 12999f1ba906SJouni Malinen /** 13009f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 13019f1ba906SJouni Malinen * 13029f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 13039f1ba906SJouni Malinen * 13049f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 13059f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 13069f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 13079f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 13089f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 13099f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 131090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 131190c97a04SJouni Malinen * (or NULL for no change) 131290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1313fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 131450b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 131550b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 131653cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 131753cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 13189f1ba906SJouni Malinen */ 13199f1ba906SJouni Malinen struct bss_parameters { 13209f1ba906SJouni Malinen int use_cts_prot; 13219f1ba906SJouni Malinen int use_short_preamble; 13229f1ba906SJouni Malinen int use_short_slot_time; 1323c1e5f471SJohannes Berg const u8 *basic_rates; 132490c97a04SJouni Malinen u8 basic_rates_len; 1325fd8aaaf3SFelix Fietkau int ap_isolate; 132650b12f59SHelmut Schaa int ht_opmode; 132753cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 13289f1ba906SJouni Malinen }; 13292ec600d6SLuis Carlos Cobo 13303ddd53f3SChun-Yeow Yeoh /** 133129cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 133229cbe68cSJohannes Berg * 133329cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 13343ddd53f3SChun-Yeow Yeoh * 13353ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 13363ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 13373ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 13383ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 13393ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 13403ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 13413ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 13423ddd53f3SChun-Yeow Yeoh * mesh interface 13433ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 13443ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 13453ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 13463ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 13473ddd53f3SChun-Yeow Yeoh * elements 13483ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 13493ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 13503ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 13513ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 13523ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 13533ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 13543ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 13553ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 13563ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 13573ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 13583ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 13593ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 13603ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 13613ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 13623ddd53f3SChun-Yeow Yeoh * element 13633ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 13643ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 13653ddd53f3SChun-Yeow Yeoh * element 13663ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 13673ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 13683ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 13693ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 13703ddd53f3SChun-Yeow Yeoh * announcements are transmitted 13713ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 13723ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 13733ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 13743ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 13753ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 13763ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 13773ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 13783ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 13793ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 13803ddd53f3SChun-Yeow Yeoh * station to establish a peer link 13813ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1382ac1073a6SChun-Yeow Yeoh * 1383ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1384ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1385ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1386ac1073a6SChun-Yeow Yeoh * 1387ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1388ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1389728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1390728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1391728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 13923b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 13933b1c5a53SMarco Porsch * setting for new peer links. 13943b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 13953b1c5a53SMarco Porsch * after transmitting its beacon. 13968e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 13978e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 13988e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 139929cbe68cSJohannes Berg */ 140093da9cc1Scolin@cozybit.com struct mesh_config { 140193da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 140293da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 140393da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 140493da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 140593da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 140693da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 140745904f21SJavier Cardona u8 element_ttl; 140893da9cc1Scolin@cozybit.com bool auto_open_plinks; 1409d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 141093da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 141193da9cc1Scolin@cozybit.com u32 path_refresh_time; 141293da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 141393da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 141493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1415dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 141693da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 141763c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 14180507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 141916dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 142094f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 142155335137SAshok Nagarajan s32 rssi_threshold; 142270c33eaaSAshok Nagarajan u16 ht_opmode; 1423ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1424ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1425728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 14263b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 14273b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 14288e7c0538SColleen Twitty u32 plink_timeout; 142993da9cc1Scolin@cozybit.com }; 143093da9cc1Scolin@cozybit.com 143131888487SJouni Malinen /** 143229cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1433683b6d3bSJohannes Berg * @chandef: defines the channel to use 143429cbe68cSJohannes Berg * @mesh_id: the mesh ID 143529cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1436d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1437c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1438c80d545dSJavier Cardona * @path_metric: which metric to use 14396e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1440581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1441581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1442b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1443b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1444bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 14459bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 14469bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 14474bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1448ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 14498564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 1450d37d49c2SBenjamin Berg * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 1451d37d49c2SBenjamin Berg * changes the channel when a radar is detected. This is required 1452d37d49c2SBenjamin Berg * to operate on DFS channels. 145329cbe68cSJohannes Berg * 145429cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 145529cbe68cSJohannes Berg */ 145629cbe68cSJohannes Berg struct mesh_setup { 1457683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 145829cbe68cSJohannes Berg const u8 *mesh_id; 145929cbe68cSJohannes Berg u8 mesh_id_len; 1460d299a1f2SJavier Cardona u8 sync_method; 1461c80d545dSJavier Cardona u8 path_sel_proto; 1462c80d545dSJavier Cardona u8 path_metric; 14636e16d90bSColleen Twitty u8 auth_id; 1464581a8b0fSJavier Cardona const u8 *ie; 1465581a8b0fSJavier Cardona u8 ie_len; 1466b130e5ceSJavier Cardona bool is_authenticated; 146715d5dda6SJavier Cardona bool is_secure; 1468bb2798d4SThomas Pedersen bool user_mpm; 14699bdbf04dSMarco Porsch u8 dtim_period; 14709bdbf04dSMarco Porsch u16 beacon_interval; 147157fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1472ffb3cf30SAshok Nagarajan u32 basic_rates; 14738564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 1474d37d49c2SBenjamin Berg bool userspace_handles_dfs; 147529cbe68cSJohannes Berg }; 147629cbe68cSJohannes Berg 147729cbe68cSJohannes Berg /** 14786e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 14796e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 14806e0bd6c3SRostislav Lisovy * 14816e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 14826e0bd6c3SRostislav Lisovy */ 14836e0bd6c3SRostislav Lisovy struct ocb_setup { 14846e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 14856e0bd6c3SRostislav Lisovy }; 14866e0bd6c3SRostislav Lisovy 14876e0bd6c3SRostislav Lisovy /** 148831888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1489a3304b0aSJohannes Berg * @ac: AC identifier 149031888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 149131888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 149231888487SJouni Malinen * 1..32767] 149331888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 149431888487SJouni Malinen * 1..32767] 149531888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 149631888487SJouni Malinen */ 149731888487SJouni Malinen struct ieee80211_txq_params { 1498a3304b0aSJohannes Berg enum nl80211_ac ac; 149931888487SJouni Malinen u16 txop; 150031888487SJouni Malinen u16 cwmin; 150131888487SJouni Malinen u16 cwmax; 150231888487SJouni Malinen u8 aifs; 150331888487SJouni Malinen }; 150431888487SJouni Malinen 1505d70e9693SJohannes Berg /** 1506d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1507d70e9693SJohannes Berg * 1508d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1509d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1510d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1511d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1512d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1513d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1514d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1515d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1516d70e9693SJohannes Berg * in the wiphy structure. 1517d70e9693SJohannes Berg * 1518d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1519d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1520d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1521d70e9693SJohannes Berg * 1522d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1523d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1524d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1525d70e9693SJohannes Berg * to userspace. 1526d70e9693SJohannes Berg */ 152772bdcf34SJouni Malinen 1528704232c2SJohannes Berg /** 15292a519311SJohannes Berg * struct cfg80211_ssid - SSID description 15302a519311SJohannes Berg * @ssid: the SSID 15312a519311SJohannes Berg * @ssid_len: length of the ssid 15322a519311SJohannes Berg */ 15332a519311SJohannes Berg struct cfg80211_ssid { 15342a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 15352a519311SJohannes Berg u8 ssid_len; 15362a519311SJohannes Berg }; 15372a519311SJohannes Berg 15382a519311SJohannes Berg /** 15391d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 15401d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 15411d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 15421d76250bSAvraham Stern * information is not available, this field is left zero. 15431d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 15441d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 15451d76250bSAvraham Stern * userspace will be notified of that 15461d76250bSAvraham Stern */ 15471d76250bSAvraham Stern struct cfg80211_scan_info { 15481d76250bSAvraham Stern u64 scan_start_tsf; 15491d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 15501d76250bSAvraham Stern bool aborted; 15511d76250bSAvraham Stern }; 15521d76250bSAvraham Stern 15531d76250bSAvraham Stern /** 15542a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 15552a519311SJohannes Berg * 15562a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 15572a519311SJohannes Berg * @n_ssids: number of SSIDs 15582a519311SJohannes Berg * @channels: channels to scan on. 1559ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1560dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 156170692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 156270692ad2SJouni Malinen * @ie_len: length of ie in octets 15631d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 15641d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 15651d76250bSAvraham Stern * the actual dwell time may be shorter. 15661d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 15671d76250bSAvraham Stern * %duration field. 1568ed473771SSam Leffler * @flags: bit field of flags controlling operation 156934850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 15702a519311SJohannes Berg * @wiphy: the wiphy this was for 157115d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1572fd014284SJohannes Berg * @wdev: the wireless device to scan for 15731d76250bSAvraham Stern * @info: (internal) information about completed scan 15745fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1575e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1576ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1577ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1578ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1579ad2b26abSJohannes Berg * be taken from the @mac_addr 1580818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 15812a519311SJohannes Berg */ 15822a519311SJohannes Berg struct cfg80211_scan_request { 15832a519311SJohannes Berg struct cfg80211_ssid *ssids; 15842a519311SJohannes Berg int n_ssids; 15852a519311SJohannes Berg u32 n_channels; 1586dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1587de95a54bSJohannes Berg const u8 *ie; 158870692ad2SJouni Malinen size_t ie_len; 15891d76250bSAvraham Stern u16 duration; 15901d76250bSAvraham Stern bool duration_mandatory; 1591ed473771SSam Leffler u32 flags; 15922a519311SJohannes Berg 159357fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 159434850ab2SJohannes Berg 1595fd014284SJohannes Berg struct wireless_dev *wdev; 1596fd014284SJohannes Berg 1597ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1598ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1599818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 1600ad2b26abSJohannes Berg 16012a519311SJohannes Berg /* internal */ 16022a519311SJohannes Berg struct wiphy *wiphy; 160315d6030bSSam Leffler unsigned long scan_start; 16041d76250bSAvraham Stern struct cfg80211_scan_info info; 16051d76250bSAvraham Stern bool notified; 1606e9f935e3SRajkumar Manoharan bool no_cck; 16075ba63533SJohannes Berg 16085ba63533SJohannes Berg /* keep last */ 16095ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 16102a519311SJohannes Berg }; 16112a519311SJohannes Berg 1612ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1613ad2b26abSJohannes Berg { 1614ad2b26abSJohannes Berg int i; 1615ad2b26abSJohannes Berg 1616ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1617ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1618ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1619ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1620ad2b26abSJohannes Berg } 1621ad2b26abSJohannes Berg } 1622ad2b26abSJohannes Berg 16232a519311SJohannes Berg /** 1624a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1625a1f1c21cSLuciano Coelho * 16263007e352SArend Van Spriel * @ssid: SSID to be matched; may be zero-length in case of BSSID match 16273007e352SArend Van Spriel * or no match (RSSI only) 16283007e352SArend Van Spriel * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 16293007e352SArend Van Spriel * or no match (RSSI only) 1630ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1631a1f1c21cSLuciano Coelho */ 1632a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1633a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 16343007e352SArend Van Spriel u8 bssid[ETH_ALEN]; 1635ea73cbceSJohannes Berg s32 rssi_thold; 1636a1f1c21cSLuciano Coelho }; 1637a1f1c21cSLuciano Coelho 1638a1f1c21cSLuciano Coelho /** 16393b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 16403b06d277SAvraham Stern * 16413b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 16423b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 16433b06d277SAvraham Stern * infinite loop. 16443b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 16453b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 16463b06d277SAvraham Stern */ 16473b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 16483b06d277SAvraham Stern u32 interval; 16493b06d277SAvraham Stern u32 iterations; 16503b06d277SAvraham Stern }; 16513b06d277SAvraham Stern 16523b06d277SAvraham Stern /** 1653bf95ecdbSvamsi krishna * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 1654bf95ecdbSvamsi krishna * 1655bf95ecdbSvamsi krishna * @band: band of BSS which should match for RSSI level adjustment. 1656bf95ecdbSvamsi krishna * @delta: value of RSSI level adjustment. 1657bf95ecdbSvamsi krishna */ 1658bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust { 1659bf95ecdbSvamsi krishna enum nl80211_band band; 1660bf95ecdbSvamsi krishna s8 delta; 1661bf95ecdbSvamsi krishna }; 1662bf95ecdbSvamsi krishna 1663bf95ecdbSvamsi krishna /** 1664807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1665807f8a8cSLuciano Coelho * 166696b08fd6SArend Van Spriel * @reqid: identifies this request. 1667807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1668807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1669807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1670dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1671807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1672807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1673ed473771SSam Leffler * @flags: bit field of flags controlling operation 1674a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1675a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1676a1f1c21cSLuciano Coelho * (others are filtered out). 1677a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1678a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 16796406c919SJohannes Berg * @report_results: indicates that results were reported for this request 1680807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1681807f8a8cSLuciano Coelho * @dev: the interface 1682077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1683807f8a8cSLuciano Coelho * @channels: channels to scan 1684ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1685ea73cbceSJohannes Berg * contains the minimum over all matchsets 1686ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1687ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1688ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1689ad2b26abSJohannes Berg * be taken from the @mac_addr 16903b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 16913b06d277SAvraham Stern * index must be executed first. 16923b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 169331a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 169493a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 169593a1e86cSJukka Rissanen * owned by a particular socket) 1696ca986ad9SArend Van Spriel * @nl_owner_dead: netlink owner socket was closed - this request be freed 1697ca986ad9SArend Van Spriel * @list: for keeping list of requests. 16989c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 16999c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 17009c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 17019c748934SLuciano Coelho * supported. 1702bf95ecdbSvamsi krishna * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 1703bf95ecdbSvamsi krishna * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 1704bf95ecdbSvamsi krishna * reporting in connected state to cases where a matching BSS is determined 1705bf95ecdbSvamsi krishna * to have better or slightly worse RSSI than the current connected BSS. 1706bf95ecdbSvamsi krishna * The relative RSSI threshold values are ignored in disconnected state. 1707bf95ecdbSvamsi krishna * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 1708bf95ecdbSvamsi krishna * to the specified band while deciding whether a better BSS is reported 1709bf95ecdbSvamsi krishna * using @relative_rssi. If delta is a negative number, the BSSs that 1710bf95ecdbSvamsi krishna * belong to the specified band will be penalized by delta dB in relative 1711bf95ecdbSvamsi krishna * comparisions. 1712807f8a8cSLuciano Coelho */ 1713807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 171496b08fd6SArend Van Spriel u64 reqid; 1715807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1716807f8a8cSLuciano Coelho int n_ssids; 1717807f8a8cSLuciano Coelho u32 n_channels; 1718dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1719807f8a8cSLuciano Coelho const u8 *ie; 1720807f8a8cSLuciano Coelho size_t ie_len; 1721ed473771SSam Leffler u32 flags; 1722a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1723a1f1c21cSLuciano Coelho int n_match_sets; 1724ea73cbceSJohannes Berg s32 min_rssi_thold; 17259c748934SLuciano Coelho u32 delay; 17263b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 17273b06d277SAvraham Stern int n_scan_plans; 1728807f8a8cSLuciano Coelho 1729ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1730ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1731ad2b26abSJohannes Berg 1732bf95ecdbSvamsi krishna bool relative_rssi_set; 1733bf95ecdbSvamsi krishna s8 relative_rssi; 1734bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust rssi_adjust; 1735bf95ecdbSvamsi krishna 1736807f8a8cSLuciano Coelho /* internal */ 1737807f8a8cSLuciano Coelho struct wiphy *wiphy; 1738807f8a8cSLuciano Coelho struct net_device *dev; 173915d6030bSSam Leffler unsigned long scan_start; 1740b34939b9SArend Van Spriel bool report_results; 174131a60ed1SJukka Rissanen struct rcu_head rcu_head; 174293a1e86cSJukka Rissanen u32 owner_nlportid; 1743ca986ad9SArend Van Spriel bool nl_owner_dead; 1744ca986ad9SArend Van Spriel struct list_head list; 1745807f8a8cSLuciano Coelho 1746807f8a8cSLuciano Coelho /* keep last */ 1747807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1748807f8a8cSLuciano Coelho }; 1749807f8a8cSLuciano Coelho 1750807f8a8cSLuciano Coelho /** 17512a519311SJohannes Berg * enum cfg80211_signal_type - signal type 17522a519311SJohannes Berg * 17532a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 17542a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 17552a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 17562a519311SJohannes Berg */ 17572a519311SJohannes Berg enum cfg80211_signal_type { 17582a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 17592a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 17602a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 17612a519311SJohannes Berg }; 17622a519311SJohannes Berg 17632a519311SJohannes Berg /** 17646e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 17656e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 17666e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 17676e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 17686e19bc4bSDmitry Shmidt * signal type 17696e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 17706e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 17716e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 17726e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 17736e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 17746e19bc4bSDmitry Shmidt * ktime_get_boot_ns() is likely appropriate. 17751d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 17761d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 17771d76250bSAvraham Stern * by %parent_bssid. 17781d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 17791d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 1780983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 1781983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 17826e19bc4bSDmitry Shmidt */ 17836e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 17846e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 17856e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 17866e19bc4bSDmitry Shmidt s32 signal; 17876e19bc4bSDmitry Shmidt u64 boottime_ns; 17881d76250bSAvraham Stern u64 parent_tsf; 17891d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 1790983dafaaSSunil Dutt u8 chains; 1791983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 17926e19bc4bSDmitry Shmidt }; 17936e19bc4bSDmitry Shmidt 17946e19bc4bSDmitry Shmidt /** 17952aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 17968cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 17979caf0364SJohannes Berg * @rcu_head: internal use, for freeing 17989caf0364SJohannes Berg * @len: length of the IEs 17990e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 18009caf0364SJohannes Berg * @data: IE data 18019caf0364SJohannes Berg */ 18029caf0364SJohannes Berg struct cfg80211_bss_ies { 18038cef2c9dSJohannes Berg u64 tsf; 18049caf0364SJohannes Berg struct rcu_head rcu_head; 18059caf0364SJohannes Berg int len; 18060e227084SJohannes Berg bool from_beacon; 18079caf0364SJohannes Berg u8 data[]; 18089caf0364SJohannes Berg }; 18099caf0364SJohannes Berg 18109caf0364SJohannes Berg /** 18112a519311SJohannes Berg * struct cfg80211_bss - BSS description 18122a519311SJohannes Berg * 18132a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 18142a519311SJohannes Berg * for use in scan results and similar. 18152a519311SJohannes Berg * 1816abe37c4bSJohannes Berg * @channel: channel this BSS is on 1817dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 18182a519311SJohannes Berg * @bssid: BSSID of the BSS 18192a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 18202a519311SJohannes Berg * @capability: the capability field in host byte order 182183c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 182283c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 182383c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 182483c7aa1aSJohannes Berg * received. It is always non-%NULL. 182534a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1826776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1827776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1828776b3580SJohannes Berg * @hidden_beacon_bss struct) 182934a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1830776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1831776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1832776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1833776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 183477965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 1835983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 1836983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 18372a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 18382a519311SJohannes Berg */ 18392a519311SJohannes Berg struct cfg80211_bss { 18402a519311SJohannes Berg struct ieee80211_channel *channel; 1841dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 18422a519311SJohannes Berg 18439caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 18449caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 18459caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 18469caf0364SJohannes Berg 1847776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 18482a519311SJohannes Berg 18492a519311SJohannes Berg s32 signal; 18502a519311SJohannes Berg 18519caf0364SJohannes Berg u16 beacon_interval; 18529caf0364SJohannes Berg u16 capability; 18539caf0364SJohannes Berg 18549caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 1855983dafaaSSunil Dutt u8 chains; 1856983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 18579caf0364SJohannes Berg 18581c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 18592a519311SJohannes Berg }; 18602a519311SJohannes Berg 18612a519311SJohannes Berg /** 1862517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1863517357c6SJohannes Berg * @bss: the bss to search 1864517357c6SJohannes Berg * @ie: the IE ID 18659caf0364SJohannes Berg * 18669caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 18679caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 18680ae997dcSYacine Belkadi * Return: %NULL if not found. 1869517357c6SJohannes Berg */ 1870517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1871517357c6SJohannes Berg 1872517357c6SJohannes Berg 1873517357c6SJohannes Berg /** 1874636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1875636a5d36SJouni Malinen * 1876636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1877636a5d36SJouni Malinen * authentication. 1878636a5d36SJouni Malinen * 1879959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1880959867faSJohannes Berg * to it if it needs to keep it. 1881636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1882636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1883636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1884fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1885fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1886fffd0934SJohannes Berg * @key: WEP key for shared key authentication 188711b6b5a4SJouni Malinen * @auth_data: Fields and elements in Authentication frames. This contains 188811b6b5a4SJouni Malinen * the authentication frame body (non-IE and IE data), excluding the 188911b6b5a4SJouni Malinen * Authentication algorithm number, i.e., starting at the Authentication 189011b6b5a4SJouni Malinen * transaction sequence number field. 189111b6b5a4SJouni Malinen * @auth_data_len: Length of auth_data buffer in octets 1892636a5d36SJouni Malinen */ 1893636a5d36SJouni Malinen struct cfg80211_auth_request { 189419957bb3SJohannes Berg struct cfg80211_bss *bss; 1895636a5d36SJouni Malinen const u8 *ie; 1896636a5d36SJouni Malinen size_t ie_len; 189719957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1898fffd0934SJohannes Berg const u8 *key; 1899fffd0934SJohannes Berg u8 key_len, key_idx; 190011b6b5a4SJouni Malinen const u8 *auth_data; 190111b6b5a4SJouni Malinen size_t auth_data_len; 1902636a5d36SJouni Malinen }; 1903636a5d36SJouni Malinen 1904636a5d36SJouni Malinen /** 19057e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 19067e7c8926SBen Greear * 19077e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1908ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1909bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 191040cbfa90SSrinivas Dasari * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external 191140cbfa90SSrinivas Dasari * authentication capability. Drivers can offload authentication to 191240cbfa90SSrinivas Dasari * userspace if this flag is set. Only applicable for cfg80211_connect() 191340cbfa90SSrinivas Dasari * request (connect callback). 19147e7c8926SBen Greear */ 19157e7c8926SBen Greear enum cfg80211_assoc_req_flags { 19167e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1917ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1918bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 191940cbfa90SSrinivas Dasari CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), 19207e7c8926SBen Greear }; 19217e7c8926SBen Greear 19227e7c8926SBen Greear /** 1923636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1924636a5d36SJouni Malinen * 1925636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1926636a5d36SJouni Malinen * (re)association. 1927959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1928959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1929959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1930959867faSJohannes Berg * association requests while already associating must be rejected. 1931636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1932636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1933dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1934b23aa676SSamuel Ortiz * @crypto: crypto settings 193535eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 193635eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 193735eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 193835eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 193935eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 194035eb8f7bSJouni Malinen * frame. 19417e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 19427e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 19437e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 19447e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1945ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1946ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1947348bd456SJouni Malinen * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 1948348bd456SJouni Malinen * %NULL if FILS is not used. 1949348bd456SJouni Malinen * @fils_kek_len: Length of fils_kek in octets 1950348bd456SJouni Malinen * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 1951348bd456SJouni Malinen * Request/Response frame or %NULL if FILS is not used. This field starts 1952348bd456SJouni Malinen * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 1953636a5d36SJouni Malinen */ 1954636a5d36SJouni Malinen struct cfg80211_assoc_request { 195519957bb3SJohannes Berg struct cfg80211_bss *bss; 19563e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1957636a5d36SJouni Malinen size_t ie_len; 1958b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 195919957bb3SJohannes Berg bool use_mfp; 19607e7c8926SBen Greear u32 flags; 19617e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 19627e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1963ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1964348bd456SJouni Malinen const u8 *fils_kek; 1965348bd456SJouni Malinen size_t fils_kek_len; 1966348bd456SJouni Malinen const u8 *fils_nonces; 1967636a5d36SJouni Malinen }; 1968636a5d36SJouni Malinen 1969636a5d36SJouni Malinen /** 1970636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1971636a5d36SJouni Malinen * 1972636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1973636a5d36SJouni Malinen * deauthentication. 1974636a5d36SJouni Malinen * 197595de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1976636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1977636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 197819957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1979077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1980077f897aSJohannes Berg * do not set a deauth frame 1981636a5d36SJouni Malinen */ 1982636a5d36SJouni Malinen struct cfg80211_deauth_request { 198395de817bSJohannes Berg const u8 *bssid; 1984636a5d36SJouni Malinen const u8 *ie; 1985636a5d36SJouni Malinen size_t ie_len; 198619957bb3SJohannes Berg u16 reason_code; 19876863255bSStanislaw Gruszka bool local_state_change; 1988636a5d36SJouni Malinen }; 1989636a5d36SJouni Malinen 1990636a5d36SJouni Malinen /** 1991636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1992636a5d36SJouni Malinen * 1993636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 199466f00449SMasahiro Yamada * disassociation. 1995636a5d36SJouni Malinen * 199619957bb3SJohannes Berg * @bss: the BSS to disassociate from 1997636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1998636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 199919957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 2000d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 2001d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 2002636a5d36SJouni Malinen */ 2003636a5d36SJouni Malinen struct cfg80211_disassoc_request { 200419957bb3SJohannes Berg struct cfg80211_bss *bss; 2005636a5d36SJouni Malinen const u8 *ie; 2006636a5d36SJouni Malinen size_t ie_len; 200719957bb3SJohannes Berg u16 reason_code; 2008d5cdfacbSJouni Malinen bool local_state_change; 2009636a5d36SJouni Malinen }; 2010636a5d36SJouni Malinen 2011636a5d36SJouni Malinen /** 201204a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 201304a773adSJohannes Berg * 201404a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 201504a773adSJohannes Berg * method. 201604a773adSJohannes Berg * 201704a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 201804a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 201904a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 202004a773adSJohannes Berg * search for IBSSs with a different BSSID. 2021683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 202204a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 202304a773adSJohannes Berg * IBSSs to join on other channels. 202404a773adSJohannes Berg * @ie: information element(s) to include in the beacon 202504a773adSJohannes Berg * @ie_len: length of that 20268e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 2027fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 2028fffd0934SJohannes Berg * after joining 2029267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 2030267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 2031267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 2032267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 20335336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 20345336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 20355336fa88SSimon Wunderlich * to operate on DFS channels. 2036fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 2037dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 2038803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2039803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 2040803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 20419ae3b172STova Mussai * @wep_keys: static WEP keys, if not NULL points to an array of 20429ae3b172STova Mussai * CFG80211_MAX_WEP_KEYS WEP keys 20439ae3b172STova Mussai * @wep_tx_key: key index (0..3) of the default TX static WEP key 204404a773adSJohannes Berg */ 204504a773adSJohannes Berg struct cfg80211_ibss_params { 2046c1e5f471SJohannes Berg const u8 *ssid; 2047c1e5f471SJohannes Berg const u8 *bssid; 2048683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 2049c1e5f471SJohannes Berg const u8 *ie; 205004a773adSJohannes Berg u8 ssid_len, ie_len; 20518e30bc55SJohannes Berg u16 beacon_interval; 2052fbd2c8dcSTeemu Paasikivi u32 basic_rates; 205304a773adSJohannes Berg bool channel_fixed; 2054fffd0934SJohannes Berg bool privacy; 2055267335d6SAntonio Quartulli bool control_port; 20565336fa88SSimon Wunderlich bool userspace_handles_dfs; 205757fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2058803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 2059803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 20609ae3b172STova Mussai struct key_params *wep_keys; 20619ae3b172STova Mussai int wep_tx_key; 206204a773adSJohannes Berg }; 206304a773adSJohannes Berg 206404a773adSJohannes Berg /** 206538de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 206638de03d2SArend van Spriel * 206738de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 206838de03d2SArend van Spriel * @param: parameters for requestion behaviour. 206938de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 207038de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 207138de03d2SArend van Spriel */ 207238de03d2SArend van Spriel struct cfg80211_bss_selection { 207338de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 207438de03d2SArend van Spriel union { 207557fbcce3SJohannes Berg enum nl80211_band band_pref; 207638de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 207738de03d2SArend van Spriel } param; 207838de03d2SArend van Spriel }; 207938de03d2SArend van Spriel 208038de03d2SArend van Spriel /** 2081b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 2082b23aa676SSamuel Ortiz * 2083b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 2084b23aa676SSamuel Ortiz * authentication and association. 2085b23aa676SSamuel Ortiz * 2086b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 2087b23aa676SSamuel Ortiz * on scan results) 20881df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 20891df4a510SJouni Malinen * %NULL if not specified 2090b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 2091b23aa676SSamuel Ortiz * results) 20921df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 20931df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 20941df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 20951df4a510SJouni Malinen * to use. 2096b23aa676SSamuel Ortiz * @ssid: SSID 2097b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 2098b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 2099abe37c4bSJohannes Berg * @ie: IEs for association request 2100abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 2101b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 2102cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 2103b23aa676SSamuel Ortiz * @crypto: crypto settings 2104fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2105fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2106fffd0934SJohannes Berg * @key: WEP key for shared key authentication 21077e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 21084486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 21094486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 21107e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 21117e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 21127e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2113ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 2114ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 211534d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 211634d50519SLior David * networks. 211738de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 211835eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 211935eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 212035eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 212135eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 212235eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 212335eb8f7bSJouni Malinen * frame. 2124a3caf744SVidyullatha Kanchanapally * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 2125a3caf744SVidyullatha Kanchanapally * NAI or %NULL if not specified. This is used to construct FILS wrapped 2126a3caf744SVidyullatha Kanchanapally * data IE. 2127a3caf744SVidyullatha Kanchanapally * @fils_erp_username_len: Length of @fils_erp_username in octets. 2128a3caf744SVidyullatha Kanchanapally * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 2129a3caf744SVidyullatha Kanchanapally * %NULL if not specified. This specifies the domain name of ER server and 2130a3caf744SVidyullatha Kanchanapally * is used to construct FILS wrapped data IE. 2131a3caf744SVidyullatha Kanchanapally * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 2132a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 2133a3caf744SVidyullatha Kanchanapally * messages. This is also used to construct FILS wrapped data IE. 2134a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 2135a3caf744SVidyullatha Kanchanapally * keys in FILS or %NULL if not specified. 2136a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 21373a00df57SAvraham Stern * @want_1x: indicates user-space supports and wants to use 802.1X driver 21383a00df57SAvraham Stern * offload of 4-way handshake. 2139b23aa676SSamuel Ortiz */ 2140b23aa676SSamuel Ortiz struct cfg80211_connect_params { 2141b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 21421df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 2143664834deSJouni Malinen const u8 *bssid; 21441df4a510SJouni Malinen const u8 *bssid_hint; 2145664834deSJouni Malinen const u8 *ssid; 2146b23aa676SSamuel Ortiz size_t ssid_len; 2147b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 21484b5800feSJohannes Berg const u8 *ie; 2149b23aa676SSamuel Ortiz size_t ie_len; 2150b23aa676SSamuel Ortiz bool privacy; 2151cee00a95SJouni Malinen enum nl80211_mfp mfp; 2152b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 2153fffd0934SJohannes Berg const u8 *key; 2154fffd0934SJohannes Berg u8 key_len, key_idx; 21557e7c8926SBen Greear u32 flags; 21564486ea98SBala Shanmugam int bg_scan_period; 21577e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 21587e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2159ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 2160ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 216134d50519SLior David bool pbss; 216238de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 2163ba6fbacfSJouni Malinen const u8 *prev_bssid; 2164a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_username; 2165a3caf744SVidyullatha Kanchanapally size_t fils_erp_username_len; 2166a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_realm; 2167a3caf744SVidyullatha Kanchanapally size_t fils_erp_realm_len; 2168a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 2169a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_rrk; 2170a3caf744SVidyullatha Kanchanapally size_t fils_erp_rrk_len; 21713a00df57SAvraham Stern bool want_1x; 2172b23aa676SSamuel Ortiz }; 2173b23aa676SSamuel Ortiz 2174b23aa676SSamuel Ortiz /** 2175088e8df8Svamsi krishna * enum cfg80211_connect_params_changed - Connection parameters being updated 2176088e8df8Svamsi krishna * 2177088e8df8Svamsi krishna * This enum provides information of all connect parameters that 2178088e8df8Svamsi krishna * have to be updated as part of update_connect_params() call. 2179088e8df8Svamsi krishna * 2180088e8df8Svamsi krishna * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 2181088e8df8Svamsi krishna */ 2182088e8df8Svamsi krishna enum cfg80211_connect_params_changed { 2183088e8df8Svamsi krishna UPDATE_ASSOC_IES = BIT(0), 2184088e8df8Svamsi krishna }; 2185088e8df8Svamsi krishna 2186088e8df8Svamsi krishna /** 2187b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 2188abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 2189abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 2190abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 2191abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2192abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 21933057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 2194b9a5f8caSJouni Malinen */ 2195b9a5f8caSJouni Malinen enum wiphy_params_flags { 2196b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2197b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 2198b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 2199b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 220081077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 22013057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 2202b9a5f8caSJouni Malinen }; 2203b9a5f8caSJouni Malinen 220467fbb16bSSamuel Ortiz /** 220567fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 220667fbb16bSSamuel Ortiz * 220767fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 220867fbb16bSSamuel Ortiz * caching. 220967fbb16bSSamuel Ortiz * 2210a3caf744SVidyullatha Kanchanapally * @bssid: The AP's BSSID (may be %NULL). 2211a3caf744SVidyullatha Kanchanapally * @pmkid: The identifier to refer a PMKSA. 2212a3caf744SVidyullatha Kanchanapally * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 2213a3caf744SVidyullatha Kanchanapally * derivation by a FILS STA. Otherwise, %NULL. 2214a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 2215a3caf744SVidyullatha Kanchanapally * the hash algorithm used to generate this. 2216a3caf744SVidyullatha Kanchanapally * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 2217a3caf744SVidyullatha Kanchanapally * cache identifier (may be %NULL). 2218a3caf744SVidyullatha Kanchanapally * @ssid_len: Length of the @ssid in octets. 2219a3caf744SVidyullatha Kanchanapally * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 2220a3caf744SVidyullatha Kanchanapally * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 2221a3caf744SVidyullatha Kanchanapally * %NULL). 222267fbb16bSSamuel Ortiz */ 222367fbb16bSSamuel Ortiz struct cfg80211_pmksa { 2224c1e5f471SJohannes Berg const u8 *bssid; 2225c1e5f471SJohannes Berg const u8 *pmkid; 2226a3caf744SVidyullatha Kanchanapally const u8 *pmk; 2227a3caf744SVidyullatha Kanchanapally size_t pmk_len; 2228a3caf744SVidyullatha Kanchanapally const u8 *ssid; 2229a3caf744SVidyullatha Kanchanapally size_t ssid_len; 2230a3caf744SVidyullatha Kanchanapally const u8 *cache_id; 223167fbb16bSSamuel Ortiz }; 22329930380fSJohannes Berg 22337643a2c3SJohannes Berg /** 223450ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 2235ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 2236ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 2237ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 2238ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 2239bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 2240ff1b6e69SJohannes Berg * 2241ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 2242ff1b6e69SJohannes Berg * memory, free @mask only! 2243ff1b6e69SJohannes Berg */ 224450ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 2245922bd80fSJohannes Berg const u8 *mask, *pattern; 2246ff1b6e69SJohannes Berg int pattern_len; 2247bb92d199SAmitkumar Karwar int pkt_offset; 2248ff1b6e69SJohannes Berg }; 2249ff1b6e69SJohannes Berg 2250ff1b6e69SJohannes Berg /** 22512a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 22522a0e047eSJohannes Berg * 22532a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 22542a0e047eSJohannes Berg * @src: source IP address 22552a0e047eSJohannes Berg * @dst: destination IP address 22562a0e047eSJohannes Berg * @dst_mac: destination MAC address 22572a0e047eSJohannes Berg * @src_port: source port 22582a0e047eSJohannes Berg * @dst_port: destination port 22592a0e047eSJohannes Berg * @payload_len: data payload length 22602a0e047eSJohannes Berg * @payload: data payload buffer 22612a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 22622a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 22632a0e047eSJohannes Berg * @wake_len: wakeup payload match length 22642a0e047eSJohannes Berg * @wake_data: wakeup payload match data 22652a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 22662a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 22672a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 22682a0e047eSJohannes Berg */ 22692a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 22702a0e047eSJohannes Berg struct socket *sock; 22712a0e047eSJohannes Berg __be32 src, dst; 22722a0e047eSJohannes Berg u16 src_port, dst_port; 22732a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 22742a0e047eSJohannes Berg int payload_len; 22752a0e047eSJohannes Berg const u8 *payload; 22762a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 22772a0e047eSJohannes Berg u32 data_interval; 22782a0e047eSJohannes Berg u32 wake_len; 22792a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 22802a0e047eSJohannes Berg u32 tokens_size; 22812a0e047eSJohannes Berg /* must be last, variable member */ 22822a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 2283ff1b6e69SJohannes Berg }; 2284ff1b6e69SJohannes Berg 2285ff1b6e69SJohannes Berg /** 2286ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2287ff1b6e69SJohannes Berg * 2288ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 2289ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 2290ff1b6e69SJohannes Berg * operating as normal during suspend 2291ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 2292ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 2293ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 2294ff1b6e69SJohannes Berg * @n_patterns: number of patterns 229577dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 229677dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 229777dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 229877dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 22992a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 23002a0e047eSJohannes Berg * NULL if not configured. 23018cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 2302ff1b6e69SJohannes Berg */ 2303ff1b6e69SJohannes Berg struct cfg80211_wowlan { 230477dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 230577dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 230677dbbb13SJohannes Berg rfkill_release; 230750ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 23082a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 2309ff1b6e69SJohannes Berg int n_patterns; 23108cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 2311ff1b6e69SJohannes Berg }; 2312ff1b6e69SJohannes Berg 2313ff1b6e69SJohannes Berg /** 2314be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 2315be29b99aSAmitkumar Karwar * 2316be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 2317be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 2318be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 2319be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 2320be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 2321be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 2322be29b99aSAmitkumar Karwar */ 2323be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2324be29b99aSAmitkumar Karwar int delay; 2325be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2326be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2327be29b99aSAmitkumar Karwar int n_patterns; 2328be29b99aSAmitkumar Karwar }; 2329be29b99aSAmitkumar Karwar 2330be29b99aSAmitkumar Karwar /** 2331be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2332be29b99aSAmitkumar Karwar * 2333be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2334be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2335be29b99aSAmitkumar Karwar * @n_rules: number of rules 2336be29b99aSAmitkumar Karwar */ 2337be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2338be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2339be29b99aSAmitkumar Karwar int n_rules; 2340be29b99aSAmitkumar Karwar }; 2341be29b99aSAmitkumar Karwar 2342be29b99aSAmitkumar Karwar /** 23438cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 23448cd4d456SLuciano Coelho * 23458cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 23468cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 23478cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 23488cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 23498cd4d456SLuciano Coelho * occurred (in MHz) 23508cd4d456SLuciano Coelho */ 23518cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 23528cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 23538cd4d456SLuciano Coelho int n_channels; 23548cd4d456SLuciano Coelho u32 channels[]; 23558cd4d456SLuciano Coelho }; 23568cd4d456SLuciano Coelho 23578cd4d456SLuciano Coelho /** 23588cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 23598cd4d456SLuciano Coelho * 23608cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 23618cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 23628cd4d456SLuciano Coelho * match information. 23638cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 23648cd4d456SLuciano Coelho * the matches that triggered the wake up. 23658cd4d456SLuciano Coelho */ 23668cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 23678cd4d456SLuciano Coelho int n_matches; 23688cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 23698cd4d456SLuciano Coelho }; 23708cd4d456SLuciano Coelho 23718cd4d456SLuciano Coelho /** 2372cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2373cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2374cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2375cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2376cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2377cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2378cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2379cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2380cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2381cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2382cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2383cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2384cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2385cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2386cd8f7cb4SJohannes Berg * it is. 23872a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 23882a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 23892a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 23908cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2391cd8f7cb4SJohannes Berg */ 2392cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2393cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2394cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 23952a0e047eSJohannes Berg rfkill_release, packet_80211, 23962a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2397cd8f7cb4SJohannes Berg s32 pattern_idx; 2398cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2399cd8f7cb4SJohannes Berg const void *packet; 24008cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2401cd8f7cb4SJohannes Berg }; 2402cd8f7cb4SJohannes Berg 2403cd8f7cb4SJohannes Berg /** 2404e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 240578f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 240678f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 240778f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2408e5497d76SJohannes Berg */ 2409e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 241078f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2411e5497d76SJohannes Berg }; 2412e5497d76SJohannes Berg 2413e5497d76SJohannes Berg /** 2414355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2415355199e0SJouni Malinen * 2416355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2417355199e0SJouni Malinen * 2418355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2419355199e0SJouni Malinen * @ie: Fast Transition IEs 2420355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2421355199e0SJouni Malinen */ 2422355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2423355199e0SJouni Malinen u16 md; 2424355199e0SJouni Malinen const u8 *ie; 2425355199e0SJouni Malinen size_t ie_len; 2426355199e0SJouni Malinen }; 2427355199e0SJouni Malinen 2428355199e0SJouni Malinen /** 2429b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2430b176e629SAndrei Otcheretianski * 2431b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2432b176e629SAndrei Otcheretianski * 2433b176e629SAndrei Otcheretianski * @chan: channel to use 2434b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2435b176e629SAndrei Otcheretianski * @wait: duration for ROC 2436b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2437b176e629SAndrei Otcheretianski * @len: buffer length 2438b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2439b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 244034d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 244134d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2442b176e629SAndrei Otcheretianski */ 2443b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2444b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2445b176e629SAndrei Otcheretianski bool offchan; 2446b176e629SAndrei Otcheretianski unsigned int wait; 2447b176e629SAndrei Otcheretianski const u8 *buf; 2448b176e629SAndrei Otcheretianski size_t len; 2449b176e629SAndrei Otcheretianski bool no_cck; 2450b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 245134d22ce2SAndrei Otcheretianski int n_csa_offsets; 245234d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2453b176e629SAndrei Otcheretianski }; 2454b176e629SAndrei Otcheretianski 2455b176e629SAndrei Otcheretianski /** 2456fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2457fa9ffc74SKyeyoon Park * 2458fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2459fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2460fa9ffc74SKyeyoon Park */ 2461fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2462fa9ffc74SKyeyoon Park u8 dscp; 2463fa9ffc74SKyeyoon Park u8 up; 2464fa9ffc74SKyeyoon Park }; 2465fa9ffc74SKyeyoon Park 2466fa9ffc74SKyeyoon Park /** 2467fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2468fa9ffc74SKyeyoon Park * 2469fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2470fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2471fa9ffc74SKyeyoon Park */ 2472fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2473fa9ffc74SKyeyoon Park u8 low; 2474fa9ffc74SKyeyoon Park u8 high; 2475fa9ffc74SKyeyoon Park }; 2476fa9ffc74SKyeyoon Park 2477fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2478fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2479fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2480fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2481fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2482fa9ffc74SKyeyoon Park 2483fa9ffc74SKyeyoon Park /** 2484fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2485fa9ffc74SKyeyoon Park * 2486fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2487fa9ffc74SKyeyoon Park * 2488fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2489fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2490fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2491fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2492fa9ffc74SKyeyoon Park */ 2493fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2494fa9ffc74SKyeyoon Park u8 num_des; 2495fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2496fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2497fa9ffc74SKyeyoon Park }; 2498fa9ffc74SKyeyoon Park 2499fa9ffc74SKyeyoon Park /** 2500cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 2501cb3b7d87SAyala Beker * 2502cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 2503cb3b7d87SAyala Beker * 2504cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 25058585989dSLuca Coelho * @bands: operating bands, a bitmap of &enum nl80211_band values. 25068585989dSLuca Coelho * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 25078585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 2508cb3b7d87SAyala Beker */ 2509cb3b7d87SAyala Beker struct cfg80211_nan_conf { 2510cb3b7d87SAyala Beker u8 master_pref; 25118585989dSLuca Coelho u8 bands; 2512cb3b7d87SAyala Beker }; 2513cb3b7d87SAyala Beker 2514cb3b7d87SAyala Beker /** 2515a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 2516a5a9dcf2SAyala Beker * configuration 2517a5a9dcf2SAyala Beker * 2518a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 25198585989dSLuca Coelho * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 2520a5a9dcf2SAyala Beker */ 2521a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 2522a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 25238585989dSLuca Coelho CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 2524a5a9dcf2SAyala Beker }; 2525a5a9dcf2SAyala Beker 2526a5a9dcf2SAyala Beker /** 2527a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 2528a442b761SAyala Beker * 2529a442b761SAyala Beker * @filter: the content of the filter 2530a442b761SAyala Beker * @len: the length of the filter 2531a442b761SAyala Beker */ 2532a442b761SAyala Beker struct cfg80211_nan_func_filter { 2533a442b761SAyala Beker const u8 *filter; 2534a442b761SAyala Beker u8 len; 2535a442b761SAyala Beker }; 2536a442b761SAyala Beker 2537a442b761SAyala Beker /** 2538a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 2539a442b761SAyala Beker * 2540a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 2541a442b761SAyala Beker * @service_id: the service ID of the function 2542a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 2543a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 2544a442b761SAyala Beker * implementation specific. 2545a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 2546a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 2547a442b761SAyala Beker * @followup_id: the instance ID for follow up 2548a442b761SAyala Beker * @followup_reqid: the requestor instance ID for follow up 2549a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 2550a442b761SAyala Beker * @ttl: time to live counter in DW. 2551a442b761SAyala Beker * @serv_spec_info: Service Specific Info 2552a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 2553a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 2554a442b761SAyala Beker * @srf_bf: Bloom Filter 2555a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 2556a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 2557a442b761SAyala Beker * @srf_macs: SRF MAC addresses 2558a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 2559a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 2560a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 2561a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 2562a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 2563a442b761SAyala Beker * @instance_id: driver allocated id of the function. 2564a442b761SAyala Beker * @cookie: unique NAN function identifier. 2565a442b761SAyala Beker */ 2566a442b761SAyala Beker struct cfg80211_nan_func { 2567a442b761SAyala Beker enum nl80211_nan_function_type type; 2568a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 2569a442b761SAyala Beker u8 publish_type; 2570a442b761SAyala Beker bool close_range; 2571a442b761SAyala Beker bool publish_bcast; 2572a442b761SAyala Beker bool subscribe_active; 2573a442b761SAyala Beker u8 followup_id; 2574a442b761SAyala Beker u8 followup_reqid; 2575a442b761SAyala Beker struct mac_address followup_dest; 2576a442b761SAyala Beker u32 ttl; 2577a442b761SAyala Beker const u8 *serv_spec_info; 2578a442b761SAyala Beker u8 serv_spec_info_len; 2579a442b761SAyala Beker bool srf_include; 2580a442b761SAyala Beker const u8 *srf_bf; 2581a442b761SAyala Beker u8 srf_bf_len; 2582a442b761SAyala Beker u8 srf_bf_idx; 2583a442b761SAyala Beker struct mac_address *srf_macs; 2584a442b761SAyala Beker int srf_num_macs; 2585a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 2586a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 2587a442b761SAyala Beker u8 num_tx_filters; 2588a442b761SAyala Beker u8 num_rx_filters; 2589a442b761SAyala Beker u8 instance_id; 2590a442b761SAyala Beker u64 cookie; 2591a442b761SAyala Beker }; 2592a442b761SAyala Beker 2593a442b761SAyala Beker /** 25943a00df57SAvraham Stern * struct cfg80211_pmk_conf - PMK configuration 25953a00df57SAvraham Stern * 25963a00df57SAvraham Stern * @aa: authenticator address 25973a00df57SAvraham Stern * @pmk_len: PMK length in bytes. 25983a00df57SAvraham Stern * @pmk: the PMK material 25993a00df57SAvraham Stern * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK 26003a00df57SAvraham Stern * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field 26013a00df57SAvraham Stern * holds PMK-R0. 26023a00df57SAvraham Stern */ 26033a00df57SAvraham Stern struct cfg80211_pmk_conf { 26043a00df57SAvraham Stern const u8 *aa; 26053a00df57SAvraham Stern u8 pmk_len; 26063a00df57SAvraham Stern const u8 *pmk; 26073a00df57SAvraham Stern const u8 *pmk_r0_name; 26083a00df57SAvraham Stern }; 26093a00df57SAvraham Stern 26103a00df57SAvraham Stern /** 261140cbfa90SSrinivas Dasari * struct cfg80211_external_auth_params - Trigger External authentication. 261240cbfa90SSrinivas Dasari * 261340cbfa90SSrinivas Dasari * Commonly used across the external auth request and event interfaces. 261440cbfa90SSrinivas Dasari * 261540cbfa90SSrinivas Dasari * @action: action type / trigger for external authentication. Only significant 261640cbfa90SSrinivas Dasari * for the authentication request event interface (driver to user space). 261740cbfa90SSrinivas Dasari * @bssid: BSSID of the peer with which the authentication has 261840cbfa90SSrinivas Dasari * to happen. Used by both the authentication request event and 261940cbfa90SSrinivas Dasari * authentication response command interface. 262040cbfa90SSrinivas Dasari * @ssid: SSID of the AP. Used by both the authentication request event and 262140cbfa90SSrinivas Dasari * authentication response command interface. 262240cbfa90SSrinivas Dasari * @key_mgmt_suite: AKM suite of the respective authentication. Used by the 262340cbfa90SSrinivas Dasari * authentication request event interface. 262440cbfa90SSrinivas Dasari * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication, 262540cbfa90SSrinivas Dasari * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you 262640cbfa90SSrinivas Dasari * the real status code for failures. Used only for the authentication 262740cbfa90SSrinivas Dasari * response command interface (user space to driver). 262840cbfa90SSrinivas Dasari */ 262940cbfa90SSrinivas Dasari struct cfg80211_external_auth_params { 263040cbfa90SSrinivas Dasari enum nl80211_external_auth_action action; 263140cbfa90SSrinivas Dasari u8 bssid[ETH_ALEN] __aligned(2); 263240cbfa90SSrinivas Dasari struct cfg80211_ssid ssid; 263340cbfa90SSrinivas Dasari unsigned int key_mgmt_suite; 263440cbfa90SSrinivas Dasari u16 status; 263540cbfa90SSrinivas Dasari }; 263640cbfa90SSrinivas Dasari 263740cbfa90SSrinivas Dasari /** 2638704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2639704232c2SJohannes Berg * 2640704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2641704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2642704232c2SJohannes Berg * 2643704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2644704232c2SJohannes Berg * on success or a negative error code. 2645704232c2SJohannes Berg * 264643fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 264743fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 264843fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 264943fb45cbSJohannes Berg * 2650ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2651ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2652ff1b6e69SJohannes Berg * configured for the device. 26530378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 26546d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 26556d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 26566d52563fSJohannes Berg * the device. 26570378b3f1SJohannes Berg * 265860719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2659463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 266084efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 266198104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 266298104fdeSJohannes Berg * also set the address member in the wdev. 2663704232c2SJohannes Berg * 266484efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 266555682965SJohannes Berg * 266660719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 266760719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 266855682965SJohannes Berg * 266941ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 267041ade00fSJohannes Berg * when adding a group key. 267141ade00fSJohannes Berg * 267241ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 267341ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 267441ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2675e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2676e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 267741ade00fSJohannes Berg * 267841ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2679e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 268041ade00fSJohannes Berg * 268141ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2682ed1b6cc7SJohannes Berg * 26833cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 26843cfcf6acSJouni Malinen * 2685e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2686e5497d76SJohannes Berg * 2687c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2688c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2689c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2690c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 26915727ef1bSJohannes Berg * 26925727ef1bSJohannes Berg * @add_station: Add a new station. 269389c771e5SJouni Malinen * @del_station: Remove a station 2694bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2695bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2696bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 269777ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 269877ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2699abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2700abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2701abe37c4bSJohannes Berg * 2702abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2703abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2704abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2705abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2706abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 270766be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 270866be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2709f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 27108d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2711f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 27128d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 27132ec600d6SLuis Carlos Cobo * 271424bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 271593da9cc1Scolin@cozybit.com * 271624bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 271793da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 271893da9cc1Scolin@cozybit.com * set, and which to leave alone. 271993da9cc1Scolin@cozybit.com * 27209f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 272131888487SJouni Malinen * 272231888487SJouni Malinen * @set_txq_params: Set TX queue parameters 272372bdcf34SJouni Malinen * 2724e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2725e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2726e8c9bd5bSJohannes Berg * join the mesh instead. 2727e8c9bd5bSJohannes Berg * 2728e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2729e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2730e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2731e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 27329aed3cc1SJouni Malinen * 27332a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 27342a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 27352a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 27362a519311SJohannes Berg * the scan/scan_done bracket too. 273791d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 273891d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 2739636a5d36SJouni Malinen * 2740636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 27418d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2742636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 27438d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2744636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 27458d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2746636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 27478d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 274804a773adSJohannes Berg * 2749b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2750bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 2751bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 2752bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 2753bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 2754bf1ecd21SJouni Malinen * was received. 2755bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 2756bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 2757bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 2758bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 2759bf1ecd21SJouni Malinen * frame instead of Association Request frame. 2760bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 2761bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 276235eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 2763bf1ecd21SJouni Malinen * indication of requesting reassociation. 2764bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 2765bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 276629ce6ecbSAvraham Stern * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 2767088e8df8Svamsi krishna * @update_connect_params: Update the connect parameters while connected to a 2768088e8df8Svamsi krishna * BSS. The updated parameters can be used by driver/firmware for 2769088e8df8Svamsi krishna * subsequent BSS selection (roaming) decisions and to form the 2770088e8df8Svamsi krishna * Authentication/(Re)Association Request frames. This call does not 2771088e8df8Svamsi krishna * request an immediate disassociation or reassociation with the current 2772088e8df8Svamsi krishna * BSS, i.e., this impacts only subsequent (re)associations. The bits in 2773088e8df8Svamsi krishna * changed are defined in &enum cfg80211_connect_params_changed. 2774088e8df8Svamsi krishna * (invoked with the wireless_dev mutex held) 27750711d638SIlan Peer * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 27760711d638SIlan Peer * connection is in progress. Once done, call cfg80211_disconnected() in 27770711d638SIlan Peer * case connection was already established (invoked with the 27780711d638SIlan Peer * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 2779b23aa676SSamuel Ortiz * 278004a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 278104a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 278204a773adSJohannes Berg * to a merge. 27838d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 278404a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 27858d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2786b9a5f8caSJouni Malinen * 2787f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2788f4e583c8SAntonio Quartulli * MESH mode) 2789f4e583c8SAntonio Quartulli * 2790b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2791b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2792b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2793b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 27947643a2c3SJohannes Berg * 27951432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2796c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2797c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2798c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2799c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 28007643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 28011f87f7d3SJohannes Berg * return 0 if successful 28021f87f7d3SJohannes Berg * 2803abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2804abe37c4bSJohannes Berg * 28051f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 28061f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2807aff89a9bSJohannes Berg * 280861fa713cSHolger Schurig * @dump_survey: get site survey information. 280961fa713cSHolger Schurig * 28109588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 28119588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 28129588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 28139588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 28149588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 28159588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 28169588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 28179588bbd5SJouni Malinen * the duration value. 2818f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2819f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2820f7ca38dfSJohannes Berg * frame on another channel 28219588bbd5SJouni Malinen * 2822fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 282371063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 282471063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 282571063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 282671063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 282771063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 282871063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 282967fbb16bSSamuel Ortiz * 2830abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2831abe37c4bSJohannes Berg * 283267fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 283367fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 283467fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 283567fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 283667fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 28379043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 28389043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2839d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 2840e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 2841e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 2842e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 2843e86abc68SJohannes Berg * disabled.) 28444a4b8169SAndrew Zaborowski * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 28454a4b8169SAndrew Zaborowski * connection quality monitor. An event is to be sent only when the 28464a4b8169SAndrew Zaborowski * signal level is found to be outside the two values. The driver should 28474a4b8169SAndrew Zaborowski * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 28484a4b8169SAndrew Zaborowski * If it is provided then there's no point providing @set_cqm_rssi_config. 284984f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 285084f10708SThomas Pedersen * thresholds. 2851807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 28523a3ecf1dSArend Van Spriel * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 28533a3ecf1dSArend Van Spriel * given request id. This call must stop the scheduled scan and be ready 28543a3ecf1dSArend Van Spriel * for starting a new one before it returns, i.e. @sched_scan_start may be 28553a3ecf1dSArend Van Spriel * called immediately after that again and should not fail in that case. 28563a3ecf1dSArend Van Spriel * The driver should not call cfg80211_sched_scan_stopped() for a requested 28573a3ecf1dSArend Van Spriel * stop (when this method returns 0). 285867fbb16bSSamuel Ortiz * 2859271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 286033d8783cSJohannes Berg * registered. The callback is allowed to sleep. 2861547025d5SBruno Randolf * 2862547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2863547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2864547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2865547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2866547025d5SBruno Randolf * 2867547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 28683677713bSJohn W. Linville * 2869109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2870109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 28717f6cf311SJohannes Berg * 28727f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 28737f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 28741d9d9213SSimon Wunderlich * 28751d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2876d6199218SBen Greear * 28775b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 28785b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 28795b7ccaf3SJohannes Berg * current monitoring channel. 288098104fdeSJohannes Berg * 288198104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 288298104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 288377765eafSVasanthakumar Thiagarajan * 288477765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 288577765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 288677765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 288777765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 288877765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 288977765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 289004f39047SSimon Wunderlich * 289104f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 28928bf24293SJouni Malinen * 28938bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 28948bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 28958bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 28965de17984SArend van Spriel * 28975de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 28985de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 28995de17984SArend van Spriel * driver can take the most appropriate actions. 29005de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 29015de17984SArend van Spriel * reliability. This operation can not fail. 2902be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 290316ef1fe2SSimon Wunderlich * 290497dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 290597dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 290697dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 290797dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 290897dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 290997dc94f1SMichal Kazior * as soon as possible. 2910fa9ffc74SKyeyoon Park * 2911fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2912e16821bcSJouni Malinen * 2913e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2914e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2915e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2916960d01acSJohannes Berg * 2917960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2918960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2919960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2920960d01acSJohannes Berg * account. 2921960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2922960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2923960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2924960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2925960d01acSJohannes Berg * rejected) 2926960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 29276e0bd6c3SRostislav Lisovy * 29286e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 29296e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 29306e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 29316e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 29321057d35eSArik Nemtsov * 29331057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 29341057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 29351057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 29361057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 29371057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2938cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 2939cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 2940a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 2941a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 2942a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 2943a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 2944a442b761SAyala Beker * cfg80211_free_nan_func(). 2945a442b761SAyala Beker * On success the driver should assign an instance_id in the 2946a442b761SAyala Beker * provided @nan_func. 2947a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 2948a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 2949a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 2950a5a9dcf2SAyala Beker * All other parameters must be ignored. 2951ce0ce13aSMichael Braun * 2952ce0ce13aSMichael Braun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 29533a00df57SAvraham Stern * 29543a00df57SAvraham Stern * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 29553a00df57SAvraham Stern * If not deleted through @del_pmk the PMK remains valid until disconnect 29563a00df57SAvraham Stern * upon which the driver should clear it. 29573a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 29583a00df57SAvraham Stern * @del_pmk: delete the previously configured PMK for the given authenticator. 29593a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 296040cbfa90SSrinivas Dasari * 296140cbfa90SSrinivas Dasari * @external_auth: indicates result of offloaded authentication processing from 296240cbfa90SSrinivas Dasari * user space 2963704232c2SJohannes Berg */ 2964704232c2SJohannes Berg struct cfg80211_ops { 2965ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 29660378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 29676d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 29680378b3f1SJohannes Berg 296984efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2970552bff0cSJohannes Berg const char *name, 29716bab2e19STom Gundersen unsigned char name_assign_type, 2972f9e10ce4SJohannes Berg enum nl80211_iftype type, 29732ec600d6SLuis Carlos Cobo struct vif_params *params); 297484efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 297584efbb84SJohannes Berg struct wireless_dev *wdev); 2976e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2977e36d56b6SJohannes Berg struct net_device *dev, 2978818a986eSJohannes Berg enum nl80211_iftype type, 29792ec600d6SLuis Carlos Cobo struct vif_params *params); 298041ade00fSJohannes Berg 298141ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2982e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 298341ade00fSJohannes Berg struct key_params *params); 298441ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2985e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2986e31b8213SJohannes Berg void *cookie, 298741ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 298841ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2989e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 299041ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 299141ade00fSJohannes Berg struct net_device *netdev, 2992dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 29933cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 29943cfcf6acSJouni Malinen struct net_device *netdev, 29953cfcf6acSJouni Malinen u8 key_index); 2996ed1b6cc7SJohannes Berg 29978860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 29988860020eSJohannes Berg struct cfg80211_ap_settings *settings); 29998860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 30008860020eSJohannes Berg struct cfg80211_beacon_data *info); 30018860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 30025727ef1bSJohannes Berg 30035727ef1bSJohannes Berg 30045727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 30053b3a0162SJohannes Berg const u8 *mac, 30063b3a0162SJohannes Berg struct station_parameters *params); 30075727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 300889c771e5SJouni Malinen struct station_del_parameters *params); 30095727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 30103b3a0162SJohannes Berg const u8 *mac, 30113b3a0162SJohannes Berg struct station_parameters *params); 3012fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 30133b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 30142ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 30152ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 30162ec600d6SLuis Carlos Cobo 30172ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 30183b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 30192ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 30203b3a0162SJohannes Berg const u8 *dst); 30212ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 30223b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 30232ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 30243b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 30252ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 30262ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 30272ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 302866be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 302966be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 303066be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 303166be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 303266be7d2bSHenning Rogge struct mpath_info *pinfo); 303324bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 303493da9cc1Scolin@cozybit.com struct net_device *dev, 303593da9cc1Scolin@cozybit.com struct mesh_config *conf); 303624bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 303729cbe68cSJohannes Berg struct net_device *dev, u32 mask, 303829cbe68cSJohannes Berg const struct mesh_config *nconf); 303929cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 304029cbe68cSJohannes Berg const struct mesh_config *conf, 304129cbe68cSJohannes Berg const struct mesh_setup *setup); 304229cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 304329cbe68cSJohannes Berg 30446e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 30456e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 30466e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 30476e0bd6c3SRostislav Lisovy 30489f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 30499f1ba906SJouni Malinen struct bss_parameters *params); 305031888487SJouni Malinen 3051f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 305231888487SJouni Malinen struct ieee80211_txq_params *params); 305372bdcf34SJouni Malinen 3054e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 3055e8c9bd5bSJohannes Berg struct net_device *dev, 3056e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 3057e8c9bd5bSJohannes Berg 3058e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 3059683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 30609aed3cc1SJouni Malinen 3061fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 30622a519311SJohannes Berg struct cfg80211_scan_request *request); 306391d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 3064636a5d36SJouni Malinen 3065636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 3066636a5d36SJouni Malinen struct cfg80211_auth_request *req); 3067636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 3068636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 3069636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 307063c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 3071636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 307263c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 307304a773adSJohannes Berg 3074b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 3075b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 3076088e8df8Svamsi krishna int (*update_connect_params)(struct wiphy *wiphy, 3077088e8df8Svamsi krishna struct net_device *dev, 3078088e8df8Svamsi krishna struct cfg80211_connect_params *sme, 3079088e8df8Svamsi krishna u32 changed); 3080b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 3081b23aa676SSamuel Ortiz u16 reason_code); 3082b23aa676SSamuel Ortiz 308304a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 308404a773adSJohannes Berg struct cfg80211_ibss_params *params); 308504a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 3086b9a5f8caSJouni Malinen 3087f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 308857fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 3089f4e583c8SAntonio Quartulli 3090b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 30917643a2c3SJohannes Berg 3092c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 3093fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 3094c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 3095c8442118SJohannes Berg int *dbm); 30961f87f7d3SJohannes Berg 3097ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 3098388ac775SJohannes Berg const u8 *addr); 3099ab737a4fSJohannes Berg 31001f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 3101aff89a9bSJohannes Berg 3102aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 3103fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 3104fc73f11fSDavid Spinadel void *data, int len); 310571063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 310671063f0eSWey-Yi Guy struct netlink_callback *cb, 310771063f0eSWey-Yi Guy void *data, int len); 3108aff89a9bSJohannes Berg #endif 3109bc92afd9SJohannes Berg 31109930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 31119930380fSJohannes Berg struct net_device *dev, 31129930380fSJohannes Berg const u8 *peer, 31139930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 31149930380fSJohannes Berg 311561fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 311661fa713cSHolger Schurig int idx, struct survey_info *info); 311761fa713cSHolger Schurig 311867fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 311967fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 312067fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 312167fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 312267fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 312367fbb16bSSamuel Ortiz 31249588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 312571bbc994SJohannes Berg struct wireless_dev *wdev, 31269588bbd5SJouni Malinen struct ieee80211_channel *chan, 31279588bbd5SJouni Malinen unsigned int duration, 31289588bbd5SJouni Malinen u64 *cookie); 31299588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 313071bbc994SJohannes Berg struct wireless_dev *wdev, 31319588bbd5SJouni Malinen u64 cookie); 31329588bbd5SJouni Malinen 313371bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 3134b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 3135b176e629SAndrei Otcheretianski u64 *cookie); 3136f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 313771bbc994SJohannes Berg struct wireless_dev *wdev, 3138f7ca38dfSJohannes Berg u64 cookie); 3139026331c4SJouni Malinen 3140bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 3141bc92afd9SJohannes Berg bool enabled, int timeout); 3142d6dc1a38SJuuso Oikarinen 3143d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 3144d6dc1a38SJuuso Oikarinen struct net_device *dev, 3145d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 3146271733cfSJohannes Berg 31474a4b8169SAndrew Zaborowski int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 31484a4b8169SAndrew Zaborowski struct net_device *dev, 31494a4b8169SAndrew Zaborowski s32 rssi_low, s32 rssi_high); 31504a4b8169SAndrew Zaborowski 315184f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 315284f10708SThomas Pedersen struct net_device *dev, 315384f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 315484f10708SThomas Pedersen 3155271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 315671bbc994SJohannes Berg struct wireless_dev *wdev, 3157271733cfSJohannes Berg u16 frame_type, bool reg); 3158afe0cbf8SBruno Randolf 3159afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 3160afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 31613677713bSJohn W. Linville 3162807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 3163807f8a8cSLuciano Coelho struct net_device *dev, 3164807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 31653a3ecf1dSArend Van Spriel int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 31663a3ecf1dSArend Van Spriel u64 reqid); 3167e5497d76SJohannes Berg 3168e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 3169e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 3170109086ceSArik Nemtsov 3171109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 31723b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 3173df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 317431fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 3175109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 31763b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 31777f6cf311SJohannes Berg 31787f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 31797f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 3180e999882aSJohannes Berg 31811d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 31821d9d9213SSimon Wunderlich struct net_device *dev, 31831d9d9213SSimon Wunderlich u16 noack_map); 31841d9d9213SSimon Wunderlich 3185683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 31865b7ccaf3SJohannes Berg struct wireless_dev *wdev, 3187683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 318898104fdeSJohannes Berg 318998104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 319098104fdeSJohannes Berg struct wireless_dev *wdev); 319198104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 319298104fdeSJohannes Berg struct wireless_dev *wdev); 319377765eafSVasanthakumar Thiagarajan 319477765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 319577765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 319604f39047SSimon Wunderlich 319704f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 319804f39047SSimon Wunderlich struct net_device *dev, 319931559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 320031559f35SJanusz Dziedzic u32 cac_time_ms); 3201355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 3202355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 32035de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 32045de17984SArend van Spriel struct wireless_dev *wdev, 32055de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 32065de17984SArend van Spriel u16 duration); 32075de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 32085de17984SArend van Spriel struct wireless_dev *wdev); 3209be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 3210be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 321116ef1fe2SSimon Wunderlich 321216ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 321316ef1fe2SSimon Wunderlich struct net_device *dev, 321416ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 3215e16821bcSJouni Malinen 3216fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 3217fa9ffc74SKyeyoon Park struct net_device *dev, 3218fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3219e16821bcSJouni Malinen 3220e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 3221e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 3222960d01acSJohannes Berg 3223960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 3224960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 3225960d01acSJohannes Berg u16 admitted_time); 3226960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 3227960d01acSJohannes Berg u8 tsid, const u8 *peer); 32281057d35eSArik Nemtsov 32291057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 32301057d35eSArik Nemtsov struct net_device *dev, 32311057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 32321057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 32331057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 32341057d35eSArik Nemtsov struct net_device *dev, 32351057d35eSArik Nemtsov const u8 *addr); 3236cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 3237cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 3238cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 3239a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3240a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 3241a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3242a442b761SAyala Beker u64 cookie); 3243a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 3244a5a9dcf2SAyala Beker struct wireless_dev *wdev, 3245a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 3246a5a9dcf2SAyala Beker u32 changes); 3247ce0ce13aSMichael Braun 3248ce0ce13aSMichael Braun int (*set_multicast_to_unicast)(struct wiphy *wiphy, 3249ce0ce13aSMichael Braun struct net_device *dev, 3250ce0ce13aSMichael Braun const bool enabled); 32513a00df57SAvraham Stern 32523a00df57SAvraham Stern int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 32533a00df57SAvraham Stern const struct cfg80211_pmk_conf *conf); 32543a00df57SAvraham Stern int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 32553a00df57SAvraham Stern const u8 *aa); 325640cbfa90SSrinivas Dasari int (*external_auth)(struct wiphy *wiphy, struct net_device *dev, 325740cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params); 3258704232c2SJohannes Berg }; 3259704232c2SJohannes Berg 3260d3236553SJohannes Berg /* 3261d3236553SJohannes Berg * wireless hardware and networking interfaces structures 3262d3236553SJohannes Berg * and registration/helper functions 3263d3236553SJohannes Berg */ 3264d3236553SJohannes Berg 3265d3236553SJohannes Berg /** 32665be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 32675be83de5SJohannes Berg * 32685be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 32695be83de5SJohannes Berg * wiphy at all 32705be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 32715be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 32725be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 32735be83de5SJohannes Berg * reason to override the default 32749bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 32759bc383deSJohannes Berg * on a VLAN interface) 32769bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 3277c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 3278c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 3279c0692b8fSJohannes Berg * control_port_no_encrypt flag. 3280e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 328115d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 328215d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 3283f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 3284f4b34b55SVivek Natarajan * firmware. 3285cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 3286109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 3287109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 3288109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 3289109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 3290109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 3291109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 3292562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 32935e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 32945e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 32955e760230SJohannes Berg * cfg80211_report_obss_beacon(). 329687bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 329787bbbe22SArik Nemtsov * responds to probe-requests in hardware. 32987c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 32997c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 33002f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 330116ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 330216ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 3303b8676221SDavid Spinadel * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 3304b8676221SDavid Spinadel * before connection. 33055be83de5SJohannes Berg */ 33065be83de5SJohannes Berg enum wiphy_flags { 3307723e73acSJohannes Berg /* use hole at 0 */ 3308a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 3309a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 33105be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 33115be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 33129bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 33139bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 3314c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 3315309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 331615d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 3317ca986ad9SArend Van Spriel /* use hole at 11 */ 33188e8b41f9SJohannes Berg /* use hole at 12 */ 3319f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 3320cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 3321109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 3322109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 3323562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 33245e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 332587bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 33267c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 33277c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 33282f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 332916ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 3330b8676221SDavid Spinadel WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 33317527a782SJohannes Berg }; 33327527a782SJohannes Berg 33337527a782SJohannes Berg /** 33347527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 33357527a782SJohannes Berg * @max: maximum number of interfaces of these types 33367527a782SJohannes Berg * @types: interface types (bits) 33377527a782SJohannes Berg */ 33387527a782SJohannes Berg struct ieee80211_iface_limit { 33397527a782SJohannes Berg u16 max; 33407527a782SJohannes Berg u16 types; 33417527a782SJohannes Berg }; 33427527a782SJohannes Berg 33437527a782SJohannes Berg /** 33447527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 33457527a782SJohannes Berg * 3346b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 3347b80edbc1SLuciano Coelho * combinations it supports concurrently. 33487527a782SJohannes Berg * 3349b80edbc1SLuciano Coelho * Examples: 3350b80edbc1SLuciano Coelho * 3351b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 33527527a782SJohannes Berg * 3353819bf593SJohannes Berg * .. code-block:: c 3354819bf593SJohannes Berg * 33557527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 33567527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 33577527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 33587527a782SJohannes Berg * }; 33597527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 33607527a782SJohannes Berg * .limits = limits1, 33617527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 33627527a782SJohannes Berg * .max_interfaces = 2, 33637527a782SJohannes Berg * .beacon_int_infra_match = true, 33647527a782SJohannes Berg * }; 33657527a782SJohannes Berg * 33667527a782SJohannes Berg * 3367b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 33687527a782SJohannes Berg * 3369819bf593SJohannes Berg * .. code-block:: c 3370819bf593SJohannes Berg * 33717527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 33727527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 33737527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 33747527a782SJohannes Berg * }; 33757527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 33767527a782SJohannes Berg * .limits = limits2, 33777527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 33787527a782SJohannes Berg * .max_interfaces = 8, 33797527a782SJohannes Berg * .num_different_channels = 1, 33807527a782SJohannes Berg * }; 33817527a782SJohannes Berg * 33827527a782SJohannes Berg * 3383b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 3384b80edbc1SLuciano Coelho * 33857527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 33867527a782SJohannes Berg * 3387819bf593SJohannes Berg * .. code-block:: c 3388819bf593SJohannes Berg * 33897527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 33907527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 33917527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 33927527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 33937527a782SJohannes Berg * }; 33947527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 33957527a782SJohannes Berg * .limits = limits3, 33967527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 33977527a782SJohannes Berg * .max_interfaces = 4, 33987527a782SJohannes Berg * .num_different_channels = 2, 33997527a782SJohannes Berg * }; 3400819bf593SJohannes Berg * 34017527a782SJohannes Berg */ 34027527a782SJohannes Berg struct ieee80211_iface_combination { 3403c6c94aeaSJohannes Berg /** 3404c6c94aeaSJohannes Berg * @limits: 3405c6c94aeaSJohannes Berg * limits for the given interface types 3406c6c94aeaSJohannes Berg */ 34077527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 3408c6c94aeaSJohannes Berg 3409c6c94aeaSJohannes Berg /** 3410c6c94aeaSJohannes Berg * @num_different_channels: 3411c6c94aeaSJohannes Berg * can use up to this many different channels 3412c6c94aeaSJohannes Berg */ 34137527a782SJohannes Berg u32 num_different_channels; 3414c6c94aeaSJohannes Berg 3415c6c94aeaSJohannes Berg /** 3416c6c94aeaSJohannes Berg * @max_interfaces: 3417c6c94aeaSJohannes Berg * maximum number of interfaces in total allowed in this group 3418c6c94aeaSJohannes Berg */ 34197527a782SJohannes Berg u16 max_interfaces; 3420c6c94aeaSJohannes Berg 3421c6c94aeaSJohannes Berg /** 3422c6c94aeaSJohannes Berg * @n_limits: 3423c6c94aeaSJohannes Berg * number of limitations 3424c6c94aeaSJohannes Berg */ 34257527a782SJohannes Berg u8 n_limits; 3426c6c94aeaSJohannes Berg 3427c6c94aeaSJohannes Berg /** 3428c6c94aeaSJohannes Berg * @beacon_int_infra_match: 3429c6c94aeaSJohannes Berg * In this combination, the beacon intervals between infrastructure 3430c6c94aeaSJohannes Berg * and AP types must match. This is required only in special cases. 3431c6c94aeaSJohannes Berg */ 34327527a782SJohannes Berg bool beacon_int_infra_match; 3433c6c94aeaSJohannes Berg 3434c6c94aeaSJohannes Berg /** 3435c6c94aeaSJohannes Berg * @radar_detect_widths: 3436c6c94aeaSJohannes Berg * bitmap of channel widths supported for radar detection 3437c6c94aeaSJohannes Berg */ 343811c4a075SSimon Wunderlich u8 radar_detect_widths; 3439c6c94aeaSJohannes Berg 3440c6c94aeaSJohannes Berg /** 3441c6c94aeaSJohannes Berg * @radar_detect_regions: 3442c6c94aeaSJohannes Berg * bitmap of regions supported for radar detection 3443c6c94aeaSJohannes Berg */ 34448c48b50aSFelix Fietkau u8 radar_detect_regions; 3445c6c94aeaSJohannes Berg 3446c6c94aeaSJohannes Berg /** 3447c6c94aeaSJohannes Berg * @beacon_int_min_gcd: 3448c6c94aeaSJohannes Berg * This interface combination supports different beacon intervals. 3449c6c94aeaSJohannes Berg * 3450c6c94aeaSJohannes Berg * = 0 3451c6c94aeaSJohannes Berg * all beacon intervals for different interface must be same. 3452c6c94aeaSJohannes Berg * > 0 3453c6c94aeaSJohannes Berg * any beacon interval for the interface part of this combination AND 3454c6c94aeaSJohannes Berg * GCD of all beacon intervals from beaconing interfaces of this 3455c6c94aeaSJohannes Berg * combination must be greater or equal to this value. 3456c6c94aeaSJohannes Berg */ 34570c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 34585be83de5SJohannes Berg }; 34595be83de5SJohannes Berg 34602e161f78SJohannes Berg struct ieee80211_txrx_stypes { 34612e161f78SJohannes Berg u16 tx, rx; 34622e161f78SJohannes Berg }; 34632e161f78SJohannes Berg 34645be83de5SJohannes Berg /** 3465ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 3466ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 3467ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 3468ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 3469ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 3470ff1b6e69SJohannes Berg * packet should be preserved in that case 3471ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 3472ff1b6e69SJohannes Berg * (see nl80211.h) 3473ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 347477dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 347577dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 347677dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 347777dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 347877dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 34798cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 3480ff1b6e69SJohannes Berg */ 3481ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 3482ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 3483ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 3484ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 348577dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 348677dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 348777dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 348877dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 348977dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 34908cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 3491ff1b6e69SJohannes Berg }; 3492ff1b6e69SJohannes Berg 34932a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 34942a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 34952a0e047eSJohannes Berg u32 data_payload_max; 34962a0e047eSJohannes Berg u32 data_interval_max; 34972a0e047eSJohannes Berg u32 wake_payload_max; 34982a0e047eSJohannes Berg bool seq; 34992a0e047eSJohannes Berg }; 35002a0e047eSJohannes Berg 3501ff1b6e69SJohannes Berg /** 3502ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 3503ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 3504ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 3505ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 3506ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 3507ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 3508bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 35098cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 35108cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 35118cd4d456SLuciano Coelho * scheduled scans. 35128cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 35138cd4d456SLuciano Coelho * details. 35142a0e047eSJohannes Berg * @tcp: TCP wakeup support information 3515ff1b6e69SJohannes Berg */ 3516ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 3517ff1b6e69SJohannes Berg u32 flags; 3518ff1b6e69SJohannes Berg int n_patterns; 3519ff1b6e69SJohannes Berg int pattern_max_len; 3520ff1b6e69SJohannes Berg int pattern_min_len; 3521bb92d199SAmitkumar Karwar int max_pkt_offset; 35228cd4d456SLuciano Coelho int max_nd_match_sets; 35232a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 3524ff1b6e69SJohannes Berg }; 3525ff1b6e69SJohannes Berg 3526ff1b6e69SJohannes Berg /** 3527be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 3528be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 3529be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 3530be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 3531be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 3532be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 3533be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 3534be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 3535be29b99aSAmitkumar Karwar */ 3536be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 3537be29b99aSAmitkumar Karwar int n_rules; 3538be29b99aSAmitkumar Karwar int max_delay; 3539be29b99aSAmitkumar Karwar int n_patterns; 3540be29b99aSAmitkumar Karwar int pattern_max_len; 3541be29b99aSAmitkumar Karwar int pattern_min_len; 3542be29b99aSAmitkumar Karwar int max_pkt_offset; 3543be29b99aSAmitkumar Karwar }; 3544be29b99aSAmitkumar Karwar 3545be29b99aSAmitkumar Karwar /** 3546ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 3547ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 3548ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 3549ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 3550ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 3551ad7e718cSJohannes Berg */ 3552ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 3553ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 3554ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 3555ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 3556ad7e718cSJohannes Berg }; 3557ad7e718cSJohannes Berg 3558ad7e718cSJohannes Berg /** 3559466b9936Stamizhr@codeaurora.org * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags 3560466b9936Stamizhr@codeaurora.org * 3561466b9936Stamizhr@codeaurora.org * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed 3562466b9936Stamizhr@codeaurora.org * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed 3563466b9936Stamizhr@codeaurora.org * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed 3564466b9936Stamizhr@codeaurora.org * 3565466b9936Stamizhr@codeaurora.org */ 3566466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag { 3567466b9936Stamizhr@codeaurora.org STA_OPMODE_MAX_BW_CHANGED = BIT(0), 3568466b9936Stamizhr@codeaurora.org STA_OPMODE_SMPS_MODE_CHANGED = BIT(1), 3569466b9936Stamizhr@codeaurora.org STA_OPMODE_N_SS_CHANGED = BIT(2), 3570466b9936Stamizhr@codeaurora.org }; 3571466b9936Stamizhr@codeaurora.org 3572466b9936Stamizhr@codeaurora.org /** 3573466b9936Stamizhr@codeaurora.org * struct sta_opmode_info - Station's ht/vht operation mode information 3574466b9936Stamizhr@codeaurora.org * @changed: contains value from &enum wiphy_opmode_flag 3575*5e78abd0Stamizhr@codeaurora.org * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station 3576*5e78abd0Stamizhr@codeaurora.org * @bw: new max bandwidth value from &enum nl80211_chan_width of a station 3577466b9936Stamizhr@codeaurora.org * @rx_nss: new rx_nss value of a station 3578466b9936Stamizhr@codeaurora.org */ 3579466b9936Stamizhr@codeaurora.org 3580466b9936Stamizhr@codeaurora.org struct sta_opmode_info { 3581466b9936Stamizhr@codeaurora.org u32 changed; 3582*5e78abd0Stamizhr@codeaurora.org enum nl80211_smps_mode smps_mode; 3583*5e78abd0Stamizhr@codeaurora.org enum nl80211_chan_width bw; 3584466b9936Stamizhr@codeaurora.org u8 rx_nss; 3585466b9936Stamizhr@codeaurora.org }; 3586466b9936Stamizhr@codeaurora.org 3587466b9936Stamizhr@codeaurora.org /** 3588ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 3589ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 3590ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 3591ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 3592ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 3593ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 35947bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 35957bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 35967bdbe400SJohannes Berg * dumpit calls. 35977bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 35987bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 35997bdbe400SJohannes Berg * are used with dump requests. 3600ad7e718cSJohannes Berg */ 3601ad7e718cSJohannes Berg struct wiphy_vendor_command { 3602ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 3603ad7e718cSJohannes Berg u32 flags; 3604ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 3605ad7e718cSJohannes Berg const void *data, int data_len); 36067bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 36077bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 36087bdbe400SJohannes Berg unsigned long *storage); 3609ad7e718cSJohannes Berg }; 3610ad7e718cSJohannes Berg 3611ad7e718cSJohannes Berg /** 3612019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 3613019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 3614019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 3615019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 3616019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 3617019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 3618019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 3619019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 3620019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 3621019ae3a9SKanchanapally, Vidyullatha */ 3622019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 3623019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 3624019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 3625019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 3626019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 3627019ae3a9SKanchanapally, Vidyullatha }; 3628019ae3a9SKanchanapally, Vidyullatha 3629019ae3a9SKanchanapally, Vidyullatha /** 36305be83de5SJohannes Berg * struct wiphy - wireless hardware description 36312784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 36322784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 36332784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 3634d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 3635d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 3636d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 3637d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 3638d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 3639d3236553SJohannes Berg * @cipher_suites: supported cipher suites 3640d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 3641b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 3642b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 3643b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 3644b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 3645b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 3646abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 3647ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 3648ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 3649ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 36500fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 3651ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 3652ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 3653ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 3654ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 3655ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 3656ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 3657ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 3658ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3659fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3660fd235913SRandy Dunlap * unregister hardware 3661abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3662abe37c4bSJohannes Berg * automatically on wiphy renames 3663abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 36644a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3665abe37c4bSJohannes Berg * @wext: wireless extension handlers 3666abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3667abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3668abe37c4bSJohannes Berg * must be set by driver 36697527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 36707527a782SJohannes Berg * list single interface types. 36717527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 36727527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 36737527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3674abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3675a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3676a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 36771f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3678d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 3679d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 3680abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3681abe37c4bSJohannes Berg * this variable determines its size 3682abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3683abe37c4bSJohannes Berg * any given scan 3684ca986ad9SArend Van Spriel * @max_sched_scan_reqs: maximum number of scheduled scan requests that 3685ca986ad9SArend Van Spriel * the device can run concurrently. 368693b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 368793b6aa69SLuciano Coelho * for in any given scheduled scan 3688a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3689a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3690a1f1c21cSLuciano Coelho * supported. 3691abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3692abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3693abe37c4bSJohannes Berg * include fixed IEs like supported rates 36945a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 36955a865badSLuciano Coelho * scans 36963b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 36973b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 36983b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 36993b06d277SAvraham Stern * single scan plan supported by the device. 37003b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 37013b06d277SAvraham Stern * scan plan supported by the device. 3702abe37c4bSJohannes Berg * @coverage_class: current coverage class 3703abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3704abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3705abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3706abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3707abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3708abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 37092e161f78SJohannes Berg * 37102e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 37112e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 37122e161f78SJohannes Berg * type 3713a7ffac95SBruno Randolf * 37147f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 37157f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 37167f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 37177f531e03SBruno Randolf * 37187f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 37197f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 37207f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3721a293911dSJohannes Berg * 372215f0ebc2SRandy Dunlap * @probe_resp_offload: 372315f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 372415f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 372515f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 372615f0ebc2SRandy Dunlap * 3727a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3728a293911dSJohannes Berg * may request, if implemented. 3729ff1b6e69SJohannes Berg * 3730ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 37316abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 37326abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 37336abb9cb9SJohannes Berg * to the suspend() operation instead. 3734562a7480SJohannes Berg * 3735562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 37367e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 37377e7c8926SBen Greear * If null, then none can be over-ridden. 3738ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3739ee2aca34SJohannes Berg * If null, then none can be over-ridden. 374077765eafSVasanthakumar Thiagarajan * 374153873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 374253873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 374353873f13SJohannes Berg * 374477765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 374577765eafSVasanthakumar Thiagarajan * supports for ACL. 3746a50df0c4SJohannes Berg * 3747a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3748a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3749a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3750a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3751019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 3752019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 3753019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 3754a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3755a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3756019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 3757019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 3758019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 3759be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3760ad7e718cSJohannes Berg * 3761ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3762ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3763567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3764567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3765b43504cfSJouni Malinen * 3766b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3767b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3768b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3769b43504cfSJouni Malinen * some cases, but may not always reach. 3770c2e4323bSLuciano Coelho * 3771c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3772c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3773c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3774c2e4323bSLuciano Coelho * infinite. 377567af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 377667af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 377767af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 377867af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 377967af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 378067af9811SEmmanuel Grumbach * This value should be set in MHz. 378138de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 378238de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 378338de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 3784a442b761SAyala Beker * 3785a442b761SAyala Beker * @cookie_counter: unique generic cookie counter, used to identify objects. 37868585989dSLuca Coelho * @nan_supported_bands: bands supported by the device in NAN mode, a 37878585989dSLuca Coelho * bitmap of &enum nl80211_band values. For instance, for 37888585989dSLuca Coelho * NL80211_BAND_2GHZ, bit 0 would be set 37898585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 3790d3236553SJohannes Berg */ 3791d3236553SJohannes Berg struct wiphy { 3792d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3793d3236553SJohannes Berg 3794ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3795d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3796ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3797ef15aac6SJohannes Berg 3798ef15aac6SJohannes Berg struct mac_address *addresses; 3799d3236553SJohannes Berg 38002e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 38012e161f78SJohannes Berg 38027527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 38037527a782SJohannes Berg int n_iface_combinations; 38047527a782SJohannes Berg u16 software_iftypes; 38057527a782SJohannes Berg 38062e161f78SJohannes Berg u16 n_addresses; 38072e161f78SJohannes Berg 3808d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3809d3236553SJohannes Berg u16 interface_modes; 3810d3236553SJohannes Berg 381177765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 381277765eafSVasanthakumar Thiagarajan 3813a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3814d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3815463d0183SJohannes Berg 3816562a7480SJohannes Berg u32 ap_sme_capa; 3817562a7480SJohannes Berg 3818d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3819d3236553SJohannes Berg 3820d3236553SJohannes Berg int bss_priv_size; 3821d3236553SJohannes Berg u8 max_scan_ssids; 3822ca986ad9SArend Van Spriel u8 max_sched_scan_reqs; 382393b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3824a1f1c21cSLuciano Coelho u8 max_match_sets; 3825d3236553SJohannes Berg u16 max_scan_ie_len; 38265a865badSLuciano Coelho u16 max_sched_scan_ie_len; 38273b06d277SAvraham Stern u32 max_sched_scan_plans; 38283b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 38293b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 3830d3236553SJohannes Berg 3831d3236553SJohannes Berg int n_cipher_suites; 3832d3236553SJohannes Berg const u32 *cipher_suites; 3833d3236553SJohannes Berg 3834b9a5f8caSJouni Malinen u8 retry_short; 3835b9a5f8caSJouni Malinen u8 retry_long; 3836b9a5f8caSJouni Malinen u32 frag_threshold; 3837b9a5f8caSJouni Malinen u32 rts_threshold; 383881077e82SLukáš Turek u8 coverage_class; 3839b9a5f8caSJouni Malinen 384081135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3841dfce95f5SKalle Valo u32 hw_version; 3842dfce95f5SKalle Valo 3843dfb89c56SJohannes Berg #ifdef CONFIG_PM 3844964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 38456abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3846dfb89c56SJohannes Berg #endif 3847ff1b6e69SJohannes Berg 3848a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3849a293911dSJohannes Berg 385067fbb16bSSamuel Ortiz u8 max_num_pmkids; 385167fbb16bSSamuel Ortiz 38527f531e03SBruno Randolf u32 available_antennas_tx; 38537f531e03SBruno Randolf u32 available_antennas_rx; 3854a7ffac95SBruno Randolf 385587bbbe22SArik Nemtsov /* 385687bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 385787bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 385887bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 385987bbbe22SArik Nemtsov */ 386087bbbe22SArik Nemtsov u32 probe_resp_offload; 386187bbbe22SArik Nemtsov 3862a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3863a50df0c4SJohannes Berg u8 extended_capabilities_len; 3864a50df0c4SJohannes Berg 3865019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 3866019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 3867019ae3a9SKanchanapally, Vidyullatha 3868d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3869d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3870d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3871d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3872d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3873cf5aa2f1SDavid Kilroy const void *privid; 3874d3236553SJohannes Berg 387557fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 3876d3236553SJohannes Berg 3877d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 38780c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3879d3236553SJohannes Berg struct regulatory_request *request); 3880d3236553SJohannes Berg 3881d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3882d3236553SJohannes Berg 3883458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3884d3236553SJohannes Berg 3885d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3886d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3887d3236553SJohannes Berg struct device dev; 3888d3236553SJohannes Berg 3889ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3890ecb44335SStanislaw Gruszka bool registered; 3891ecb44335SStanislaw Gruszka 3892d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3893d3236553SJohannes Berg struct dentry *debugfsdir; 3894d3236553SJohannes Berg 38957e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3896ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 38977e7c8926SBen Greear 389853873f13SJohannes Berg struct list_head wdev_list; 389953873f13SJohannes Berg 3900463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 39010c5c9fb5SEric W. Biederman possible_net_t _net; 3902463d0183SJohannes Berg 39033d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 39043d23e349SJohannes Berg const struct iw_handler_def *wext; 39053d23e349SJohannes Berg #endif 39063d23e349SJohannes Berg 3907be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3908be29b99aSAmitkumar Karwar 3909ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3910567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3911567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3912ad7e718cSJohannes Berg 3913b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3914b43504cfSJouni Malinen 39159a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 391667af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 39179a774c78SAndrei Otcheretianski 391838de03d2SArend van Spriel u32 bss_select_support; 391938de03d2SArend van Spriel 3920a442b761SAyala Beker u64 cookie_counter; 3921a442b761SAyala Beker 39228585989dSLuca Coelho u8 nan_supported_bands; 39238585989dSLuca Coelho 39241c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3925d3236553SJohannes Berg }; 3926d3236553SJohannes Berg 3927463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3928463d0183SJohannes Berg { 3929c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3930463d0183SJohannes Berg } 3931463d0183SJohannes Berg 3932463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3933463d0183SJohannes Berg { 3934c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3935463d0183SJohannes Berg } 3936463d0183SJohannes Berg 3937d3236553SJohannes Berg /** 3938d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3939d3236553SJohannes Berg * 3940d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 39410ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3942d3236553SJohannes Berg */ 3943d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3944d3236553SJohannes Berg { 3945d3236553SJohannes Berg BUG_ON(!wiphy); 3946d3236553SJohannes Berg return &wiphy->priv; 3947d3236553SJohannes Berg } 3948d3236553SJohannes Berg 3949d3236553SJohannes Berg /** 3950f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3951f1f74825SDavid Kilroy * 3952f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 39530ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3954f1f74825SDavid Kilroy */ 3955f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3956f1f74825SDavid Kilroy { 3957f1f74825SDavid Kilroy BUG_ON(!priv); 3958f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3959f1f74825SDavid Kilroy } 3960f1f74825SDavid Kilroy 3961f1f74825SDavid Kilroy /** 3962d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3963d3236553SJohannes Berg * 3964d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3965d3236553SJohannes Berg * @dev: The device to parent it to 3966d3236553SJohannes Berg */ 3967d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3968d3236553SJohannes Berg { 3969d3236553SJohannes Berg wiphy->dev.parent = dev; 3970d3236553SJohannes Berg } 3971d3236553SJohannes Berg 3972d3236553SJohannes Berg /** 3973d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3974d3236553SJohannes Berg * 3975d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 39760ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3977d3236553SJohannes Berg */ 3978d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3979d3236553SJohannes Berg { 3980d3236553SJohannes Berg return wiphy->dev.parent; 3981d3236553SJohannes Berg } 3982d3236553SJohannes Berg 3983d3236553SJohannes Berg /** 3984d3236553SJohannes Berg * wiphy_name - get wiphy name 3985d3236553SJohannes Berg * 3986d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 39870ae997dcSYacine Belkadi * Return: The name of @wiphy. 3988d3236553SJohannes Berg */ 3989e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3990d3236553SJohannes Berg { 3991d3236553SJohannes Berg return dev_name(&wiphy->dev); 3992d3236553SJohannes Berg } 3993d3236553SJohannes Berg 3994d3236553SJohannes Berg /** 39951998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 39961998d90aSBen Greear * 39971998d90aSBen Greear * @ops: The configuration operations for this device 39981998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 39991998d90aSBen Greear * @requested_name: Request a particular name. 40001998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 40011998d90aSBen Greear * 40021998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 40031998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 40041998d90aSBen Greear * 40051998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 40061998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 40071998d90aSBen Greear */ 40081998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 40091998d90aSBen Greear const char *requested_name); 40101998d90aSBen Greear 40111998d90aSBen Greear /** 4012d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 4013d3236553SJohannes Berg * 4014d3236553SJohannes Berg * @ops: The configuration operations for this device 4015d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 4016d3236553SJohannes Berg * 4017d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 4018d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 4019d3236553SJohannes Berg * 40200ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 40210ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 4022d3236553SJohannes Berg */ 40231998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 40241998d90aSBen Greear int sizeof_priv) 40251998d90aSBen Greear { 40261998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 40271998d90aSBen Greear } 4028d3236553SJohannes Berg 4029d3236553SJohannes Berg /** 4030d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 4031d3236553SJohannes Berg * 4032d3236553SJohannes Berg * @wiphy: The wiphy to register. 4033d3236553SJohannes Berg * 40340ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 4035d3236553SJohannes Berg */ 403610dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 4037d3236553SJohannes Berg 4038d3236553SJohannes Berg /** 4039d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 4040d3236553SJohannes Berg * 4041d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 4042d3236553SJohannes Berg * 4043d3236553SJohannes Berg * After this call, no more requests can be made with this priv 4044d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 4045d3236553SJohannes Berg * request that is being handled. 4046d3236553SJohannes Berg */ 404710dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 4048d3236553SJohannes Berg 4049d3236553SJohannes Berg /** 4050d3236553SJohannes Berg * wiphy_free - free wiphy 4051d3236553SJohannes Berg * 4052d3236553SJohannes Berg * @wiphy: The wiphy to free 4053d3236553SJohannes Berg */ 405410dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 4055d3236553SJohannes Berg 4056fffd0934SJohannes Berg /* internal structs */ 40576829c878SJohannes Berg struct cfg80211_conn; 405819957bb3SJohannes Berg struct cfg80211_internal_bss; 4059fffd0934SJohannes Berg struct cfg80211_cached_keys; 40604a4b8169SAndrew Zaborowski struct cfg80211_cqm_config; 406119957bb3SJohannes Berg 4062d3236553SJohannes Berg /** 406389a54e48SJohannes Berg * struct wireless_dev - wireless device state 4064d3236553SJohannes Berg * 406589a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 406689a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 406789a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 406889a54e48SJohannes Berg * It need not be registered then as netdev registration will 406989a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 407089a54e48SJohannes Berg * 407189a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 407289a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 407389a54e48SJohannes Berg * there's no netdev registration in that case it may not be 407489a54e48SJohannes Berg * allocated outside of callback operations that return it. 4075d3236553SJohannes Berg * 4076d3236553SJohannes Berg * @wiphy: pointer to hardware description 4077d3236553SJohannes Berg * @iftype: interface type 4078d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 407989a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 408089a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 408189a54e48SJohannes Berg * wireless device if it has no netdev 4082d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 40839e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 40849e0e2961SMichal Kazior * the user-set channel definition. 4085780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 4086aa430da4SJohannes Berg * track the channel to be used for AP later 4087d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 4088d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 4089d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 409029cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 409129cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 4092d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 40939bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 40949bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 40959bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 40969bc383deSJohannes Berg * by cfg80211 on change_interface 40972e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 40982e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 40998d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 41008d61ffa5SJohannes Berg * and some API functions require it held 410156d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 410256d1893dSJohannes Berg * beacons, 0 when not valid 410398104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 410473c7da3dSArend Van Spriel * @is_running: true if this is a non-netdev device that has been started, e.g. 410573c7da3dSArend Van Spriel * the P2P Device. 410604f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 410704f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 410831559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 4109780b40dfSJohannes Berg * @ps: powersave mode is enabled 4110780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 4111780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 4112780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 4113780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 4114780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 411534d50519SLior David * @conn_bss_type: connecting/connected BSS type 4116bd2522b1SAndrzej Zaborowski * @conn_owner_nlportid: (private) connection owner socket port ID 4117bd2522b1SAndrzej Zaborowski * @disconnect_wk: (private) auto-disconnect work 4118bd2522b1SAndrzej Zaborowski * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 4119780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 41205336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 4121780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 4122780b40dfSJohannes Berg * @event_lock: (private) lock for event list 412378f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 4124ab81007aSJohannes Berg * @nl_owner_dead: (private) owner socket went away 41254a4b8169SAndrew Zaborowski * @cqm_config: (private) nl80211 RSSI monitor state 4126d3236553SJohannes Berg */ 4127d3236553SJohannes Berg struct wireless_dev { 4128d3236553SJohannes Berg struct wiphy *wiphy; 4129d3236553SJohannes Berg enum nl80211_iftype iftype; 4130d3236553SJohannes Berg 4131667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 4132d3236553SJohannes Berg struct list_head list; 4133d3236553SJohannes Berg struct net_device *netdev; 4134d3236553SJohannes Berg 413589a54e48SJohannes Berg u32 identifier; 413689a54e48SJohannes Berg 41372e161f78SJohannes Berg struct list_head mgmt_registrations; 41382e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 4139026331c4SJouni Malinen 4140667503ddSJohannes Berg struct mutex mtx; 4141667503ddSJohannes Berg 414273c7da3dSArend Van Spriel bool use_4addr, is_running; 414398104fdeSJohannes Berg 414498104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 41459bc383deSJohannes Berg 4146b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 4147d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 414829cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 41496829c878SJohannes Berg struct cfg80211_conn *conn; 4150fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 415134d50519SLior David enum ieee80211_bss_type conn_bss_type; 4152bd2522b1SAndrzej Zaborowski u32 conn_owner_nlportid; 4153bd2522b1SAndrzej Zaborowski 4154bd2522b1SAndrzej Zaborowski struct work_struct disconnect_wk; 4155bd2522b1SAndrzej Zaborowski u8 disconnect_bssid[ETH_ALEN]; 4156d3236553SJohannes Berg 4157667503ddSJohannes Berg struct list_head event_list; 4158667503ddSJohannes Berg spinlock_t event_lock; 4159667503ddSJohannes Berg 416019957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 4161683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 41629e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 4163f4489ebeSMichal Kazior 4164c30a3d38SMichal Kazior bool ibss_fixed; 41655336fa88SSimon Wunderlich bool ibss_dfs_possible; 4166c30a3d38SMichal Kazior 4167ffb9eb3dSKalle Valo bool ps; 4168ffb9eb3dSKalle Valo int ps_timeout; 4169ffb9eb3dSKalle Valo 417056d1893dSJohannes Berg int beacon_interval; 417156d1893dSJohannes Berg 417215e47304SEric W. Biederman u32 ap_unexpected_nlportid; 417328946da7SJohannes Berg 4174ab81007aSJohannes Berg u32 owner_nlportid; 4175ab81007aSJohannes Berg bool nl_owner_dead; 4176ab81007aSJohannes Berg 417704f39047SSimon Wunderlich bool cac_started; 417804f39047SSimon Wunderlich unsigned long cac_start_time; 417931559f35SJanusz Dziedzic unsigned int cac_time_ms; 418004f39047SSimon Wunderlich 41813d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 4182d3236553SJohannes Berg /* wext data */ 4183cbe8fa9cSJohannes Berg struct { 4184cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 4185f2129354SJohannes Berg struct cfg80211_connect_params connect; 4186fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 4187c1e5f471SJohannes Berg const u8 *ie; 4188f2129354SJohannes Berg size_t ie_len; 4189f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 4190f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 419108645126SJohannes Berg s8 default_key, default_mgmt_key; 4192ffb9eb3dSKalle Valo bool prev_bssid_valid; 4193cbe8fa9cSJohannes Berg } wext; 4194d3236553SJohannes Berg #endif 41954a4b8169SAndrew Zaborowski 41964a4b8169SAndrew Zaborowski struct cfg80211_cqm_config *cqm_config; 4197d3236553SJohannes Berg }; 4198d3236553SJohannes Berg 419998104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 420098104fdeSJohannes Berg { 420198104fdeSJohannes Berg if (wdev->netdev) 420298104fdeSJohannes Berg return wdev->netdev->dev_addr; 420398104fdeSJohannes Berg return wdev->address; 420498104fdeSJohannes Berg } 420598104fdeSJohannes Berg 420673c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev) 420773c7da3dSArend Van Spriel { 420873c7da3dSArend Van Spriel if (wdev->netdev) 420973c7da3dSArend Van Spriel return netif_running(wdev->netdev); 421073c7da3dSArend Van Spriel return wdev->is_running; 421173c7da3dSArend Van Spriel } 421273c7da3dSArend Van Spriel 4213d3236553SJohannes Berg /** 4214d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 4215d3236553SJohannes Berg * 4216d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 42170ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 4218d3236553SJohannes Berg */ 4219d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 4220d3236553SJohannes Berg { 4221d3236553SJohannes Berg BUG_ON(!wdev); 4222d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 4223d3236553SJohannes Berg } 4224d3236553SJohannes Berg 4225d70e9693SJohannes Berg /** 4226d70e9693SJohannes Berg * DOC: Utility functions 4227d70e9693SJohannes Berg * 4228d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 4229d3236553SJohannes Berg */ 4230d3236553SJohannes Berg 4231d3236553SJohannes Berg /** 4232d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 4233abe37c4bSJohannes Berg * @chan: channel number 423459eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 42350ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 4236d3236553SJohannes Berg */ 423757fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); 4238d3236553SJohannes Berg 4239d3236553SJohannes Berg /** 4240d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 4241abe37c4bSJohannes Berg * @freq: center frequency 42420ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 4243d3236553SJohannes Berg */ 424410dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 4245d3236553SJohannes Berg 4246d3236553SJohannes Berg /** 4247d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 4248543b921bSArend Van Spriel * 4249abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 4250abe37c4bSJohannes Berg * @freq: the center frequency of the channel 4251543b921bSArend Van Spriel * 42520ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 4253d3236553SJohannes Berg */ 4254543b921bSArend Van Spriel struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq); 4255d3236553SJohannes Berg 4256d3236553SJohannes Berg /** 4257d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 4258d3236553SJohannes Berg * 4259d3236553SJohannes Berg * @sband: the band to look for rates in 4260d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 4261d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 4262d3236553SJohannes Berg * 42630ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 42640ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 42650ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 42660ae997dcSYacine Belkadi * rates in the band's bitrate table. 4267d3236553SJohannes Berg */ 4268d3236553SJohannes Berg struct ieee80211_rate * 4269d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 4270d3236553SJohannes Berg u32 basic_rates, int bitrate); 4271d3236553SJohannes Berg 4272b422c6cdSAshok Nagarajan /** 4273b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 4274b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 427574608acaSSimon Wunderlich * @scan_width: width of the control channel 4276b422c6cdSAshok Nagarajan * 4277b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 4278b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 4279b422c6cdSAshok Nagarajan */ 428074608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 428174608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 4282b422c6cdSAshok Nagarajan 4283d3236553SJohannes Berg /* 4284d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 4285d3236553SJohannes Berg * 4286d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 4287d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 4288d3236553SJohannes Berg */ 4289d3236553SJohannes Berg 429033e5a2f7SJohannes Berg struct radiotap_align_size { 429133e5a2f7SJohannes Berg uint8_t align:4, size:4; 429233e5a2f7SJohannes Berg }; 429333e5a2f7SJohannes Berg 429433e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 429533e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 429633e5a2f7SJohannes Berg int n_bits; 429733e5a2f7SJohannes Berg uint32_t oui; 429833e5a2f7SJohannes Berg uint8_t subns; 429933e5a2f7SJohannes Berg }; 430033e5a2f7SJohannes Berg 430133e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 430233e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 430333e5a2f7SJohannes Berg int n_ns; 430433e5a2f7SJohannes Berg }; 430533e5a2f7SJohannes Berg 4306d3236553SJohannes Berg /** 4307d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 430833e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 430933e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 431033e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 431133e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 431233e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 431333e5a2f7SJohannes Berg * the beginning of the actual data portion 431433e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 431533e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 431633e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 431733e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 431833e5a2f7SJohannes Berg * radiotap namespace or not 431933e5a2f7SJohannes Berg * 432033e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 432133e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 432233e5a2f7SJohannes Berg * @_arg_index: next argument index 432333e5a2f7SJohannes Berg * @_arg: next argument pointer 432433e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 432533e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 432633e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 432733e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 432833e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 432933e5a2f7SJohannes Berg * next bitmap word 433033e5a2f7SJohannes Berg * 433133e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 433233e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 4333d3236553SJohannes Berg */ 4334d3236553SJohannes Berg 4335d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 433633e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 433733e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 433833e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 4339d3236553SJohannes Berg 434033e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 434167272440SJohannes Berg __le32 *_next_bitmap; 434233e5a2f7SJohannes Berg 434333e5a2f7SJohannes Berg unsigned char *this_arg; 434433e5a2f7SJohannes Berg int this_arg_index; 434533e5a2f7SJohannes Berg int this_arg_size; 434633e5a2f7SJohannes Berg 434733e5a2f7SJohannes Berg int is_radiotap_ns; 434833e5a2f7SJohannes Berg 434933e5a2f7SJohannes Berg int _max_length; 435033e5a2f7SJohannes Berg int _arg_index; 435133e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 435233e5a2f7SJohannes Berg int _reset_on_ext; 4353d3236553SJohannes Berg }; 4354d3236553SJohannes Berg 435510dd9b7cSJoe Perches int 435610dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 4357d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 435810dd9b7cSJoe Perches int max_length, 435910dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 4360d3236553SJohannes Berg 436110dd9b7cSJoe Perches int 436210dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 4363d3236553SJohannes Berg 436433e5a2f7SJohannes Berg 4365e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 4366e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 4367e31a16d6SZhu Yi 4368e31a16d6SZhu Yi /** 4369e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 4370e31a16d6SZhu Yi * 4371e31a16d6SZhu Yi * @skb: the frame 43720ae997dcSYacine Belkadi * 43730ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 43740ae997dcSYacine Belkadi * returns the 802.11 header length. 43750ae997dcSYacine Belkadi * 43760ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 43770ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 43780ae997dcSYacine Belkadi * 802.11 header. 4379e31a16d6SZhu Yi */ 4380e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 4381e31a16d6SZhu Yi 4382e31a16d6SZhu Yi /** 4383e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 4384e31a16d6SZhu Yi * @fc: frame control field in little-endian format 43850ae997dcSYacine Belkadi * Return: The header length in bytes. 4386e31a16d6SZhu Yi */ 4387633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 4388e31a16d6SZhu Yi 4389e31a16d6SZhu Yi /** 43909b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 43919b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 43929b395bc3SJohannes Berg * (first byte) will be accessed 43930ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 43949b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 43959b395bc3SJohannes Berg */ 43969b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 43979b395bc3SJohannes Berg 43989b395bc3SJohannes Berg /** 4399d70e9693SJohannes Berg * DOC: Data path helpers 4400d70e9693SJohannes Berg * 4401d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 4402d70e9693SJohannes Berg * functions that help implement the data path for devices 4403d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 4404d70e9693SJohannes Berg */ 4405d70e9693SJohannes Berg 4406d70e9693SJohannes Berg /** 44077f6990c8SJohannes Berg * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 44087f6990c8SJohannes Berg * @skb: the 802.11 data frame 44097f6990c8SJohannes Berg * @ehdr: pointer to a &struct ethhdr that will get the header, instead 44107f6990c8SJohannes Berg * of it being pushed into the SKB 44117f6990c8SJohannes Berg * @addr: the device MAC address 44127f6990c8SJohannes Berg * @iftype: the virtual interface type 441324bba078SFelix Fietkau * @data_offset: offset of payload after the 802.11 header 44147f6990c8SJohannes Berg * Return: 0 on success. Non-zero on error. 44157f6990c8SJohannes Berg */ 44167f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 441724bba078SFelix Fietkau const u8 *addr, enum nl80211_iftype iftype, 441824bba078SFelix Fietkau u8 data_offset); 44197f6990c8SJohannes Berg 44207f6990c8SJohannes Berg /** 4421e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 4422e31a16d6SZhu Yi * @skb: the 802.11 data frame 4423e31a16d6SZhu Yi * @addr: the device MAC address 4424e31a16d6SZhu Yi * @iftype: the virtual interface type 44250ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 4426e31a16d6SZhu Yi */ 44277f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 44287f6990c8SJohannes Berg enum nl80211_iftype iftype) 44297f6990c8SJohannes Berg { 443024bba078SFelix Fietkau return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); 44317f6990c8SJohannes Berg } 4432e31a16d6SZhu Yi 4433e31a16d6SZhu Yi /** 4434eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 4435eaf85ca7SZhu Yi * 44367f6990c8SJohannes Berg * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 44377f6990c8SJohannes Berg * The @list will be empty if the decode fails. The @skb must be fully 44387f6990c8SJohannes Berg * header-less before being passed in here; it is freed in this function. 4439eaf85ca7SZhu Yi * 44407f6990c8SJohannes Berg * @skb: The input A-MSDU frame without any headers. 4441eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 4442eaf85ca7SZhu Yi * initialized by by the caller. 4443eaf85ca7SZhu Yi * @addr: The device MAC address. 4444eaf85ca7SZhu Yi * @iftype: The device interface type. 4445eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 44468b935ee2SJohannes Berg * @check_da: DA to check in the inner ethernet header, or NULL 44478b935ee2SJohannes Berg * @check_sa: SA to check in the inner ethernet header, or NULL 4448eaf85ca7SZhu Yi */ 4449eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 4450eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 44518b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 44528b935ee2SJohannes Berg const u8 *check_da, const u8 *check_sa); 4453eaf85ca7SZhu Yi 4454eaf85ca7SZhu Yi /** 4455e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 4456e31a16d6SZhu Yi * @skb: the data frame 4457fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 44580ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 4459e31a16d6SZhu Yi */ 4460fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 4461fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4462e31a16d6SZhu Yi 4463c21dbf92SJohannes Berg /** 4464fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 4465fbd05e4aSLuca Coelho * 4466fbd05e4aSLuca Coelho * @eid: element ID 4467fbd05e4aSLuca Coelho * @ies: data consisting of IEs 4468fbd05e4aSLuca Coelho * @len: length of data 4469fbd05e4aSLuca Coelho * @match: byte array to match 4470fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 4471fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 4472fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 4473fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 4474fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 4475fbd05e4aSLuca Coelho * the second byte is the IE length. 4476fbd05e4aSLuca Coelho * 4477fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 4478fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 4479fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 4480fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 4481fbd05e4aSLuca Coelho * element ID. 4482fbd05e4aSLuca Coelho * 4483fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 4484fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 4485fbd05e4aSLuca Coelho * byte array to match. 4486fbd05e4aSLuca Coelho */ 4487fbd05e4aSLuca Coelho const u8 *cfg80211_find_ie_match(u8 eid, const u8 *ies, int len, 4488fbd05e4aSLuca Coelho const u8 *match, int match_len, 4489fbd05e4aSLuca Coelho int match_offset); 4490fbd05e4aSLuca Coelho 4491fbd05e4aSLuca Coelho /** 4492c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 4493c21dbf92SJohannes Berg * 4494c21dbf92SJohannes Berg * @eid: element ID 4495c21dbf92SJohannes Berg * @ies: data consisting of IEs 4496c21dbf92SJohannes Berg * @len: length of data 4497c21dbf92SJohannes Berg * 44980ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 44990ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 45000ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 45010ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 45020ae997dcSYacine Belkadi * 45030ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 45040ae997dcSYacine Belkadi * having to fit into the given data. 4505c21dbf92SJohannes Berg */ 4506fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 4507fbd05e4aSLuca Coelho { 4508fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 4509fbd05e4aSLuca Coelho } 4510c21dbf92SJohannes Berg 4511d70e9693SJohannes Berg /** 45123f817fe7SJouni Malinen * cfg80211_find_ext_ie - find information element with EID Extension in data 45133f817fe7SJouni Malinen * 45143f817fe7SJouni Malinen * @ext_eid: element ID Extension 45153f817fe7SJouni Malinen * @ies: data consisting of IEs 45163f817fe7SJouni Malinen * @len: length of data 45173f817fe7SJouni Malinen * 45183f817fe7SJouni Malinen * Return: %NULL if the extended element ID could not be found or if 45193f817fe7SJouni Malinen * the element is invalid (claims to be longer than the given 45203f817fe7SJouni Malinen * data), or a pointer to the first byte of the requested 45213f817fe7SJouni Malinen * element, that is the byte containing the element ID. 45223f817fe7SJouni Malinen * 45233f817fe7SJouni Malinen * Note: There are no checks on the element length other than 45243f817fe7SJouni Malinen * having to fit into the given data. 45253f817fe7SJouni Malinen */ 45263f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 45273f817fe7SJouni Malinen { 45283f817fe7SJouni Malinen return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 45293f817fe7SJouni Malinen &ext_eid, 1, 2); 45303f817fe7SJouni Malinen } 45313f817fe7SJouni Malinen 45323f817fe7SJouni Malinen /** 45330c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 45340c28ec58SEliad Peller * 45350c28ec58SEliad Peller * @oui: vendor OUI 45369e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 45370c28ec58SEliad Peller * @ies: data consisting of IEs 45380c28ec58SEliad Peller * @len: length of data 45390c28ec58SEliad Peller * 45400ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 45410ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 45420ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 45430ae997dcSYacine Belkadi * element ID. 45440ae997dcSYacine Belkadi * 45450ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 45460ae997dcSYacine Belkadi * the given data. 45470c28ec58SEliad Peller */ 45489e9ea439SEmmanuel Grumbach const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 45490c28ec58SEliad Peller const u8 *ies, int len); 45500c28ec58SEliad Peller 45510c28ec58SEliad Peller /** 4552d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 4553d70e9693SJohannes Berg * 4554d70e9693SJohannes Berg * TODO 4555d3236553SJohannes Berg */ 4556d3236553SJohannes Berg 4557d3236553SJohannes Berg /** 4558d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 4559d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 4560d3236553SJohannes Berg * conflicts) 4561d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 4562d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 4563d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 4564d3236553SJohannes Berg * alpha2. 4565d3236553SJohannes Berg * 4566d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 4567d3236553SJohannes Berg * what it believes should be the current regulatory domain by 4568d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 4569d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 4570d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 4571d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 4572d3236553SJohannes Berg * 4573d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 4574d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 4575d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 4576d3236553SJohannes Berg * 4577d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 4578d3236553SJohannes Berg * an -ENOMEM. 45790ae997dcSYacine Belkadi * 45800ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 4581d3236553SJohannes Berg */ 458210dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 4583d3236553SJohannes Berg 4584d3236553SJohannes Berg /** 4585b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 4586b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 4587b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 4588b0d7aa59SJonathan Doron * 4589b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 4590b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 4591b0d7aa59SJonathan Doron * information. 4592b0d7aa59SJonathan Doron * 4593b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 4594b0d7aa59SJonathan Doron */ 4595b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 4596b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 4597b0d7aa59SJonathan Doron 4598b0d7aa59SJonathan Doron /** 45992c3e861cSArik Nemtsov * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 46002c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 46012c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 46022c3e861cSArik Nemtsov * 46032c3e861cSArik Nemtsov * This functions requires the RTNL to be held and applies the new regdomain 46042c3e861cSArik Nemtsov * synchronously to this wiphy. For more details see 46052c3e861cSArik Nemtsov * regulatory_set_wiphy_regd(). 46062c3e861cSArik Nemtsov * 46072c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 46082c3e861cSArik Nemtsov */ 46092c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 46102c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 46112c3e861cSArik Nemtsov 46122c3e861cSArik Nemtsov /** 4613d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 4614d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 4615d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 4616d3236553SJohannes Berg * 4617d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 4618d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 4619d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 4620d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 4621d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 4622d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 4623222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 4624ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 4625222ea581SLuis R. Rodriguez * that called this helper. 4626d3236553SJohannes Berg */ 462710dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 4628d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 4629d3236553SJohannes Berg 4630d3236553SJohannes Berg /** 4631d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 4632d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 4633d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 4634d3236553SJohannes Berg * 4635d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 4636d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 4637d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 4638d3236553SJohannes Berg * and processed already. 4639d3236553SJohannes Berg * 46400ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 46410ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 46420ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 46430ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 46440ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 46450ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 46460ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 4647d3236553SJohannes Berg */ 4648361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 4649361c9c8bSJohannes Berg u32 center_freq); 4650d3236553SJohannes Berg 4651034c6d6eSLuis R. Rodriguez /** 4652034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 4653034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 4654034c6d6eSLuis R. Rodriguez * 4655034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 4656034c6d6eSLuis R. Rodriguez * proper string representation. 4657034c6d6eSLuis R. Rodriguez */ 4658034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 4659034c6d6eSLuis R. Rodriguez 4660d3236553SJohannes Berg /* 4661d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 4662d3236553SJohannes Berg * functions and BSS handling helpers 4663d3236553SJohannes Berg */ 4664d3236553SJohannes Berg 46652a519311SJohannes Berg /** 46662a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 46672a519311SJohannes Berg * 46682a519311SJohannes Berg * @request: the corresponding scan request 46691d76250bSAvraham Stern * @info: information about the completed scan 46702a519311SJohannes Berg */ 46711d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 46721d76250bSAvraham Stern struct cfg80211_scan_info *info); 46732a519311SJohannes Berg 46742a519311SJohannes Berg /** 4675807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 4676807f8a8cSLuciano Coelho * 4677807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 4678b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 4679807f8a8cSLuciano Coelho */ 4680b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 4681807f8a8cSLuciano Coelho 4682807f8a8cSLuciano Coelho /** 4683807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 4684807f8a8cSLuciano Coelho * 4685807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 4686b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 4687807f8a8cSLuciano Coelho * 4688807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 4689807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 4690807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 4691807f8a8cSLuciano Coelho */ 4692b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 4693807f8a8cSLuciano Coelho 4694807f8a8cSLuciano Coelho /** 4695792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 4696792e6aa7SEliad Peller * 4697792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 4698b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 4699792e6aa7SEliad Peller * 4700792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 4701792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 4702792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 4703792e6aa7SEliad Peller * This function should be called with rtnl locked. 4704792e6aa7SEliad Peller */ 4705b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid); 4706792e6aa7SEliad Peller 4707792e6aa7SEliad Peller /** 47086e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 47092a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 47106e19bc4bSDmitry Shmidt * @data: the BSS metadata 4711abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 4712abe37c4bSJohannes Berg * @len: length of the management frame 47132a519311SJohannes Berg * @gfp: context flags 47142a519311SJohannes Berg * 47152a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 47162a519311SJohannes Berg * the BSS should be updated/added. 4717ef100682SJohannes Berg * 47180ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 47190ae997dcSYacine Belkadi * Or %NULL on error. 47202a519311SJohannes Berg */ 4721ef100682SJohannes Berg struct cfg80211_bss * __must_check 47226e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 47236e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 47246e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 47256e19bc4bSDmitry Shmidt gfp_t gfp); 47266e19bc4bSDmitry Shmidt 47276e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4728dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 47293afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4730dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 4731dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 47326e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 47336e19bc4bSDmitry Shmidt { 47346e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 47356e19bc4bSDmitry Shmidt .chan = rx_channel, 47366e19bc4bSDmitry Shmidt .scan_width = scan_width, 47376e19bc4bSDmitry Shmidt .signal = signal, 47386e19bc4bSDmitry Shmidt }; 47396e19bc4bSDmitry Shmidt 47406e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 47416e19bc4bSDmitry Shmidt } 4742dcd6eac1SSimon Wunderlich 4743dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 47442a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 47453afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 47462a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 4747dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4748dcd6eac1SSimon Wunderlich { 47496e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 47506e19bc4bSDmitry Shmidt .chan = rx_channel, 47516e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 47526e19bc4bSDmitry Shmidt .signal = signal, 47536e19bc4bSDmitry Shmidt }; 47546e19bc4bSDmitry Shmidt 47556e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 4756dcd6eac1SSimon Wunderlich } 47572a519311SJohannes Berg 4758abe37c4bSJohannes Berg /** 47595bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 47605bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 47615bc8c1f2SJohannes Berg * from a beacon or probe response 47625bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 47635bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 47645bc8c1f2SJohannes Berg */ 47655bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 47665bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 47675bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 47685bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 47695bc8c1f2SJohannes Berg }; 47705bc8c1f2SJohannes Berg 47715bc8c1f2SJohannes Berg /** 47726e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 4773abe37c4bSJohannes Berg * 4774abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 47756e19bc4bSDmitry Shmidt * @data: the BSS metadata 47765bc8c1f2SJohannes Berg * @ftype: frame type (if known) 4777abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 47787b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 4779abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 4780abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 4781abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 4782abe37c4bSJohannes Berg * @ielen: length of the additional IEs 4783abe37c4bSJohannes Berg * @gfp: context flags 4784abe37c4bSJohannes Berg * 4785abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 4786abe37c4bSJohannes Berg * the BSS should be updated/added. 4787ef100682SJohannes Berg * 47880ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 47890ae997dcSYacine Belkadi * Or %NULL on error. 4790abe37c4bSJohannes Berg */ 4791ef100682SJohannes Berg struct cfg80211_bss * __must_check 47926e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 47936e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 47946e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 47956e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 47966e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 47976e19bc4bSDmitry Shmidt gfp_t gfp); 47986e19bc4bSDmitry Shmidt 47996e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4800dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 48013afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4802dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 48035bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 4804dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 4805dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 48066e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 48076e19bc4bSDmitry Shmidt { 48086e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 48096e19bc4bSDmitry Shmidt .chan = rx_channel, 48106e19bc4bSDmitry Shmidt .scan_width = scan_width, 48116e19bc4bSDmitry Shmidt .signal = signal, 48126e19bc4bSDmitry Shmidt }; 48136e19bc4bSDmitry Shmidt 48146e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 48156e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 48166e19bc4bSDmitry Shmidt gfp); 48176e19bc4bSDmitry Shmidt } 4818dcd6eac1SSimon Wunderlich 4819dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 482006aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 48213afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 48225bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 48237b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 48247b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4825dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4826dcd6eac1SSimon Wunderlich { 48276e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 48286e19bc4bSDmitry Shmidt .chan = rx_channel, 48296e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 48306e19bc4bSDmitry Shmidt .signal = signal, 48316e19bc4bSDmitry Shmidt }; 48326e19bc4bSDmitry Shmidt 48336e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 48346e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 4835dcd6eac1SSimon Wunderlich gfp); 4836dcd6eac1SSimon Wunderlich } 483706aa7afaSJussi Kivilinna 483827548677SJohannes Berg /** 483927548677SJohannes Berg * cfg80211_get_bss - get a BSS reference 484027548677SJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 484127548677SJohannes Berg * @channel: the channel to search on (or %NULL) 484227548677SJohannes Berg * @bssid: the desired BSSID (or %NULL) 484327548677SJohannes Berg * @ssid: the desired SSID (or %NULL) 484427548677SJohannes Berg * @ssid_len: length of the SSID (or 0) 484527548677SJohannes Berg * @bss_type: type of BSS, see &enum ieee80211_bss_type 484627548677SJohannes Berg * @privacy: privacy filter, see &enum ieee80211_privacy 484727548677SJohannes Berg */ 48482a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 48492a519311SJohannes Berg struct ieee80211_channel *channel, 48502a519311SJohannes Berg const u8 *bssid, 485179420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 48526eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 485327548677SJohannes Berg enum ieee80211_privacy privacy); 485479420f09SJohannes Berg static inline struct cfg80211_bss * 485579420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 485679420f09SJohannes Berg struct ieee80211_channel *channel, 485779420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 485879420f09SJohannes Berg { 485979420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 48606eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 48616eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 486279420f09SJohannes Berg } 486379420f09SJohannes Berg 48644c0c0b75SJohannes Berg /** 48654c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 48665b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 48674c0c0b75SJohannes Berg * @bss: the BSS struct to reference 48684c0c0b75SJohannes Berg * 48694c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 48704c0c0b75SJohannes Berg */ 48715b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 48724c0c0b75SJohannes Berg 48734c0c0b75SJohannes Berg /** 48744c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 48755b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 48764c0c0b75SJohannes Berg * @bss: the BSS struct 48774c0c0b75SJohannes Berg * 48784c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 48794c0c0b75SJohannes Berg */ 48805b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4881d3236553SJohannes Berg 4882d491af19SJohannes Berg /** 4883d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4884d491af19SJohannes Berg * @wiphy: the wiphy 4885d491af19SJohannes Berg * @bss: the bss to remove 4886d491af19SJohannes Berg * 4887d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4888d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4889d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4890d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4891d491af19SJohannes Berg */ 4892d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4893fee52678SJohannes Berg 4894dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4895dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4896dcd6eac1SSimon Wunderlich { 4897dcd6eac1SSimon Wunderlich switch (chandef->width) { 4898dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4899dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4900dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4901dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4902dcd6eac1SSimon Wunderlich default: 4903dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4904dcd6eac1SSimon Wunderlich } 4905dcd6eac1SSimon Wunderlich } 4906dcd6eac1SSimon Wunderlich 49076039f6d2SJouni Malinen /** 49086ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 49096039f6d2SJouni Malinen * @dev: network device 49106039f6d2SJouni Malinen * @buf: authentication frame (header + body) 49116039f6d2SJouni Malinen * @len: length of the frame data 49126039f6d2SJouni Malinen * 49136ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 49146ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 49156ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 49166ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 49176ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 49186ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 49196ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 49206ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 49216ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 49226ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 49236ff57cf8SJohannes Berg * 49246ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 49256039f6d2SJouni Malinen */ 49266ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 49276039f6d2SJouni Malinen 49286039f6d2SJouni Malinen /** 49296ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 49301965c853SJouni Malinen * @dev: network device 49311965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4932cb0b4bebSJohannes Berg * 49338d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 49348d61ffa5SJohannes Berg * mutex. 49351965c853SJouni Malinen */ 49366ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 49371965c853SJouni Malinen 49381965c853SJouni Malinen /** 49396ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 49406039f6d2SJouni Malinen * @dev: network device 49416ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 49426ff57cf8SJohannes Berg * moves to cfg80211 in this call 49436ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 49446039f6d2SJouni Malinen * @len: length of the frame data 4945f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 4946f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 49476039f6d2SJouni Malinen * 49486ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 49496ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 49506ff57cf8SJohannes Berg * 49516ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 49526039f6d2SJouni Malinen */ 49536ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 49546ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4955b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4956b0b6aa2cSEliad Peller int uapsd_queues); 49576039f6d2SJouni Malinen 49586039f6d2SJouni Malinen /** 49596ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 49601965c853SJouni Malinen * @dev: network device 4961959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4962cb0b4bebSJohannes Berg * 49638d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 49641965c853SJouni Malinen */ 4965959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 49661965c853SJouni Malinen 49671965c853SJouni Malinen /** 4968e6f462dfSJohannes Berg * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt 4969e6f462dfSJohannes Berg * @dev: network device 4970e6f462dfSJohannes Berg * @bss: The BSS entry with which association was abandoned. 4971e6f462dfSJohannes Berg * 4972e6f462dfSJohannes Berg * Call this whenever - for reasons reported through other API, like deauth RX, 4973e6f462dfSJohannes Berg * an association attempt was abandoned. 4974e6f462dfSJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 4975e6f462dfSJohannes Berg */ 4976e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss); 4977e6f462dfSJohannes Berg 4978e6f462dfSJohannes Berg /** 49796ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 49806039f6d2SJouni Malinen * @dev: network device 49816ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 49826039f6d2SJouni Malinen * @len: length of the frame data 49836039f6d2SJouni Malinen * 49846039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 498553b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 49868d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 49878d61ffa5SJohannes Berg * corresponding wdev's mutex. 49886039f6d2SJouni Malinen */ 49896ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4990ce470613SHolger Schurig 4991ce470613SHolger Schurig /** 49926ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4993cf4e594eSJouni Malinen * @dev: network device 4994cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4995cf4e594eSJouni Malinen * @len: length of the frame data 4996cf4e594eSJouni Malinen * 49976ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 49986ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4999cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 5000cf4e594eSJouni Malinen */ 50016ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 50026ff57cf8SJohannes Berg const u8 *buf, size_t len); 5003cf4e594eSJouni Malinen 5004cf4e594eSJouni Malinen /** 5005a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 5006a3b8b056SJouni Malinen * @dev: network device 5007a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 5008a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 5009a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 5010a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 5011e6d6e342SJohannes Berg * @gfp: allocation flags 5012a3b8b056SJouni Malinen * 5013a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 5014a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 5015a3b8b056SJouni Malinen * primitive. 5016a3b8b056SJouni Malinen */ 5017a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 5018a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 5019e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 5020a3b8b056SJouni Malinen 502104a773adSJohannes Berg /** 502204a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 502304a773adSJohannes Berg * 502404a773adSJohannes Berg * @dev: network device 502504a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 5026fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 502704a773adSJohannes Berg * @gfp: allocation flags 502804a773adSJohannes Berg * 502904a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 503004a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 503104a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 503204a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 503304a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 503404a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 503504a773adSJohannes Berg */ 5036fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 5037fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 503804a773adSJohannes Berg 50391f87f7d3SJohannes Berg /** 5040c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 5041c93b5e71SJavier Cardona * 5042c93b5e71SJavier Cardona * @dev: network device 5043c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 5044c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 5045c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 5046c93b5e71SJavier Cardona * @gfp: allocation flags 5047c93b5e71SJavier Cardona * 5048c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 5049c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 5050c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 5051c93b5e71SJavier Cardona */ 5052c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 5053c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 5054c93b5e71SJavier Cardona 5055c93b5e71SJavier Cardona /** 5056d70e9693SJohannes Berg * DOC: RFkill integration 5057d70e9693SJohannes Berg * 5058d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 5059d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 5060d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 5061d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 5062d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 5063d70e9693SJohannes Berg * 5064d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 5065d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 5066d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 5067d70e9693SJohannes Berg */ 5068d70e9693SJohannes Berg 5069d70e9693SJohannes Berg /** 50701f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 50711f87f7d3SJohannes Berg * @wiphy: the wiphy 50721f87f7d3SJohannes Berg * @blocked: block status 50731f87f7d3SJohannes Berg */ 50741f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 50751f87f7d3SJohannes Berg 50761f87f7d3SJohannes Berg /** 50771f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 50781f87f7d3SJohannes Berg * @wiphy: the wiphy 50791f87f7d3SJohannes Berg */ 50801f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 50811f87f7d3SJohannes Berg 50821f87f7d3SJohannes Berg /** 50831f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 50841f87f7d3SJohannes Berg * @wiphy: the wiphy 50851f87f7d3SJohannes Berg */ 50861f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 50871f87f7d3SJohannes Berg 5088ad7e718cSJohannes Berg /** 5089ad7e718cSJohannes Berg * DOC: Vendor commands 5090ad7e718cSJohannes Berg * 5091ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 5092ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 5093ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 5094ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 5095ad7e718cSJohannes Berg * the configuration mechanism. 5096ad7e718cSJohannes Berg * 5097ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 5098ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 5099ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 5100ad7e718cSJohannes Berg * 5101ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 5102ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 5103ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 5104ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 5105ad7e718cSJohannes Berg * managers etc. need. 5106ad7e718cSJohannes Berg */ 5107ad7e718cSJohannes Berg 5108ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 5109ad7e718cSJohannes Berg enum nl80211_commands cmd, 5110ad7e718cSJohannes Berg enum nl80211_attrs attr, 5111ad7e718cSJohannes Berg int approxlen); 5112ad7e718cSJohannes Berg 5113567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 51146c09e791SAhmad Kholaif struct wireless_dev *wdev, 5115567ffc35SJohannes Berg enum nl80211_commands cmd, 5116567ffc35SJohannes Berg enum nl80211_attrs attr, 5117567ffc35SJohannes Berg int vendor_event_idx, 5118567ffc35SJohannes Berg int approxlen, gfp_t gfp); 5119567ffc35SJohannes Berg 5120567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 5121567ffc35SJohannes Berg 5122ad7e718cSJohannes Berg /** 5123ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 5124ad7e718cSJohannes Berg * @wiphy: the wiphy 5125ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 5126ad7e718cSJohannes Berg * be put into the skb 5127ad7e718cSJohannes Berg * 5128ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 5129ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 5130ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 5131ad7e718cSJohannes Berg * 5132ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 5133ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 5134ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 5135ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 5136ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 5137ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 5138ad7e718cSJohannes Berg * You must not modify the skb in any other way. 5139ad7e718cSJohannes Berg * 5140ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 5141ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 5142ad7e718cSJohannes Berg * 5143ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5144ad7e718cSJohannes Berg */ 5145ad7e718cSJohannes Berg static inline struct sk_buff * 5146ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 5147ad7e718cSJohannes Berg { 5148ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 5149ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 5150ad7e718cSJohannes Berg } 5151ad7e718cSJohannes Berg 5152ad7e718cSJohannes Berg /** 5153ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 5154ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 5155ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 5156ad7e718cSJohannes Berg * 5157ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 5158ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 5159ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 5160ad7e718cSJohannes Berg * skb regardless of the return value. 5161ad7e718cSJohannes Berg * 5162ad7e718cSJohannes Berg * Return: An error code or 0 on success. 5163ad7e718cSJohannes Berg */ 5164ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 5165ad7e718cSJohannes Berg 5166567ffc35SJohannes Berg /** 5167567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 5168567ffc35SJohannes Berg * @wiphy: the wiphy 51696c09e791SAhmad Kholaif * @wdev: the wireless device 5170567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 5171567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 5172567ffc35SJohannes Berg * be put into the skb 5173567ffc35SJohannes Berg * @gfp: allocation flags 5174567ffc35SJohannes Berg * 5175567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 5176567ffc35SJohannes Berg * vendor-specific multicast group. 5177567ffc35SJohannes Berg * 51786c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 51796c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 51806c09e791SAhmad Kholaif * attribute. 51816c09e791SAhmad Kholaif * 5182567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 5183567ffc35SJohannes Berg * skb to send the event. 5184567ffc35SJohannes Berg * 5185567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5186567ffc35SJohannes Berg */ 5187567ffc35SJohannes Berg static inline struct sk_buff * 51886c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 51896c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 5190567ffc35SJohannes Berg { 51916c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 5192567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 5193567ffc35SJohannes Berg event_idx, approxlen, gfp); 5194567ffc35SJohannes Berg } 5195567ffc35SJohannes Berg 5196567ffc35SJohannes Berg /** 5197567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 5198567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 5199567ffc35SJohannes Berg * @gfp: allocation flags 5200567ffc35SJohannes Berg * 5201567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 5202567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 5203567ffc35SJohannes Berg */ 5204567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 5205567ffc35SJohannes Berg { 5206567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 5207567ffc35SJohannes Berg } 5208567ffc35SJohannes Berg 5209aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 5210aff89a9bSJohannes Berg /** 5211d70e9693SJohannes Berg * DOC: Test mode 5212d70e9693SJohannes Berg * 5213d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 5214d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 5215d70e9693SJohannes Berg * factory programming. 5216d70e9693SJohannes Berg * 5217d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 5218d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 5219d70e9693SJohannes Berg */ 5220d70e9693SJohannes Berg 5221d70e9693SJohannes Berg /** 5222aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 5223aff89a9bSJohannes Berg * @wiphy: the wiphy 5224aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 5225aff89a9bSJohannes Berg * be put into the skb 5226aff89a9bSJohannes Berg * 5227aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 5228aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 5229aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 5230aff89a9bSJohannes Berg * 52310ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 52320ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 52330ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 52340ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 52350ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 52360ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 52370ae997dcSYacine Belkadi * must not modify the skb in any other way. 5238aff89a9bSJohannes Berg * 5239aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 5240aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 52410ae997dcSYacine Belkadi * 52420ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5243aff89a9bSJohannes Berg */ 5244ad7e718cSJohannes Berg static inline struct sk_buff * 5245ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 5246ad7e718cSJohannes Berg { 5247ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 5248ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 5249ad7e718cSJohannes Berg } 5250aff89a9bSJohannes Berg 5251aff89a9bSJohannes Berg /** 5252aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 5253aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 5254aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 5255aff89a9bSJohannes Berg * 52560ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 52570ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 52580ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 52590ae997dcSYacine Belkadi * regardless of the return value. 52600ae997dcSYacine Belkadi * 52610ae997dcSYacine Belkadi * Return: An error code or 0 on success. 5262aff89a9bSJohannes Berg */ 5263ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 5264ad7e718cSJohannes Berg { 5265ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 5266ad7e718cSJohannes Berg } 5267aff89a9bSJohannes Berg 5268aff89a9bSJohannes Berg /** 5269aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 5270aff89a9bSJohannes Berg * @wiphy: the wiphy 5271aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 5272aff89a9bSJohannes Berg * be put into the skb 5273aff89a9bSJohannes Berg * @gfp: allocation flags 5274aff89a9bSJohannes Berg * 5275aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 5276aff89a9bSJohannes Berg * testmode multicast group. 5277aff89a9bSJohannes Berg * 52780ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 52790ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 52800ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 52810ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 52820ae997dcSYacine Belkadi * in any other way. 5283aff89a9bSJohannes Berg * 5284aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 5285aff89a9bSJohannes Berg * skb to send the event. 52860ae997dcSYacine Belkadi * 52870ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5288aff89a9bSJohannes Berg */ 5289567ffc35SJohannes Berg static inline struct sk_buff * 5290567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 5291567ffc35SJohannes Berg { 52926c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 5293567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 5294567ffc35SJohannes Berg approxlen, gfp); 5295567ffc35SJohannes Berg } 5296aff89a9bSJohannes Berg 5297aff89a9bSJohannes Berg /** 5298aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 5299aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 5300aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 5301aff89a9bSJohannes Berg * @gfp: allocation flags 5302aff89a9bSJohannes Berg * 5303aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 5304aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 5305aff89a9bSJohannes Berg * consumes it. 5306aff89a9bSJohannes Berg */ 5307567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 5308567ffc35SJohannes Berg { 5309567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 5310567ffc35SJohannes Berg } 5311aff89a9bSJohannes Berg 5312aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 531371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 5314aff89a9bSJohannes Berg #else 5315aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 531671063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 5317aff89a9bSJohannes Berg #endif 5318aff89a9bSJohannes Berg 5319b23aa676SSamuel Ortiz /** 53205349a0f7SVidyullatha Kanchanapally * struct cfg80211_connect_resp_params - Connection response params 53215349a0f7SVidyullatha Kanchanapally * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 53225349a0f7SVidyullatha Kanchanapally * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 53235349a0f7SVidyullatha Kanchanapally * the real status code for failures. If this call is used to report a 53245349a0f7SVidyullatha Kanchanapally * failure due to a timeout (e.g., not receiving an Authentication frame 53255349a0f7SVidyullatha Kanchanapally * from the AP) instead of an explicit rejection by the AP, -1 is used to 53265349a0f7SVidyullatha Kanchanapally * indicate that this is a failure, but without a status code. 53275349a0f7SVidyullatha Kanchanapally * @timeout_reason is used to report the reason for the timeout in that 53285349a0f7SVidyullatha Kanchanapally * case. 53295349a0f7SVidyullatha Kanchanapally * @bssid: The BSSID of the AP (may be %NULL) 53305349a0f7SVidyullatha Kanchanapally * @bss: Entry of bss to which STA got connected to, can be obtained through 53315349a0f7SVidyullatha Kanchanapally * cfg80211_get_bss() (may be %NULL). Only one parameter among @bssid and 53325349a0f7SVidyullatha Kanchanapally * @bss needs to be specified. 53335349a0f7SVidyullatha Kanchanapally * @req_ie: Association request IEs (may be %NULL) 53345349a0f7SVidyullatha Kanchanapally * @req_ie_len: Association request IEs length 53355349a0f7SVidyullatha Kanchanapally * @resp_ie: Association response IEs (may be %NULL) 53365349a0f7SVidyullatha Kanchanapally * @resp_ie_len: Association response IEs length 5337a3caf744SVidyullatha Kanchanapally * @fils_kek: KEK derived from a successful FILS connection (may be %NULL) 5338a3caf744SVidyullatha Kanchanapally * @fils_kek_len: Length of @fils_kek in octets 5339a3caf744SVidyullatha Kanchanapally * @update_erp_next_seq_num: Boolean value to specify whether the value in 5340a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num is valid. 5341a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in ERP message in 5342a3caf744SVidyullatha Kanchanapally * FILS Authentication. This value should be specified irrespective of the 5343a3caf744SVidyullatha Kanchanapally * status for a FILS connection. 5344a3caf744SVidyullatha Kanchanapally * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 5345a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of @pmk in octets 5346a3caf744SVidyullatha Kanchanapally * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 5347a3caf744SVidyullatha Kanchanapally * used for this FILS connection (may be %NULL). 53485349a0f7SVidyullatha Kanchanapally * @timeout_reason: Reason for connection timeout. This is used when the 53495349a0f7SVidyullatha Kanchanapally * connection fails due to a timeout instead of an explicit rejection from 53505349a0f7SVidyullatha Kanchanapally * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 53515349a0f7SVidyullatha Kanchanapally * not known. This value is used only if @status < 0 to indicate that the 53525349a0f7SVidyullatha Kanchanapally * failure is due to a timeout and not due to explicit rejection by the AP. 53535349a0f7SVidyullatha Kanchanapally * This value is ignored in other cases (@status >= 0). 53545349a0f7SVidyullatha Kanchanapally */ 53555349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params { 53565349a0f7SVidyullatha Kanchanapally int status; 53575349a0f7SVidyullatha Kanchanapally const u8 *bssid; 53585349a0f7SVidyullatha Kanchanapally struct cfg80211_bss *bss; 53595349a0f7SVidyullatha Kanchanapally const u8 *req_ie; 53605349a0f7SVidyullatha Kanchanapally size_t req_ie_len; 53615349a0f7SVidyullatha Kanchanapally const u8 *resp_ie; 53625349a0f7SVidyullatha Kanchanapally size_t resp_ie_len; 5363a3caf744SVidyullatha Kanchanapally const u8 *fils_kek; 5364a3caf744SVidyullatha Kanchanapally size_t fils_kek_len; 5365a3caf744SVidyullatha Kanchanapally bool update_erp_next_seq_num; 5366a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 5367a3caf744SVidyullatha Kanchanapally const u8 *pmk; 5368a3caf744SVidyullatha Kanchanapally size_t pmk_len; 5369a3caf744SVidyullatha Kanchanapally const u8 *pmkid; 53705349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason; 53715349a0f7SVidyullatha Kanchanapally }; 53725349a0f7SVidyullatha Kanchanapally 53735349a0f7SVidyullatha Kanchanapally /** 53745349a0f7SVidyullatha Kanchanapally * cfg80211_connect_done - notify cfg80211 of connection result 53755349a0f7SVidyullatha Kanchanapally * 53765349a0f7SVidyullatha Kanchanapally * @dev: network device 53775349a0f7SVidyullatha Kanchanapally * @params: connection response parameters 53785349a0f7SVidyullatha Kanchanapally * @gfp: allocation flags 53795349a0f7SVidyullatha Kanchanapally * 53805349a0f7SVidyullatha Kanchanapally * It should be called by the underlying driver once execution of the connection 53815349a0f7SVidyullatha Kanchanapally * request from connect() has been completed. This is similar to 53825349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), but takes a structure pointer for connection response 53835349a0f7SVidyullatha Kanchanapally * parameters. Only one of the functions among cfg80211_connect_bss(), 53845349a0f7SVidyullatha Kanchanapally * cfg80211_connect_result(), cfg80211_connect_timeout(), 53855349a0f7SVidyullatha Kanchanapally * and cfg80211_connect_done() should be called. 53865349a0f7SVidyullatha Kanchanapally */ 53875349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev, 53885349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params *params, 53895349a0f7SVidyullatha Kanchanapally gfp_t gfp); 53905349a0f7SVidyullatha Kanchanapally 53915349a0f7SVidyullatha Kanchanapally /** 5392e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 5393e7054989SKanchanapally, Vidyullatha * 5394e7054989SKanchanapally, Vidyullatha * @dev: network device 5395e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 5396e7054989SKanchanapally, Vidyullatha * @bss: entry of bss to which STA got connected to, can be obtained 5397e7054989SKanchanapally, Vidyullatha * through cfg80211_get_bss (may be %NULL) 5398e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 5399e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 5400e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 5401e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 5402c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 5403e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5404c88215d7SJouni Malinen * the real status code for failures. If this call is used to report a 5405c88215d7SJouni Malinen * failure due to a timeout (e.g., not receiving an Authentication frame 5406c88215d7SJouni Malinen * from the AP) instead of an explicit rejection by the AP, -1 is used to 5407c88215d7SJouni Malinen * indicate that this is a failure, but without a status code. 5408c88215d7SJouni Malinen * @timeout_reason is used to report the reason for the timeout in that 5409c88215d7SJouni Malinen * case. 5410e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 54113093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. This is used when the 54123093ebbeSPurushottam Kushwaha * connection fails due to a timeout instead of an explicit rejection from 54133093ebbeSPurushottam Kushwaha * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 54143093ebbeSPurushottam Kushwaha * not known. This value is used only if @status < 0 to indicate that the 54153093ebbeSPurushottam Kushwaha * failure is due to a timeout and not due to explicit rejection by the AP. 54163093ebbeSPurushottam Kushwaha * This value is ignored in other cases (@status >= 0). 5417e7054989SKanchanapally, Vidyullatha * 5418c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 5419c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 5420c88215d7SJouni Malinen * cfg80211_connect_result(), but with the option of identifying the exact bss 54215349a0f7SVidyullatha Kanchanapally * entry for the connection. Only one of the functions among 54225349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 54235349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 5424e7054989SKanchanapally, Vidyullatha */ 54255349a0f7SVidyullatha Kanchanapally static inline void 54265349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 5427e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 5428e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 54293093ebbeSPurushottam Kushwaha size_t resp_ie_len, int status, gfp_t gfp, 54305349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason) 54315349a0f7SVidyullatha Kanchanapally { 54325349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params params; 54335349a0f7SVidyullatha Kanchanapally 54345349a0f7SVidyullatha Kanchanapally memset(¶ms, 0, sizeof(params)); 54355349a0f7SVidyullatha Kanchanapally params.status = status; 54365349a0f7SVidyullatha Kanchanapally params.bssid = bssid; 54375349a0f7SVidyullatha Kanchanapally params.bss = bss; 54385349a0f7SVidyullatha Kanchanapally params.req_ie = req_ie; 54395349a0f7SVidyullatha Kanchanapally params.req_ie_len = req_ie_len; 54405349a0f7SVidyullatha Kanchanapally params.resp_ie = resp_ie; 54415349a0f7SVidyullatha Kanchanapally params.resp_ie_len = resp_ie_len; 54425349a0f7SVidyullatha Kanchanapally params.timeout_reason = timeout_reason; 54435349a0f7SVidyullatha Kanchanapally 54445349a0f7SVidyullatha Kanchanapally cfg80211_connect_done(dev, ¶ms, gfp); 54455349a0f7SVidyullatha Kanchanapally } 5446e7054989SKanchanapally, Vidyullatha 5447e7054989SKanchanapally, Vidyullatha /** 5448b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 5449b23aa676SSamuel Ortiz * 5450b23aa676SSamuel Ortiz * @dev: network device 5451b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 5452b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 5453b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 5454b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 5455b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 5456c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 5457b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5458b23aa676SSamuel Ortiz * the real status code for failures. 5459b23aa676SSamuel Ortiz * @gfp: allocation flags 5460b23aa676SSamuel Ortiz * 5461c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 5462c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 5463c88215d7SJouni Malinen * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 54645349a0f7SVidyullatha Kanchanapally * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 54655349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 5466b23aa676SSamuel Ortiz */ 5467e7054989SKanchanapally, Vidyullatha static inline void 5468e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 5469b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 5470b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 5471e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 5472e7054989SKanchanapally, Vidyullatha { 5473e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 54743093ebbeSPurushottam Kushwaha resp_ie_len, status, gfp, 54753093ebbeSPurushottam Kushwaha NL80211_TIMEOUT_UNSPECIFIED); 5476e7054989SKanchanapally, Vidyullatha } 5477b23aa676SSamuel Ortiz 5478b23aa676SSamuel Ortiz /** 5479bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 5480bf1ecd21SJouni Malinen * 5481bf1ecd21SJouni Malinen * @dev: network device 5482bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 5483bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 5484bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 5485bf1ecd21SJouni Malinen * @gfp: allocation flags 54863093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. 5487bf1ecd21SJouni Malinen * 5488bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 5489bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 5490bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 5491bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 54925349a0f7SVidyullatha Kanchanapally * waiting for the response. Only one of the functions among 54935349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 54945349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 5495bf1ecd21SJouni Malinen */ 5496bf1ecd21SJouni Malinen static inline void 5497bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 54983093ebbeSPurushottam Kushwaha const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 54993093ebbeSPurushottam Kushwaha enum nl80211_timeout_reason timeout_reason) 5500bf1ecd21SJouni Malinen { 5501bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 55023093ebbeSPurushottam Kushwaha gfp, timeout_reason); 5503bf1ecd21SJouni Malinen } 5504bf1ecd21SJouni Malinen 5505bf1ecd21SJouni Malinen /** 550629ce6ecbSAvraham Stern * struct cfg80211_roam_info - driver initiated roaming information 550729ce6ecbSAvraham Stern * 550829ce6ecbSAvraham Stern * @channel: the channel of the new AP 550929ce6ecbSAvraham Stern * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set) 551029ce6ecbSAvraham Stern * @bssid: the BSSID of the new AP (may be %NULL if %bss is set) 551129ce6ecbSAvraham Stern * @req_ie: association request IEs (maybe be %NULL) 551229ce6ecbSAvraham Stern * @req_ie_len: association request IEs length 551329ce6ecbSAvraham Stern * @resp_ie: association response IEs (may be %NULL) 551429ce6ecbSAvraham Stern * @resp_ie_len: assoc response IEs length 551529ce6ecbSAvraham Stern */ 551629ce6ecbSAvraham Stern struct cfg80211_roam_info { 551729ce6ecbSAvraham Stern struct ieee80211_channel *channel; 551829ce6ecbSAvraham Stern struct cfg80211_bss *bss; 551929ce6ecbSAvraham Stern const u8 *bssid; 552029ce6ecbSAvraham Stern const u8 *req_ie; 552129ce6ecbSAvraham Stern size_t req_ie_len; 552229ce6ecbSAvraham Stern const u8 *resp_ie; 552329ce6ecbSAvraham Stern size_t resp_ie_len; 552429ce6ecbSAvraham Stern }; 552529ce6ecbSAvraham Stern 552629ce6ecbSAvraham Stern /** 5527b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 5528b23aa676SSamuel Ortiz * 5529b23aa676SSamuel Ortiz * @dev: network device 553029ce6ecbSAvraham Stern * @info: information about the new BSS. struct &cfg80211_roam_info. 5531b23aa676SSamuel Ortiz * @gfp: allocation flags 5532b23aa676SSamuel Ortiz * 553329ce6ecbSAvraham Stern * This function may be called with the driver passing either the BSSID of the 553429ce6ecbSAvraham Stern * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 553529ce6ecbSAvraham Stern * It should be called by the underlying driver whenever it roamed from one AP 553629ce6ecbSAvraham Stern * to another while connected. Drivers which have roaming implemented in 553729ce6ecbSAvraham Stern * firmware should pass the bss entry to avoid a race in bss entry timeout where 553829ce6ecbSAvraham Stern * the bss entry of the new AP is seen in the driver, but gets timed out by the 553929ce6ecbSAvraham Stern * time it is accessed in __cfg80211_roamed() due to delay in scheduling 5540adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 554129ce6ecbSAvraham Stern * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 554229ce6ecbSAvraham Stern * released while diconneting from the current bss. 5543adbde344SVasanthakumar Thiagarajan */ 554429ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 554529ce6ecbSAvraham Stern gfp_t gfp); 5546adbde344SVasanthakumar Thiagarajan 5547adbde344SVasanthakumar Thiagarajan /** 5548503c1fb9SAvraham Stern * cfg80211_port_authorized - notify cfg80211 of successful security association 5549503c1fb9SAvraham Stern * 5550503c1fb9SAvraham Stern * @dev: network device 5551503c1fb9SAvraham Stern * @bssid: the BSSID of the AP 5552503c1fb9SAvraham Stern * @gfp: allocation flags 5553503c1fb9SAvraham Stern * 5554503c1fb9SAvraham Stern * This function should be called by a driver that supports 4 way handshake 5555503c1fb9SAvraham Stern * offload after a security association was successfully established (i.e., 5556503c1fb9SAvraham Stern * the 4 way handshake was completed successfully). The call to this function 5557503c1fb9SAvraham Stern * should be preceded with a call to cfg80211_connect_result(), 5558503c1fb9SAvraham Stern * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 5559503c1fb9SAvraham Stern * indicate the 802.11 association. 5560503c1fb9SAvraham Stern */ 5561503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, 5562503c1fb9SAvraham Stern gfp_t gfp); 5563503c1fb9SAvraham Stern 5564503c1fb9SAvraham Stern /** 5565b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 5566b23aa676SSamuel Ortiz * 5567b23aa676SSamuel Ortiz * @dev: network device 5568b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 5569b23aa676SSamuel Ortiz * @ie_len: length of IEs 5570b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 557180279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 5572b23aa676SSamuel Ortiz * @gfp: allocation flags 5573b23aa676SSamuel Ortiz * 5574b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 5575b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 5576b23aa676SSamuel Ortiz */ 5577b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 557880279fb7SJohannes Berg const u8 *ie, size_t ie_len, 557980279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 5580b23aa676SSamuel Ortiz 55819588bbd5SJouni Malinen /** 55829588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 558371bbc994SJohannes Berg * @wdev: wireless device 55849588bbd5SJouni Malinen * @cookie: the request cookie 55859588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 55869588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 55879588bbd5SJouni Malinen * channel 55889588bbd5SJouni Malinen * @gfp: allocation flags 55899588bbd5SJouni Malinen */ 559071bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 55919588bbd5SJouni Malinen struct ieee80211_channel *chan, 55929588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 55939588bbd5SJouni Malinen 55949588bbd5SJouni Malinen /** 55959588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 559671bbc994SJohannes Berg * @wdev: wireless device 55979588bbd5SJouni Malinen * @cookie: the request cookie 55989588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 55999588bbd5SJouni Malinen * @gfp: allocation flags 56009588bbd5SJouni Malinen */ 560171bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 56029588bbd5SJouni Malinen struct ieee80211_channel *chan, 56039588bbd5SJouni Malinen gfp_t gfp); 5604b23aa676SSamuel Ortiz 560598b62183SJohannes Berg 560698b62183SJohannes Berg /** 560798b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 560898b62183SJohannes Berg * 560998b62183SJohannes Berg * @dev: the netdev 561098b62183SJohannes Berg * @mac_addr: the station's address 561198b62183SJohannes Berg * @sinfo: the station information 561298b62183SJohannes Berg * @gfp: allocation flags 561398b62183SJohannes Berg */ 561498b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 561598b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 561698b62183SJohannes Berg 5617026331c4SJouni Malinen /** 5618cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 5619cf5ead82SJohannes Berg * @dev: the netdev 5620cf5ead82SJohannes Berg * @mac_addr: the station's address 5621cf5ead82SJohannes Berg * @sinfo: the station information/statistics 5622cf5ead82SJohannes Berg * @gfp: allocation flags 5623cf5ead82SJohannes Berg */ 5624cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 5625cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 5626cf5ead82SJohannes Berg 5627cf5ead82SJohannes Berg /** 5628ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 5629ec15e68bSJouni Malinen * 5630ec15e68bSJouni Malinen * @dev: the netdev 5631ec15e68bSJouni Malinen * @mac_addr: the station's address 5632ec15e68bSJouni Malinen * @gfp: allocation flags 5633ec15e68bSJouni Malinen */ 5634cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 5635cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 5636cf5ead82SJohannes Berg { 5637cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 5638cf5ead82SJohannes Berg } 5639ec15e68bSJouni Malinen 5640ec15e68bSJouni Malinen /** 5641ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 5642ed44a951SPandiyarajan Pitchaimuthu * 5643ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 5644ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 5645ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 5646ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 5647ed44a951SPandiyarajan Pitchaimuthu * 5648ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 5649ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 5650ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 5651ed44a951SPandiyarajan Pitchaimuthu * 5652ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 5653ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 5654ed44a951SPandiyarajan Pitchaimuthu */ 5655ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 5656ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 5657ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 5658ed44a951SPandiyarajan Pitchaimuthu 5659ed44a951SPandiyarajan Pitchaimuthu /** 56602e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 566171bbc994SJohannes Berg * @wdev: wireless device receiving the frame 5662026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 56636c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 56642e161f78SJohannes Berg * @buf: Management frame (header + body) 5665026331c4SJouni Malinen * @len: length of the frame data 566619504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 56672e161f78SJohannes Berg * 56680ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 56690ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 56700ae997dcSYacine Belkadi * 56710ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 56722e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 56732e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 56742e161f78SJohannes Berg * driver is responsible for rejecting the frame. 5675026331c4SJouni Malinen */ 567671bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 5677970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 5678026331c4SJouni Malinen 5679026331c4SJouni Malinen /** 56802e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 568171bbc994SJohannes Berg * @wdev: wireless device receiving the frame 56822e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 56832e161f78SJohannes Berg * @buf: Management frame (header + body) 5684026331c4SJouni Malinen * @len: length of the frame data 5685026331c4SJouni Malinen * @ack: Whether frame was acknowledged 5686026331c4SJouni Malinen * @gfp: context flags 5687026331c4SJouni Malinen * 56882e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 56892e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 5690026331c4SJouni Malinen * transmission attempt. 5691026331c4SJouni Malinen */ 569271bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 5693026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 5694026331c4SJouni Malinen 5695d6dc1a38SJuuso Oikarinen 5696d6dc1a38SJuuso Oikarinen /** 5697d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 5698d6dc1a38SJuuso Oikarinen * @dev: network device 5699d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 5700bee427b8SAndrzej Zaborowski * @rssi_level: new RSSI level value or 0 if not available 5701d6dc1a38SJuuso Oikarinen * @gfp: context flags 5702d6dc1a38SJuuso Oikarinen * 5703d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 5704d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 5705d6dc1a38SJuuso Oikarinen */ 5706d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 5707d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 5708bee427b8SAndrzej Zaborowski s32 rssi_level, gfp_t gfp); 5709d6dc1a38SJuuso Oikarinen 5710c063dbf5SJohannes Berg /** 5711c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 5712c063dbf5SJohannes Berg * @dev: network device 5713c063dbf5SJohannes Berg * @peer: peer's MAC address 5714c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 5715c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 5716c063dbf5SJohannes Berg * threshold (to account for temporary interference) 5717c063dbf5SJohannes Berg * @gfp: context flags 5718c063dbf5SJohannes Berg */ 5719c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 5720c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 5721c063dbf5SJohannes Berg 5722e5497d76SJohannes Berg /** 572384f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 572484f10708SThomas Pedersen * @dev: network device 572584f10708SThomas Pedersen * @peer: peer's MAC address 572684f10708SThomas Pedersen * @num_packets: how many packets were lost 572784f10708SThomas Pedersen * @rate: % of packets which failed transmission 572884f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 572984f10708SThomas Pedersen * @gfp: context flags 573084f10708SThomas Pedersen * 573184f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 573284f10708SThomas Pedersen * given interval is exceeded. 573384f10708SThomas Pedersen */ 573484f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 573584f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 573684f10708SThomas Pedersen 573784f10708SThomas Pedersen /** 573898f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 573998f03342SJohannes Berg * @dev: network device 574098f03342SJohannes Berg * @gfp: context flags 574198f03342SJohannes Berg * 574298f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 574398f03342SJohannes Berg */ 574498f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 574598f03342SJohannes Berg 574698f03342SJohannes Berg /** 57475b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 57485b97f49dSJohannes Berg * @wiphy: the wiphy 57495b97f49dSJohannes Berg * @chandef: chandef for the current channel 57505b97f49dSJohannes Berg * @gfp: context flags 57515b97f49dSJohannes Berg * 57525b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 57535b97f49dSJohannes Berg */ 57545b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 57555b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 57565b97f49dSJohannes Berg 57575b97f49dSJohannes Berg /** 5758466b9936Stamizhr@codeaurora.org * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event 5759466b9936Stamizhr@codeaurora.org * @dev: network device 5760466b9936Stamizhr@codeaurora.org * @mac: MAC address of a station which opmode got modified 5761466b9936Stamizhr@codeaurora.org * @sta_opmode: station's current opmode value 5762466b9936Stamizhr@codeaurora.org * @gfp: context flags 5763466b9936Stamizhr@codeaurora.org * 5764466b9936Stamizhr@codeaurora.org * Driver should call this function when station's opmode modified via action 5765466b9936Stamizhr@codeaurora.org * frame. 5766466b9936Stamizhr@codeaurora.org */ 5767466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, 5768466b9936Stamizhr@codeaurora.org struct sta_opmode_info *sta_opmode, 5769466b9936Stamizhr@codeaurora.org gfp_t gfp); 5770466b9936Stamizhr@codeaurora.org 5771466b9936Stamizhr@codeaurora.org /** 57725b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 57735b97f49dSJohannes Berg * @netdev: network device 57745b97f49dSJohannes Berg * @chandef: chandef for the current channel 57755b97f49dSJohannes Berg * @event: type of event 57765b97f49dSJohannes Berg * @gfp: context flags 57775b97f49dSJohannes Berg * 57785b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 57795b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 57805b97f49dSJohannes Berg * also by full-MAC drivers. 57815b97f49dSJohannes Berg */ 57825b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 57835b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 57845b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 57855b97f49dSJohannes Berg 57865b97f49dSJohannes Berg 57875b97f49dSJohannes Berg /** 5788e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 5789e5497d76SJohannes Berg * @dev: network device 5790e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 5791e5497d76SJohannes Berg * @replay_ctr: new replay counter 5792af71ff85SJohannes Berg * @gfp: allocation flags 5793e5497d76SJohannes Berg */ 5794e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 5795e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 5796e5497d76SJohannes Berg 5797c9df56b4SJouni Malinen /** 5798c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 5799c9df56b4SJouni Malinen * @dev: network device 5800c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 5801c9df56b4SJouni Malinen * @bssid: BSSID of AP 5802c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 5803c9df56b4SJouni Malinen * @gfp: allocation flags 5804c9df56b4SJouni Malinen */ 5805c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 5806c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 5807c9df56b4SJouni Malinen 580828946da7SJohannes Berg /** 580928946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 581028946da7SJohannes Berg * @dev: The device the frame matched to 581128946da7SJohannes Berg * @addr: the transmitter address 581228946da7SJohannes Berg * @gfp: context flags 581328946da7SJohannes Berg * 581428946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 581528946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 581628946da7SJohannes Berg * sender. 58170ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 581828946da7SJohannes Berg * for a reason other than not having a subscription.) 581928946da7SJohannes Berg */ 582028946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 582128946da7SJohannes Berg const u8 *addr, gfp_t gfp); 582228946da7SJohannes Berg 58237f6cf311SJohannes Berg /** 5824b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 5825b92ab5d8SJohannes Berg * @dev: The device the frame matched to 5826b92ab5d8SJohannes Berg * @addr: the transmitter address 5827b92ab5d8SJohannes Berg * @gfp: context flags 5828b92ab5d8SJohannes Berg * 5829b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 5830b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 5831b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 5832b92ab5d8SJohannes Berg * station to avoid event flooding. 58330ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 5834b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 5835b92ab5d8SJohannes Berg */ 5836b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 5837b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 5838b92ab5d8SJohannes Berg 5839b92ab5d8SJohannes Berg /** 58407f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 58417f6cf311SJohannes Berg * @dev: the device the probe was sent on 58427f6cf311SJohannes Berg * @addr: the address of the peer 58437f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 58447f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 5845c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the ACK frame. 5846c4b50cd3SVenkateswara Naralasetty * @is_valid_ack_signal: indicates the ack_signal is valid or not. 58477f6cf311SJohannes Berg * @gfp: allocation flags 58487f6cf311SJohannes Berg */ 58497f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 5850c4b50cd3SVenkateswara Naralasetty u64 cookie, bool acked, s32 ack_signal, 5851c4b50cd3SVenkateswara Naralasetty bool is_valid_ack_signal, gfp_t gfp); 58527f6cf311SJohannes Berg 58535e760230SJohannes Berg /** 58545e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 58555e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 58565e760230SJohannes Berg * @frame: the frame 58575e760230SJohannes Berg * @len: length of the frame 58585e760230SJohannes Berg * @freq: frequency the frame was received on 58596c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 58605e760230SJohannes Berg * 58615e760230SJohannes Berg * Use this function to report to userspace when a beacon was 58625e760230SJohannes Berg * received. It is not useful to call this when there is no 58635e760230SJohannes Berg * netdev that is in AP/GO mode. 58645e760230SJohannes Berg */ 58655e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 58665e760230SJohannes Berg const u8 *frame, size_t len, 586737c73b5fSBen Greear int freq, int sig_dbm); 58685e760230SJohannes Berg 5869d58e7e37SJohannes Berg /** 5870683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 587154858ee5SAlexander Simon * @wiphy: the wiphy 5872683b6d3bSJohannes Berg * @chandef: the channel definition 5873174e0cd2SIlan Peer * @iftype: interface type 5874d58e7e37SJohannes Berg * 58750ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 58760ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 587754858ee5SAlexander Simon */ 5878683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 5879174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 5880174e0cd2SIlan Peer enum nl80211_iftype iftype); 588154858ee5SAlexander Simon 5882923b352fSArik Nemtsov /** 5883923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 5884923b352fSArik Nemtsov * @wiphy: the wiphy 5885923b352fSArik Nemtsov * @chandef: the channel definition 5886923b352fSArik Nemtsov * @iftype: interface type 5887923b352fSArik Nemtsov * 5888923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 5889923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 5890923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 5891923b352fSArik Nemtsov * more permissive conditions. 5892923b352fSArik Nemtsov * 5893923b352fSArik Nemtsov * Requires the RTNL to be held. 5894923b352fSArik Nemtsov */ 5895923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 5896923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 5897923b352fSArik Nemtsov enum nl80211_iftype iftype); 5898923b352fSArik Nemtsov 58998097e149SThomas Pedersen /* 59005314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 59015314526bSThomas Pedersen * @dev: the device which switched channels 5902683b6d3bSJohannes Berg * @chandef: the new channel definition 59035314526bSThomas Pedersen * 5904e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 5905e487eaebSSimon Wunderlich * driver context! 59065314526bSThomas Pedersen */ 5907683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 5908683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 59095314526bSThomas Pedersen 5910f8d7552eSLuciano Coelho /* 5911f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 5912f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 5913f8d7552eSLuciano Coelho * @chandef: the future channel definition 5914f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 5915f8d7552eSLuciano Coelho * 5916f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 5917f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 5918f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 5919f8d7552eSLuciano Coelho */ 5920f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 5921f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 5922f8d7552eSLuciano Coelho u8 count); 5923f8d7552eSLuciano Coelho 59241ce3e82bSJohannes Berg /** 59251ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 59261ce3e82bSJohannes Berg * 59271ce3e82bSJohannes Berg * @operating_class: the operating class to convert 59281ce3e82bSJohannes Berg * @band: band pointer to fill 59291ce3e82bSJohannes Berg * 59301ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 59311ce3e82bSJohannes Berg */ 59321ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 593357fbcce3SJohannes Berg enum nl80211_band *band); 59341ce3e82bSJohannes Berg 5935a38700ddSArik Nemtsov /** 5936a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 5937a38700ddSArik Nemtsov * 5938a38700ddSArik Nemtsov * @chandef: the chandef to convert 5939a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 5940a38700ddSArik Nemtsov * 5941a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 5942a38700ddSArik Nemtsov */ 5943a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 5944a38700ddSArik Nemtsov u8 *op_class); 5945a38700ddSArik Nemtsov 59465314526bSThomas Pedersen /* 59473475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 59483475b094SJouni Malinen * @dev: the device on which the operation is requested 59493475b094SJouni Malinen * @peer: the MAC address of the peer device 59503475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 59513475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 59523475b094SJouni Malinen * @reason_code: the reason code for teardown request 59533475b094SJouni Malinen * @gfp: allocation flags 59543475b094SJouni Malinen * 59553475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 59563475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 59573475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 59583475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 59593475b094SJouni Malinen * based on traffic and signal strength for a peer). 59603475b094SJouni Malinen */ 59613475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 59623475b094SJouni Malinen enum nl80211_tdls_operation oper, 59633475b094SJouni Malinen u16 reason_code, gfp_t gfp); 59643475b094SJouni Malinen 59653475b094SJouni Malinen /* 59668097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 59678097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 59688097e149SThomas Pedersen * 59698097e149SThomas Pedersen * return 0 if MCS index >= 32 59708097e149SThomas Pedersen */ 59718eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 59728097e149SThomas Pedersen 597398104fdeSJohannes Berg /** 597498104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 597598104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 597698104fdeSJohannes Berg * 597798104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 597898104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 597998104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 598098104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 598198104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 598298104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 598398104fdeSJohannes Berg * when the device is unbound from the driver. 598498104fdeSJohannes Berg * 598598104fdeSJohannes Berg * Requires the RTNL to be held. 598698104fdeSJohannes Berg */ 598798104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 598898104fdeSJohannes Berg 59890ee45355SJohannes Berg /** 5990355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 5991355199e0SJouni Malinen * @ies: FT IEs 5992355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 5993355199e0SJouni Malinen * @target_ap: target AP's MAC address 5994355199e0SJouni Malinen * @ric_ies: RIC IE 5995355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 5996355199e0SJouni Malinen */ 5997355199e0SJouni Malinen struct cfg80211_ft_event_params { 5998355199e0SJouni Malinen const u8 *ies; 5999355199e0SJouni Malinen size_t ies_len; 6000355199e0SJouni Malinen const u8 *target_ap; 6001355199e0SJouni Malinen const u8 *ric_ies; 6002355199e0SJouni Malinen size_t ric_ies_len; 6003355199e0SJouni Malinen }; 6004355199e0SJouni Malinen 6005355199e0SJouni Malinen /** 6006355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 6007355199e0SJouni Malinen * @netdev: network device 6008355199e0SJouni Malinen * @ft_event: IE information 6009355199e0SJouni Malinen */ 6010355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 6011355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 6012355199e0SJouni Malinen 6013355199e0SJouni Malinen /** 60140ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 60150ee45355SJohannes Berg * @ies: the input IE buffer 60160ee45355SJohannes Berg * @len: the input length 60170ee45355SJohannes Berg * @attr: the attribute ID to find 60180ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 60190ee45355SJohannes Berg * if the function is only called to get the needed buffer size 60200ee45355SJohannes Berg * @bufsize: size of the output buffer 60210ee45355SJohannes Berg * 60220ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 60230ee45355SJohannes Berg * copies its contents to the given buffer. 60240ee45355SJohannes Berg * 60250ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 60260ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 60270ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 60280ee45355SJohannes Berg */ 6029c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 6030c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 6031c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 60320ee45355SJohannes Berg 6033cd8f7cb4SJohannes Berg /** 603429464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 603529464cccSJohannes Berg * @ies: the IE buffer 603629464cccSJohannes Berg * @ielen: the length of the IE buffer 603729464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 60382512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 60392512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 604029464cccSJohannes Berg * @n_ids: the size of the element ID array 604129464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 604229464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 604329464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 604429464cccSJohannes Berg * 604529464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 604629464cccSJohannes Berg * variable to point to the location where the buffer should be 604729464cccSJohannes Berg * split. 604829464cccSJohannes Berg * 604929464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 605029464cccSJohannes Berg * has to be guaranteed by the caller! 605129464cccSJohannes Berg * 605229464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 605329464cccSJohannes Berg * correctly, if not the result of using this function will not 605429464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 605529464cccSJohannes Berg * 605629464cccSJohannes Berg * The function returns the offset where the next part of the 605729464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 605829464cccSJohannes Berg * of the buffer should be used. 605929464cccSJohannes Berg */ 606029464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 606129464cccSJohannes Berg const u8 *ids, int n_ids, 606229464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 606329464cccSJohannes Berg size_t offset); 606429464cccSJohannes Berg 606529464cccSJohannes Berg /** 606629464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 606729464cccSJohannes Berg * @ies: the IE buffer 606829464cccSJohannes Berg * @ielen: the length of the IE buffer 606929464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 60702512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 60712512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 607229464cccSJohannes Berg * @n_ids: the size of the element ID array 607329464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 607429464cccSJohannes Berg * 607529464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 607629464cccSJohannes Berg * variable to point to the location where the buffer should be 607729464cccSJohannes Berg * split. 607829464cccSJohannes Berg * 607929464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 608029464cccSJohannes Berg * has to be guaranteed by the caller! 608129464cccSJohannes Berg * 608229464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 608329464cccSJohannes Berg * correctly, if not the result of using this function will not 608429464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 608529464cccSJohannes Berg * 608629464cccSJohannes Berg * The function returns the offset where the next part of the 608729464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 608829464cccSJohannes Berg * of the buffer should be used. 608929464cccSJohannes Berg */ 60900483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 60910483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 60920483eeacSJohannes Berg { 60930483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 60940483eeacSJohannes Berg } 609529464cccSJohannes Berg 609629464cccSJohannes Berg /** 6097cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 6098cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 6099cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 6100cd8f7cb4SJohannes Berg * @gfp: allocation flags 6101cd8f7cb4SJohannes Berg * 6102cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 6103cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 6104cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 6105cd8f7cb4SJohannes Berg * else caused the wakeup. 6106cd8f7cb4SJohannes Berg */ 6107cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 6108cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 6109cd8f7cb4SJohannes Berg gfp_t gfp); 6110cd8f7cb4SJohannes Berg 61115de17984SArend van Spriel /** 61125de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 61135de17984SArend van Spriel * 61145de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 611503f831a6SRobert P. J. Day * @gfp: allocation flags 61165de17984SArend van Spriel * 61175de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 61185de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 61195de17984SArend van Spriel * by .crit_proto_start() has expired. 61205de17984SArend van Spriel */ 61215de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 61225de17984SArend van Spriel 6123bdfbec2dSIlan Peer /** 6124bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 6125bdfbec2dSIlan Peer * @wiphy: the wiphy 6126bdfbec2dSIlan Peer * 6127bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 6128bdfbec2dSIlan Peer */ 6129bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 6130bdfbec2dSIlan Peer 6131cb2d956dSLuciano Coelho /** 6132cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 6133cb2d956dSLuciano Coelho * 6134cb2d956dSLuciano Coelho * @wiphy: the wiphy 6135e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 6136cb2d956dSLuciano Coelho * 6137cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 6138cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 6139cb2d956dSLuciano Coelho * the interface combinations. 6140cb2d956dSLuciano Coelho */ 6141cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 6142e227300cSPurushottam Kushwaha struct iface_combination_params *params); 6143cb2d956dSLuciano Coelho 614465a124ddSMichal Kazior /** 614565a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 614665a124ddSMichal Kazior * 614765a124ddSMichal Kazior * @wiphy: the wiphy 6148e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 614965a124ddSMichal Kazior * @iter: function to call for each matching combination 615065a124ddSMichal Kazior * @data: pointer to pass to iter function 615165a124ddSMichal Kazior * 615265a124ddSMichal Kazior * This function can be called by the driver to check what possible 615365a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 615465a124ddSMichal Kazior * purposes. 615565a124ddSMichal Kazior */ 615665a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 6157e227300cSPurushottam Kushwaha struct iface_combination_params *params, 615865a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 615965a124ddSMichal Kazior void *data), 616065a124ddSMichal Kazior void *data); 616165a124ddSMichal Kazior 6162f04c2203SMichal Kazior /* 6163f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 6164f04c2203SMichal Kazior * 6165f04c2203SMichal Kazior * @wiphy: the wiphy 6166f04c2203SMichal Kazior * @wdev: wireless device 6167f04c2203SMichal Kazior * @gfp: context flags 6168f04c2203SMichal Kazior * 6169f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 6170f04c2203SMichal Kazior * disconnected. 6171f04c2203SMichal Kazior * 6172f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 6173f04c2203SMichal Kazior */ 6174f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 6175f04c2203SMichal Kazior gfp_t gfp); 6176f04c2203SMichal Kazior 6177f6837ba8SJohannes Berg /** 6178f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 6179f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 6180f6837ba8SJohannes Berg * 6181f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 6182f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 6183f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 6184f6837ba8SJohannes Berg * that really can't be recovered in any other way. 6185f6837ba8SJohannes Berg * 6186f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 6187f6837ba8SJohannes Berg * the driver while the function is running. 6188f6837ba8SJohannes Berg */ 6189f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 6190f6837ba8SJohannes Berg 6191d75bb06bSGautam Kumar Shukla /** 6192d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 6193d75bb06bSGautam Kumar Shukla * 6194d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 6195d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 6196d75bb06bSGautam Kumar Shukla * 6197d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 6198d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 6199d75bb06bSGautam Kumar Shukla */ 6200d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 6201d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 6202d75bb06bSGautam Kumar Shukla { 6203d75bb06bSGautam Kumar Shukla u8 *ft_byte; 6204d75bb06bSGautam Kumar Shukla 6205d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 6206d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 6207d75bb06bSGautam Kumar Shukla } 6208d75bb06bSGautam Kumar Shukla 6209d75bb06bSGautam Kumar Shukla /** 6210d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 6211d75bb06bSGautam Kumar Shukla * 6212d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 6213d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 6214d75bb06bSGautam Kumar Shukla * 6215d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 6216d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 6217d75bb06bSGautam Kumar Shukla */ 6218d75bb06bSGautam Kumar Shukla static inline bool 6219d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 6220d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 6221d75bb06bSGautam Kumar Shukla { 6222d75bb06bSGautam Kumar Shukla u8 ft_byte; 6223d75bb06bSGautam Kumar Shukla 6224d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 6225d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 6226d75bb06bSGautam Kumar Shukla } 6227b7ffbd7eSJohannes Berg 6228a442b761SAyala Beker /** 6229a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 6230a442b761SAyala Beker * @f: NAN function that should be freed 6231a442b761SAyala Beker * 6232a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 6233a442b761SAyala Beker */ 6234a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 6235a442b761SAyala Beker 623650bcd31dSAyala Beker /** 623750bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 623850bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 623950bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 624050bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 624150bcd31dSAyala Beker * result. 624250bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 624350bcd31dSAyala Beker * @inst_id: the local instance id 624450bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 624550bcd31dSAyala Beker * @addr: the MAC address of the peer 624650bcd31dSAyala Beker * @info_len: the length of the &info 624750bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 624850bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 624950bcd31dSAyala Beker */ 625050bcd31dSAyala Beker struct cfg80211_nan_match_params { 625150bcd31dSAyala Beker enum nl80211_nan_function_type type; 625250bcd31dSAyala Beker u8 inst_id; 625350bcd31dSAyala Beker u8 peer_inst_id; 625450bcd31dSAyala Beker const u8 *addr; 625550bcd31dSAyala Beker u8 info_len; 625650bcd31dSAyala Beker const u8 *info; 625750bcd31dSAyala Beker u64 cookie; 625850bcd31dSAyala Beker }; 625950bcd31dSAyala Beker 626050bcd31dSAyala Beker /** 626150bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 626250bcd31dSAyala Beker * @wdev: the wireless device reporting the match 626350bcd31dSAyala Beker * @match: match notification parameters 626450bcd31dSAyala Beker * @gfp: allocation flags 626550bcd31dSAyala Beker * 626650bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 626750bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 626850bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 626950bcd31dSAyala Beker */ 627050bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 627150bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 627250bcd31dSAyala Beker 6273368e5a7bSAyala Beker /** 6274368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 6275368e5a7bSAyala Beker * 6276368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 6277368e5a7bSAyala Beker * @inst_id: the local instance id 6278368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 6279368e5a7bSAyala Beker * @cookie: unique NAN function identifier 6280368e5a7bSAyala Beker * @gfp: allocation flags 6281368e5a7bSAyala Beker * 6282368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 6283368e5a7bSAyala Beker */ 6284368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 6285368e5a7bSAyala Beker u8 inst_id, 6286368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 6287368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 6288368e5a7bSAyala Beker 6289b7ffbd7eSJohannes Berg /* ethtool helper */ 6290b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 6291b7ffbd7eSJohannes Berg 629240cbfa90SSrinivas Dasari /** 629340cbfa90SSrinivas Dasari * cfg80211_external_auth_request - userspace request for authentication 629440cbfa90SSrinivas Dasari * @netdev: network device 629540cbfa90SSrinivas Dasari * @params: External authentication parameters 629640cbfa90SSrinivas Dasari * @gfp: allocation flags 629740cbfa90SSrinivas Dasari * Returns: 0 on success, < 0 on error 629840cbfa90SSrinivas Dasari */ 629940cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev, 630040cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params, 630140cbfa90SSrinivas Dasari gfp_t gfp); 630240cbfa90SSrinivas Dasari 6303e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 6304e1db74fcSJoe Perches 6305e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 6306e1db74fcSJoe Perches 6307e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 63089c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 6309e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 63109c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 6311e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 63129c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 6313e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 63149c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 6315e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 63169c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 6317e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 63189c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 6319e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 63209c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 6321e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 63229c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 6323073730d7SJoe Perches 63249c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 6325e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 63269c376639SJoe Perches 6327e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 63289c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 6329e1db74fcSJoe Perches 6330e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 6331e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 6332e1db74fcSJoe Perches #else 6333e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 6334e1db74fcSJoe Perches ({ \ 6335e1db74fcSJoe Perches if (0) \ 6336e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 6337e1db74fcSJoe Perches 0; \ 6338e1db74fcSJoe Perches }) 6339e1db74fcSJoe Perches #endif 6340e1db74fcSJoe Perches 6341e1db74fcSJoe Perches /* 6342e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 6343e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 6344e1db74fcSJoe Perches * file/line information and a backtrace. 6345e1db74fcSJoe Perches */ 6346e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 6347e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 6348e1db74fcSJoe Perches 6349704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 6350