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 6525fb628e9SJouni Malinen */ 6535fb628e9SJouni Malinen struct cfg80211_crypto_settings { 6545fb628e9SJouni Malinen u32 wpa_versions; 6555fb628e9SJouni Malinen u32 cipher_group; 6565fb628e9SJouni Malinen int n_ciphers_pairwise; 6575fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 6585fb628e9SJouni Malinen int n_akm_suites; 6595fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 6605fb628e9SJouni Malinen bool control_port; 6615fb628e9SJouni Malinen __be16 control_port_ethertype; 6625fb628e9SJouni Malinen bool control_port_no_encrypt; 663b8676221SDavid Spinadel struct key_params *wep_keys; 664b8676221SDavid Spinadel int wep_tx_key; 6655fb628e9SJouni Malinen }; 6665fb628e9SJouni Malinen 6675fb628e9SJouni Malinen /** 6688860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 669ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 670ed1b6cc7SJohannes Berg * or %NULL if not changed 671ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 672ed1b6cc7SJohannes Berg * or %NULL if not changed 673ed1b6cc7SJohannes Berg * @head_len: length of @head 674ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6759946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6769946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6779946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6789946ecfbSJouni Malinen * frames or %NULL 6799946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6809946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6819946ecfbSJouni Malinen * Response frames or %NULL 6829946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 68300f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 68400f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 685ed1b6cc7SJohannes Berg */ 6868860020eSJohannes Berg struct cfg80211_beacon_data { 6878860020eSJohannes Berg const u8 *head, *tail; 6888860020eSJohannes Berg const u8 *beacon_ies; 6898860020eSJohannes Berg const u8 *proberesp_ies; 6908860020eSJohannes Berg const u8 *assocresp_ies; 6918860020eSJohannes Berg const u8 *probe_resp; 6928860020eSJohannes Berg 6938860020eSJohannes Berg size_t head_len, tail_len; 6948860020eSJohannes Berg size_t beacon_ies_len; 6958860020eSJohannes Berg size_t proberesp_ies_len; 6968860020eSJohannes Berg size_t assocresp_ies_len; 6978860020eSJohannes Berg size_t probe_resp_len; 6988860020eSJohannes Berg }; 6998860020eSJohannes Berg 7006d45a74bSVasanthakumar Thiagarajan struct mac_address { 7016d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 7026d45a74bSVasanthakumar Thiagarajan }; 7036d45a74bSVasanthakumar Thiagarajan 7048860020eSJohannes Berg /** 70577765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 70677765eafSVasanthakumar Thiagarajan * 70777765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 708077f897aSJohannes Berg * entry specified by mac_addr 70977765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 71077765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 71177765eafSVasanthakumar Thiagarajan */ 71277765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 71377765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 71477765eafSVasanthakumar Thiagarajan int n_acl_entries; 71577765eafSVasanthakumar Thiagarajan 71677765eafSVasanthakumar Thiagarajan /* Keep it last */ 71777765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 71877765eafSVasanthakumar Thiagarajan }; 71977765eafSVasanthakumar Thiagarajan 720a7c7fbffSPurushottam Kushwaha /* 721a7c7fbffSPurushottam Kushwaha * cfg80211_bitrate_mask - masks for bitrate control 722a7c7fbffSPurushottam Kushwaha */ 723a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask { 724a7c7fbffSPurushottam Kushwaha struct { 725a7c7fbffSPurushottam Kushwaha u32 legacy; 726a7c7fbffSPurushottam Kushwaha u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 727a7c7fbffSPurushottam Kushwaha u16 vht_mcs[NL80211_VHT_NSS_MAX]; 728a7c7fbffSPurushottam Kushwaha enum nl80211_txrate_gi gi; 729a7c7fbffSPurushottam Kushwaha } control[NUM_NL80211_BANDS]; 730a7c7fbffSPurushottam Kushwaha }; 731a7c7fbffSPurushottam Kushwaha 7328860020eSJohannes Berg /** 7338860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 7348860020eSJohannes Berg * 7358860020eSJohannes Berg * Used to configure an AP interface. 7368860020eSJohannes Berg * 737683b6d3bSJohannes Berg * @chandef: defines the channel to use 7388860020eSJohannes Berg * @beacon: beacon data 7398860020eSJohannes Berg * @beacon_interval: beacon interval 7408860020eSJohannes Berg * @dtim_period: DTIM period 7418860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 7428860020eSJohannes Berg * user space) 7438860020eSJohannes Berg * @ssid_len: length of @ssid 7448860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 7458860020eSJohannes Berg * @crypto: crypto settings 7468860020eSJohannes Berg * @privacy: the BSS uses privacy 7478860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 74818998c38SEliad Peller * @smps_mode: SMPS mode 7491b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 75053cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 75153cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 75277765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 75377765eafSVasanthakumar Thiagarajan * MAC address based access control 75434d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 75534d50519SLior David * networks. 7568564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 75766cd794eSJohannes Berg * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 75866cd794eSJohannes Berg * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 75966cd794eSJohannes Berg * @ht_required: stations must support HT 76066cd794eSJohannes Berg * @vht_required: stations must support VHT 7618860020eSJohannes Berg */ 7628860020eSJohannes Berg struct cfg80211_ap_settings { 763683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 764aa430da4SJohannes Berg 7658860020eSJohannes Berg struct cfg80211_beacon_data beacon; 7668860020eSJohannes Berg 7678860020eSJohannes Berg int beacon_interval, dtim_period; 76832e9de84SJouni Malinen const u8 *ssid; 76932e9de84SJouni Malinen size_t ssid_len; 77032e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 7715fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 7725fb628e9SJouni Malinen bool privacy; 7735fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 77418998c38SEliad Peller enum nl80211_smps_mode smps_mode; 7751b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 77653cabad7SJohannes Berg u8 p2p_ctwindow; 77753cabad7SJohannes Berg bool p2p_opp_ps; 77877765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 77934d50519SLior David bool pbss; 780a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask beacon_rate; 78166cd794eSJohannes Berg 78266cd794eSJohannes Berg const struct ieee80211_ht_cap *ht_cap; 78366cd794eSJohannes Berg const struct ieee80211_vht_cap *vht_cap; 78466cd794eSJohannes Berg bool ht_required, vht_required; 785ed1b6cc7SJohannes Berg }; 786ed1b6cc7SJohannes Berg 7875727ef1bSJohannes Berg /** 78816ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 78916ef1fe2SSimon Wunderlich * 79016ef1fe2SSimon Wunderlich * Used for channel switch 79116ef1fe2SSimon Wunderlich * 79216ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 79316ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7949a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7959a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7969a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7979a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 79816ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 79916ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 80016ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 80116ef1fe2SSimon Wunderlich * @count: number of beacons until switch 80216ef1fe2SSimon Wunderlich */ 80316ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 80416ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 80516ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 8069a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 8079a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 8089a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 8099a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 81016ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 81116ef1fe2SSimon Wunderlich bool radar_required; 81216ef1fe2SSimon Wunderlich bool block_tx; 81316ef1fe2SSimon Wunderlich u8 count; 81416ef1fe2SSimon Wunderlich }; 81516ef1fe2SSimon Wunderlich 81616ef1fe2SSimon Wunderlich /** 817e227300cSPurushottam Kushwaha * struct iface_combination_params - input parameters for interface combinations 818e227300cSPurushottam Kushwaha * 819e227300cSPurushottam Kushwaha * Used to pass interface combination parameters 820e227300cSPurushottam Kushwaha * 821e227300cSPurushottam Kushwaha * @num_different_channels: the number of different channels we want 822e227300cSPurushottam Kushwaha * to use for verification 823e227300cSPurushottam Kushwaha * @radar_detect: a bitmap where each bit corresponds to a channel 824e227300cSPurushottam Kushwaha * width where radar detection is needed, as in the definition of 825e227300cSPurushottam Kushwaha * &struct ieee80211_iface_combination.@radar_detect_widths 826e227300cSPurushottam Kushwaha * @iftype_num: array with the number of interfaces of each interface 827e227300cSPurushottam Kushwaha * type. The index is the interface type as specified in &enum 828e227300cSPurushottam Kushwaha * nl80211_iftype. 8294c8dea63SJohannes Berg * @new_beacon_int: set this to the beacon interval of a new interface 8304c8dea63SJohannes Berg * that's not operating yet, if such is to be checked as part of 8314c8dea63SJohannes Berg * the verification 832e227300cSPurushottam Kushwaha */ 833e227300cSPurushottam Kushwaha struct iface_combination_params { 834e227300cSPurushottam Kushwaha int num_different_channels; 835e227300cSPurushottam Kushwaha u8 radar_detect; 836e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 8374c8dea63SJohannes Berg u32 new_beacon_int; 838e227300cSPurushottam Kushwaha }; 839e227300cSPurushottam Kushwaha 840e227300cSPurushottam Kushwaha /** 8413b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 8423b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 8439d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 844f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 8453b9ce80cSJohannes Berg * 8463b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 8473b9ce80cSJohannes Berg * for those that don't these flags will are used. 8483b9ce80cSJohannes Berg */ 8493b9ce80cSJohannes Berg enum station_parameters_apply_mask { 8503b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 8519d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 852f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 8533b9ce80cSJohannes Berg }; 8543b9ce80cSJohannes Berg 8553b9ce80cSJohannes Berg /** 8565727ef1bSJohannes Berg * struct station_parameters - station parameters 8575727ef1bSJohannes Berg * 8585727ef1bSJohannes Berg * Used to change and create a new station. 8595727ef1bSJohannes Berg * 8605727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 8615727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 8625727ef1bSJohannes Berg * (or NULL for no change) 8635727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 864eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 865819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 866eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 867819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 8685727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 8695727ef1bSJohannes Berg * @aid: AID or zero for no change 8707d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 871abe37c4bSJohannes Berg * @plink_action: plink action to take 8729c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 873abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 874f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 875910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 876910868dbSEliad Peller * as the AC bitmap in the QoS info field 877910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 878910868dbSEliad Peller * QoS info field (but already shifted down) 879c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 880c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 881c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 8823b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 8833b1c5a53SMarco Porsch * to unknown) 8849d62a986SJouni Malinen * @capability: station capability 8859d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 8869d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 887c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 888c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 889c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 890c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 89160f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 89260f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 89317b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 8945727ef1bSJohannes Berg */ 8955727ef1bSJohannes Berg struct station_parameters { 8962c1aabf3SJohannes Berg const u8 *supported_rates; 8975727ef1bSJohannes Berg struct net_device *vlan; 898eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 8993b9ce80cSJohannes Berg u32 sta_modify_mask; 9005727ef1bSJohannes Berg int listen_interval; 9015727ef1bSJohannes Berg u16 aid; 9027d27a0baSMasashi Honma u16 peer_aid; 9035727ef1bSJohannes Berg u8 supported_rates_len; 9042ec600d6SLuis Carlos Cobo u8 plink_action; 9059c3990aaSJavier Cardona u8 plink_state; 9062c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 9072c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 908c75786c9SEliad Peller u8 uapsd_queues; 909c75786c9SEliad Peller u8 max_sp; 9103b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 9119d62a986SJouni Malinen u16 capability; 9122c1aabf3SJohannes Berg const u8 *ext_capab; 9139d62a986SJouni Malinen u8 ext_capab_len; 914c01fc9adSSunil Dutt const u8 *supported_channels; 915c01fc9adSSunil Dutt u8 supported_channels_len; 916c01fc9adSSunil Dutt const u8 *supported_oper_classes; 917c01fc9adSSunil Dutt u8 supported_oper_classes_len; 91860f4a7b1SMarek Kwaczynski u8 opmode_notif; 91960f4a7b1SMarek Kwaczynski bool opmode_notif_used; 92017b94247SAyala Beker int support_p2p_ps; 9215727ef1bSJohannes Berg }; 9225727ef1bSJohannes Berg 923fd5b74dcSJohannes Berg /** 92489c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 92589c771e5SJouni Malinen * 92689c771e5SJouni Malinen * Used to delete a station entry (or all stations). 92789c771e5SJouni Malinen * 92889c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 92998856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 93098856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 93198856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 93289c771e5SJouni Malinen */ 93389c771e5SJouni Malinen struct station_del_parameters { 93489c771e5SJouni Malinen const u8 *mac; 93598856866SJouni Malinen u8 subtype; 93698856866SJouni Malinen u16 reason_code; 93789c771e5SJouni Malinen }; 93889c771e5SJouni Malinen 93989c771e5SJouni Malinen /** 94077ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 94177ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 94247edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 94347edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 94477ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 94577ee7c89SJohannes Berg * the AP MLME in the device 94677ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 94777ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 94877ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 94977ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 95077ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 95177ee7c89SJohannes Berg * supported/used) 95277ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 95377ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 954eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 955eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 95677ee7c89SJohannes Berg */ 95777ee7c89SJohannes Berg enum cfg80211_station_type { 95877ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 95947edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 96077ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 96177ee7c89SJohannes Berg CFG80211_STA_AP_STA, 96277ee7c89SJohannes Berg CFG80211_STA_IBSS, 96377ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 96477ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 965eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 966eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 96777ee7c89SJohannes Berg }; 96877ee7c89SJohannes Berg 96977ee7c89SJohannes Berg /** 97077ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 97177ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 97277ee7c89SJohannes Berg * @params: the new parameters for a station 97377ee7c89SJohannes Berg * @statype: the type of station being modified 97477ee7c89SJohannes Berg * 97577ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 97677ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 97777ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 97877ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 97977ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 98077ee7c89SJohannes Berg */ 98177ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 98277ee7c89SJohannes Berg struct station_parameters *params, 98377ee7c89SJohannes Berg enum cfg80211_station_type statype); 98477ee7c89SJohannes Berg 98577ee7c89SJohannes Berg /** 986420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 987420e7fabSHenning Rogge * 988420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 989420e7fabSHenning Rogge * type for 802.11n transmissions. 990420e7fabSHenning Rogge * 991db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 992db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 993420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 994db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 995420e7fabSHenning Rogge */ 996420e7fabSHenning Rogge enum rate_info_flags { 997db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 998db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 999b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 1000b51f3beeSJohannes Berg RATE_INFO_FLAGS_60G = BIT(3), 1001b51f3beeSJohannes Berg }; 1002b51f3beeSJohannes Berg 1003b51f3beeSJohannes Berg /** 1004b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 1005b51f3beeSJohannes Berg * 1006b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 1007b51f3beeSJohannes Berg * 1008b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 1009b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 1010b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 1011b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 1012b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 1013b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 1014b51f3beeSJohannes Berg */ 1015b51f3beeSJohannes Berg enum rate_info_bw { 1016842be75cSJohannes Berg RATE_INFO_BW_20 = 0, 1017b51f3beeSJohannes Berg RATE_INFO_BW_5, 1018b51f3beeSJohannes Berg RATE_INFO_BW_10, 1019b51f3beeSJohannes Berg RATE_INFO_BW_40, 1020b51f3beeSJohannes Berg RATE_INFO_BW_80, 1021b51f3beeSJohannes Berg RATE_INFO_BW_160, 1022420e7fabSHenning Rogge }; 1023420e7fabSHenning Rogge 1024420e7fabSHenning Rogge /** 1025420e7fabSHenning Rogge * struct rate_info - bitrate information 1026420e7fabSHenning Rogge * 1027420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 1028420e7fabSHenning Rogge * 1029420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 1030420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 1031420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 1032db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 1033b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 1034420e7fabSHenning Rogge */ 1035420e7fabSHenning Rogge struct rate_info { 1036420e7fabSHenning Rogge u8 flags; 1037420e7fabSHenning Rogge u8 mcs; 1038420e7fabSHenning Rogge u16 legacy; 1039db9c64cfSJohannes Berg u8 nss; 1040b51f3beeSJohannes Berg u8 bw; 1041fd5b74dcSJohannes Berg }; 1042fd5b74dcSJohannes Berg 1043fd5b74dcSJohannes Berg /** 1044f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 1045f4263c98SPaul Stewart * 1046f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1047f4263c98SPaul Stewart * type for 802.11n transmissions. 1048f4263c98SPaul Stewart * 1049f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1050f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1051f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1052f4263c98SPaul Stewart */ 1053f4263c98SPaul Stewart enum bss_param_flags { 1054f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1055f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1056f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1057f4263c98SPaul Stewart }; 1058f4263c98SPaul Stewart 1059f4263c98SPaul Stewart /** 1060f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1061f4263c98SPaul Stewart * 1062f4263c98SPaul Stewart * Information about the currently associated BSS 1063f4263c98SPaul Stewart * 1064f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1065f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1066f4263c98SPaul Stewart * @beacon_interval: beacon interval 1067f4263c98SPaul Stewart */ 1068f4263c98SPaul Stewart struct sta_bss_parameters { 1069f4263c98SPaul Stewart u8 flags; 1070f4263c98SPaul Stewart u8 dtim_period; 1071f4263c98SPaul Stewart u16 beacon_interval; 1072f4263c98SPaul Stewart }; 1073f4263c98SPaul Stewart 10746de39808SJohannes Berg /** 10756de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 10766de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 10776de39808SJohannes Berg * indicate the relevant values in this struct are filled 10786de39808SJohannes Berg * @rx_msdu: number of received MSDUs 10796de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 10806de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 10816de39808SJohannes Berg * transmitted MSDUs 10826de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 10836de39808SJohannes Berg */ 10846de39808SJohannes Berg struct cfg80211_tid_stats { 10856de39808SJohannes Berg u32 filled; 10866de39808SJohannes Berg u64 rx_msdu; 10876de39808SJohannes Berg u64 tx_msdu; 10886de39808SJohannes Berg u64 tx_msdu_retries; 10896de39808SJohannes Berg u64 tx_msdu_failed; 10906de39808SJohannes Berg }; 10916de39808SJohannes Berg 1092119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1093119363c7SFelix Fietkau 1094f4263c98SPaul Stewart /** 10952ec600d6SLuis Carlos Cobo * struct station_info - station information 1096fd5b74dcSJohannes Berg * 10972ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1098fd5b74dcSJohannes Berg * 1099319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1100319090bfSJohannes Berg * indicate the relevant values in this struct for them 1101ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1102fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 11038d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 11048d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 11052ec600d6SLuis Carlos Cobo * @llid: mesh local link id 11062ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 11072ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 110873c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 110973c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 111073c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 111173c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1112119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1113119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1114119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1115858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1116858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 11178d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 11188d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 11198d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 11208d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 11215a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 11221ba01458SRandy Dunlap * @bss_param: current BSS parameters 1123f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1124f5ea9120SJohannes Berg * This number should increase every time the list of stations 1125f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1126f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 112750d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 112850d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 112950d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 113050d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 113150d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1132c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1133a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1134d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 11353b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 11363b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 11373b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1138867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1139867d849fSAntonio Quartulli * towards this station. 1140a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1141a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1142a76b1942SJohannes Berg * from this peer 1143739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 11446de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 11456de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1146fd5b74dcSJohannes Berg */ 11472ec600d6SLuis Carlos Cobo struct station_info { 1148739960f1SMohammed Shafi Shajakhan u64 filled; 1149ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1150fd5b74dcSJohannes Berg u32 inactive_time; 115142745e03SVladimir Kondratiev u64 rx_bytes; 115242745e03SVladimir Kondratiev u64 tx_bytes; 11532ec600d6SLuis Carlos Cobo u16 llid; 11542ec600d6SLuis Carlos Cobo u16 plid; 11552ec600d6SLuis Carlos Cobo u8 plink_state; 1156420e7fabSHenning Rogge s8 signal; 1157541a45a1SBruno Randolf s8 signal_avg; 1158119363c7SFelix Fietkau 1159119363c7SFelix Fietkau u8 chains; 1160119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1161119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1162119363c7SFelix Fietkau 1163420e7fabSHenning Rogge struct rate_info txrate; 1164c8dcfd8aSFelix Fietkau struct rate_info rxrate; 116598c8a60aSJouni Malinen u32 rx_packets; 116698c8a60aSJouni Malinen u32 tx_packets; 1167b206b4efSBruno Randolf u32 tx_retries; 1168b206b4efSBruno Randolf u32 tx_failed; 11695a5c731aSBen Greear u32 rx_dropped_misc; 1170f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1171bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1172f5ea9120SJohannes Berg 1173f5ea9120SJohannes Berg int generation; 117450d3dfb7SJouni Malinen 117550d3dfb7SJouni Malinen const u8 *assoc_req_ies; 117650d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1177f612cedfSJouni Malinen 1178a85e1d55SPaul Stewart u32 beacon_loss_count; 1179d299a1f2SJavier Cardona s64 t_offset; 11803b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 11813b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 11823b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1183a85e1d55SPaul Stewart 1184867d849fSAntonio Quartulli u32 expected_throughput; 1185a76b1942SJohannes Berg 1186a76b1942SJohannes Berg u64 rx_beacon; 1187739960f1SMohammed Shafi Shajakhan u64 rx_duration; 1188a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 11896de39808SJohannes Berg struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1190fd5b74dcSJohannes Berg }; 1191fd5b74dcSJohannes Berg 119261aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 119366f7ac50SMichael Wu /** 11947406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11957406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11967406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11977406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11987406353dSAntonio Quartulli * 11997406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 12007406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 12017406353dSAntonio Quartulli * considered undefined. 12027406353dSAntonio Quartulli */ 12037406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 12047406353dSAntonio Quartulli struct station_info *sinfo); 120561aaa0e8SLinus Lüssing #else 120661aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 120761aaa0e8SLinus Lüssing const u8 *mac_addr, 120861aaa0e8SLinus Lüssing struct station_info *sinfo) 120961aaa0e8SLinus Lüssing { 121061aaa0e8SLinus Lüssing return -ENOENT; 121161aaa0e8SLinus Lüssing } 121261aaa0e8SLinus Lüssing #endif 12137406353dSAntonio Quartulli 12147406353dSAntonio Quartulli /** 121566f7ac50SMichael Wu * enum monitor_flags - monitor flags 121666f7ac50SMichael Wu * 121766f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 121866f7ac50SMichael Wu * according to the nl80211 flags. 121966f7ac50SMichael Wu * 1220818a986eSJohannes Berg * @MONITOR_FLAG_CHANGED: set if the flags were changed 122166f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 122266f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 122366f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 122466f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 122566f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1226e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 122766f7ac50SMichael Wu */ 122866f7ac50SMichael Wu enum monitor_flags { 1229818a986eSJohannes Berg MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID, 123066f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 123166f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 123266f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 123366f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 123466f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1235e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 123666f7ac50SMichael Wu }; 123766f7ac50SMichael Wu 12382ec600d6SLuis Carlos Cobo /** 12392ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 12402ec600d6SLuis Carlos Cobo * 12412ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 12422ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 12432ec600d6SLuis Carlos Cobo * 1244abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1245abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1246abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1247abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1248abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1249abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1250abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 12512ec600d6SLuis Carlos Cobo */ 12522ec600d6SLuis Carlos Cobo enum mpath_info_flags { 12532ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1254d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 12552ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 12562ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 12572ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 12582ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 12592ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 12602ec600d6SLuis Carlos Cobo }; 12612ec600d6SLuis Carlos Cobo 12622ec600d6SLuis Carlos Cobo /** 12632ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 12642ec600d6SLuis Carlos Cobo * 12652ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 12662ec600d6SLuis Carlos Cobo * 12672ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 12682ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1269d19b3bf6SRui Paulo * @sn: target sequence number 12702ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 12712ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 12722ec600d6SLuis Carlos Cobo * @flags: mesh path flags 12732ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 12742ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1275f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1276f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1277f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1278f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 12792ec600d6SLuis Carlos Cobo */ 12802ec600d6SLuis Carlos Cobo struct mpath_info { 12812ec600d6SLuis Carlos Cobo u32 filled; 12822ec600d6SLuis Carlos Cobo u32 frame_qlen; 1283d19b3bf6SRui Paulo u32 sn; 12842ec600d6SLuis Carlos Cobo u32 metric; 12852ec600d6SLuis Carlos Cobo u32 exptime; 12862ec600d6SLuis Carlos Cobo u32 discovery_timeout; 12872ec600d6SLuis Carlos Cobo u8 discovery_retries; 12882ec600d6SLuis Carlos Cobo u8 flags; 1289f5ea9120SJohannes Berg 1290f5ea9120SJohannes Berg int generation; 12912ec600d6SLuis Carlos Cobo }; 12922ec600d6SLuis Carlos Cobo 12939f1ba906SJouni Malinen /** 12949f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 12959f1ba906SJouni Malinen * 12969f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 12979f1ba906SJouni Malinen * 12989f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 12999f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 13009f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 13019f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 13029f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 13039f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 130490c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 130590c97a04SJouni Malinen * (or NULL for no change) 130690c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1307fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 130850b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 130950b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 131053cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 131153cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 13129f1ba906SJouni Malinen */ 13139f1ba906SJouni Malinen struct bss_parameters { 13149f1ba906SJouni Malinen int use_cts_prot; 13159f1ba906SJouni Malinen int use_short_preamble; 13169f1ba906SJouni Malinen int use_short_slot_time; 1317c1e5f471SJohannes Berg const u8 *basic_rates; 131890c97a04SJouni Malinen u8 basic_rates_len; 1319fd8aaaf3SFelix Fietkau int ap_isolate; 132050b12f59SHelmut Schaa int ht_opmode; 132153cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 13229f1ba906SJouni Malinen }; 13232ec600d6SLuis Carlos Cobo 13243ddd53f3SChun-Yeow Yeoh /** 132529cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 132629cbe68cSJohannes Berg * 132729cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 13283ddd53f3SChun-Yeow Yeoh * 13293ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 13303ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 13313ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 13323ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 13333ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 13343ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 13353ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 13363ddd53f3SChun-Yeow Yeoh * mesh interface 13373ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 13383ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 13393ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 13403ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 13413ddd53f3SChun-Yeow Yeoh * elements 13423ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 13433ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 13443ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 13453ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 13463ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 13473ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 13483ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 13493ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 13503ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 13513ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 13523ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 13533ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 13543ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 13553ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 13563ddd53f3SChun-Yeow Yeoh * element 13573ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 13583ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 13593ddd53f3SChun-Yeow Yeoh * element 13603ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 13613ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 13623ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 13633ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 13643ddd53f3SChun-Yeow Yeoh * announcements are transmitted 13653ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 13663ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 13673ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 13683ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 13693ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 13703ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 13713ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 13723ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 13733ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 13743ddd53f3SChun-Yeow Yeoh * station to establish a peer link 13753ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1376ac1073a6SChun-Yeow Yeoh * 1377ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1378ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1379ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1380ac1073a6SChun-Yeow Yeoh * 1381ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1382ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1383728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1384728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1385728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 13863b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 13873b1c5a53SMarco Porsch * setting for new peer links. 13883b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 13893b1c5a53SMarco Porsch * after transmitting its beacon. 13908e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 13918e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 13928e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 139329cbe68cSJohannes Berg */ 139493da9cc1Scolin@cozybit.com struct mesh_config { 139593da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 139693da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 139793da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 139893da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 139993da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 140093da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 140145904f21SJavier Cardona u8 element_ttl; 140293da9cc1Scolin@cozybit.com bool auto_open_plinks; 1403d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 140493da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 140593da9cc1Scolin@cozybit.com u32 path_refresh_time; 140693da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 140793da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 140893da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1409dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 141093da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 141163c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 14120507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 141316dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 141494f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 141555335137SAshok Nagarajan s32 rssi_threshold; 141670c33eaaSAshok Nagarajan u16 ht_opmode; 1417ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1418ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1419728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 14203b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 14213b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 14228e7c0538SColleen Twitty u32 plink_timeout; 142393da9cc1Scolin@cozybit.com }; 142493da9cc1Scolin@cozybit.com 142531888487SJouni Malinen /** 142629cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1427683b6d3bSJohannes Berg * @chandef: defines the channel to use 142829cbe68cSJohannes Berg * @mesh_id: the mesh ID 142929cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1430d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1431c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1432c80d545dSJavier Cardona * @path_metric: which metric to use 14336e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1434581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1435581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1436b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1437b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1438bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 14399bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 14409bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 14414bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1442ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 14438564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 144429cbe68cSJohannes Berg * 144529cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 144629cbe68cSJohannes Berg */ 144729cbe68cSJohannes Berg struct mesh_setup { 1448683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 144929cbe68cSJohannes Berg const u8 *mesh_id; 145029cbe68cSJohannes Berg u8 mesh_id_len; 1451d299a1f2SJavier Cardona u8 sync_method; 1452c80d545dSJavier Cardona u8 path_sel_proto; 1453c80d545dSJavier Cardona u8 path_metric; 14546e16d90bSColleen Twitty u8 auth_id; 1455581a8b0fSJavier Cardona const u8 *ie; 1456581a8b0fSJavier Cardona u8 ie_len; 1457b130e5ceSJavier Cardona bool is_authenticated; 145815d5dda6SJavier Cardona bool is_secure; 1459bb2798d4SThomas Pedersen bool user_mpm; 14609bdbf04dSMarco Porsch u8 dtim_period; 14619bdbf04dSMarco Porsch u16 beacon_interval; 146257fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1463ffb3cf30SAshok Nagarajan u32 basic_rates; 14648564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 146529cbe68cSJohannes Berg }; 146629cbe68cSJohannes Berg 146729cbe68cSJohannes Berg /** 14686e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 14696e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 14706e0bd6c3SRostislav Lisovy * 14716e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 14726e0bd6c3SRostislav Lisovy */ 14736e0bd6c3SRostislav Lisovy struct ocb_setup { 14746e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 14756e0bd6c3SRostislav Lisovy }; 14766e0bd6c3SRostislav Lisovy 14776e0bd6c3SRostislav Lisovy /** 147831888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1479a3304b0aSJohannes Berg * @ac: AC identifier 148031888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 148131888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 148231888487SJouni Malinen * 1..32767] 148331888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 148431888487SJouni Malinen * 1..32767] 148531888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 148631888487SJouni Malinen */ 148731888487SJouni Malinen struct ieee80211_txq_params { 1488a3304b0aSJohannes Berg enum nl80211_ac ac; 148931888487SJouni Malinen u16 txop; 149031888487SJouni Malinen u16 cwmin; 149131888487SJouni Malinen u16 cwmax; 149231888487SJouni Malinen u8 aifs; 149331888487SJouni Malinen }; 149431888487SJouni Malinen 1495d70e9693SJohannes Berg /** 1496d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1497d70e9693SJohannes Berg * 1498d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1499d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1500d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1501d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1502d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1503d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1504d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1505d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1506d70e9693SJohannes Berg * in the wiphy structure. 1507d70e9693SJohannes Berg * 1508d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1509d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1510d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1511d70e9693SJohannes Berg * 1512d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1513d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1514d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1515d70e9693SJohannes Berg * to userspace. 1516d70e9693SJohannes Berg */ 151772bdcf34SJouni Malinen 1518704232c2SJohannes Berg /** 15192a519311SJohannes Berg * struct cfg80211_ssid - SSID description 15202a519311SJohannes Berg * @ssid: the SSID 15212a519311SJohannes Berg * @ssid_len: length of the ssid 15222a519311SJohannes Berg */ 15232a519311SJohannes Berg struct cfg80211_ssid { 15242a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 15252a519311SJohannes Berg u8 ssid_len; 15262a519311SJohannes Berg }; 15272a519311SJohannes Berg 15282a519311SJohannes Berg /** 15291d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 15301d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 15311d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 15321d76250bSAvraham Stern * information is not available, this field is left zero. 15331d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 15341d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 15351d76250bSAvraham Stern * userspace will be notified of that 15361d76250bSAvraham Stern */ 15371d76250bSAvraham Stern struct cfg80211_scan_info { 15381d76250bSAvraham Stern u64 scan_start_tsf; 15391d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 15401d76250bSAvraham Stern bool aborted; 15411d76250bSAvraham Stern }; 15421d76250bSAvraham Stern 15431d76250bSAvraham Stern /** 15442a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 15452a519311SJohannes Berg * 15462a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 15472a519311SJohannes Berg * @n_ssids: number of SSIDs 15482a519311SJohannes Berg * @channels: channels to scan on. 1549ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1550dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 155170692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 155270692ad2SJouni Malinen * @ie_len: length of ie in octets 15531d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 15541d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 15551d76250bSAvraham Stern * the actual dwell time may be shorter. 15561d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 15571d76250bSAvraham Stern * %duration field. 1558ed473771SSam Leffler * @flags: bit field of flags controlling operation 155934850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 15602a519311SJohannes Berg * @wiphy: the wiphy this was for 156115d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1562fd014284SJohannes Berg * @wdev: the wireless device to scan for 15631d76250bSAvraham Stern * @info: (internal) information about completed scan 15645fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1565e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1566ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1567ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1568ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1569ad2b26abSJohannes Berg * be taken from the @mac_addr 1570818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 15712a519311SJohannes Berg */ 15722a519311SJohannes Berg struct cfg80211_scan_request { 15732a519311SJohannes Berg struct cfg80211_ssid *ssids; 15742a519311SJohannes Berg int n_ssids; 15752a519311SJohannes Berg u32 n_channels; 1576dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1577de95a54bSJohannes Berg const u8 *ie; 157870692ad2SJouni Malinen size_t ie_len; 15791d76250bSAvraham Stern u16 duration; 15801d76250bSAvraham Stern bool duration_mandatory; 1581ed473771SSam Leffler u32 flags; 15822a519311SJohannes Berg 158357fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 158434850ab2SJohannes Berg 1585fd014284SJohannes Berg struct wireless_dev *wdev; 1586fd014284SJohannes Berg 1587ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1588ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1589818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 1590ad2b26abSJohannes Berg 15912a519311SJohannes Berg /* internal */ 15922a519311SJohannes Berg struct wiphy *wiphy; 159315d6030bSSam Leffler unsigned long scan_start; 15941d76250bSAvraham Stern struct cfg80211_scan_info info; 15951d76250bSAvraham Stern bool notified; 1596e9f935e3SRajkumar Manoharan bool no_cck; 15975ba63533SJohannes Berg 15985ba63533SJohannes Berg /* keep last */ 15995ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 16002a519311SJohannes Berg }; 16012a519311SJohannes Berg 1602ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1603ad2b26abSJohannes Berg { 1604ad2b26abSJohannes Berg int i; 1605ad2b26abSJohannes Berg 1606ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1607ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1608ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1609ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1610ad2b26abSJohannes Berg } 1611ad2b26abSJohannes Berg } 1612ad2b26abSJohannes Berg 16132a519311SJohannes Berg /** 1614a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1615a1f1c21cSLuciano Coelho * 16163007e352SArend Van Spriel * @ssid: SSID to be matched; may be zero-length in case of BSSID match 16173007e352SArend Van Spriel * or no match (RSSI only) 16183007e352SArend Van Spriel * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 16193007e352SArend Van Spriel * or no match (RSSI only) 1620ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1621a1f1c21cSLuciano Coelho */ 1622a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1623a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 16243007e352SArend Van Spriel u8 bssid[ETH_ALEN]; 1625ea73cbceSJohannes Berg s32 rssi_thold; 1626a1f1c21cSLuciano Coelho }; 1627a1f1c21cSLuciano Coelho 1628a1f1c21cSLuciano Coelho /** 16293b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 16303b06d277SAvraham Stern * 16313b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 16323b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 16333b06d277SAvraham Stern * infinite loop. 16343b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 16353b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 16363b06d277SAvraham Stern */ 16373b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 16383b06d277SAvraham Stern u32 interval; 16393b06d277SAvraham Stern u32 iterations; 16403b06d277SAvraham Stern }; 16413b06d277SAvraham Stern 16423b06d277SAvraham Stern /** 1643bf95ecdbSvamsi krishna * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 1644bf95ecdbSvamsi krishna * 1645bf95ecdbSvamsi krishna * @band: band of BSS which should match for RSSI level adjustment. 1646bf95ecdbSvamsi krishna * @delta: value of RSSI level adjustment. 1647bf95ecdbSvamsi krishna */ 1648bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust { 1649bf95ecdbSvamsi krishna enum nl80211_band band; 1650bf95ecdbSvamsi krishna s8 delta; 1651bf95ecdbSvamsi krishna }; 1652bf95ecdbSvamsi krishna 1653bf95ecdbSvamsi krishna /** 1654807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1655807f8a8cSLuciano Coelho * 165696b08fd6SArend Van Spriel * @reqid: identifies this request. 1657807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1658807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1659807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1660dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1661807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1662807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1663ed473771SSam Leffler * @flags: bit field of flags controlling operation 1664a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1665a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1666a1f1c21cSLuciano Coelho * (others are filtered out). 1667a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1668a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1669*6406c919SJohannes Berg * @report_results: indicates that results were reported for this request 1670807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1671807f8a8cSLuciano Coelho * @dev: the interface 1672077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1673807f8a8cSLuciano Coelho * @channels: channels to scan 1674ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1675ea73cbceSJohannes Berg * contains the minimum over all matchsets 1676ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1677ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1678ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1679ad2b26abSJohannes Berg * be taken from the @mac_addr 16803b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 16813b06d277SAvraham Stern * index must be executed first. 16823b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 168331a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 168493a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 168593a1e86cSJukka Rissanen * owned by a particular socket) 1686ca986ad9SArend Van Spriel * @nl_owner_dead: netlink owner socket was closed - this request be freed 1687ca986ad9SArend Van Spriel * @list: for keeping list of requests. 16889c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 16899c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 16909c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 16919c748934SLuciano Coelho * supported. 1692bf95ecdbSvamsi krishna * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 1693bf95ecdbSvamsi krishna * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 1694bf95ecdbSvamsi krishna * reporting in connected state to cases where a matching BSS is determined 1695bf95ecdbSvamsi krishna * to have better or slightly worse RSSI than the current connected BSS. 1696bf95ecdbSvamsi krishna * The relative RSSI threshold values are ignored in disconnected state. 1697bf95ecdbSvamsi krishna * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 1698bf95ecdbSvamsi krishna * to the specified band while deciding whether a better BSS is reported 1699bf95ecdbSvamsi krishna * using @relative_rssi. If delta is a negative number, the BSSs that 1700bf95ecdbSvamsi krishna * belong to the specified band will be penalized by delta dB in relative 1701bf95ecdbSvamsi krishna * comparisions. 1702807f8a8cSLuciano Coelho */ 1703807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 170496b08fd6SArend Van Spriel u64 reqid; 1705807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1706807f8a8cSLuciano Coelho int n_ssids; 1707807f8a8cSLuciano Coelho u32 n_channels; 1708dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1709807f8a8cSLuciano Coelho const u8 *ie; 1710807f8a8cSLuciano Coelho size_t ie_len; 1711ed473771SSam Leffler u32 flags; 1712a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1713a1f1c21cSLuciano Coelho int n_match_sets; 1714ea73cbceSJohannes Berg s32 min_rssi_thold; 17159c748934SLuciano Coelho u32 delay; 17163b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 17173b06d277SAvraham Stern int n_scan_plans; 1718807f8a8cSLuciano Coelho 1719ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1720ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1721ad2b26abSJohannes Berg 1722bf95ecdbSvamsi krishna bool relative_rssi_set; 1723bf95ecdbSvamsi krishna s8 relative_rssi; 1724bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust rssi_adjust; 1725bf95ecdbSvamsi krishna 1726807f8a8cSLuciano Coelho /* internal */ 1727807f8a8cSLuciano Coelho struct wiphy *wiphy; 1728807f8a8cSLuciano Coelho struct net_device *dev; 172915d6030bSSam Leffler unsigned long scan_start; 1730b34939b9SArend Van Spriel bool report_results; 173131a60ed1SJukka Rissanen struct rcu_head rcu_head; 173293a1e86cSJukka Rissanen u32 owner_nlportid; 1733ca986ad9SArend Van Spriel bool nl_owner_dead; 1734ca986ad9SArend Van Spriel struct list_head list; 1735807f8a8cSLuciano Coelho 1736807f8a8cSLuciano Coelho /* keep last */ 1737807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1738807f8a8cSLuciano Coelho }; 1739807f8a8cSLuciano Coelho 1740807f8a8cSLuciano Coelho /** 17412a519311SJohannes Berg * enum cfg80211_signal_type - signal type 17422a519311SJohannes Berg * 17432a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 17442a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 17452a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 17462a519311SJohannes Berg */ 17472a519311SJohannes Berg enum cfg80211_signal_type { 17482a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 17492a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 17502a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 17512a519311SJohannes Berg }; 17522a519311SJohannes Berg 17532a519311SJohannes Berg /** 17546e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 17556e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 17566e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 17576e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 17586e19bc4bSDmitry Shmidt * signal type 17596e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 17606e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 17616e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 17626e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 17636e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 17646e19bc4bSDmitry Shmidt * ktime_get_boot_ns() is likely appropriate. 17651d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 17661d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 17671d76250bSAvraham Stern * by %parent_bssid. 17681d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 17691d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 17706e19bc4bSDmitry Shmidt */ 17716e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 17726e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 17736e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 17746e19bc4bSDmitry Shmidt s32 signal; 17756e19bc4bSDmitry Shmidt u64 boottime_ns; 17761d76250bSAvraham Stern u64 parent_tsf; 17771d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 17786e19bc4bSDmitry Shmidt }; 17796e19bc4bSDmitry Shmidt 17806e19bc4bSDmitry Shmidt /** 17812aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 17828cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 17839caf0364SJohannes Berg * @rcu_head: internal use, for freeing 17849caf0364SJohannes Berg * @len: length of the IEs 17850e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 17869caf0364SJohannes Berg * @data: IE data 17879caf0364SJohannes Berg */ 17889caf0364SJohannes Berg struct cfg80211_bss_ies { 17898cef2c9dSJohannes Berg u64 tsf; 17909caf0364SJohannes Berg struct rcu_head rcu_head; 17919caf0364SJohannes Berg int len; 17920e227084SJohannes Berg bool from_beacon; 17939caf0364SJohannes Berg u8 data[]; 17949caf0364SJohannes Berg }; 17959caf0364SJohannes Berg 17969caf0364SJohannes Berg /** 17972a519311SJohannes Berg * struct cfg80211_bss - BSS description 17982a519311SJohannes Berg * 17992a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 18002a519311SJohannes Berg * for use in scan results and similar. 18012a519311SJohannes Berg * 1802abe37c4bSJohannes Berg * @channel: channel this BSS is on 1803dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 18042a519311SJohannes Berg * @bssid: BSSID of the BSS 18052a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 18062a519311SJohannes Berg * @capability: the capability field in host byte order 180783c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 180883c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 180983c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 181083c7aa1aSJohannes Berg * received. It is always non-%NULL. 181134a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1812776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1813776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1814776b3580SJohannes Berg * @hidden_beacon_bss struct) 181534a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1816776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1817776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1818776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1819776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 182077965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 18212a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 18222a519311SJohannes Berg */ 18232a519311SJohannes Berg struct cfg80211_bss { 18242a519311SJohannes Berg struct ieee80211_channel *channel; 1825dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 18262a519311SJohannes Berg 18279caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 18289caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 18299caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 18309caf0364SJohannes Berg 1831776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 18322a519311SJohannes Berg 18332a519311SJohannes Berg s32 signal; 18342a519311SJohannes Berg 18359caf0364SJohannes Berg u16 beacon_interval; 18369caf0364SJohannes Berg u16 capability; 18379caf0364SJohannes Berg 18389caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 18399caf0364SJohannes Berg 18401c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 18412a519311SJohannes Berg }; 18422a519311SJohannes Berg 18432a519311SJohannes Berg /** 1844517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1845517357c6SJohannes Berg * @bss: the bss to search 1846517357c6SJohannes Berg * @ie: the IE ID 18479caf0364SJohannes Berg * 18489caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 18499caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 18500ae997dcSYacine Belkadi * Return: %NULL if not found. 1851517357c6SJohannes Berg */ 1852517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1853517357c6SJohannes Berg 1854517357c6SJohannes Berg 1855517357c6SJohannes Berg /** 1856636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1857636a5d36SJouni Malinen * 1858636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1859636a5d36SJouni Malinen * authentication. 1860636a5d36SJouni Malinen * 1861959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1862959867faSJohannes Berg * to it if it needs to keep it. 1863636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1864636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1865636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1866fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1867fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1868fffd0934SJohannes Berg * @key: WEP key for shared key authentication 186911b6b5a4SJouni Malinen * @auth_data: Fields and elements in Authentication frames. This contains 187011b6b5a4SJouni Malinen * the authentication frame body (non-IE and IE data), excluding the 187111b6b5a4SJouni Malinen * Authentication algorithm number, i.e., starting at the Authentication 187211b6b5a4SJouni Malinen * transaction sequence number field. 187311b6b5a4SJouni Malinen * @auth_data_len: Length of auth_data buffer in octets 1874636a5d36SJouni Malinen */ 1875636a5d36SJouni Malinen struct cfg80211_auth_request { 187619957bb3SJohannes Berg struct cfg80211_bss *bss; 1877636a5d36SJouni Malinen const u8 *ie; 1878636a5d36SJouni Malinen size_t ie_len; 187919957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1880fffd0934SJohannes Berg const u8 *key; 1881fffd0934SJohannes Berg u8 key_len, key_idx; 188211b6b5a4SJouni Malinen const u8 *auth_data; 188311b6b5a4SJouni Malinen size_t auth_data_len; 1884636a5d36SJouni Malinen }; 1885636a5d36SJouni Malinen 1886636a5d36SJouni Malinen /** 18877e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 18887e7c8926SBen Greear * 18897e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1890ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1891bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 18927e7c8926SBen Greear */ 18937e7c8926SBen Greear enum cfg80211_assoc_req_flags { 18947e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1895ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1896bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 18977e7c8926SBen Greear }; 18987e7c8926SBen Greear 18997e7c8926SBen Greear /** 1900636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1901636a5d36SJouni Malinen * 1902636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1903636a5d36SJouni Malinen * (re)association. 1904959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1905959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1906959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1907959867faSJohannes Berg * association requests while already associating must be rejected. 1908636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1909636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1910dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1911b23aa676SSamuel Ortiz * @crypto: crypto settings 191235eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 191335eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 191435eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 191535eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 191635eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 191735eb8f7bSJouni Malinen * frame. 19187e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 19197e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 19207e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 19217e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1922ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1923ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1924348bd456SJouni Malinen * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 1925348bd456SJouni Malinen * %NULL if FILS is not used. 1926348bd456SJouni Malinen * @fils_kek_len: Length of fils_kek in octets 1927348bd456SJouni Malinen * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 1928348bd456SJouni Malinen * Request/Response frame or %NULL if FILS is not used. This field starts 1929348bd456SJouni Malinen * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 1930636a5d36SJouni Malinen */ 1931636a5d36SJouni Malinen struct cfg80211_assoc_request { 193219957bb3SJohannes Berg struct cfg80211_bss *bss; 19333e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1934636a5d36SJouni Malinen size_t ie_len; 1935b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 193619957bb3SJohannes Berg bool use_mfp; 19377e7c8926SBen Greear u32 flags; 19387e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 19397e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1940ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1941348bd456SJouni Malinen const u8 *fils_kek; 1942348bd456SJouni Malinen size_t fils_kek_len; 1943348bd456SJouni Malinen const u8 *fils_nonces; 1944636a5d36SJouni Malinen }; 1945636a5d36SJouni Malinen 1946636a5d36SJouni Malinen /** 1947636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1948636a5d36SJouni Malinen * 1949636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1950636a5d36SJouni Malinen * deauthentication. 1951636a5d36SJouni Malinen * 195295de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1953636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1954636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 195519957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1956077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1957077f897aSJohannes Berg * do not set a deauth frame 1958636a5d36SJouni Malinen */ 1959636a5d36SJouni Malinen struct cfg80211_deauth_request { 196095de817bSJohannes Berg const u8 *bssid; 1961636a5d36SJouni Malinen const u8 *ie; 1962636a5d36SJouni Malinen size_t ie_len; 196319957bb3SJohannes Berg u16 reason_code; 19646863255bSStanislaw Gruszka bool local_state_change; 1965636a5d36SJouni Malinen }; 1966636a5d36SJouni Malinen 1967636a5d36SJouni Malinen /** 1968636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1969636a5d36SJouni Malinen * 1970636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 197166f00449SMasahiro Yamada * disassociation. 1972636a5d36SJouni Malinen * 197319957bb3SJohannes Berg * @bss: the BSS to disassociate from 1974636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1975636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 197619957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1977d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1978d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1979636a5d36SJouni Malinen */ 1980636a5d36SJouni Malinen struct cfg80211_disassoc_request { 198119957bb3SJohannes Berg struct cfg80211_bss *bss; 1982636a5d36SJouni Malinen const u8 *ie; 1983636a5d36SJouni Malinen size_t ie_len; 198419957bb3SJohannes Berg u16 reason_code; 1985d5cdfacbSJouni Malinen bool local_state_change; 1986636a5d36SJouni Malinen }; 1987636a5d36SJouni Malinen 1988636a5d36SJouni Malinen /** 198904a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 199004a773adSJohannes Berg * 199104a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 199204a773adSJohannes Berg * method. 199304a773adSJohannes Berg * 199404a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 199504a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 199604a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 199704a773adSJohannes Berg * search for IBSSs with a different BSSID. 1998683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 199904a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 200004a773adSJohannes Berg * IBSSs to join on other channels. 200104a773adSJohannes Berg * @ie: information element(s) to include in the beacon 200204a773adSJohannes Berg * @ie_len: length of that 20038e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 2004fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 2005fffd0934SJohannes Berg * after joining 2006267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 2007267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 2008267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 2009267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 20105336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 20115336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 20125336fa88SSimon Wunderlich * to operate on DFS channels. 2013fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 2014dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 2015803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2016803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 2017803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 201804a773adSJohannes Berg */ 201904a773adSJohannes Berg struct cfg80211_ibss_params { 2020c1e5f471SJohannes Berg const u8 *ssid; 2021c1e5f471SJohannes Berg const u8 *bssid; 2022683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 2023c1e5f471SJohannes Berg const u8 *ie; 202404a773adSJohannes Berg u8 ssid_len, ie_len; 20258e30bc55SJohannes Berg u16 beacon_interval; 2026fbd2c8dcSTeemu Paasikivi u32 basic_rates; 202704a773adSJohannes Berg bool channel_fixed; 2028fffd0934SJohannes Berg bool privacy; 2029267335d6SAntonio Quartulli bool control_port; 20305336fa88SSimon Wunderlich bool userspace_handles_dfs; 203157fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2032803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 2033803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 203404a773adSJohannes Berg }; 203504a773adSJohannes Berg 203604a773adSJohannes Berg /** 203738de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 203838de03d2SArend van Spriel * 203938de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 204038de03d2SArend van Spriel * @param: parameters for requestion behaviour. 204138de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 204238de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 204338de03d2SArend van Spriel */ 204438de03d2SArend van Spriel struct cfg80211_bss_selection { 204538de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 204638de03d2SArend van Spriel union { 204757fbcce3SJohannes Berg enum nl80211_band band_pref; 204838de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 204938de03d2SArend van Spriel } param; 205038de03d2SArend van Spriel }; 205138de03d2SArend van Spriel 205238de03d2SArend van Spriel /** 2053b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 2054b23aa676SSamuel Ortiz * 2055b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 2056b23aa676SSamuel Ortiz * authentication and association. 2057b23aa676SSamuel Ortiz * 2058b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 2059b23aa676SSamuel Ortiz * on scan results) 20601df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 20611df4a510SJouni Malinen * %NULL if not specified 2062b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 2063b23aa676SSamuel Ortiz * results) 20641df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 20651df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 20661df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 20671df4a510SJouni Malinen * to use. 2068b23aa676SSamuel Ortiz * @ssid: SSID 2069b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 2070b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 2071abe37c4bSJohannes Berg * @ie: IEs for association request 2072abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 2073b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 2074cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 2075b23aa676SSamuel Ortiz * @crypto: crypto settings 2076fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2077fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2078fffd0934SJohannes Berg * @key: WEP key for shared key authentication 20797e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 20804486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 20814486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 20827e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 20837e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 20847e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2085ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 2086ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 208734d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 208834d50519SLior David * networks. 208938de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 209035eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 209135eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 209235eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 209335eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 209435eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 209535eb8f7bSJouni Malinen * frame. 2096a3caf744SVidyullatha Kanchanapally * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 2097a3caf744SVidyullatha Kanchanapally * NAI or %NULL if not specified. This is used to construct FILS wrapped 2098a3caf744SVidyullatha Kanchanapally * data IE. 2099a3caf744SVidyullatha Kanchanapally * @fils_erp_username_len: Length of @fils_erp_username in octets. 2100a3caf744SVidyullatha Kanchanapally * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 2101a3caf744SVidyullatha Kanchanapally * %NULL if not specified. This specifies the domain name of ER server and 2102a3caf744SVidyullatha Kanchanapally * is used to construct FILS wrapped data IE. 2103a3caf744SVidyullatha Kanchanapally * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 2104a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 2105a3caf744SVidyullatha Kanchanapally * messages. This is also used to construct FILS wrapped data IE. 2106a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 2107a3caf744SVidyullatha Kanchanapally * keys in FILS or %NULL if not specified. 2108a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 2109b23aa676SSamuel Ortiz */ 2110b23aa676SSamuel Ortiz struct cfg80211_connect_params { 2111b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 21121df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 2113664834deSJouni Malinen const u8 *bssid; 21141df4a510SJouni Malinen const u8 *bssid_hint; 2115664834deSJouni Malinen const u8 *ssid; 2116b23aa676SSamuel Ortiz size_t ssid_len; 2117b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 21184b5800feSJohannes Berg const u8 *ie; 2119b23aa676SSamuel Ortiz size_t ie_len; 2120b23aa676SSamuel Ortiz bool privacy; 2121cee00a95SJouni Malinen enum nl80211_mfp mfp; 2122b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 2123fffd0934SJohannes Berg const u8 *key; 2124fffd0934SJohannes Berg u8 key_len, key_idx; 21257e7c8926SBen Greear u32 flags; 21264486ea98SBala Shanmugam int bg_scan_period; 21277e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 21287e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2129ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 2130ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 213134d50519SLior David bool pbss; 213238de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 2133ba6fbacfSJouni Malinen const u8 *prev_bssid; 2134a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_username; 2135a3caf744SVidyullatha Kanchanapally size_t fils_erp_username_len; 2136a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_realm; 2137a3caf744SVidyullatha Kanchanapally size_t fils_erp_realm_len; 2138a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 2139a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_rrk; 2140a3caf744SVidyullatha Kanchanapally size_t fils_erp_rrk_len; 2141b23aa676SSamuel Ortiz }; 2142b23aa676SSamuel Ortiz 2143b23aa676SSamuel Ortiz /** 2144088e8df8Svamsi krishna * enum cfg80211_connect_params_changed - Connection parameters being updated 2145088e8df8Svamsi krishna * 2146088e8df8Svamsi krishna * This enum provides information of all connect parameters that 2147088e8df8Svamsi krishna * have to be updated as part of update_connect_params() call. 2148088e8df8Svamsi krishna * 2149088e8df8Svamsi krishna * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 2150088e8df8Svamsi krishna */ 2151088e8df8Svamsi krishna enum cfg80211_connect_params_changed { 2152088e8df8Svamsi krishna UPDATE_ASSOC_IES = BIT(0), 2153088e8df8Svamsi krishna }; 2154088e8df8Svamsi krishna 2155088e8df8Svamsi krishna /** 2156b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 2157abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 2158abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 2159abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 2160abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2161abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 21623057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 2163b9a5f8caSJouni Malinen */ 2164b9a5f8caSJouni Malinen enum wiphy_params_flags { 2165b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2166b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 2167b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 2168b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 216981077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 21703057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 2171b9a5f8caSJouni Malinen }; 2172b9a5f8caSJouni Malinen 217367fbb16bSSamuel Ortiz /** 217467fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 217567fbb16bSSamuel Ortiz * 217667fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 217767fbb16bSSamuel Ortiz * caching. 217867fbb16bSSamuel Ortiz * 2179a3caf744SVidyullatha Kanchanapally * @bssid: The AP's BSSID (may be %NULL). 2180a3caf744SVidyullatha Kanchanapally * @pmkid: The identifier to refer a PMKSA. 2181a3caf744SVidyullatha Kanchanapally * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 2182a3caf744SVidyullatha Kanchanapally * derivation by a FILS STA. Otherwise, %NULL. 2183a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 2184a3caf744SVidyullatha Kanchanapally * the hash algorithm used to generate this. 2185a3caf744SVidyullatha Kanchanapally * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 2186a3caf744SVidyullatha Kanchanapally * cache identifier (may be %NULL). 2187a3caf744SVidyullatha Kanchanapally * @ssid_len: Length of the @ssid in octets. 2188a3caf744SVidyullatha Kanchanapally * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 2189a3caf744SVidyullatha Kanchanapally * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 2190a3caf744SVidyullatha Kanchanapally * %NULL). 219167fbb16bSSamuel Ortiz */ 219267fbb16bSSamuel Ortiz struct cfg80211_pmksa { 2193c1e5f471SJohannes Berg const u8 *bssid; 2194c1e5f471SJohannes Berg const u8 *pmkid; 2195a3caf744SVidyullatha Kanchanapally const u8 *pmk; 2196a3caf744SVidyullatha Kanchanapally size_t pmk_len; 2197a3caf744SVidyullatha Kanchanapally const u8 *ssid; 2198a3caf744SVidyullatha Kanchanapally size_t ssid_len; 2199a3caf744SVidyullatha Kanchanapally const u8 *cache_id; 220067fbb16bSSamuel Ortiz }; 22019930380fSJohannes Berg 22027643a2c3SJohannes Berg /** 220350ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 2204ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 2205ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 2206ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 2207ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 2208bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 2209ff1b6e69SJohannes Berg * 2210ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 2211ff1b6e69SJohannes Berg * memory, free @mask only! 2212ff1b6e69SJohannes Berg */ 221350ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 2214922bd80fSJohannes Berg const u8 *mask, *pattern; 2215ff1b6e69SJohannes Berg int pattern_len; 2216bb92d199SAmitkumar Karwar int pkt_offset; 2217ff1b6e69SJohannes Berg }; 2218ff1b6e69SJohannes Berg 2219ff1b6e69SJohannes Berg /** 22202a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 22212a0e047eSJohannes Berg * 22222a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 22232a0e047eSJohannes Berg * @src: source IP address 22242a0e047eSJohannes Berg * @dst: destination IP address 22252a0e047eSJohannes Berg * @dst_mac: destination MAC address 22262a0e047eSJohannes Berg * @src_port: source port 22272a0e047eSJohannes Berg * @dst_port: destination port 22282a0e047eSJohannes Berg * @payload_len: data payload length 22292a0e047eSJohannes Berg * @payload: data payload buffer 22302a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 22312a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 22322a0e047eSJohannes Berg * @wake_len: wakeup payload match length 22332a0e047eSJohannes Berg * @wake_data: wakeup payload match data 22342a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 22352a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 22362a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 22372a0e047eSJohannes Berg */ 22382a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 22392a0e047eSJohannes Berg struct socket *sock; 22402a0e047eSJohannes Berg __be32 src, dst; 22412a0e047eSJohannes Berg u16 src_port, dst_port; 22422a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 22432a0e047eSJohannes Berg int payload_len; 22442a0e047eSJohannes Berg const u8 *payload; 22452a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 22462a0e047eSJohannes Berg u32 data_interval; 22472a0e047eSJohannes Berg u32 wake_len; 22482a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 22492a0e047eSJohannes Berg u32 tokens_size; 22502a0e047eSJohannes Berg /* must be last, variable member */ 22512a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 2252ff1b6e69SJohannes Berg }; 2253ff1b6e69SJohannes Berg 2254ff1b6e69SJohannes Berg /** 2255ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2256ff1b6e69SJohannes Berg * 2257ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 2258ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 2259ff1b6e69SJohannes Berg * operating as normal during suspend 2260ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 2261ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 2262ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 2263ff1b6e69SJohannes Berg * @n_patterns: number of patterns 226477dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 226577dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 226677dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 226777dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 22682a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 22692a0e047eSJohannes Berg * NULL if not configured. 22708cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 2271ff1b6e69SJohannes Berg */ 2272ff1b6e69SJohannes Berg struct cfg80211_wowlan { 227377dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 227477dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 227577dbbb13SJohannes Berg rfkill_release; 227650ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 22772a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 2278ff1b6e69SJohannes Berg int n_patterns; 22798cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 2280ff1b6e69SJohannes Berg }; 2281ff1b6e69SJohannes Berg 2282ff1b6e69SJohannes Berg /** 2283be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 2284be29b99aSAmitkumar Karwar * 2285be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 2286be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 2287be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 2288be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 2289be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 2290be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 2291be29b99aSAmitkumar Karwar */ 2292be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2293be29b99aSAmitkumar Karwar int delay; 2294be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2295be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2296be29b99aSAmitkumar Karwar int n_patterns; 2297be29b99aSAmitkumar Karwar }; 2298be29b99aSAmitkumar Karwar 2299be29b99aSAmitkumar Karwar /** 2300be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2301be29b99aSAmitkumar Karwar * 2302be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2303be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2304be29b99aSAmitkumar Karwar * @n_rules: number of rules 2305be29b99aSAmitkumar Karwar */ 2306be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2307be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2308be29b99aSAmitkumar Karwar int n_rules; 2309be29b99aSAmitkumar Karwar }; 2310be29b99aSAmitkumar Karwar 2311be29b99aSAmitkumar Karwar /** 23128cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 23138cd4d456SLuciano Coelho * 23148cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 23158cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 23168cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 23178cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 23188cd4d456SLuciano Coelho * occurred (in MHz) 23198cd4d456SLuciano Coelho */ 23208cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 23218cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 23228cd4d456SLuciano Coelho int n_channels; 23238cd4d456SLuciano Coelho u32 channels[]; 23248cd4d456SLuciano Coelho }; 23258cd4d456SLuciano Coelho 23268cd4d456SLuciano Coelho /** 23278cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 23288cd4d456SLuciano Coelho * 23298cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 23308cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 23318cd4d456SLuciano Coelho * match information. 23328cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 23338cd4d456SLuciano Coelho * the matches that triggered the wake up. 23348cd4d456SLuciano Coelho */ 23358cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 23368cd4d456SLuciano Coelho int n_matches; 23378cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 23388cd4d456SLuciano Coelho }; 23398cd4d456SLuciano Coelho 23408cd4d456SLuciano Coelho /** 2341cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2342cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2343cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2344cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2345cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2346cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2347cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2348cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2349cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2350cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2351cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2352cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2353cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2354cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2355cd8f7cb4SJohannes Berg * it is. 23562a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 23572a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 23582a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 23598cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2360cd8f7cb4SJohannes Berg */ 2361cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2362cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2363cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 23642a0e047eSJohannes Berg rfkill_release, packet_80211, 23652a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2366cd8f7cb4SJohannes Berg s32 pattern_idx; 2367cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2368cd8f7cb4SJohannes Berg const void *packet; 23698cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2370cd8f7cb4SJohannes Berg }; 2371cd8f7cb4SJohannes Berg 2372cd8f7cb4SJohannes Berg /** 2373e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 237478f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 237578f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 237678f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2377e5497d76SJohannes Berg */ 2378e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 237978f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2380e5497d76SJohannes Berg }; 2381e5497d76SJohannes Berg 2382e5497d76SJohannes Berg /** 2383355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2384355199e0SJouni Malinen * 2385355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2386355199e0SJouni Malinen * 2387355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2388355199e0SJouni Malinen * @ie: Fast Transition IEs 2389355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2390355199e0SJouni Malinen */ 2391355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2392355199e0SJouni Malinen u16 md; 2393355199e0SJouni Malinen const u8 *ie; 2394355199e0SJouni Malinen size_t ie_len; 2395355199e0SJouni Malinen }; 2396355199e0SJouni Malinen 2397355199e0SJouni Malinen /** 2398b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2399b176e629SAndrei Otcheretianski * 2400b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2401b176e629SAndrei Otcheretianski * 2402b176e629SAndrei Otcheretianski * @chan: channel to use 2403b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2404b176e629SAndrei Otcheretianski * @wait: duration for ROC 2405b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2406b176e629SAndrei Otcheretianski * @len: buffer length 2407b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2408b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 240934d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 241034d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2411b176e629SAndrei Otcheretianski */ 2412b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2413b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2414b176e629SAndrei Otcheretianski bool offchan; 2415b176e629SAndrei Otcheretianski unsigned int wait; 2416b176e629SAndrei Otcheretianski const u8 *buf; 2417b176e629SAndrei Otcheretianski size_t len; 2418b176e629SAndrei Otcheretianski bool no_cck; 2419b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 242034d22ce2SAndrei Otcheretianski int n_csa_offsets; 242134d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2422b176e629SAndrei Otcheretianski }; 2423b176e629SAndrei Otcheretianski 2424b176e629SAndrei Otcheretianski /** 2425fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2426fa9ffc74SKyeyoon Park * 2427fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2428fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2429fa9ffc74SKyeyoon Park */ 2430fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2431fa9ffc74SKyeyoon Park u8 dscp; 2432fa9ffc74SKyeyoon Park u8 up; 2433fa9ffc74SKyeyoon Park }; 2434fa9ffc74SKyeyoon Park 2435fa9ffc74SKyeyoon Park /** 2436fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2437fa9ffc74SKyeyoon Park * 2438fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2439fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2440fa9ffc74SKyeyoon Park */ 2441fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2442fa9ffc74SKyeyoon Park u8 low; 2443fa9ffc74SKyeyoon Park u8 high; 2444fa9ffc74SKyeyoon Park }; 2445fa9ffc74SKyeyoon Park 2446fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2447fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2448fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2449fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2450fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2451fa9ffc74SKyeyoon Park 2452fa9ffc74SKyeyoon Park /** 2453fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2454fa9ffc74SKyeyoon Park * 2455fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2456fa9ffc74SKyeyoon Park * 2457fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2458fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2459fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2460fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2461fa9ffc74SKyeyoon Park */ 2462fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2463fa9ffc74SKyeyoon Park u8 num_des; 2464fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2465fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2466fa9ffc74SKyeyoon Park }; 2467fa9ffc74SKyeyoon Park 2468fa9ffc74SKyeyoon Park /** 2469cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 2470cb3b7d87SAyala Beker * 2471cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 2472cb3b7d87SAyala Beker * 2473cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 24748585989dSLuca Coelho * @bands: operating bands, a bitmap of &enum nl80211_band values. 24758585989dSLuca Coelho * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 24768585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 2477cb3b7d87SAyala Beker */ 2478cb3b7d87SAyala Beker struct cfg80211_nan_conf { 2479cb3b7d87SAyala Beker u8 master_pref; 24808585989dSLuca Coelho u8 bands; 2481cb3b7d87SAyala Beker }; 2482cb3b7d87SAyala Beker 2483cb3b7d87SAyala Beker /** 2484a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 2485a5a9dcf2SAyala Beker * configuration 2486a5a9dcf2SAyala Beker * 2487a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 24888585989dSLuca Coelho * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 2489a5a9dcf2SAyala Beker */ 2490a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 2491a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 24928585989dSLuca Coelho CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 2493a5a9dcf2SAyala Beker }; 2494a5a9dcf2SAyala Beker 2495a5a9dcf2SAyala Beker /** 2496a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 2497a442b761SAyala Beker * 2498a442b761SAyala Beker * @filter: the content of the filter 2499a442b761SAyala Beker * @len: the length of the filter 2500a442b761SAyala Beker */ 2501a442b761SAyala Beker struct cfg80211_nan_func_filter { 2502a442b761SAyala Beker const u8 *filter; 2503a442b761SAyala Beker u8 len; 2504a442b761SAyala Beker }; 2505a442b761SAyala Beker 2506a442b761SAyala Beker /** 2507a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 2508a442b761SAyala Beker * 2509a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 2510a442b761SAyala Beker * @service_id: the service ID of the function 2511a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 2512a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 2513a442b761SAyala Beker * implementation specific. 2514a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 2515a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 2516a442b761SAyala Beker * @followup_id: the instance ID for follow up 2517a442b761SAyala Beker * @followup_reqid: the requestor instance ID for follow up 2518a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 2519a442b761SAyala Beker * @ttl: time to live counter in DW. 2520a442b761SAyala Beker * @serv_spec_info: Service Specific Info 2521a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 2522a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 2523a442b761SAyala Beker * @srf_bf: Bloom Filter 2524a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 2525a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 2526a442b761SAyala Beker * @srf_macs: SRF MAC addresses 2527a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 2528a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 2529a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 2530a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 2531a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 2532a442b761SAyala Beker * @instance_id: driver allocated id of the function. 2533a442b761SAyala Beker * @cookie: unique NAN function identifier. 2534a442b761SAyala Beker */ 2535a442b761SAyala Beker struct cfg80211_nan_func { 2536a442b761SAyala Beker enum nl80211_nan_function_type type; 2537a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 2538a442b761SAyala Beker u8 publish_type; 2539a442b761SAyala Beker bool close_range; 2540a442b761SAyala Beker bool publish_bcast; 2541a442b761SAyala Beker bool subscribe_active; 2542a442b761SAyala Beker u8 followup_id; 2543a442b761SAyala Beker u8 followup_reqid; 2544a442b761SAyala Beker struct mac_address followup_dest; 2545a442b761SAyala Beker u32 ttl; 2546a442b761SAyala Beker const u8 *serv_spec_info; 2547a442b761SAyala Beker u8 serv_spec_info_len; 2548a442b761SAyala Beker bool srf_include; 2549a442b761SAyala Beker const u8 *srf_bf; 2550a442b761SAyala Beker u8 srf_bf_len; 2551a442b761SAyala Beker u8 srf_bf_idx; 2552a442b761SAyala Beker struct mac_address *srf_macs; 2553a442b761SAyala Beker int srf_num_macs; 2554a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 2555a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 2556a442b761SAyala Beker u8 num_tx_filters; 2557a442b761SAyala Beker u8 num_rx_filters; 2558a442b761SAyala Beker u8 instance_id; 2559a442b761SAyala Beker u64 cookie; 2560a442b761SAyala Beker }; 2561a442b761SAyala Beker 2562a442b761SAyala Beker /** 2563704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2564704232c2SJohannes Berg * 2565704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2566704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2567704232c2SJohannes Berg * 2568704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2569704232c2SJohannes Berg * on success or a negative error code. 2570704232c2SJohannes Berg * 257143fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 257243fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 257343fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 257443fb45cbSJohannes Berg * 2575ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2576ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2577ff1b6e69SJohannes Berg * configured for the device. 25780378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 25796d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 25806d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 25816d52563fSJohannes Berg * the device. 25820378b3f1SJohannes Berg * 258360719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2584463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 258584efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 258698104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 258798104fdeSJohannes Berg * also set the address member in the wdev. 2588704232c2SJohannes Berg * 258984efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 259055682965SJohannes Berg * 259160719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 259260719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 259355682965SJohannes Berg * 259441ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 259541ade00fSJohannes Berg * when adding a group key. 259641ade00fSJohannes Berg * 259741ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 259841ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 259941ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2600e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2601e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 260241ade00fSJohannes Berg * 260341ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2604e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 260541ade00fSJohannes Berg * 260641ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2607ed1b6cc7SJohannes Berg * 26083cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 26093cfcf6acSJouni Malinen * 2610e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2611e5497d76SJohannes Berg * 2612c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2613c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2614c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2615c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 26165727ef1bSJohannes Berg * 26175727ef1bSJohannes Berg * @add_station: Add a new station. 261889c771e5SJouni Malinen * @del_station: Remove a station 2619bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2620bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2621bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 262277ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 262377ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2624abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2625abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2626abe37c4bSJohannes Berg * 2627abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2628abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2629abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2630abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2631abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 263266be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 263366be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2634f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 26358d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2636f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 26378d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 26382ec600d6SLuis Carlos Cobo * 263924bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 264093da9cc1Scolin@cozybit.com * 264124bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 264293da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 264393da9cc1Scolin@cozybit.com * set, and which to leave alone. 264493da9cc1Scolin@cozybit.com * 26459f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 264631888487SJouni Malinen * 264731888487SJouni Malinen * @set_txq_params: Set TX queue parameters 264872bdcf34SJouni Malinen * 2649e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2650e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2651e8c9bd5bSJohannes Berg * join the mesh instead. 2652e8c9bd5bSJohannes Berg * 2653e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2654e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2655e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2656e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 26579aed3cc1SJouni Malinen * 26582a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 26592a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 26602a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 26612a519311SJohannes Berg * the scan/scan_done bracket too. 266291d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 266391d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 2664636a5d36SJouni Malinen * 2665636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 26668d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2667636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 26688d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2669636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 26708d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2671636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 26728d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 267304a773adSJohannes Berg * 2674b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2675bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 2676bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 2677bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 2678bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 2679bf1ecd21SJouni Malinen * was received. 2680bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 2681bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 2682bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 2683bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 2684bf1ecd21SJouni Malinen * frame instead of Association Request frame. 2685bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 2686bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 268735eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 2688bf1ecd21SJouni Malinen * indication of requesting reassociation. 2689bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 2690bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 269129ce6ecbSAvraham Stern * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 2692088e8df8Svamsi krishna * @update_connect_params: Update the connect parameters while connected to a 2693088e8df8Svamsi krishna * BSS. The updated parameters can be used by driver/firmware for 2694088e8df8Svamsi krishna * subsequent BSS selection (roaming) decisions and to form the 2695088e8df8Svamsi krishna * Authentication/(Re)Association Request frames. This call does not 2696088e8df8Svamsi krishna * request an immediate disassociation or reassociation with the current 2697088e8df8Svamsi krishna * BSS, i.e., this impacts only subsequent (re)associations. The bits in 2698088e8df8Svamsi krishna * changed are defined in &enum cfg80211_connect_params_changed. 2699088e8df8Svamsi krishna * (invoked with the wireless_dev mutex held) 27000711d638SIlan Peer * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 27010711d638SIlan Peer * connection is in progress. Once done, call cfg80211_disconnected() in 27020711d638SIlan Peer * case connection was already established (invoked with the 27030711d638SIlan Peer * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 2704b23aa676SSamuel Ortiz * 270504a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 270604a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 270704a773adSJohannes Berg * to a merge. 27088d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 270904a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 27108d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2711b9a5f8caSJouni Malinen * 2712f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2713f4e583c8SAntonio Quartulli * MESH mode) 2714f4e583c8SAntonio Quartulli * 2715b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2716b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2717b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2718b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 27197643a2c3SJohannes Berg * 27201432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2721c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2722c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2723c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2724c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 27257643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 27261f87f7d3SJohannes Berg * return 0 if successful 27271f87f7d3SJohannes Berg * 2728abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2729abe37c4bSJohannes Berg * 27301f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 27311f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2732aff89a9bSJohannes Berg * 273361fa713cSHolger Schurig * @dump_survey: get site survey information. 273461fa713cSHolger Schurig * 27359588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 27369588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 27379588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 27389588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 27399588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 27409588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 27419588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 27429588bbd5SJouni Malinen * the duration value. 2743f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2744f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2745f7ca38dfSJohannes Berg * frame on another channel 27469588bbd5SJouni Malinen * 2747fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 274871063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 274971063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 275071063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 275171063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 275271063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 275371063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 275467fbb16bSSamuel Ortiz * 2755abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2756abe37c4bSJohannes Berg * 275767fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 275867fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 275967fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 276067fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 276167fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 27629043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 27639043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2764d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 2765e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 2766e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 2767e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 2768e86abc68SJohannes Berg * disabled.) 27694a4b8169SAndrew Zaborowski * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 27704a4b8169SAndrew Zaborowski * connection quality monitor. An event is to be sent only when the 27714a4b8169SAndrew Zaborowski * signal level is found to be outside the two values. The driver should 27724a4b8169SAndrew Zaborowski * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 27734a4b8169SAndrew Zaborowski * If it is provided then there's no point providing @set_cqm_rssi_config. 277484f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 277584f10708SThomas Pedersen * thresholds. 2776807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 27773a3ecf1dSArend Van Spriel * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 27783a3ecf1dSArend Van Spriel * given request id. This call must stop the scheduled scan and be ready 27793a3ecf1dSArend Van Spriel * for starting a new one before it returns, i.e. @sched_scan_start may be 27803a3ecf1dSArend Van Spriel * called immediately after that again and should not fail in that case. 27813a3ecf1dSArend Van Spriel * The driver should not call cfg80211_sched_scan_stopped() for a requested 27823a3ecf1dSArend Van Spriel * stop (when this method returns 0). 278367fbb16bSSamuel Ortiz * 2784271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 278533d8783cSJohannes Berg * registered. The callback is allowed to sleep. 2786547025d5SBruno Randolf * 2787547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2788547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2789547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2790547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2791547025d5SBruno Randolf * 2792547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 27933677713bSJohn W. Linville * 2794109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2795109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 27967f6cf311SJohannes Berg * 27977f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 27987f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 27991d9d9213SSimon Wunderlich * 28001d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2801d6199218SBen Greear * 28025b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 28035b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 28045b7ccaf3SJohannes Berg * current monitoring channel. 280598104fdeSJohannes Berg * 280698104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 280798104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 280877765eafSVasanthakumar Thiagarajan * 280977765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 281077765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 281177765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 281277765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 281377765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 281477765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 281504f39047SSimon Wunderlich * 281604f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 28178bf24293SJouni Malinen * 28188bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 28198bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 28208bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 28215de17984SArend van Spriel * 28225de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 28235de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 28245de17984SArend van Spriel * driver can take the most appropriate actions. 28255de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 28265de17984SArend van Spriel * reliability. This operation can not fail. 2827be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 282816ef1fe2SSimon Wunderlich * 282997dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 283097dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 283197dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 283297dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 283397dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 283497dc94f1SMichal Kazior * as soon as possible. 2835fa9ffc74SKyeyoon Park * 2836fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2837e16821bcSJouni Malinen * 2838e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2839e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2840e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2841960d01acSJohannes Berg * 2842960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2843960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2844960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2845960d01acSJohannes Berg * account. 2846960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2847960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2848960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2849960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2850960d01acSJohannes Berg * rejected) 2851960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 28526e0bd6c3SRostislav Lisovy * 28536e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 28546e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 28556e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 28566e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 28571057d35eSArik Nemtsov * 28581057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 28591057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 28601057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 28611057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 28621057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2863cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 2864cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 2865a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 2866a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 2867a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 2868a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 2869a442b761SAyala Beker * cfg80211_free_nan_func(). 2870a442b761SAyala Beker * On success the driver should assign an instance_id in the 2871a442b761SAyala Beker * provided @nan_func. 2872a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 2873a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 2874a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 2875a5a9dcf2SAyala Beker * All other parameters must be ignored. 2876ce0ce13aSMichael Braun * 2877ce0ce13aSMichael Braun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 2878704232c2SJohannes Berg */ 2879704232c2SJohannes Berg struct cfg80211_ops { 2880ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 28810378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 28826d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 28830378b3f1SJohannes Berg 288484efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2885552bff0cSJohannes Berg const char *name, 28866bab2e19STom Gundersen unsigned char name_assign_type, 2887f9e10ce4SJohannes Berg enum nl80211_iftype type, 28882ec600d6SLuis Carlos Cobo struct vif_params *params); 288984efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 289084efbb84SJohannes Berg struct wireless_dev *wdev); 2891e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2892e36d56b6SJohannes Berg struct net_device *dev, 2893818a986eSJohannes Berg enum nl80211_iftype type, 28942ec600d6SLuis Carlos Cobo struct vif_params *params); 289541ade00fSJohannes Berg 289641ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2897e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 289841ade00fSJohannes Berg struct key_params *params); 289941ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2900e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2901e31b8213SJohannes Berg void *cookie, 290241ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 290341ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2904e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 290541ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 290641ade00fSJohannes Berg struct net_device *netdev, 2907dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 29083cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 29093cfcf6acSJouni Malinen struct net_device *netdev, 29103cfcf6acSJouni Malinen u8 key_index); 2911ed1b6cc7SJohannes Berg 29128860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 29138860020eSJohannes Berg struct cfg80211_ap_settings *settings); 29148860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 29158860020eSJohannes Berg struct cfg80211_beacon_data *info); 29168860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 29175727ef1bSJohannes Berg 29185727ef1bSJohannes Berg 29195727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 29203b3a0162SJohannes Berg const u8 *mac, 29213b3a0162SJohannes Berg struct station_parameters *params); 29225727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 292389c771e5SJouni Malinen struct station_del_parameters *params); 29245727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 29253b3a0162SJohannes Berg const u8 *mac, 29263b3a0162SJohannes Berg struct station_parameters *params); 2927fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 29283b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 29292ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 29302ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 29312ec600d6SLuis Carlos Cobo 29322ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 29333b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 29342ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 29353b3a0162SJohannes Berg const u8 *dst); 29362ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 29373b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 29382ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 29393b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 29402ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 29412ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 29422ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 294366be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 294466be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 294566be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 294666be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 294766be7d2bSHenning Rogge struct mpath_info *pinfo); 294824bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 294993da9cc1Scolin@cozybit.com struct net_device *dev, 295093da9cc1Scolin@cozybit.com struct mesh_config *conf); 295124bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 295229cbe68cSJohannes Berg struct net_device *dev, u32 mask, 295329cbe68cSJohannes Berg const struct mesh_config *nconf); 295429cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 295529cbe68cSJohannes Berg const struct mesh_config *conf, 295629cbe68cSJohannes Berg const struct mesh_setup *setup); 295729cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 295829cbe68cSJohannes Berg 29596e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 29606e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 29616e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 29626e0bd6c3SRostislav Lisovy 29639f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 29649f1ba906SJouni Malinen struct bss_parameters *params); 296531888487SJouni Malinen 2966f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 296731888487SJouni Malinen struct ieee80211_txq_params *params); 296872bdcf34SJouni Malinen 2969e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2970e8c9bd5bSJohannes Berg struct net_device *dev, 2971e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2972e8c9bd5bSJohannes Berg 2973e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2974683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 29759aed3cc1SJouni Malinen 2976fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 29772a519311SJohannes Berg struct cfg80211_scan_request *request); 297891d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 2979636a5d36SJouni Malinen 2980636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2981636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2982636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2983636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2984636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 298563c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2986636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 298763c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 298804a773adSJohannes Berg 2989b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2990b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2991088e8df8Svamsi krishna int (*update_connect_params)(struct wiphy *wiphy, 2992088e8df8Svamsi krishna struct net_device *dev, 2993088e8df8Svamsi krishna struct cfg80211_connect_params *sme, 2994088e8df8Svamsi krishna u32 changed); 2995b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2996b23aa676SSamuel Ortiz u16 reason_code); 2997b23aa676SSamuel Ortiz 299804a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 299904a773adSJohannes Berg struct cfg80211_ibss_params *params); 300004a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 3001b9a5f8caSJouni Malinen 3002f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 300357fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 3004f4e583c8SAntonio Quartulli 3005b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 30067643a2c3SJohannes Berg 3007c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 3008fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 3009c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 3010c8442118SJohannes Berg int *dbm); 30111f87f7d3SJohannes Berg 3012ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 3013388ac775SJohannes Berg const u8 *addr); 3014ab737a4fSJohannes Berg 30151f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 3016aff89a9bSJohannes Berg 3017aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 3018fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 3019fc73f11fSDavid Spinadel void *data, int len); 302071063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 302171063f0eSWey-Yi Guy struct netlink_callback *cb, 302271063f0eSWey-Yi Guy void *data, int len); 3023aff89a9bSJohannes Berg #endif 3024bc92afd9SJohannes Berg 30259930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 30269930380fSJohannes Berg struct net_device *dev, 30279930380fSJohannes Berg const u8 *peer, 30289930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 30299930380fSJohannes Berg 303061fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 303161fa713cSHolger Schurig int idx, struct survey_info *info); 303261fa713cSHolger Schurig 303367fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 303467fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 303567fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 303667fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 303767fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 303867fbb16bSSamuel Ortiz 30399588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 304071bbc994SJohannes Berg struct wireless_dev *wdev, 30419588bbd5SJouni Malinen struct ieee80211_channel *chan, 30429588bbd5SJouni Malinen unsigned int duration, 30439588bbd5SJouni Malinen u64 *cookie); 30449588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 304571bbc994SJohannes Berg struct wireless_dev *wdev, 30469588bbd5SJouni Malinen u64 cookie); 30479588bbd5SJouni Malinen 304871bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 3049b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 3050b176e629SAndrei Otcheretianski u64 *cookie); 3051f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 305271bbc994SJohannes Berg struct wireless_dev *wdev, 3053f7ca38dfSJohannes Berg u64 cookie); 3054026331c4SJouni Malinen 3055bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 3056bc92afd9SJohannes Berg bool enabled, int timeout); 3057d6dc1a38SJuuso Oikarinen 3058d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 3059d6dc1a38SJuuso Oikarinen struct net_device *dev, 3060d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 3061271733cfSJohannes Berg 30624a4b8169SAndrew Zaborowski int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 30634a4b8169SAndrew Zaborowski struct net_device *dev, 30644a4b8169SAndrew Zaborowski s32 rssi_low, s32 rssi_high); 30654a4b8169SAndrew Zaborowski 306684f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 306784f10708SThomas Pedersen struct net_device *dev, 306884f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 306984f10708SThomas Pedersen 3070271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 307171bbc994SJohannes Berg struct wireless_dev *wdev, 3072271733cfSJohannes Berg u16 frame_type, bool reg); 3073afe0cbf8SBruno Randolf 3074afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 3075afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 30763677713bSJohn W. Linville 3077807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 3078807f8a8cSLuciano Coelho struct net_device *dev, 3079807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 30803a3ecf1dSArend Van Spriel int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 30813a3ecf1dSArend Van Spriel u64 reqid); 3082e5497d76SJohannes Berg 3083e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 3084e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 3085109086ceSArik Nemtsov 3086109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 30873b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 3088df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 308931fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 3090109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 30913b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 30927f6cf311SJohannes Berg 30937f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 30947f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 3095e999882aSJohannes Berg 30961d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 30971d9d9213SSimon Wunderlich struct net_device *dev, 30981d9d9213SSimon Wunderlich u16 noack_map); 30991d9d9213SSimon Wunderlich 3100683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 31015b7ccaf3SJohannes Berg struct wireless_dev *wdev, 3102683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 310398104fdeSJohannes Berg 310498104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 310598104fdeSJohannes Berg struct wireless_dev *wdev); 310698104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 310798104fdeSJohannes Berg struct wireless_dev *wdev); 310877765eafSVasanthakumar Thiagarajan 310977765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 311077765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 311104f39047SSimon Wunderlich 311204f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 311304f39047SSimon Wunderlich struct net_device *dev, 311431559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 311531559f35SJanusz Dziedzic u32 cac_time_ms); 3116355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 3117355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 31185de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 31195de17984SArend van Spriel struct wireless_dev *wdev, 31205de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 31215de17984SArend van Spriel u16 duration); 31225de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 31235de17984SArend van Spriel struct wireless_dev *wdev); 3124be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 3125be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 312616ef1fe2SSimon Wunderlich 312716ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 312816ef1fe2SSimon Wunderlich struct net_device *dev, 312916ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 3130e16821bcSJouni Malinen 3131fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 3132fa9ffc74SKyeyoon Park struct net_device *dev, 3133fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3134e16821bcSJouni Malinen 3135e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 3136e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 3137960d01acSJohannes Berg 3138960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 3139960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 3140960d01acSJohannes Berg u16 admitted_time); 3141960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 3142960d01acSJohannes Berg u8 tsid, const u8 *peer); 31431057d35eSArik Nemtsov 31441057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 31451057d35eSArik Nemtsov struct net_device *dev, 31461057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 31471057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 31481057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 31491057d35eSArik Nemtsov struct net_device *dev, 31501057d35eSArik Nemtsov const u8 *addr); 3151cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 3152cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 3153cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 3154a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3155a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 3156a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3157a442b761SAyala Beker u64 cookie); 3158a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 3159a5a9dcf2SAyala Beker struct wireless_dev *wdev, 3160a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 3161a5a9dcf2SAyala Beker u32 changes); 3162ce0ce13aSMichael Braun 3163ce0ce13aSMichael Braun int (*set_multicast_to_unicast)(struct wiphy *wiphy, 3164ce0ce13aSMichael Braun struct net_device *dev, 3165ce0ce13aSMichael Braun const bool enabled); 3166704232c2SJohannes Berg }; 3167704232c2SJohannes Berg 3168d3236553SJohannes Berg /* 3169d3236553SJohannes Berg * wireless hardware and networking interfaces structures 3170d3236553SJohannes Berg * and registration/helper functions 3171d3236553SJohannes Berg */ 3172d3236553SJohannes Berg 3173d3236553SJohannes Berg /** 31745be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 31755be83de5SJohannes Berg * 31765be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 31775be83de5SJohannes Berg * wiphy at all 31785be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 31795be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 31805be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 31815be83de5SJohannes Berg * reason to override the default 31829bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 31839bc383deSJohannes Berg * on a VLAN interface) 31849bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 3185c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 3186c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 3187c0692b8fSJohannes Berg * control_port_no_encrypt flag. 3188e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 318915d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 319015d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 31911ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 3192f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 3193f4b34b55SVivek Natarajan * firmware. 3194cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 3195109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 3196109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 3197109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 3198109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 3199109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 3200109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 3201562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 32025e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 32035e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 32045e760230SJohannes Berg * cfg80211_report_obss_beacon(). 320587bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 320687bbbe22SArik Nemtsov * responds to probe-requests in hardware. 32077c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 32087c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 32092f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 321016ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 321116ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 3212b8676221SDavid Spinadel * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 3213b8676221SDavid Spinadel * before connection. 32145be83de5SJohannes Berg */ 32155be83de5SJohannes Berg enum wiphy_flags { 3216723e73acSJohannes Berg /* use hole at 0 */ 3217a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 3218a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 32195be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 32205be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 32219bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 32229bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 3223c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 3224309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 322515d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 3226ca986ad9SArend Van Spriel /* use hole at 11 */ 32278e8b41f9SJohannes Berg /* use hole at 12 */ 3228f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 3229cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 3230109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 3231109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 3232562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 32335e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 323487bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 32357c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 32367c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 32372f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 323816ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 3239b8676221SDavid Spinadel WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 32407527a782SJohannes Berg }; 32417527a782SJohannes Berg 32427527a782SJohannes Berg /** 32437527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 32447527a782SJohannes Berg * @max: maximum number of interfaces of these types 32457527a782SJohannes Berg * @types: interface types (bits) 32467527a782SJohannes Berg */ 32477527a782SJohannes Berg struct ieee80211_iface_limit { 32487527a782SJohannes Berg u16 max; 32497527a782SJohannes Berg u16 types; 32507527a782SJohannes Berg }; 32517527a782SJohannes Berg 32527527a782SJohannes Berg /** 32537527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 32547527a782SJohannes Berg * 3255b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 3256b80edbc1SLuciano Coelho * combinations it supports concurrently. 32577527a782SJohannes Berg * 3258b80edbc1SLuciano Coelho * Examples: 3259b80edbc1SLuciano Coelho * 3260b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 32617527a782SJohannes Berg * 3262819bf593SJohannes Berg * .. code-block:: c 3263819bf593SJohannes Berg * 32647527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 32657527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 32667527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 32677527a782SJohannes Berg * }; 32687527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 32697527a782SJohannes Berg * .limits = limits1, 32707527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 32717527a782SJohannes Berg * .max_interfaces = 2, 32727527a782SJohannes Berg * .beacon_int_infra_match = true, 32737527a782SJohannes Berg * }; 32747527a782SJohannes Berg * 32757527a782SJohannes Berg * 3276b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 32777527a782SJohannes Berg * 3278819bf593SJohannes Berg * .. code-block:: c 3279819bf593SJohannes Berg * 32807527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 32817527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 32827527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 32837527a782SJohannes Berg * }; 32847527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 32857527a782SJohannes Berg * .limits = limits2, 32867527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 32877527a782SJohannes Berg * .max_interfaces = 8, 32887527a782SJohannes Berg * .num_different_channels = 1, 32897527a782SJohannes Berg * }; 32907527a782SJohannes Berg * 32917527a782SJohannes Berg * 3292b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 3293b80edbc1SLuciano Coelho * 32947527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 32957527a782SJohannes Berg * 3296819bf593SJohannes Berg * .. code-block:: c 3297819bf593SJohannes Berg * 32987527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 32997527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 33007527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 33017527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 33027527a782SJohannes Berg * }; 33037527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 33047527a782SJohannes Berg * .limits = limits3, 33057527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 33067527a782SJohannes Berg * .max_interfaces = 4, 33077527a782SJohannes Berg * .num_different_channels = 2, 33087527a782SJohannes Berg * }; 3309819bf593SJohannes Berg * 33107527a782SJohannes Berg */ 33117527a782SJohannes Berg struct ieee80211_iface_combination { 3312c6c94aeaSJohannes Berg /** 3313c6c94aeaSJohannes Berg * @limits: 3314c6c94aeaSJohannes Berg * limits for the given interface types 3315c6c94aeaSJohannes Berg */ 33167527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 3317c6c94aeaSJohannes Berg 3318c6c94aeaSJohannes Berg /** 3319c6c94aeaSJohannes Berg * @num_different_channels: 3320c6c94aeaSJohannes Berg * can use up to this many different channels 3321c6c94aeaSJohannes Berg */ 33227527a782SJohannes Berg u32 num_different_channels; 3323c6c94aeaSJohannes Berg 3324c6c94aeaSJohannes Berg /** 3325c6c94aeaSJohannes Berg * @max_interfaces: 3326c6c94aeaSJohannes Berg * maximum number of interfaces in total allowed in this group 3327c6c94aeaSJohannes Berg */ 33287527a782SJohannes Berg u16 max_interfaces; 3329c6c94aeaSJohannes Berg 3330c6c94aeaSJohannes Berg /** 3331c6c94aeaSJohannes Berg * @n_limits: 3332c6c94aeaSJohannes Berg * number of limitations 3333c6c94aeaSJohannes Berg */ 33347527a782SJohannes Berg u8 n_limits; 3335c6c94aeaSJohannes Berg 3336c6c94aeaSJohannes Berg /** 3337c6c94aeaSJohannes Berg * @beacon_int_infra_match: 3338c6c94aeaSJohannes Berg * In this combination, the beacon intervals between infrastructure 3339c6c94aeaSJohannes Berg * and AP types must match. This is required only in special cases. 3340c6c94aeaSJohannes Berg */ 33417527a782SJohannes Berg bool beacon_int_infra_match; 3342c6c94aeaSJohannes Berg 3343c6c94aeaSJohannes Berg /** 3344c6c94aeaSJohannes Berg * @radar_detect_widths: 3345c6c94aeaSJohannes Berg * bitmap of channel widths supported for radar detection 3346c6c94aeaSJohannes Berg */ 334711c4a075SSimon Wunderlich u8 radar_detect_widths; 3348c6c94aeaSJohannes Berg 3349c6c94aeaSJohannes Berg /** 3350c6c94aeaSJohannes Berg * @radar_detect_regions: 3351c6c94aeaSJohannes Berg * bitmap of regions supported for radar detection 3352c6c94aeaSJohannes Berg */ 33538c48b50aSFelix Fietkau u8 radar_detect_regions; 3354c6c94aeaSJohannes Berg 3355c6c94aeaSJohannes Berg /** 3356c6c94aeaSJohannes Berg * @beacon_int_min_gcd: 3357c6c94aeaSJohannes Berg * This interface combination supports different beacon intervals. 3358c6c94aeaSJohannes Berg * 3359c6c94aeaSJohannes Berg * = 0 3360c6c94aeaSJohannes Berg * all beacon intervals for different interface must be same. 3361c6c94aeaSJohannes Berg * > 0 3362c6c94aeaSJohannes Berg * any beacon interval for the interface part of this combination AND 3363c6c94aeaSJohannes Berg * GCD of all beacon intervals from beaconing interfaces of this 3364c6c94aeaSJohannes Berg * combination must be greater or equal to this value. 3365c6c94aeaSJohannes Berg */ 33660c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 33675be83de5SJohannes Berg }; 33685be83de5SJohannes Berg 33692e161f78SJohannes Berg struct ieee80211_txrx_stypes { 33702e161f78SJohannes Berg u16 tx, rx; 33712e161f78SJohannes Berg }; 33722e161f78SJohannes Berg 33735be83de5SJohannes Berg /** 3374ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 3375ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 3376ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 3377ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 3378ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 3379ff1b6e69SJohannes Berg * packet should be preserved in that case 3380ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 3381ff1b6e69SJohannes Berg * (see nl80211.h) 3382ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 338377dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 338477dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 338577dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 338677dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 338777dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 33888cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 3389ff1b6e69SJohannes Berg */ 3390ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 3391ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 3392ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 3393ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 339477dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 339577dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 339677dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 339777dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 339877dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 33998cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 3400ff1b6e69SJohannes Berg }; 3401ff1b6e69SJohannes Berg 34022a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 34032a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 34042a0e047eSJohannes Berg u32 data_payload_max; 34052a0e047eSJohannes Berg u32 data_interval_max; 34062a0e047eSJohannes Berg u32 wake_payload_max; 34072a0e047eSJohannes Berg bool seq; 34082a0e047eSJohannes Berg }; 34092a0e047eSJohannes Berg 3410ff1b6e69SJohannes Berg /** 3411ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 3412ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 3413ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 3414ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 3415ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 3416ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 3417bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 34188cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 34198cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 34208cd4d456SLuciano Coelho * scheduled scans. 34218cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 34228cd4d456SLuciano Coelho * details. 34232a0e047eSJohannes Berg * @tcp: TCP wakeup support information 3424ff1b6e69SJohannes Berg */ 3425ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 3426ff1b6e69SJohannes Berg u32 flags; 3427ff1b6e69SJohannes Berg int n_patterns; 3428ff1b6e69SJohannes Berg int pattern_max_len; 3429ff1b6e69SJohannes Berg int pattern_min_len; 3430bb92d199SAmitkumar Karwar int max_pkt_offset; 34318cd4d456SLuciano Coelho int max_nd_match_sets; 34322a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 3433ff1b6e69SJohannes Berg }; 3434ff1b6e69SJohannes Berg 3435ff1b6e69SJohannes Berg /** 3436be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 3437be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 3438be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 3439be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 3440be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 3441be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 3442be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 3443be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 3444be29b99aSAmitkumar Karwar */ 3445be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 3446be29b99aSAmitkumar Karwar int n_rules; 3447be29b99aSAmitkumar Karwar int max_delay; 3448be29b99aSAmitkumar Karwar int n_patterns; 3449be29b99aSAmitkumar Karwar int pattern_max_len; 3450be29b99aSAmitkumar Karwar int pattern_min_len; 3451be29b99aSAmitkumar Karwar int max_pkt_offset; 3452be29b99aSAmitkumar Karwar }; 3453be29b99aSAmitkumar Karwar 3454be29b99aSAmitkumar Karwar /** 3455ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 3456ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 3457ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 3458ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 3459ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 3460ad7e718cSJohannes Berg */ 3461ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 3462ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 3463ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 3464ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 3465ad7e718cSJohannes Berg }; 3466ad7e718cSJohannes Berg 3467ad7e718cSJohannes Berg /** 3468ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 3469ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 3470ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 3471ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 3472ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 3473ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 34747bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 34757bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 34767bdbe400SJohannes Berg * dumpit calls. 34777bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 34787bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 34797bdbe400SJohannes Berg * are used with dump requests. 3480ad7e718cSJohannes Berg */ 3481ad7e718cSJohannes Berg struct wiphy_vendor_command { 3482ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 3483ad7e718cSJohannes Berg u32 flags; 3484ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 3485ad7e718cSJohannes Berg const void *data, int data_len); 34867bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 34877bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 34887bdbe400SJohannes Berg unsigned long *storage); 3489ad7e718cSJohannes Berg }; 3490ad7e718cSJohannes Berg 3491ad7e718cSJohannes Berg /** 3492019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 3493019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 3494019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 3495019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 3496019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 3497019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 3498019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 3499019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 3500019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 3501019ae3a9SKanchanapally, Vidyullatha */ 3502019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 3503019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 3504019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 3505019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 3506019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 3507019ae3a9SKanchanapally, Vidyullatha }; 3508019ae3a9SKanchanapally, Vidyullatha 3509019ae3a9SKanchanapally, Vidyullatha /** 35105be83de5SJohannes Berg * struct wiphy - wireless hardware description 35112784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 35122784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 35132784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 3514d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 3515d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 3516d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 3517d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 3518d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 3519d3236553SJohannes Berg * @cipher_suites: supported cipher suites 3520d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 3521b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 3522b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 3523b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 3524b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 3525b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 3526abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 3527ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 3528ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 3529ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 35300fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 3531ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 3532ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 3533ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 3534ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 3535ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 3536ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 3537ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 3538ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3539fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3540fd235913SRandy Dunlap * unregister hardware 3541abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3542abe37c4bSJohannes Berg * automatically on wiphy renames 3543abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 35444a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3545abe37c4bSJohannes Berg * @wext: wireless extension handlers 3546abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3547abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3548abe37c4bSJohannes Berg * must be set by driver 35497527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 35507527a782SJohannes Berg * list single interface types. 35517527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 35527527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 35537527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3554abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3555a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3556a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 35571f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3558d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 3559d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 3560abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3561abe37c4bSJohannes Berg * this variable determines its size 3562abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3563abe37c4bSJohannes Berg * any given scan 3564ca986ad9SArend Van Spriel * @max_sched_scan_reqs: maximum number of scheduled scan requests that 3565ca986ad9SArend Van Spriel * the device can run concurrently. 356693b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 356793b6aa69SLuciano Coelho * for in any given scheduled scan 3568a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3569a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3570a1f1c21cSLuciano Coelho * supported. 3571abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3572abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3573abe37c4bSJohannes Berg * include fixed IEs like supported rates 35745a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 35755a865badSLuciano Coelho * scans 35763b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 35773b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 35783b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 35793b06d277SAvraham Stern * single scan plan supported by the device. 35803b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 35813b06d277SAvraham Stern * scan plan supported by the device. 3582abe37c4bSJohannes Berg * @coverage_class: current coverage class 3583abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3584abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3585abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3586abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3587abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3588abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 35892e161f78SJohannes Berg * 35902e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 35912e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 35922e161f78SJohannes Berg * type 3593a7ffac95SBruno Randolf * 35947f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 35957f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 35967f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 35977f531e03SBruno Randolf * 35987f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 35997f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 36007f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3601a293911dSJohannes Berg * 360215f0ebc2SRandy Dunlap * @probe_resp_offload: 360315f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 360415f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 360515f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 360615f0ebc2SRandy Dunlap * 3607a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3608a293911dSJohannes Berg * may request, if implemented. 3609ff1b6e69SJohannes Berg * 3610ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 36116abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 36126abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 36136abb9cb9SJohannes Berg * to the suspend() operation instead. 3614562a7480SJohannes Berg * 3615562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 36167e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 36177e7c8926SBen Greear * If null, then none can be over-ridden. 3618ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3619ee2aca34SJohannes Berg * If null, then none can be over-ridden. 362077765eafSVasanthakumar Thiagarajan * 362153873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 362253873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 362353873f13SJohannes Berg * 362477765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 362577765eafSVasanthakumar Thiagarajan * supports for ACL. 3626a50df0c4SJohannes Berg * 3627a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3628a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3629a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3630a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3631019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 3632019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 3633019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 3634a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3635a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3636019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 3637019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 3638019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 3639be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3640ad7e718cSJohannes Berg * 3641ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3642ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3643567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3644567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3645b43504cfSJouni Malinen * 3646b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3647b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3648b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3649b43504cfSJouni Malinen * some cases, but may not always reach. 3650c2e4323bSLuciano Coelho * 3651c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3652c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3653c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3654c2e4323bSLuciano Coelho * infinite. 365567af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 365667af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 365767af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 365867af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 365967af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 366067af9811SEmmanuel Grumbach * This value should be set in MHz. 366138de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 366238de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 366338de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 3664a442b761SAyala Beker * 3665a442b761SAyala Beker * @cookie_counter: unique generic cookie counter, used to identify objects. 36668585989dSLuca Coelho * @nan_supported_bands: bands supported by the device in NAN mode, a 36678585989dSLuca Coelho * bitmap of &enum nl80211_band values. For instance, for 36688585989dSLuca Coelho * NL80211_BAND_2GHZ, bit 0 would be set 36698585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 3670d3236553SJohannes Berg */ 3671d3236553SJohannes Berg struct wiphy { 3672d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3673d3236553SJohannes Berg 3674ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3675d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3676ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3677ef15aac6SJohannes Berg 3678ef15aac6SJohannes Berg struct mac_address *addresses; 3679d3236553SJohannes Berg 36802e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 36812e161f78SJohannes Berg 36827527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 36837527a782SJohannes Berg int n_iface_combinations; 36847527a782SJohannes Berg u16 software_iftypes; 36857527a782SJohannes Berg 36862e161f78SJohannes Berg u16 n_addresses; 36872e161f78SJohannes Berg 3688d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3689d3236553SJohannes Berg u16 interface_modes; 3690d3236553SJohannes Berg 369177765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 369277765eafSVasanthakumar Thiagarajan 3693a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3694d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3695463d0183SJohannes Berg 3696562a7480SJohannes Berg u32 ap_sme_capa; 3697562a7480SJohannes Berg 3698d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3699d3236553SJohannes Berg 3700d3236553SJohannes Berg int bss_priv_size; 3701d3236553SJohannes Berg u8 max_scan_ssids; 3702ca986ad9SArend Van Spriel u8 max_sched_scan_reqs; 370393b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3704a1f1c21cSLuciano Coelho u8 max_match_sets; 3705d3236553SJohannes Berg u16 max_scan_ie_len; 37065a865badSLuciano Coelho u16 max_sched_scan_ie_len; 37073b06d277SAvraham Stern u32 max_sched_scan_plans; 37083b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 37093b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 3710d3236553SJohannes Berg 3711d3236553SJohannes Berg int n_cipher_suites; 3712d3236553SJohannes Berg const u32 *cipher_suites; 3713d3236553SJohannes Berg 3714b9a5f8caSJouni Malinen u8 retry_short; 3715b9a5f8caSJouni Malinen u8 retry_long; 3716b9a5f8caSJouni Malinen u32 frag_threshold; 3717b9a5f8caSJouni Malinen u32 rts_threshold; 371881077e82SLukáš Turek u8 coverage_class; 3719b9a5f8caSJouni Malinen 372081135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3721dfce95f5SKalle Valo u32 hw_version; 3722dfce95f5SKalle Valo 3723dfb89c56SJohannes Berg #ifdef CONFIG_PM 3724964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 37256abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3726dfb89c56SJohannes Berg #endif 3727ff1b6e69SJohannes Berg 3728a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3729a293911dSJohannes Berg 373067fbb16bSSamuel Ortiz u8 max_num_pmkids; 373167fbb16bSSamuel Ortiz 37327f531e03SBruno Randolf u32 available_antennas_tx; 37337f531e03SBruno Randolf u32 available_antennas_rx; 3734a7ffac95SBruno Randolf 373587bbbe22SArik Nemtsov /* 373687bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 373787bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 373887bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 373987bbbe22SArik Nemtsov */ 374087bbbe22SArik Nemtsov u32 probe_resp_offload; 374187bbbe22SArik Nemtsov 3742a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3743a50df0c4SJohannes Berg u8 extended_capabilities_len; 3744a50df0c4SJohannes Berg 3745019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 3746019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 3747019ae3a9SKanchanapally, Vidyullatha 3748d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3749d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3750d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3751d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3752d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3753cf5aa2f1SDavid Kilroy const void *privid; 3754d3236553SJohannes Berg 375557fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 3756d3236553SJohannes Berg 3757d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 37580c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3759d3236553SJohannes Berg struct regulatory_request *request); 3760d3236553SJohannes Berg 3761d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3762d3236553SJohannes Berg 3763458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3764d3236553SJohannes Berg 3765d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3766d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3767d3236553SJohannes Berg struct device dev; 3768d3236553SJohannes Berg 3769ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3770ecb44335SStanislaw Gruszka bool registered; 3771ecb44335SStanislaw Gruszka 3772d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3773d3236553SJohannes Berg struct dentry *debugfsdir; 3774d3236553SJohannes Berg 37757e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3776ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 37777e7c8926SBen Greear 377853873f13SJohannes Berg struct list_head wdev_list; 377953873f13SJohannes Berg 3780463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 37810c5c9fb5SEric W. Biederman possible_net_t _net; 3782463d0183SJohannes Berg 37833d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 37843d23e349SJohannes Berg const struct iw_handler_def *wext; 37853d23e349SJohannes Berg #endif 37863d23e349SJohannes Berg 3787be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3788be29b99aSAmitkumar Karwar 3789ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3790567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3791567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3792ad7e718cSJohannes Berg 3793b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3794b43504cfSJouni Malinen 37959a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 379667af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 37979a774c78SAndrei Otcheretianski 379838de03d2SArend van Spriel u32 bss_select_support; 379938de03d2SArend van Spriel 3800a442b761SAyala Beker u64 cookie_counter; 3801a442b761SAyala Beker 38028585989dSLuca Coelho u8 nan_supported_bands; 38038585989dSLuca Coelho 38041c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3805d3236553SJohannes Berg }; 3806d3236553SJohannes Berg 3807463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3808463d0183SJohannes Berg { 3809c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3810463d0183SJohannes Berg } 3811463d0183SJohannes Berg 3812463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3813463d0183SJohannes Berg { 3814c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3815463d0183SJohannes Berg } 3816463d0183SJohannes Berg 3817d3236553SJohannes Berg /** 3818d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3819d3236553SJohannes Berg * 3820d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 38210ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3822d3236553SJohannes Berg */ 3823d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3824d3236553SJohannes Berg { 3825d3236553SJohannes Berg BUG_ON(!wiphy); 3826d3236553SJohannes Berg return &wiphy->priv; 3827d3236553SJohannes Berg } 3828d3236553SJohannes Berg 3829d3236553SJohannes Berg /** 3830f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3831f1f74825SDavid Kilroy * 3832f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 38330ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3834f1f74825SDavid Kilroy */ 3835f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3836f1f74825SDavid Kilroy { 3837f1f74825SDavid Kilroy BUG_ON(!priv); 3838f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3839f1f74825SDavid Kilroy } 3840f1f74825SDavid Kilroy 3841f1f74825SDavid Kilroy /** 3842d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3843d3236553SJohannes Berg * 3844d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3845d3236553SJohannes Berg * @dev: The device to parent it to 3846d3236553SJohannes Berg */ 3847d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3848d3236553SJohannes Berg { 3849d3236553SJohannes Berg wiphy->dev.parent = dev; 3850d3236553SJohannes Berg } 3851d3236553SJohannes Berg 3852d3236553SJohannes Berg /** 3853d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3854d3236553SJohannes Berg * 3855d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 38560ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3857d3236553SJohannes Berg */ 3858d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3859d3236553SJohannes Berg { 3860d3236553SJohannes Berg return wiphy->dev.parent; 3861d3236553SJohannes Berg } 3862d3236553SJohannes Berg 3863d3236553SJohannes Berg /** 3864d3236553SJohannes Berg * wiphy_name - get wiphy name 3865d3236553SJohannes Berg * 3866d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 38670ae997dcSYacine Belkadi * Return: The name of @wiphy. 3868d3236553SJohannes Berg */ 3869e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3870d3236553SJohannes Berg { 3871d3236553SJohannes Berg return dev_name(&wiphy->dev); 3872d3236553SJohannes Berg } 3873d3236553SJohannes Berg 3874d3236553SJohannes Berg /** 38751998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 38761998d90aSBen Greear * 38771998d90aSBen Greear * @ops: The configuration operations for this device 38781998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 38791998d90aSBen Greear * @requested_name: Request a particular name. 38801998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 38811998d90aSBen Greear * 38821998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 38831998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 38841998d90aSBen Greear * 38851998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 38861998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 38871998d90aSBen Greear */ 38881998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 38891998d90aSBen Greear const char *requested_name); 38901998d90aSBen Greear 38911998d90aSBen Greear /** 3892d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3893d3236553SJohannes Berg * 3894d3236553SJohannes Berg * @ops: The configuration operations for this device 3895d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3896d3236553SJohannes Berg * 3897d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3898d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3899d3236553SJohannes Berg * 39000ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 39010ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3902d3236553SJohannes Berg */ 39031998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 39041998d90aSBen Greear int sizeof_priv) 39051998d90aSBen Greear { 39061998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 39071998d90aSBen Greear } 3908d3236553SJohannes Berg 3909d3236553SJohannes Berg /** 3910d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3911d3236553SJohannes Berg * 3912d3236553SJohannes Berg * @wiphy: The wiphy to register. 3913d3236553SJohannes Berg * 39140ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3915d3236553SJohannes Berg */ 391610dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3917d3236553SJohannes Berg 3918d3236553SJohannes Berg /** 3919d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3920d3236553SJohannes Berg * 3921d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3922d3236553SJohannes Berg * 3923d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3924d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3925d3236553SJohannes Berg * request that is being handled. 3926d3236553SJohannes Berg */ 392710dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3928d3236553SJohannes Berg 3929d3236553SJohannes Berg /** 3930d3236553SJohannes Berg * wiphy_free - free wiphy 3931d3236553SJohannes Berg * 3932d3236553SJohannes Berg * @wiphy: The wiphy to free 3933d3236553SJohannes Berg */ 393410dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3935d3236553SJohannes Berg 3936fffd0934SJohannes Berg /* internal structs */ 39376829c878SJohannes Berg struct cfg80211_conn; 393819957bb3SJohannes Berg struct cfg80211_internal_bss; 3939fffd0934SJohannes Berg struct cfg80211_cached_keys; 39404a4b8169SAndrew Zaborowski struct cfg80211_cqm_config; 394119957bb3SJohannes Berg 3942d3236553SJohannes Berg /** 394389a54e48SJohannes Berg * struct wireless_dev - wireless device state 3944d3236553SJohannes Berg * 394589a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 394689a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 394789a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 394889a54e48SJohannes Berg * It need not be registered then as netdev registration will 394989a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 395089a54e48SJohannes Berg * 395189a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 395289a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 395389a54e48SJohannes Berg * there's no netdev registration in that case it may not be 395489a54e48SJohannes Berg * allocated outside of callback operations that return it. 3955d3236553SJohannes Berg * 3956d3236553SJohannes Berg * @wiphy: pointer to hardware description 3957d3236553SJohannes Berg * @iftype: interface type 3958d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 395989a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 396089a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 396189a54e48SJohannes Berg * wireless device if it has no netdev 3962d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 39639e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 39649e0e2961SMichal Kazior * the user-set channel definition. 3965780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3966aa430da4SJohannes Berg * track the channel to be used for AP later 3967d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3968d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3969d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 397029cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 397129cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3972d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 39739bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 39749bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 39759bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 39769bc383deSJohannes Berg * by cfg80211 on change_interface 39772e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 39782e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 39798d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 39808d61ffa5SJohannes Berg * and some API functions require it held 398156d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 398256d1893dSJohannes Berg * beacons, 0 when not valid 398398104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 398473c7da3dSArend Van Spriel * @is_running: true if this is a non-netdev device that has been started, e.g. 398573c7da3dSArend Van Spriel * the P2P Device. 398604f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 398704f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 398831559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3989780b40dfSJohannes Berg * @ps: powersave mode is enabled 3990780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3991780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3992780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3993780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3994780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 399534d50519SLior David * @conn_bss_type: connecting/connected BSS type 3996bd2522b1SAndrzej Zaborowski * @conn_owner_nlportid: (private) connection owner socket port ID 3997bd2522b1SAndrzej Zaborowski * @disconnect_wk: (private) auto-disconnect work 3998bd2522b1SAndrzej Zaborowski * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 3999780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 40005336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 4001780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 4002780b40dfSJohannes Berg * @event_lock: (private) lock for event list 400378f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 4004ab81007aSJohannes Berg * @nl_owner_dead: (private) owner socket went away 40054a4b8169SAndrew Zaborowski * @cqm_config: (private) nl80211 RSSI monitor state 4006d3236553SJohannes Berg */ 4007d3236553SJohannes Berg struct wireless_dev { 4008d3236553SJohannes Berg struct wiphy *wiphy; 4009d3236553SJohannes Berg enum nl80211_iftype iftype; 4010d3236553SJohannes Berg 4011667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 4012d3236553SJohannes Berg struct list_head list; 4013d3236553SJohannes Berg struct net_device *netdev; 4014d3236553SJohannes Berg 401589a54e48SJohannes Berg u32 identifier; 401689a54e48SJohannes Berg 40172e161f78SJohannes Berg struct list_head mgmt_registrations; 40182e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 4019026331c4SJouni Malinen 4020667503ddSJohannes Berg struct mutex mtx; 4021667503ddSJohannes Berg 402273c7da3dSArend Van Spriel bool use_4addr, is_running; 402398104fdeSJohannes Berg 402498104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 40259bc383deSJohannes Berg 4026b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 4027d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 402829cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 40296829c878SJohannes Berg struct cfg80211_conn *conn; 4030fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 403134d50519SLior David enum ieee80211_bss_type conn_bss_type; 4032bd2522b1SAndrzej Zaborowski u32 conn_owner_nlportid; 4033bd2522b1SAndrzej Zaborowski 4034bd2522b1SAndrzej Zaborowski struct work_struct disconnect_wk; 4035bd2522b1SAndrzej Zaborowski u8 disconnect_bssid[ETH_ALEN]; 4036d3236553SJohannes Berg 4037667503ddSJohannes Berg struct list_head event_list; 4038667503ddSJohannes Berg spinlock_t event_lock; 4039667503ddSJohannes Berg 404019957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 4041683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 40429e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 4043f4489ebeSMichal Kazior 4044c30a3d38SMichal Kazior bool ibss_fixed; 40455336fa88SSimon Wunderlich bool ibss_dfs_possible; 4046c30a3d38SMichal Kazior 4047ffb9eb3dSKalle Valo bool ps; 4048ffb9eb3dSKalle Valo int ps_timeout; 4049ffb9eb3dSKalle Valo 405056d1893dSJohannes Berg int beacon_interval; 405156d1893dSJohannes Berg 405215e47304SEric W. Biederman u32 ap_unexpected_nlportid; 405328946da7SJohannes Berg 4054ab81007aSJohannes Berg u32 owner_nlportid; 4055ab81007aSJohannes Berg bool nl_owner_dead; 4056ab81007aSJohannes Berg 405704f39047SSimon Wunderlich bool cac_started; 405804f39047SSimon Wunderlich unsigned long cac_start_time; 405931559f35SJanusz Dziedzic unsigned int cac_time_ms; 406004f39047SSimon Wunderlich 40613d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 4062d3236553SJohannes Berg /* wext data */ 4063cbe8fa9cSJohannes Berg struct { 4064cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 4065f2129354SJohannes Berg struct cfg80211_connect_params connect; 4066fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 4067c1e5f471SJohannes Berg const u8 *ie; 4068f2129354SJohannes Berg size_t ie_len; 4069f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 4070f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 407108645126SJohannes Berg s8 default_key, default_mgmt_key; 4072ffb9eb3dSKalle Valo bool prev_bssid_valid; 4073cbe8fa9cSJohannes Berg } wext; 4074d3236553SJohannes Berg #endif 40754a4b8169SAndrew Zaborowski 40764a4b8169SAndrew Zaborowski struct cfg80211_cqm_config *cqm_config; 4077d3236553SJohannes Berg }; 4078d3236553SJohannes Berg 407998104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 408098104fdeSJohannes Berg { 408198104fdeSJohannes Berg if (wdev->netdev) 408298104fdeSJohannes Berg return wdev->netdev->dev_addr; 408398104fdeSJohannes Berg return wdev->address; 408498104fdeSJohannes Berg } 408598104fdeSJohannes Berg 408673c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev) 408773c7da3dSArend Van Spriel { 408873c7da3dSArend Van Spriel if (wdev->netdev) 408973c7da3dSArend Van Spriel return netif_running(wdev->netdev); 409073c7da3dSArend Van Spriel return wdev->is_running; 409173c7da3dSArend Van Spriel } 409273c7da3dSArend Van Spriel 4093d3236553SJohannes Berg /** 4094d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 4095d3236553SJohannes Berg * 4096d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 40970ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 4098d3236553SJohannes Berg */ 4099d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 4100d3236553SJohannes Berg { 4101d3236553SJohannes Berg BUG_ON(!wdev); 4102d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 4103d3236553SJohannes Berg } 4104d3236553SJohannes Berg 4105d70e9693SJohannes Berg /** 4106d70e9693SJohannes Berg * DOC: Utility functions 4107d70e9693SJohannes Berg * 4108d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 4109d3236553SJohannes Berg */ 4110d3236553SJohannes Berg 4111d3236553SJohannes Berg /** 4112d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 4113abe37c4bSJohannes Berg * @chan: channel number 411459eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 41150ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 4116d3236553SJohannes Berg */ 411757fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); 4118d3236553SJohannes Berg 4119d3236553SJohannes Berg /** 4120d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 4121abe37c4bSJohannes Berg * @freq: center frequency 41220ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 4123d3236553SJohannes Berg */ 412410dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 4125d3236553SJohannes Berg 4126d3236553SJohannes Berg /** 4127d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 4128543b921bSArend Van Spriel * 4129abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 4130abe37c4bSJohannes Berg * @freq: the center frequency of the channel 4131543b921bSArend Van Spriel * 41320ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 4133d3236553SJohannes Berg */ 4134543b921bSArend Van Spriel struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq); 4135d3236553SJohannes Berg 4136d3236553SJohannes Berg /** 4137d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 4138d3236553SJohannes Berg * 4139d3236553SJohannes Berg * @sband: the band to look for rates in 4140d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 4141d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 4142d3236553SJohannes Berg * 41430ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 41440ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 41450ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 41460ae997dcSYacine Belkadi * rates in the band's bitrate table. 4147d3236553SJohannes Berg */ 4148d3236553SJohannes Berg struct ieee80211_rate * 4149d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 4150d3236553SJohannes Berg u32 basic_rates, int bitrate); 4151d3236553SJohannes Berg 4152b422c6cdSAshok Nagarajan /** 4153b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 4154b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 415574608acaSSimon Wunderlich * @scan_width: width of the control channel 4156b422c6cdSAshok Nagarajan * 4157b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 4158b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 4159b422c6cdSAshok Nagarajan */ 416074608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 416174608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 4162b422c6cdSAshok Nagarajan 4163d3236553SJohannes Berg /* 4164d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 4165d3236553SJohannes Berg * 4166d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 4167d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 4168d3236553SJohannes Berg */ 4169d3236553SJohannes Berg 417033e5a2f7SJohannes Berg struct radiotap_align_size { 417133e5a2f7SJohannes Berg uint8_t align:4, size:4; 417233e5a2f7SJohannes Berg }; 417333e5a2f7SJohannes Berg 417433e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 417533e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 417633e5a2f7SJohannes Berg int n_bits; 417733e5a2f7SJohannes Berg uint32_t oui; 417833e5a2f7SJohannes Berg uint8_t subns; 417933e5a2f7SJohannes Berg }; 418033e5a2f7SJohannes Berg 418133e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 418233e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 418333e5a2f7SJohannes Berg int n_ns; 418433e5a2f7SJohannes Berg }; 418533e5a2f7SJohannes Berg 4186d3236553SJohannes Berg /** 4187d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 418833e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 418933e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 419033e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 419133e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 419233e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 419333e5a2f7SJohannes Berg * the beginning of the actual data portion 419433e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 419533e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 419633e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 419733e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 419833e5a2f7SJohannes Berg * radiotap namespace or not 419933e5a2f7SJohannes Berg * 420033e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 420133e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 420233e5a2f7SJohannes Berg * @_arg_index: next argument index 420333e5a2f7SJohannes Berg * @_arg: next argument pointer 420433e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 420533e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 420633e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 420733e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 420833e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 420933e5a2f7SJohannes Berg * next bitmap word 421033e5a2f7SJohannes Berg * 421133e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 421233e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 4213d3236553SJohannes Berg */ 4214d3236553SJohannes Berg 4215d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 421633e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 421733e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 421833e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 4219d3236553SJohannes Berg 422033e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 422167272440SJohannes Berg __le32 *_next_bitmap; 422233e5a2f7SJohannes Berg 422333e5a2f7SJohannes Berg unsigned char *this_arg; 422433e5a2f7SJohannes Berg int this_arg_index; 422533e5a2f7SJohannes Berg int this_arg_size; 422633e5a2f7SJohannes Berg 422733e5a2f7SJohannes Berg int is_radiotap_ns; 422833e5a2f7SJohannes Berg 422933e5a2f7SJohannes Berg int _max_length; 423033e5a2f7SJohannes Berg int _arg_index; 423133e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 423233e5a2f7SJohannes Berg int _reset_on_ext; 4233d3236553SJohannes Berg }; 4234d3236553SJohannes Berg 423510dd9b7cSJoe Perches int 423610dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 4237d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 423810dd9b7cSJoe Perches int max_length, 423910dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 4240d3236553SJohannes Berg 424110dd9b7cSJoe Perches int 424210dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 4243d3236553SJohannes Berg 424433e5a2f7SJohannes Berg 4245e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 4246e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 4247e31a16d6SZhu Yi 4248e31a16d6SZhu Yi /** 4249e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 4250e31a16d6SZhu Yi * 4251e31a16d6SZhu Yi * @skb: the frame 42520ae997dcSYacine Belkadi * 42530ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 42540ae997dcSYacine Belkadi * returns the 802.11 header length. 42550ae997dcSYacine Belkadi * 42560ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 42570ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 42580ae997dcSYacine Belkadi * 802.11 header. 4259e31a16d6SZhu Yi */ 4260e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 4261e31a16d6SZhu Yi 4262e31a16d6SZhu Yi /** 4263e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 4264e31a16d6SZhu Yi * @fc: frame control field in little-endian format 42650ae997dcSYacine Belkadi * Return: The header length in bytes. 4266e31a16d6SZhu Yi */ 4267633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 4268e31a16d6SZhu Yi 4269e31a16d6SZhu Yi /** 42709b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 42719b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 42729b395bc3SJohannes Berg * (first byte) will be accessed 42730ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 42749b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 42759b395bc3SJohannes Berg */ 42769b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 42779b395bc3SJohannes Berg 42789b395bc3SJohannes Berg /** 4279d70e9693SJohannes Berg * DOC: Data path helpers 4280d70e9693SJohannes Berg * 4281d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 4282d70e9693SJohannes Berg * functions that help implement the data path for devices 4283d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 4284d70e9693SJohannes Berg */ 4285d70e9693SJohannes Berg 4286d70e9693SJohannes Berg /** 42877f6990c8SJohannes Berg * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 42887f6990c8SJohannes Berg * @skb: the 802.11 data frame 42897f6990c8SJohannes Berg * @ehdr: pointer to a &struct ethhdr that will get the header, instead 42907f6990c8SJohannes Berg * of it being pushed into the SKB 42917f6990c8SJohannes Berg * @addr: the device MAC address 42927f6990c8SJohannes Berg * @iftype: the virtual interface type 42937f6990c8SJohannes Berg * Return: 0 on success. Non-zero on error. 42947f6990c8SJohannes Berg */ 42957f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 42967f6990c8SJohannes Berg const u8 *addr, enum nl80211_iftype iftype); 42977f6990c8SJohannes Berg 42987f6990c8SJohannes Berg /** 4299e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 4300e31a16d6SZhu Yi * @skb: the 802.11 data frame 4301e31a16d6SZhu Yi * @addr: the device MAC address 4302e31a16d6SZhu Yi * @iftype: the virtual interface type 43030ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 4304e31a16d6SZhu Yi */ 43057f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 43067f6990c8SJohannes Berg enum nl80211_iftype iftype) 43077f6990c8SJohannes Berg { 43087f6990c8SJohannes Berg return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype); 43097f6990c8SJohannes Berg } 4310e31a16d6SZhu Yi 4311e31a16d6SZhu Yi /** 4312e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 4313e31a16d6SZhu Yi * @skb: the 802.3 frame 4314e31a16d6SZhu Yi * @addr: the device MAC address 4315e31a16d6SZhu Yi * @iftype: the virtual interface type 4316e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 4317e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 43180ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 4319e31a16d6SZhu Yi */ 4320eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 4321c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 4322c1e5f471SJohannes Berg bool qos); 4323e31a16d6SZhu Yi 4324e31a16d6SZhu Yi /** 4325eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 4326eaf85ca7SZhu Yi * 43277f6990c8SJohannes Berg * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 43287f6990c8SJohannes Berg * The @list will be empty if the decode fails. The @skb must be fully 43297f6990c8SJohannes Berg * header-less before being passed in here; it is freed in this function. 4330eaf85ca7SZhu Yi * 43317f6990c8SJohannes Berg * @skb: The input A-MSDU frame without any headers. 4332eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 4333eaf85ca7SZhu Yi * initialized by by the caller. 4334eaf85ca7SZhu Yi * @addr: The device MAC address. 4335eaf85ca7SZhu Yi * @iftype: The device interface type. 4336eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 43378b935ee2SJohannes Berg * @check_da: DA to check in the inner ethernet header, or NULL 43388b935ee2SJohannes Berg * @check_sa: SA to check in the inner ethernet header, or NULL 4339eaf85ca7SZhu Yi */ 4340eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 4341eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 43428b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 43438b935ee2SJohannes Berg const u8 *check_da, const u8 *check_sa); 4344eaf85ca7SZhu Yi 4345eaf85ca7SZhu Yi /** 4346e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 4347e31a16d6SZhu Yi * @skb: the data frame 4348fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 43490ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 4350e31a16d6SZhu Yi */ 4351fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 4352fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4353e31a16d6SZhu Yi 4354c21dbf92SJohannes Berg /** 4355fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 4356fbd05e4aSLuca Coelho * 4357fbd05e4aSLuca Coelho * @eid: element ID 4358fbd05e4aSLuca Coelho * @ies: data consisting of IEs 4359fbd05e4aSLuca Coelho * @len: length of data 4360fbd05e4aSLuca Coelho * @match: byte array to match 4361fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 4362fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 4363fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 4364fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 4365fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 4366fbd05e4aSLuca Coelho * the second byte is the IE length. 4367fbd05e4aSLuca Coelho * 4368fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 4369fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 4370fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 4371fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 4372fbd05e4aSLuca Coelho * element ID. 4373fbd05e4aSLuca Coelho * 4374fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 4375fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 4376fbd05e4aSLuca Coelho * byte array to match. 4377fbd05e4aSLuca Coelho */ 4378fbd05e4aSLuca Coelho const u8 *cfg80211_find_ie_match(u8 eid, const u8 *ies, int len, 4379fbd05e4aSLuca Coelho const u8 *match, int match_len, 4380fbd05e4aSLuca Coelho int match_offset); 4381fbd05e4aSLuca Coelho 4382fbd05e4aSLuca Coelho /** 4383c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 4384c21dbf92SJohannes Berg * 4385c21dbf92SJohannes Berg * @eid: element ID 4386c21dbf92SJohannes Berg * @ies: data consisting of IEs 4387c21dbf92SJohannes Berg * @len: length of data 4388c21dbf92SJohannes Berg * 43890ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 43900ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 43910ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 43920ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 43930ae997dcSYacine Belkadi * 43940ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 43950ae997dcSYacine Belkadi * having to fit into the given data. 4396c21dbf92SJohannes Berg */ 4397fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 4398fbd05e4aSLuca Coelho { 4399fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 4400fbd05e4aSLuca Coelho } 4401c21dbf92SJohannes Berg 4402d70e9693SJohannes Berg /** 44033f817fe7SJouni Malinen * cfg80211_find_ext_ie - find information element with EID Extension in data 44043f817fe7SJouni Malinen * 44053f817fe7SJouni Malinen * @ext_eid: element ID Extension 44063f817fe7SJouni Malinen * @ies: data consisting of IEs 44073f817fe7SJouni Malinen * @len: length of data 44083f817fe7SJouni Malinen * 44093f817fe7SJouni Malinen * Return: %NULL if the extended element ID could not be found or if 44103f817fe7SJouni Malinen * the element is invalid (claims to be longer than the given 44113f817fe7SJouni Malinen * data), or a pointer to the first byte of the requested 44123f817fe7SJouni Malinen * element, that is the byte containing the element ID. 44133f817fe7SJouni Malinen * 44143f817fe7SJouni Malinen * Note: There are no checks on the element length other than 44153f817fe7SJouni Malinen * having to fit into the given data. 44163f817fe7SJouni Malinen */ 44173f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 44183f817fe7SJouni Malinen { 44193f817fe7SJouni Malinen return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 44203f817fe7SJouni Malinen &ext_eid, 1, 2); 44213f817fe7SJouni Malinen } 44223f817fe7SJouni Malinen 44233f817fe7SJouni Malinen /** 44240c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 44250c28ec58SEliad Peller * 44260c28ec58SEliad Peller * @oui: vendor OUI 44279e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 44280c28ec58SEliad Peller * @ies: data consisting of IEs 44290c28ec58SEliad Peller * @len: length of data 44300c28ec58SEliad Peller * 44310ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 44320ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 44330ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 44340ae997dcSYacine Belkadi * element ID. 44350ae997dcSYacine Belkadi * 44360ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 44370ae997dcSYacine Belkadi * the given data. 44380c28ec58SEliad Peller */ 44399e9ea439SEmmanuel Grumbach const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 44400c28ec58SEliad Peller const u8 *ies, int len); 44410c28ec58SEliad Peller 44420c28ec58SEliad Peller /** 4443d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 4444d70e9693SJohannes Berg * 4445d70e9693SJohannes Berg * TODO 4446d3236553SJohannes Berg */ 4447d3236553SJohannes Berg 4448d3236553SJohannes Berg /** 4449d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 4450d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 4451d3236553SJohannes Berg * conflicts) 4452d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 4453d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 4454d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 4455d3236553SJohannes Berg * alpha2. 4456d3236553SJohannes Berg * 4457d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 4458d3236553SJohannes Berg * what it believes should be the current regulatory domain by 4459d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 4460d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 4461d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 4462d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 4463d3236553SJohannes Berg * 4464d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 4465d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 4466d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 4467d3236553SJohannes Berg * 4468d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 4469d3236553SJohannes Berg * an -ENOMEM. 44700ae997dcSYacine Belkadi * 44710ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 4472d3236553SJohannes Berg */ 447310dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 4474d3236553SJohannes Berg 4475d3236553SJohannes Berg /** 4476b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 4477b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 4478b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 4479b0d7aa59SJonathan Doron * 4480b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 4481b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 4482b0d7aa59SJonathan Doron * information. 4483b0d7aa59SJonathan Doron * 4484b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 4485b0d7aa59SJonathan Doron */ 4486b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 4487b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 4488b0d7aa59SJonathan Doron 4489b0d7aa59SJonathan Doron /** 44902c3e861cSArik Nemtsov * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 44912c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 44922c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 44932c3e861cSArik Nemtsov * 44942c3e861cSArik Nemtsov * This functions requires the RTNL to be held and applies the new regdomain 44952c3e861cSArik Nemtsov * synchronously to this wiphy. For more details see 44962c3e861cSArik Nemtsov * regulatory_set_wiphy_regd(). 44972c3e861cSArik Nemtsov * 44982c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 44992c3e861cSArik Nemtsov */ 45002c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 45012c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 45022c3e861cSArik Nemtsov 45032c3e861cSArik Nemtsov /** 4504d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 4505d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 4506d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 4507d3236553SJohannes Berg * 4508d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 4509d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 4510d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 4511d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 4512d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 4513d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 4514222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 4515ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 4516222ea581SLuis R. Rodriguez * that called this helper. 4517d3236553SJohannes Berg */ 451810dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 4519d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 4520d3236553SJohannes Berg 4521d3236553SJohannes Berg /** 4522d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 4523d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 4524d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 4525d3236553SJohannes Berg * 4526d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 4527d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 4528d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 4529d3236553SJohannes Berg * and processed already. 4530d3236553SJohannes Berg * 45310ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 45320ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 45330ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 45340ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 45350ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 45360ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 45370ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 4538d3236553SJohannes Berg */ 4539361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 4540361c9c8bSJohannes Berg u32 center_freq); 4541d3236553SJohannes Berg 4542034c6d6eSLuis R. Rodriguez /** 4543034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 4544034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 4545034c6d6eSLuis R. Rodriguez * 4546034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 4547034c6d6eSLuis R. Rodriguez * proper string representation. 4548034c6d6eSLuis R. Rodriguez */ 4549034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 4550034c6d6eSLuis R. Rodriguez 4551d3236553SJohannes Berg /* 4552d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 4553d3236553SJohannes Berg * functions and BSS handling helpers 4554d3236553SJohannes Berg */ 4555d3236553SJohannes Berg 45562a519311SJohannes Berg /** 45572a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 45582a519311SJohannes Berg * 45592a519311SJohannes Berg * @request: the corresponding scan request 45601d76250bSAvraham Stern * @info: information about the completed scan 45612a519311SJohannes Berg */ 45621d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 45631d76250bSAvraham Stern struct cfg80211_scan_info *info); 45642a519311SJohannes Berg 45652a519311SJohannes Berg /** 4566807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 4567807f8a8cSLuciano Coelho * 4568807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 4569b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 4570807f8a8cSLuciano Coelho */ 4571b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 4572807f8a8cSLuciano Coelho 4573807f8a8cSLuciano Coelho /** 4574807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 4575807f8a8cSLuciano Coelho * 4576807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 4577b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 4578807f8a8cSLuciano Coelho * 4579807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 4580807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 4581807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 4582807f8a8cSLuciano Coelho */ 4583b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 4584807f8a8cSLuciano Coelho 4585807f8a8cSLuciano Coelho /** 4586792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 4587792e6aa7SEliad Peller * 4588792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 4589b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 4590792e6aa7SEliad Peller * 4591792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 4592792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 4593792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 4594792e6aa7SEliad Peller * This function should be called with rtnl locked. 4595792e6aa7SEliad Peller */ 4596b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid); 4597792e6aa7SEliad Peller 4598792e6aa7SEliad Peller /** 45996e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 46002a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 46016e19bc4bSDmitry Shmidt * @data: the BSS metadata 4602abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 4603abe37c4bSJohannes Berg * @len: length of the management frame 46042a519311SJohannes Berg * @gfp: context flags 46052a519311SJohannes Berg * 46062a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 46072a519311SJohannes Berg * the BSS should be updated/added. 4608ef100682SJohannes Berg * 46090ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 46100ae997dcSYacine Belkadi * Or %NULL on error. 46112a519311SJohannes Berg */ 4612ef100682SJohannes Berg struct cfg80211_bss * __must_check 46136e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 46146e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 46156e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 46166e19bc4bSDmitry Shmidt gfp_t gfp); 46176e19bc4bSDmitry Shmidt 46186e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4619dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 46203afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4621dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 4622dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 46236e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 46246e19bc4bSDmitry Shmidt { 46256e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 46266e19bc4bSDmitry Shmidt .chan = rx_channel, 46276e19bc4bSDmitry Shmidt .scan_width = scan_width, 46286e19bc4bSDmitry Shmidt .signal = signal, 46296e19bc4bSDmitry Shmidt }; 46306e19bc4bSDmitry Shmidt 46316e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 46326e19bc4bSDmitry Shmidt } 4633dcd6eac1SSimon Wunderlich 4634dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 46352a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 46363afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 46372a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 4638dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4639dcd6eac1SSimon Wunderlich { 46406e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 46416e19bc4bSDmitry Shmidt .chan = rx_channel, 46426e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 46436e19bc4bSDmitry Shmidt .signal = signal, 46446e19bc4bSDmitry Shmidt }; 46456e19bc4bSDmitry Shmidt 46466e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 4647dcd6eac1SSimon Wunderlich } 46482a519311SJohannes Berg 4649abe37c4bSJohannes Berg /** 46505bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 46515bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 46525bc8c1f2SJohannes Berg * from a beacon or probe response 46535bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 46545bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 46555bc8c1f2SJohannes Berg */ 46565bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 46575bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 46585bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 46595bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 46605bc8c1f2SJohannes Berg }; 46615bc8c1f2SJohannes Berg 46625bc8c1f2SJohannes Berg /** 46636e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 4664abe37c4bSJohannes Berg * 4665abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 46666e19bc4bSDmitry Shmidt * @data: the BSS metadata 46675bc8c1f2SJohannes Berg * @ftype: frame type (if known) 4668abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 46697b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 4670abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 4671abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 4672abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 4673abe37c4bSJohannes Berg * @ielen: length of the additional IEs 4674abe37c4bSJohannes Berg * @gfp: context flags 4675abe37c4bSJohannes Berg * 4676abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 4677abe37c4bSJohannes Berg * the BSS should be updated/added. 4678ef100682SJohannes Berg * 46790ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 46800ae997dcSYacine Belkadi * Or %NULL on error. 4681abe37c4bSJohannes Berg */ 4682ef100682SJohannes Berg struct cfg80211_bss * __must_check 46836e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 46846e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 46856e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 46866e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 46876e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 46886e19bc4bSDmitry Shmidt gfp_t gfp); 46896e19bc4bSDmitry Shmidt 46906e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4691dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 46923afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4693dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 46945bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 4695dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 4696dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 46976e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 46986e19bc4bSDmitry Shmidt { 46996e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 47006e19bc4bSDmitry Shmidt .chan = rx_channel, 47016e19bc4bSDmitry Shmidt .scan_width = scan_width, 47026e19bc4bSDmitry Shmidt .signal = signal, 47036e19bc4bSDmitry Shmidt }; 47046e19bc4bSDmitry Shmidt 47056e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 47066e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 47076e19bc4bSDmitry Shmidt gfp); 47086e19bc4bSDmitry Shmidt } 4709dcd6eac1SSimon Wunderlich 4710dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 471106aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 47123afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 47135bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 47147b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 47157b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4716dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4717dcd6eac1SSimon Wunderlich { 47186e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 47196e19bc4bSDmitry Shmidt .chan = rx_channel, 47206e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 47216e19bc4bSDmitry Shmidt .signal = signal, 47226e19bc4bSDmitry Shmidt }; 47236e19bc4bSDmitry Shmidt 47246e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 47256e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 4726dcd6eac1SSimon Wunderlich gfp); 4727dcd6eac1SSimon Wunderlich } 472806aa7afaSJussi Kivilinna 472927548677SJohannes Berg /** 473027548677SJohannes Berg * cfg80211_get_bss - get a BSS reference 473127548677SJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 473227548677SJohannes Berg * @channel: the channel to search on (or %NULL) 473327548677SJohannes Berg * @bssid: the desired BSSID (or %NULL) 473427548677SJohannes Berg * @ssid: the desired SSID (or %NULL) 473527548677SJohannes Berg * @ssid_len: length of the SSID (or 0) 473627548677SJohannes Berg * @bss_type: type of BSS, see &enum ieee80211_bss_type 473727548677SJohannes Berg * @privacy: privacy filter, see &enum ieee80211_privacy 473827548677SJohannes Berg */ 47392a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 47402a519311SJohannes Berg struct ieee80211_channel *channel, 47412a519311SJohannes Berg const u8 *bssid, 474279420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 47436eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 474427548677SJohannes Berg enum ieee80211_privacy privacy); 474579420f09SJohannes Berg static inline struct cfg80211_bss * 474679420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 474779420f09SJohannes Berg struct ieee80211_channel *channel, 474879420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 474979420f09SJohannes Berg { 475079420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 47516eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 47526eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 475379420f09SJohannes Berg } 475479420f09SJohannes Berg 47554c0c0b75SJohannes Berg /** 47564c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 47575b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 47584c0c0b75SJohannes Berg * @bss: the BSS struct to reference 47594c0c0b75SJohannes Berg * 47604c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 47614c0c0b75SJohannes Berg */ 47625b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 47634c0c0b75SJohannes Berg 47644c0c0b75SJohannes Berg /** 47654c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 47665b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 47674c0c0b75SJohannes Berg * @bss: the BSS struct 47684c0c0b75SJohannes Berg * 47694c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 47704c0c0b75SJohannes Berg */ 47715b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4772d3236553SJohannes Berg 4773d491af19SJohannes Berg /** 4774d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4775d491af19SJohannes Berg * @wiphy: the wiphy 4776d491af19SJohannes Berg * @bss: the bss to remove 4777d491af19SJohannes Berg * 4778d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4779d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4780d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4781d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4782d491af19SJohannes Berg */ 4783d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4784fee52678SJohannes Berg 4785dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4786dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4787dcd6eac1SSimon Wunderlich { 4788dcd6eac1SSimon Wunderlich switch (chandef->width) { 4789dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4790dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4791dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4792dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4793dcd6eac1SSimon Wunderlich default: 4794dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4795dcd6eac1SSimon Wunderlich } 4796dcd6eac1SSimon Wunderlich } 4797dcd6eac1SSimon Wunderlich 47986039f6d2SJouni Malinen /** 47996ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 48006039f6d2SJouni Malinen * @dev: network device 48016039f6d2SJouni Malinen * @buf: authentication frame (header + body) 48026039f6d2SJouni Malinen * @len: length of the frame data 48036039f6d2SJouni Malinen * 48046ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 48056ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 48066ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 48076ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 48086ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 48096ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 48106ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 48116ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 48126ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 48136ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 48146ff57cf8SJohannes Berg * 48156ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 48166039f6d2SJouni Malinen */ 48176ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 48186039f6d2SJouni Malinen 48196039f6d2SJouni Malinen /** 48206ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 48211965c853SJouni Malinen * @dev: network device 48221965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4823cb0b4bebSJohannes Berg * 48248d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 48258d61ffa5SJohannes Berg * mutex. 48261965c853SJouni Malinen */ 48276ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 48281965c853SJouni Malinen 48291965c853SJouni Malinen /** 48306ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 48316039f6d2SJouni Malinen * @dev: network device 48326ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 48336ff57cf8SJohannes Berg * moves to cfg80211 in this call 48346ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 48356039f6d2SJouni Malinen * @len: length of the frame data 4836f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 4837f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 48386039f6d2SJouni Malinen * 48396ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 48406ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 48416ff57cf8SJohannes Berg * 48426ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 48436039f6d2SJouni Malinen */ 48446ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 48456ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4846b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4847b0b6aa2cSEliad Peller int uapsd_queues); 48486039f6d2SJouni Malinen 48496039f6d2SJouni Malinen /** 48506ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 48511965c853SJouni Malinen * @dev: network device 4852959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4853cb0b4bebSJohannes Berg * 48548d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 48551965c853SJouni Malinen */ 4856959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 48571965c853SJouni Malinen 48581965c853SJouni Malinen /** 4859e6f462dfSJohannes Berg * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt 4860e6f462dfSJohannes Berg * @dev: network device 4861e6f462dfSJohannes Berg * @bss: The BSS entry with which association was abandoned. 4862e6f462dfSJohannes Berg * 4863e6f462dfSJohannes Berg * Call this whenever - for reasons reported through other API, like deauth RX, 4864e6f462dfSJohannes Berg * an association attempt was abandoned. 4865e6f462dfSJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 4866e6f462dfSJohannes Berg */ 4867e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss); 4868e6f462dfSJohannes Berg 4869e6f462dfSJohannes Berg /** 48706ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 48716039f6d2SJouni Malinen * @dev: network device 48726ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 48736039f6d2SJouni Malinen * @len: length of the frame data 48746039f6d2SJouni Malinen * 48756039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 487653b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 48778d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 48788d61ffa5SJohannes Berg * corresponding wdev's mutex. 48796039f6d2SJouni Malinen */ 48806ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4881ce470613SHolger Schurig 4882ce470613SHolger Schurig /** 48836ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4884cf4e594eSJouni Malinen * @dev: network device 4885cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4886cf4e594eSJouni Malinen * @len: length of the frame data 4887cf4e594eSJouni Malinen * 48886ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 48896ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4890cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4891cf4e594eSJouni Malinen */ 48926ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 48936ff57cf8SJohannes Berg const u8 *buf, size_t len); 4894cf4e594eSJouni Malinen 4895cf4e594eSJouni Malinen /** 4896a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4897a3b8b056SJouni Malinen * @dev: network device 4898a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4899a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4900a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4901a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4902e6d6e342SJohannes Berg * @gfp: allocation flags 4903a3b8b056SJouni Malinen * 4904a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4905a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4906a3b8b056SJouni Malinen * primitive. 4907a3b8b056SJouni Malinen */ 4908a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4909a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4910e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4911a3b8b056SJouni Malinen 491204a773adSJohannes Berg /** 491304a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 491404a773adSJohannes Berg * 491504a773adSJohannes Berg * @dev: network device 491604a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4917fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 491804a773adSJohannes Berg * @gfp: allocation flags 491904a773adSJohannes Berg * 492004a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 492104a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 492204a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 492304a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 492404a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 492504a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 492604a773adSJohannes Berg */ 4927fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4928fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 492904a773adSJohannes Berg 49301f87f7d3SJohannes Berg /** 4931c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4932c93b5e71SJavier Cardona * 4933c93b5e71SJavier Cardona * @dev: network device 4934c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4935c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4936c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4937c93b5e71SJavier Cardona * @gfp: allocation flags 4938c93b5e71SJavier Cardona * 4939c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4940c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4941c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4942c93b5e71SJavier Cardona */ 4943c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4944c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4945c93b5e71SJavier Cardona 4946c93b5e71SJavier Cardona /** 4947d70e9693SJohannes Berg * DOC: RFkill integration 4948d70e9693SJohannes Berg * 4949d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4950d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4951d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4952d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4953d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4954d70e9693SJohannes Berg * 4955d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4956d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4957d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4958d70e9693SJohannes Berg */ 4959d70e9693SJohannes Berg 4960d70e9693SJohannes Berg /** 49611f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 49621f87f7d3SJohannes Berg * @wiphy: the wiphy 49631f87f7d3SJohannes Berg * @blocked: block status 49641f87f7d3SJohannes Berg */ 49651f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 49661f87f7d3SJohannes Berg 49671f87f7d3SJohannes Berg /** 49681f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 49691f87f7d3SJohannes Berg * @wiphy: the wiphy 49701f87f7d3SJohannes Berg */ 49711f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 49721f87f7d3SJohannes Berg 49731f87f7d3SJohannes Berg /** 49741f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 49751f87f7d3SJohannes Berg * @wiphy: the wiphy 49761f87f7d3SJohannes Berg */ 49771f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 49781f87f7d3SJohannes Berg 4979ad7e718cSJohannes Berg /** 4980ad7e718cSJohannes Berg * DOC: Vendor commands 4981ad7e718cSJohannes Berg * 4982ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4983ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4984ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4985ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4986ad7e718cSJohannes Berg * the configuration mechanism. 4987ad7e718cSJohannes Berg * 4988ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4989ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4990ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4991ad7e718cSJohannes Berg * 4992ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4993ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4994ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4995ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4996ad7e718cSJohannes Berg * managers etc. need. 4997ad7e718cSJohannes Berg */ 4998ad7e718cSJohannes Berg 4999ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 5000ad7e718cSJohannes Berg enum nl80211_commands cmd, 5001ad7e718cSJohannes Berg enum nl80211_attrs attr, 5002ad7e718cSJohannes Berg int approxlen); 5003ad7e718cSJohannes Berg 5004567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 50056c09e791SAhmad Kholaif struct wireless_dev *wdev, 5006567ffc35SJohannes Berg enum nl80211_commands cmd, 5007567ffc35SJohannes Berg enum nl80211_attrs attr, 5008567ffc35SJohannes Berg int vendor_event_idx, 5009567ffc35SJohannes Berg int approxlen, gfp_t gfp); 5010567ffc35SJohannes Berg 5011567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 5012567ffc35SJohannes Berg 5013ad7e718cSJohannes Berg /** 5014ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 5015ad7e718cSJohannes Berg * @wiphy: the wiphy 5016ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 5017ad7e718cSJohannes Berg * be put into the skb 5018ad7e718cSJohannes Berg * 5019ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 5020ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 5021ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 5022ad7e718cSJohannes Berg * 5023ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 5024ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 5025ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 5026ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 5027ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 5028ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 5029ad7e718cSJohannes Berg * You must not modify the skb in any other way. 5030ad7e718cSJohannes Berg * 5031ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 5032ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 5033ad7e718cSJohannes Berg * 5034ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5035ad7e718cSJohannes Berg */ 5036ad7e718cSJohannes Berg static inline struct sk_buff * 5037ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 5038ad7e718cSJohannes Berg { 5039ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 5040ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 5041ad7e718cSJohannes Berg } 5042ad7e718cSJohannes Berg 5043ad7e718cSJohannes Berg /** 5044ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 5045ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 5046ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 5047ad7e718cSJohannes Berg * 5048ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 5049ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 5050ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 5051ad7e718cSJohannes Berg * skb regardless of the return value. 5052ad7e718cSJohannes Berg * 5053ad7e718cSJohannes Berg * Return: An error code or 0 on success. 5054ad7e718cSJohannes Berg */ 5055ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 5056ad7e718cSJohannes Berg 5057567ffc35SJohannes Berg /** 5058567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 5059567ffc35SJohannes Berg * @wiphy: the wiphy 50606c09e791SAhmad Kholaif * @wdev: the wireless device 5061567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 5062567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 5063567ffc35SJohannes Berg * be put into the skb 5064567ffc35SJohannes Berg * @gfp: allocation flags 5065567ffc35SJohannes Berg * 5066567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 5067567ffc35SJohannes Berg * vendor-specific multicast group. 5068567ffc35SJohannes Berg * 50696c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 50706c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 50716c09e791SAhmad Kholaif * attribute. 50726c09e791SAhmad Kholaif * 5073567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 5074567ffc35SJohannes Berg * skb to send the event. 5075567ffc35SJohannes Berg * 5076567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5077567ffc35SJohannes Berg */ 5078567ffc35SJohannes Berg static inline struct sk_buff * 50796c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 50806c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 5081567ffc35SJohannes Berg { 50826c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 5083567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 5084567ffc35SJohannes Berg event_idx, approxlen, gfp); 5085567ffc35SJohannes Berg } 5086567ffc35SJohannes Berg 5087567ffc35SJohannes Berg /** 5088567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 5089567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 5090567ffc35SJohannes Berg * @gfp: allocation flags 5091567ffc35SJohannes Berg * 5092567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 5093567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 5094567ffc35SJohannes Berg */ 5095567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 5096567ffc35SJohannes Berg { 5097567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 5098567ffc35SJohannes Berg } 5099567ffc35SJohannes Berg 5100aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 5101aff89a9bSJohannes Berg /** 5102d70e9693SJohannes Berg * DOC: Test mode 5103d70e9693SJohannes Berg * 5104d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 5105d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 5106d70e9693SJohannes Berg * factory programming. 5107d70e9693SJohannes Berg * 5108d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 5109d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 5110d70e9693SJohannes Berg */ 5111d70e9693SJohannes Berg 5112d70e9693SJohannes Berg /** 5113aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 5114aff89a9bSJohannes Berg * @wiphy: the wiphy 5115aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 5116aff89a9bSJohannes Berg * be put into the skb 5117aff89a9bSJohannes Berg * 5118aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 5119aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 5120aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 5121aff89a9bSJohannes Berg * 51220ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 51230ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 51240ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 51250ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 51260ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 51270ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 51280ae997dcSYacine Belkadi * must not modify the skb in any other way. 5129aff89a9bSJohannes Berg * 5130aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 5131aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 51320ae997dcSYacine Belkadi * 51330ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5134aff89a9bSJohannes Berg */ 5135ad7e718cSJohannes Berg static inline struct sk_buff * 5136ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 5137ad7e718cSJohannes Berg { 5138ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 5139ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 5140ad7e718cSJohannes Berg } 5141aff89a9bSJohannes Berg 5142aff89a9bSJohannes Berg /** 5143aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 5144aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 5145aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 5146aff89a9bSJohannes Berg * 51470ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 51480ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 51490ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 51500ae997dcSYacine Belkadi * regardless of the return value. 51510ae997dcSYacine Belkadi * 51520ae997dcSYacine Belkadi * Return: An error code or 0 on success. 5153aff89a9bSJohannes Berg */ 5154ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 5155ad7e718cSJohannes Berg { 5156ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 5157ad7e718cSJohannes Berg } 5158aff89a9bSJohannes Berg 5159aff89a9bSJohannes Berg /** 5160aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 5161aff89a9bSJohannes Berg * @wiphy: the wiphy 5162aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 5163aff89a9bSJohannes Berg * be put into the skb 5164aff89a9bSJohannes Berg * @gfp: allocation flags 5165aff89a9bSJohannes Berg * 5166aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 5167aff89a9bSJohannes Berg * testmode multicast group. 5168aff89a9bSJohannes Berg * 51690ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 51700ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 51710ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 51720ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 51730ae997dcSYacine Belkadi * in any other way. 5174aff89a9bSJohannes Berg * 5175aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 5176aff89a9bSJohannes Berg * skb to send the event. 51770ae997dcSYacine Belkadi * 51780ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 5179aff89a9bSJohannes Berg */ 5180567ffc35SJohannes Berg static inline struct sk_buff * 5181567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 5182567ffc35SJohannes Berg { 51836c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 5184567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 5185567ffc35SJohannes Berg approxlen, gfp); 5186567ffc35SJohannes Berg } 5187aff89a9bSJohannes Berg 5188aff89a9bSJohannes Berg /** 5189aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 5190aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 5191aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 5192aff89a9bSJohannes Berg * @gfp: allocation flags 5193aff89a9bSJohannes Berg * 5194aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 5195aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 5196aff89a9bSJohannes Berg * consumes it. 5197aff89a9bSJohannes Berg */ 5198567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 5199567ffc35SJohannes Berg { 5200567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 5201567ffc35SJohannes Berg } 5202aff89a9bSJohannes Berg 5203aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 520471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 5205aff89a9bSJohannes Berg #else 5206aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 520771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 5208aff89a9bSJohannes Berg #endif 5209aff89a9bSJohannes Berg 5210b23aa676SSamuel Ortiz /** 52115349a0f7SVidyullatha Kanchanapally * struct cfg80211_connect_resp_params - Connection response params 52125349a0f7SVidyullatha Kanchanapally * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 52135349a0f7SVidyullatha Kanchanapally * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 52145349a0f7SVidyullatha Kanchanapally * the real status code for failures. If this call is used to report a 52155349a0f7SVidyullatha Kanchanapally * failure due to a timeout (e.g., not receiving an Authentication frame 52165349a0f7SVidyullatha Kanchanapally * from the AP) instead of an explicit rejection by the AP, -1 is used to 52175349a0f7SVidyullatha Kanchanapally * indicate that this is a failure, but without a status code. 52185349a0f7SVidyullatha Kanchanapally * @timeout_reason is used to report the reason for the timeout in that 52195349a0f7SVidyullatha Kanchanapally * case. 52205349a0f7SVidyullatha Kanchanapally * @bssid: The BSSID of the AP (may be %NULL) 52215349a0f7SVidyullatha Kanchanapally * @bss: Entry of bss to which STA got connected to, can be obtained through 52225349a0f7SVidyullatha Kanchanapally * cfg80211_get_bss() (may be %NULL). Only one parameter among @bssid and 52235349a0f7SVidyullatha Kanchanapally * @bss needs to be specified. 52245349a0f7SVidyullatha Kanchanapally * @req_ie: Association request IEs (may be %NULL) 52255349a0f7SVidyullatha Kanchanapally * @req_ie_len: Association request IEs length 52265349a0f7SVidyullatha Kanchanapally * @resp_ie: Association response IEs (may be %NULL) 52275349a0f7SVidyullatha Kanchanapally * @resp_ie_len: Association response IEs length 5228a3caf744SVidyullatha Kanchanapally * @fils_kek: KEK derived from a successful FILS connection (may be %NULL) 5229a3caf744SVidyullatha Kanchanapally * @fils_kek_len: Length of @fils_kek in octets 5230a3caf744SVidyullatha Kanchanapally * @update_erp_next_seq_num: Boolean value to specify whether the value in 5231a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num is valid. 5232a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in ERP message in 5233a3caf744SVidyullatha Kanchanapally * FILS Authentication. This value should be specified irrespective of the 5234a3caf744SVidyullatha Kanchanapally * status for a FILS connection. 5235a3caf744SVidyullatha Kanchanapally * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 5236a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of @pmk in octets 5237a3caf744SVidyullatha Kanchanapally * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 5238a3caf744SVidyullatha Kanchanapally * used for this FILS connection (may be %NULL). 52395349a0f7SVidyullatha Kanchanapally * @timeout_reason: Reason for connection timeout. This is used when the 52405349a0f7SVidyullatha Kanchanapally * connection fails due to a timeout instead of an explicit rejection from 52415349a0f7SVidyullatha Kanchanapally * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 52425349a0f7SVidyullatha Kanchanapally * not known. This value is used only if @status < 0 to indicate that the 52435349a0f7SVidyullatha Kanchanapally * failure is due to a timeout and not due to explicit rejection by the AP. 52445349a0f7SVidyullatha Kanchanapally * This value is ignored in other cases (@status >= 0). 52455349a0f7SVidyullatha Kanchanapally */ 52465349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params { 52475349a0f7SVidyullatha Kanchanapally int status; 52485349a0f7SVidyullatha Kanchanapally const u8 *bssid; 52495349a0f7SVidyullatha Kanchanapally struct cfg80211_bss *bss; 52505349a0f7SVidyullatha Kanchanapally const u8 *req_ie; 52515349a0f7SVidyullatha Kanchanapally size_t req_ie_len; 52525349a0f7SVidyullatha Kanchanapally const u8 *resp_ie; 52535349a0f7SVidyullatha Kanchanapally size_t resp_ie_len; 5254a3caf744SVidyullatha Kanchanapally const u8 *fils_kek; 5255a3caf744SVidyullatha Kanchanapally size_t fils_kek_len; 5256a3caf744SVidyullatha Kanchanapally bool update_erp_next_seq_num; 5257a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 5258a3caf744SVidyullatha Kanchanapally const u8 *pmk; 5259a3caf744SVidyullatha Kanchanapally size_t pmk_len; 5260a3caf744SVidyullatha Kanchanapally const u8 *pmkid; 52615349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason; 52625349a0f7SVidyullatha Kanchanapally }; 52635349a0f7SVidyullatha Kanchanapally 52645349a0f7SVidyullatha Kanchanapally /** 52655349a0f7SVidyullatha Kanchanapally * cfg80211_connect_done - notify cfg80211 of connection result 52665349a0f7SVidyullatha Kanchanapally * 52675349a0f7SVidyullatha Kanchanapally * @dev: network device 52685349a0f7SVidyullatha Kanchanapally * @params: connection response parameters 52695349a0f7SVidyullatha Kanchanapally * @gfp: allocation flags 52705349a0f7SVidyullatha Kanchanapally * 52715349a0f7SVidyullatha Kanchanapally * It should be called by the underlying driver once execution of the connection 52725349a0f7SVidyullatha Kanchanapally * request from connect() has been completed. This is similar to 52735349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), but takes a structure pointer for connection response 52745349a0f7SVidyullatha Kanchanapally * parameters. Only one of the functions among cfg80211_connect_bss(), 52755349a0f7SVidyullatha Kanchanapally * cfg80211_connect_result(), cfg80211_connect_timeout(), 52765349a0f7SVidyullatha Kanchanapally * and cfg80211_connect_done() should be called. 52775349a0f7SVidyullatha Kanchanapally */ 52785349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev, 52795349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params *params, 52805349a0f7SVidyullatha Kanchanapally gfp_t gfp); 52815349a0f7SVidyullatha Kanchanapally 52825349a0f7SVidyullatha Kanchanapally /** 5283e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 5284e7054989SKanchanapally, Vidyullatha * 5285e7054989SKanchanapally, Vidyullatha * @dev: network device 5286e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 5287e7054989SKanchanapally, Vidyullatha * @bss: entry of bss to which STA got connected to, can be obtained 5288e7054989SKanchanapally, Vidyullatha * through cfg80211_get_bss (may be %NULL) 5289e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 5290e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 5291e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 5292e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 5293c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 5294e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5295c88215d7SJouni Malinen * the real status code for failures. If this call is used to report a 5296c88215d7SJouni Malinen * failure due to a timeout (e.g., not receiving an Authentication frame 5297c88215d7SJouni Malinen * from the AP) instead of an explicit rejection by the AP, -1 is used to 5298c88215d7SJouni Malinen * indicate that this is a failure, but without a status code. 5299c88215d7SJouni Malinen * @timeout_reason is used to report the reason for the timeout in that 5300c88215d7SJouni Malinen * case. 5301e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 53023093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. This is used when the 53033093ebbeSPurushottam Kushwaha * connection fails due to a timeout instead of an explicit rejection from 53043093ebbeSPurushottam Kushwaha * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 53053093ebbeSPurushottam Kushwaha * not known. This value is used only if @status < 0 to indicate that the 53063093ebbeSPurushottam Kushwaha * failure is due to a timeout and not due to explicit rejection by the AP. 53073093ebbeSPurushottam Kushwaha * This value is ignored in other cases (@status >= 0). 5308e7054989SKanchanapally, Vidyullatha * 5309c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 5310c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 5311c88215d7SJouni Malinen * cfg80211_connect_result(), but with the option of identifying the exact bss 53125349a0f7SVidyullatha Kanchanapally * entry for the connection. Only one of the functions among 53135349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 53145349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 5315e7054989SKanchanapally, Vidyullatha */ 53165349a0f7SVidyullatha Kanchanapally static inline void 53175349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 5318e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 5319e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 53203093ebbeSPurushottam Kushwaha size_t resp_ie_len, int status, gfp_t gfp, 53215349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason) 53225349a0f7SVidyullatha Kanchanapally { 53235349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params params; 53245349a0f7SVidyullatha Kanchanapally 53255349a0f7SVidyullatha Kanchanapally memset(¶ms, 0, sizeof(params)); 53265349a0f7SVidyullatha Kanchanapally params.status = status; 53275349a0f7SVidyullatha Kanchanapally params.bssid = bssid; 53285349a0f7SVidyullatha Kanchanapally params.bss = bss; 53295349a0f7SVidyullatha Kanchanapally params.req_ie = req_ie; 53305349a0f7SVidyullatha Kanchanapally params.req_ie_len = req_ie_len; 53315349a0f7SVidyullatha Kanchanapally params.resp_ie = resp_ie; 53325349a0f7SVidyullatha Kanchanapally params.resp_ie_len = resp_ie_len; 53335349a0f7SVidyullatha Kanchanapally params.timeout_reason = timeout_reason; 53345349a0f7SVidyullatha Kanchanapally 53355349a0f7SVidyullatha Kanchanapally cfg80211_connect_done(dev, ¶ms, gfp); 53365349a0f7SVidyullatha Kanchanapally } 5337e7054989SKanchanapally, Vidyullatha 5338e7054989SKanchanapally, Vidyullatha /** 5339b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 5340b23aa676SSamuel Ortiz * 5341b23aa676SSamuel Ortiz * @dev: network device 5342b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 5343b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 5344b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 5345b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 5346b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 5347c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 5348b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5349b23aa676SSamuel Ortiz * the real status code for failures. 5350b23aa676SSamuel Ortiz * @gfp: allocation flags 5351b23aa676SSamuel Ortiz * 5352c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 5353c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 5354c88215d7SJouni Malinen * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 53555349a0f7SVidyullatha Kanchanapally * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 53565349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 5357b23aa676SSamuel Ortiz */ 5358e7054989SKanchanapally, Vidyullatha static inline void 5359e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 5360b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 5361b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 5362e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 5363e7054989SKanchanapally, Vidyullatha { 5364e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 53653093ebbeSPurushottam Kushwaha resp_ie_len, status, gfp, 53663093ebbeSPurushottam Kushwaha NL80211_TIMEOUT_UNSPECIFIED); 5367e7054989SKanchanapally, Vidyullatha } 5368b23aa676SSamuel Ortiz 5369b23aa676SSamuel Ortiz /** 5370bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 5371bf1ecd21SJouni Malinen * 5372bf1ecd21SJouni Malinen * @dev: network device 5373bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 5374bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 5375bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 5376bf1ecd21SJouni Malinen * @gfp: allocation flags 53773093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. 5378bf1ecd21SJouni Malinen * 5379bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 5380bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 5381bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 5382bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 53835349a0f7SVidyullatha Kanchanapally * waiting for the response. Only one of the functions among 53845349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 53855349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 5386bf1ecd21SJouni Malinen */ 5387bf1ecd21SJouni Malinen static inline void 5388bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 53893093ebbeSPurushottam Kushwaha const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 53903093ebbeSPurushottam Kushwaha enum nl80211_timeout_reason timeout_reason) 5391bf1ecd21SJouni Malinen { 5392bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 53933093ebbeSPurushottam Kushwaha gfp, timeout_reason); 5394bf1ecd21SJouni Malinen } 5395bf1ecd21SJouni Malinen 5396bf1ecd21SJouni Malinen /** 539729ce6ecbSAvraham Stern * struct cfg80211_roam_info - driver initiated roaming information 539829ce6ecbSAvraham Stern * 539929ce6ecbSAvraham Stern * @channel: the channel of the new AP 540029ce6ecbSAvraham Stern * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set) 540129ce6ecbSAvraham Stern * @bssid: the BSSID of the new AP (may be %NULL if %bss is set) 540229ce6ecbSAvraham Stern * @req_ie: association request IEs (maybe be %NULL) 540329ce6ecbSAvraham Stern * @req_ie_len: association request IEs length 540429ce6ecbSAvraham Stern * @resp_ie: association response IEs (may be %NULL) 540529ce6ecbSAvraham Stern * @resp_ie_len: assoc response IEs length 540629ce6ecbSAvraham Stern */ 540729ce6ecbSAvraham Stern struct cfg80211_roam_info { 540829ce6ecbSAvraham Stern struct ieee80211_channel *channel; 540929ce6ecbSAvraham Stern struct cfg80211_bss *bss; 541029ce6ecbSAvraham Stern const u8 *bssid; 541129ce6ecbSAvraham Stern const u8 *req_ie; 541229ce6ecbSAvraham Stern size_t req_ie_len; 541329ce6ecbSAvraham Stern const u8 *resp_ie; 541429ce6ecbSAvraham Stern size_t resp_ie_len; 541529ce6ecbSAvraham Stern }; 541629ce6ecbSAvraham Stern 541729ce6ecbSAvraham Stern /** 5418b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 5419b23aa676SSamuel Ortiz * 5420b23aa676SSamuel Ortiz * @dev: network device 542129ce6ecbSAvraham Stern * @info: information about the new BSS. struct &cfg80211_roam_info. 5422b23aa676SSamuel Ortiz * @gfp: allocation flags 5423b23aa676SSamuel Ortiz * 542429ce6ecbSAvraham Stern * This function may be called with the driver passing either the BSSID of the 542529ce6ecbSAvraham Stern * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 542629ce6ecbSAvraham Stern * It should be called by the underlying driver whenever it roamed from one AP 542729ce6ecbSAvraham Stern * to another while connected. Drivers which have roaming implemented in 542829ce6ecbSAvraham Stern * firmware should pass the bss entry to avoid a race in bss entry timeout where 542929ce6ecbSAvraham Stern * the bss entry of the new AP is seen in the driver, but gets timed out by the 543029ce6ecbSAvraham Stern * time it is accessed in __cfg80211_roamed() due to delay in scheduling 5431adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 543229ce6ecbSAvraham Stern * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 543329ce6ecbSAvraham Stern * released while diconneting from the current bss. 5434adbde344SVasanthakumar Thiagarajan */ 543529ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 543629ce6ecbSAvraham Stern gfp_t gfp); 5437adbde344SVasanthakumar Thiagarajan 5438adbde344SVasanthakumar Thiagarajan /** 5439b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 5440b23aa676SSamuel Ortiz * 5441b23aa676SSamuel Ortiz * @dev: network device 5442b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 5443b23aa676SSamuel Ortiz * @ie_len: length of IEs 5444b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 544580279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 5446b23aa676SSamuel Ortiz * @gfp: allocation flags 5447b23aa676SSamuel Ortiz * 5448b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 5449b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 5450b23aa676SSamuel Ortiz */ 5451b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 545280279fb7SJohannes Berg const u8 *ie, size_t ie_len, 545380279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 5454b23aa676SSamuel Ortiz 54559588bbd5SJouni Malinen /** 54569588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 545771bbc994SJohannes Berg * @wdev: wireless device 54589588bbd5SJouni Malinen * @cookie: the request cookie 54599588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 54609588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 54619588bbd5SJouni Malinen * channel 54629588bbd5SJouni Malinen * @gfp: allocation flags 54639588bbd5SJouni Malinen */ 546471bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 54659588bbd5SJouni Malinen struct ieee80211_channel *chan, 54669588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 54679588bbd5SJouni Malinen 54689588bbd5SJouni Malinen /** 54699588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 547071bbc994SJohannes Berg * @wdev: wireless device 54719588bbd5SJouni Malinen * @cookie: the request cookie 54729588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 54739588bbd5SJouni Malinen * @gfp: allocation flags 54749588bbd5SJouni Malinen */ 547571bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 54769588bbd5SJouni Malinen struct ieee80211_channel *chan, 54779588bbd5SJouni Malinen gfp_t gfp); 5478b23aa676SSamuel Ortiz 547998b62183SJohannes Berg 548098b62183SJohannes Berg /** 548198b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 548298b62183SJohannes Berg * 548398b62183SJohannes Berg * @dev: the netdev 548498b62183SJohannes Berg * @mac_addr: the station's address 548598b62183SJohannes Berg * @sinfo: the station information 548698b62183SJohannes Berg * @gfp: allocation flags 548798b62183SJohannes Berg */ 548898b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 548998b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 549098b62183SJohannes Berg 5491026331c4SJouni Malinen /** 5492cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 5493cf5ead82SJohannes Berg * @dev: the netdev 5494cf5ead82SJohannes Berg * @mac_addr: the station's address 5495cf5ead82SJohannes Berg * @sinfo: the station information/statistics 5496cf5ead82SJohannes Berg * @gfp: allocation flags 5497cf5ead82SJohannes Berg */ 5498cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 5499cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 5500cf5ead82SJohannes Berg 5501cf5ead82SJohannes Berg /** 5502ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 5503ec15e68bSJouni Malinen * 5504ec15e68bSJouni Malinen * @dev: the netdev 5505ec15e68bSJouni Malinen * @mac_addr: the station's address 5506ec15e68bSJouni Malinen * @gfp: allocation flags 5507ec15e68bSJouni Malinen */ 5508cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 5509cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 5510cf5ead82SJohannes Berg { 5511cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 5512cf5ead82SJohannes Berg } 5513ec15e68bSJouni Malinen 5514ec15e68bSJouni Malinen /** 5515ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 5516ed44a951SPandiyarajan Pitchaimuthu * 5517ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 5518ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 5519ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 5520ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 5521ed44a951SPandiyarajan Pitchaimuthu * 5522ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 5523ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 5524ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 5525ed44a951SPandiyarajan Pitchaimuthu * 5526ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 5527ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 5528ed44a951SPandiyarajan Pitchaimuthu */ 5529ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 5530ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 5531ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 5532ed44a951SPandiyarajan Pitchaimuthu 5533ed44a951SPandiyarajan Pitchaimuthu /** 55342e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 553571bbc994SJohannes Berg * @wdev: wireless device receiving the frame 5536026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 5537804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 55382e161f78SJohannes Berg * @buf: Management frame (header + body) 5539026331c4SJouni Malinen * @len: length of the frame data 554019504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 55412e161f78SJohannes Berg * 55420ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 55430ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 55440ae997dcSYacine Belkadi * 55450ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 55462e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 55472e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 55482e161f78SJohannes Berg * driver is responsible for rejecting the frame. 5549026331c4SJouni Malinen */ 555071bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 5551970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 5552026331c4SJouni Malinen 5553026331c4SJouni Malinen /** 55542e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 555571bbc994SJohannes Berg * @wdev: wireless device receiving the frame 55562e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 55572e161f78SJohannes Berg * @buf: Management frame (header + body) 5558026331c4SJouni Malinen * @len: length of the frame data 5559026331c4SJouni Malinen * @ack: Whether frame was acknowledged 5560026331c4SJouni Malinen * @gfp: context flags 5561026331c4SJouni Malinen * 55622e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 55632e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 5564026331c4SJouni Malinen * transmission attempt. 5565026331c4SJouni Malinen */ 556671bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 5567026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 5568026331c4SJouni Malinen 5569d6dc1a38SJuuso Oikarinen 5570d6dc1a38SJuuso Oikarinen /** 5571d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 5572d6dc1a38SJuuso Oikarinen * @dev: network device 5573d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 5574bee427b8SAndrzej Zaborowski * @rssi_level: new RSSI level value or 0 if not available 5575d6dc1a38SJuuso Oikarinen * @gfp: context flags 5576d6dc1a38SJuuso Oikarinen * 5577d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 5578d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 5579d6dc1a38SJuuso Oikarinen */ 5580d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 5581d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 5582bee427b8SAndrzej Zaborowski s32 rssi_level, gfp_t gfp); 5583d6dc1a38SJuuso Oikarinen 5584c063dbf5SJohannes Berg /** 5585c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 5586c063dbf5SJohannes Berg * @dev: network device 5587c063dbf5SJohannes Berg * @peer: peer's MAC address 5588c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 5589c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 5590c063dbf5SJohannes Berg * threshold (to account for temporary interference) 5591c063dbf5SJohannes Berg * @gfp: context flags 5592c063dbf5SJohannes Berg */ 5593c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 5594c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 5595c063dbf5SJohannes Berg 5596e5497d76SJohannes Berg /** 559784f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 559884f10708SThomas Pedersen * @dev: network device 559984f10708SThomas Pedersen * @peer: peer's MAC address 560084f10708SThomas Pedersen * @num_packets: how many packets were lost 560184f10708SThomas Pedersen * @rate: % of packets which failed transmission 560284f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 560384f10708SThomas Pedersen * @gfp: context flags 560484f10708SThomas Pedersen * 560584f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 560684f10708SThomas Pedersen * given interval is exceeded. 560784f10708SThomas Pedersen */ 560884f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 560984f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 561084f10708SThomas Pedersen 561184f10708SThomas Pedersen /** 561298f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 561398f03342SJohannes Berg * @dev: network device 561498f03342SJohannes Berg * @gfp: context flags 561598f03342SJohannes Berg * 561698f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 561798f03342SJohannes Berg */ 561898f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 561998f03342SJohannes Berg 562098f03342SJohannes Berg /** 56215b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 56225b97f49dSJohannes Berg * @wiphy: the wiphy 56235b97f49dSJohannes Berg * @chandef: chandef for the current channel 56245b97f49dSJohannes Berg * @gfp: context flags 56255b97f49dSJohannes Berg * 56265b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 56275b97f49dSJohannes Berg */ 56285b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 56295b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 56305b97f49dSJohannes Berg 56315b97f49dSJohannes Berg /** 56325b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 56335b97f49dSJohannes Berg * @netdev: network device 56345b97f49dSJohannes Berg * @chandef: chandef for the current channel 56355b97f49dSJohannes Berg * @event: type of event 56365b97f49dSJohannes Berg * @gfp: context flags 56375b97f49dSJohannes Berg * 56385b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 56395b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 56405b97f49dSJohannes Berg * also by full-MAC drivers. 56415b97f49dSJohannes Berg */ 56425b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 56435b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 56445b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 56455b97f49dSJohannes Berg 56465b97f49dSJohannes Berg 56475b97f49dSJohannes Berg /** 5648e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 5649e5497d76SJohannes Berg * @dev: network device 5650e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 5651e5497d76SJohannes Berg * @replay_ctr: new replay counter 5652af71ff85SJohannes Berg * @gfp: allocation flags 5653e5497d76SJohannes Berg */ 5654e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 5655e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 5656e5497d76SJohannes Berg 5657c9df56b4SJouni Malinen /** 5658c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 5659c9df56b4SJouni Malinen * @dev: network device 5660c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 5661c9df56b4SJouni Malinen * @bssid: BSSID of AP 5662c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 5663c9df56b4SJouni Malinen * @gfp: allocation flags 5664c9df56b4SJouni Malinen */ 5665c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 5666c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 5667c9df56b4SJouni Malinen 566828946da7SJohannes Berg /** 566928946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 567028946da7SJohannes Berg * @dev: The device the frame matched to 567128946da7SJohannes Berg * @addr: the transmitter address 567228946da7SJohannes Berg * @gfp: context flags 567328946da7SJohannes Berg * 567428946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 567528946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 567628946da7SJohannes Berg * sender. 56770ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 567828946da7SJohannes Berg * for a reason other than not having a subscription.) 567928946da7SJohannes Berg */ 568028946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 568128946da7SJohannes Berg const u8 *addr, gfp_t gfp); 568228946da7SJohannes Berg 56837f6cf311SJohannes Berg /** 5684b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 5685b92ab5d8SJohannes Berg * @dev: The device the frame matched to 5686b92ab5d8SJohannes Berg * @addr: the transmitter address 5687b92ab5d8SJohannes Berg * @gfp: context flags 5688b92ab5d8SJohannes Berg * 5689b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 5690b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 5691b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 5692b92ab5d8SJohannes Berg * station to avoid event flooding. 56930ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 5694b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 5695b92ab5d8SJohannes Berg */ 5696b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 5697b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 5698b92ab5d8SJohannes Berg 5699b92ab5d8SJohannes Berg /** 57007f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 57017f6cf311SJohannes Berg * @dev: the device the probe was sent on 57027f6cf311SJohannes Berg * @addr: the address of the peer 57037f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 57047f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 57057f6cf311SJohannes Berg * @gfp: allocation flags 57067f6cf311SJohannes Berg */ 57077f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 57087f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 57097f6cf311SJohannes Berg 57105e760230SJohannes Berg /** 57115e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 57125e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 57135e760230SJohannes Berg * @frame: the frame 57145e760230SJohannes Berg * @len: length of the frame 57155e760230SJohannes Berg * @freq: frequency the frame was received on 5716804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 57175e760230SJohannes Berg * 57185e760230SJohannes Berg * Use this function to report to userspace when a beacon was 57195e760230SJohannes Berg * received. It is not useful to call this when there is no 57205e760230SJohannes Berg * netdev that is in AP/GO mode. 57215e760230SJohannes Berg */ 57225e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 57235e760230SJohannes Berg const u8 *frame, size_t len, 572437c73b5fSBen Greear int freq, int sig_dbm); 57255e760230SJohannes Berg 5726d58e7e37SJohannes Berg /** 5727683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 572854858ee5SAlexander Simon * @wiphy: the wiphy 5729683b6d3bSJohannes Berg * @chandef: the channel definition 5730174e0cd2SIlan Peer * @iftype: interface type 5731d58e7e37SJohannes Berg * 57320ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 57330ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 573454858ee5SAlexander Simon */ 5735683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 5736174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 5737174e0cd2SIlan Peer enum nl80211_iftype iftype); 573854858ee5SAlexander Simon 5739923b352fSArik Nemtsov /** 5740923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 5741923b352fSArik Nemtsov * @wiphy: the wiphy 5742923b352fSArik Nemtsov * @chandef: the channel definition 5743923b352fSArik Nemtsov * @iftype: interface type 5744923b352fSArik Nemtsov * 5745923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 5746923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 5747923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 5748923b352fSArik Nemtsov * more permissive conditions. 5749923b352fSArik Nemtsov * 5750923b352fSArik Nemtsov * Requires the RTNL to be held. 5751923b352fSArik Nemtsov */ 5752923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 5753923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 5754923b352fSArik Nemtsov enum nl80211_iftype iftype); 5755923b352fSArik Nemtsov 57568097e149SThomas Pedersen /* 57575314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 57585314526bSThomas Pedersen * @dev: the device which switched channels 5759683b6d3bSJohannes Berg * @chandef: the new channel definition 57605314526bSThomas Pedersen * 5761e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 5762e487eaebSSimon Wunderlich * driver context! 57635314526bSThomas Pedersen */ 5764683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 5765683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 57665314526bSThomas Pedersen 5767f8d7552eSLuciano Coelho /* 5768f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 5769f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 5770f8d7552eSLuciano Coelho * @chandef: the future channel definition 5771f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 5772f8d7552eSLuciano Coelho * 5773f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 5774f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 5775f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 5776f8d7552eSLuciano Coelho */ 5777f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 5778f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 5779f8d7552eSLuciano Coelho u8 count); 5780f8d7552eSLuciano Coelho 57811ce3e82bSJohannes Berg /** 57821ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 57831ce3e82bSJohannes Berg * 57841ce3e82bSJohannes Berg * @operating_class: the operating class to convert 57851ce3e82bSJohannes Berg * @band: band pointer to fill 57861ce3e82bSJohannes Berg * 57871ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 57881ce3e82bSJohannes Berg */ 57891ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 579057fbcce3SJohannes Berg enum nl80211_band *band); 57911ce3e82bSJohannes Berg 5792a38700ddSArik Nemtsov /** 5793a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 5794a38700ddSArik Nemtsov * 5795a38700ddSArik Nemtsov * @chandef: the chandef to convert 5796a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 5797a38700ddSArik Nemtsov * 5798a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 5799a38700ddSArik Nemtsov */ 5800a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 5801a38700ddSArik Nemtsov u8 *op_class); 5802a38700ddSArik Nemtsov 58035314526bSThomas Pedersen /* 58043475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 58053475b094SJouni Malinen * @dev: the device on which the operation is requested 58063475b094SJouni Malinen * @peer: the MAC address of the peer device 58073475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 58083475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 58093475b094SJouni Malinen * @reason_code: the reason code for teardown request 58103475b094SJouni Malinen * @gfp: allocation flags 58113475b094SJouni Malinen * 58123475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 58133475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 58143475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 58153475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 58163475b094SJouni Malinen * based on traffic and signal strength for a peer). 58173475b094SJouni Malinen */ 58183475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 58193475b094SJouni Malinen enum nl80211_tdls_operation oper, 58203475b094SJouni Malinen u16 reason_code, gfp_t gfp); 58213475b094SJouni Malinen 58223475b094SJouni Malinen /* 58238097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 58248097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 58258097e149SThomas Pedersen * 58268097e149SThomas Pedersen * return 0 if MCS index >= 32 58278097e149SThomas Pedersen */ 58288eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 58298097e149SThomas Pedersen 583098104fdeSJohannes Berg /** 583198104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 583298104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 583398104fdeSJohannes Berg * 583498104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 583598104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 583698104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 583798104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 583898104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 583998104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 584098104fdeSJohannes Berg * when the device is unbound from the driver. 584198104fdeSJohannes Berg * 584298104fdeSJohannes Berg * Requires the RTNL to be held. 584398104fdeSJohannes Berg */ 584498104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 584598104fdeSJohannes Berg 58460ee45355SJohannes Berg /** 5847355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 5848355199e0SJouni Malinen * @ies: FT IEs 5849355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 5850355199e0SJouni Malinen * @target_ap: target AP's MAC address 5851355199e0SJouni Malinen * @ric_ies: RIC IE 5852355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 5853355199e0SJouni Malinen */ 5854355199e0SJouni Malinen struct cfg80211_ft_event_params { 5855355199e0SJouni Malinen const u8 *ies; 5856355199e0SJouni Malinen size_t ies_len; 5857355199e0SJouni Malinen const u8 *target_ap; 5858355199e0SJouni Malinen const u8 *ric_ies; 5859355199e0SJouni Malinen size_t ric_ies_len; 5860355199e0SJouni Malinen }; 5861355199e0SJouni Malinen 5862355199e0SJouni Malinen /** 5863355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 5864355199e0SJouni Malinen * @netdev: network device 5865355199e0SJouni Malinen * @ft_event: IE information 5866355199e0SJouni Malinen */ 5867355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 5868355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 5869355199e0SJouni Malinen 5870355199e0SJouni Malinen /** 58710ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 58720ee45355SJohannes Berg * @ies: the input IE buffer 58730ee45355SJohannes Berg * @len: the input length 58740ee45355SJohannes Berg * @attr: the attribute ID to find 58750ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 58760ee45355SJohannes Berg * if the function is only called to get the needed buffer size 58770ee45355SJohannes Berg * @bufsize: size of the output buffer 58780ee45355SJohannes Berg * 58790ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 58800ee45355SJohannes Berg * copies its contents to the given buffer. 58810ee45355SJohannes Berg * 58820ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 58830ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 58840ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 58850ee45355SJohannes Berg */ 5886c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 5887c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 5888c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 58890ee45355SJohannes Berg 5890cd8f7cb4SJohannes Berg /** 589129464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 589229464cccSJohannes Berg * @ies: the IE buffer 589329464cccSJohannes Berg * @ielen: the length of the IE buffer 589429464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 589529464cccSJohannes Berg * the split 589629464cccSJohannes Berg * @n_ids: the size of the element ID array 589729464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 589829464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 589929464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 590029464cccSJohannes Berg * 590129464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 590229464cccSJohannes Berg * variable to point to the location where the buffer should be 590329464cccSJohannes Berg * split. 590429464cccSJohannes Berg * 590529464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 590629464cccSJohannes Berg * has to be guaranteed by the caller! 590729464cccSJohannes Berg * 590829464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 590929464cccSJohannes Berg * correctly, if not the result of using this function will not 591029464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 591129464cccSJohannes Berg * 591229464cccSJohannes Berg * The function returns the offset where the next part of the 591329464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 591429464cccSJohannes Berg * of the buffer should be used. 591529464cccSJohannes Berg */ 591629464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 591729464cccSJohannes Berg const u8 *ids, int n_ids, 591829464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 591929464cccSJohannes Berg size_t offset); 592029464cccSJohannes Berg 592129464cccSJohannes Berg /** 592229464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 592329464cccSJohannes Berg * @ies: the IE buffer 592429464cccSJohannes Berg * @ielen: the length of the IE buffer 592529464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 592629464cccSJohannes Berg * the split 592729464cccSJohannes Berg * @n_ids: the size of the element ID array 592829464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 592929464cccSJohannes Berg * 593029464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 593129464cccSJohannes Berg * variable to point to the location where the buffer should be 593229464cccSJohannes Berg * split. 593329464cccSJohannes Berg * 593429464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 593529464cccSJohannes Berg * has to be guaranteed by the caller! 593629464cccSJohannes Berg * 593729464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 593829464cccSJohannes Berg * correctly, if not the result of using this function will not 593929464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 594029464cccSJohannes Berg * 594129464cccSJohannes Berg * The function returns the offset where the next part of the 594229464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 594329464cccSJohannes Berg * of the buffer should be used. 594429464cccSJohannes Berg */ 59450483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 59460483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 59470483eeacSJohannes Berg { 59480483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 59490483eeacSJohannes Berg } 595029464cccSJohannes Berg 595129464cccSJohannes Berg /** 5952cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 5953cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 5954cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 5955cd8f7cb4SJohannes Berg * @gfp: allocation flags 5956cd8f7cb4SJohannes Berg * 5957cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 5958cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 5959cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 5960cd8f7cb4SJohannes Berg * else caused the wakeup. 5961cd8f7cb4SJohannes Berg */ 5962cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 5963cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 5964cd8f7cb4SJohannes Berg gfp_t gfp); 5965cd8f7cb4SJohannes Berg 59665de17984SArend van Spriel /** 59675de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 59685de17984SArend van Spriel * 59695de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 597003f831a6SRobert P. J. Day * @gfp: allocation flags 59715de17984SArend van Spriel * 59725de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 59735de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 59745de17984SArend van Spriel * by .crit_proto_start() has expired. 59755de17984SArend van Spriel */ 59765de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 59775de17984SArend van Spriel 5978bdfbec2dSIlan Peer /** 5979bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 5980bdfbec2dSIlan Peer * @wiphy: the wiphy 5981bdfbec2dSIlan Peer * 5982bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 5983bdfbec2dSIlan Peer */ 5984bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 5985bdfbec2dSIlan Peer 5986cb2d956dSLuciano Coelho /** 5987cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 5988cb2d956dSLuciano Coelho * 5989cb2d956dSLuciano Coelho * @wiphy: the wiphy 5990e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 5991cb2d956dSLuciano Coelho * 5992cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 5993cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 5994cb2d956dSLuciano Coelho * the interface combinations. 5995cb2d956dSLuciano Coelho */ 5996cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 5997e227300cSPurushottam Kushwaha struct iface_combination_params *params); 5998cb2d956dSLuciano Coelho 599965a124ddSMichal Kazior /** 600065a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 600165a124ddSMichal Kazior * 600265a124ddSMichal Kazior * @wiphy: the wiphy 6003e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 600465a124ddSMichal Kazior * @iter: function to call for each matching combination 600565a124ddSMichal Kazior * @data: pointer to pass to iter function 600665a124ddSMichal Kazior * 600765a124ddSMichal Kazior * This function can be called by the driver to check what possible 600865a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 600965a124ddSMichal Kazior * purposes. 601065a124ddSMichal Kazior */ 601165a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 6012e227300cSPurushottam Kushwaha struct iface_combination_params *params, 601365a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 601465a124ddSMichal Kazior void *data), 601565a124ddSMichal Kazior void *data); 601665a124ddSMichal Kazior 6017f04c2203SMichal Kazior /* 6018f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 6019f04c2203SMichal Kazior * 6020f04c2203SMichal Kazior * @wiphy: the wiphy 6021f04c2203SMichal Kazior * @wdev: wireless device 6022f04c2203SMichal Kazior * @gfp: context flags 6023f04c2203SMichal Kazior * 6024f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 6025f04c2203SMichal Kazior * disconnected. 6026f04c2203SMichal Kazior * 6027f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 6028f04c2203SMichal Kazior */ 6029f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 6030f04c2203SMichal Kazior gfp_t gfp); 6031f04c2203SMichal Kazior 6032f6837ba8SJohannes Berg /** 6033f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 6034f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 6035f6837ba8SJohannes Berg * 6036f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 6037f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 6038f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 6039f6837ba8SJohannes Berg * that really can't be recovered in any other way. 6040f6837ba8SJohannes Berg * 6041f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 6042f6837ba8SJohannes Berg * the driver while the function is running. 6043f6837ba8SJohannes Berg */ 6044f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 6045f6837ba8SJohannes Berg 6046d75bb06bSGautam Kumar Shukla /** 6047d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 6048d75bb06bSGautam Kumar Shukla * 6049d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 6050d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 6051d75bb06bSGautam Kumar Shukla * 6052d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 6053d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 6054d75bb06bSGautam Kumar Shukla */ 6055d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 6056d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 6057d75bb06bSGautam Kumar Shukla { 6058d75bb06bSGautam Kumar Shukla u8 *ft_byte; 6059d75bb06bSGautam Kumar Shukla 6060d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 6061d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 6062d75bb06bSGautam Kumar Shukla } 6063d75bb06bSGautam Kumar Shukla 6064d75bb06bSGautam Kumar Shukla /** 6065d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 6066d75bb06bSGautam Kumar Shukla * 6067d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 6068d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 6069d75bb06bSGautam Kumar Shukla * 6070d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 6071d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 6072d75bb06bSGautam Kumar Shukla */ 6073d75bb06bSGautam Kumar Shukla static inline bool 6074d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 6075d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 6076d75bb06bSGautam Kumar Shukla { 6077d75bb06bSGautam Kumar Shukla u8 ft_byte; 6078d75bb06bSGautam Kumar Shukla 6079d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 6080d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 6081d75bb06bSGautam Kumar Shukla } 6082b7ffbd7eSJohannes Berg 6083a442b761SAyala Beker /** 6084a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 6085a442b761SAyala Beker * @f: NAN function that should be freed 6086a442b761SAyala Beker * 6087a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 6088a442b761SAyala Beker */ 6089a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 6090a442b761SAyala Beker 609150bcd31dSAyala Beker /** 609250bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 609350bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 609450bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 609550bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 609650bcd31dSAyala Beker * result. 609750bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 609850bcd31dSAyala Beker * @inst_id: the local instance id 609950bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 610050bcd31dSAyala Beker * @addr: the MAC address of the peer 610150bcd31dSAyala Beker * @info_len: the length of the &info 610250bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 610350bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 610450bcd31dSAyala Beker */ 610550bcd31dSAyala Beker struct cfg80211_nan_match_params { 610650bcd31dSAyala Beker enum nl80211_nan_function_type type; 610750bcd31dSAyala Beker u8 inst_id; 610850bcd31dSAyala Beker u8 peer_inst_id; 610950bcd31dSAyala Beker const u8 *addr; 611050bcd31dSAyala Beker u8 info_len; 611150bcd31dSAyala Beker const u8 *info; 611250bcd31dSAyala Beker u64 cookie; 611350bcd31dSAyala Beker }; 611450bcd31dSAyala Beker 611550bcd31dSAyala Beker /** 611650bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 611750bcd31dSAyala Beker * @wdev: the wireless device reporting the match 611850bcd31dSAyala Beker * @match: match notification parameters 611950bcd31dSAyala Beker * @gfp: allocation flags 612050bcd31dSAyala Beker * 612150bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 612250bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 612350bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 612450bcd31dSAyala Beker */ 612550bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 612650bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 612750bcd31dSAyala Beker 6128368e5a7bSAyala Beker /** 6129368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 6130368e5a7bSAyala Beker * 6131368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 6132368e5a7bSAyala Beker * @inst_id: the local instance id 6133368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 6134368e5a7bSAyala Beker * @cookie: unique NAN function identifier 6135368e5a7bSAyala Beker * @gfp: allocation flags 6136368e5a7bSAyala Beker * 6137368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 6138368e5a7bSAyala Beker */ 6139368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 6140368e5a7bSAyala Beker u8 inst_id, 6141368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 6142368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 6143368e5a7bSAyala Beker 6144b7ffbd7eSJohannes Berg /* ethtool helper */ 6145b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 6146b7ffbd7eSJohannes Berg 6147e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 6148e1db74fcSJoe Perches 6149e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 6150e1db74fcSJoe Perches 6151e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 61529c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 6153e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 61549c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 6155e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 61569c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 6157e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 61589c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 6159e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 61609c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 6161e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 61629c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 6163e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 61649c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 6165e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 61669c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 6167073730d7SJoe Perches 61689c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 6169e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 61709c376639SJoe Perches 6171e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 61729c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 6173e1db74fcSJoe Perches 6174e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 6175e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 6176e1db74fcSJoe Perches #else 6177e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 6178e1db74fcSJoe Perches ({ \ 6179e1db74fcSJoe Perches if (0) \ 6180e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 6181e1db74fcSJoe Perches 0; \ 6182e1db74fcSJoe Perches }) 6183e1db74fcSJoe Perches #endif 6184e1db74fcSJoe Perches 6185e1db74fcSJoe Perches /* 6186e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 6187e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 6188e1db74fcSJoe Perches * file/line information and a backtrace. 6189e1db74fcSJoe Perches */ 6190e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 6191e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 6192e1db74fcSJoe Perches 6193704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 6194