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 83b06d277SAvraham Stern * Copyright 2015 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 314d3236553SJohannes Berg /* 315d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 316704232c2SJohannes Berg */ 317704232c2SJohannes Berg 3182ec600d6SLuis Carlos Cobo /** 319d70e9693SJohannes Berg * DOC: Actions and configuration 320d70e9693SJohannes Berg * 321d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 322d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 323d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 324d70e9693SJohannes Berg * operations use are described separately. 325d70e9693SJohannes Berg * 326d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 327d70e9693SJohannes Berg * information via some functions that drivers need to call. 328d70e9693SJohannes Berg * 329d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 330d70e9693SJohannes Berg * in a separate chapter. 331d70e9693SJohannes Berg */ 332d70e9693SJohannes Berg 333c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 334c6e6a0c8SAviya Erenfeld WLAN_USER_POSITION_LEN) 335c6e6a0c8SAviya Erenfeld 336d70e9693SJohannes Berg /** 3372ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 3388b787643SFelix Fietkau * @use_4addr: use 4-address frames 339e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 340e8f479b1SBen Greear * If this parameter is set to zero address the driver may 341e8f479b1SBen Greear * determine the address as needed. 342e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 343e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 344e8f479b1SBen Greear ** only p2p devices with specified MAC. 345c6e6a0c8SAviya Erenfeld * @vht_mumimo_groups: MU-MIMO groupID. used for monitoring only 346c6e6a0c8SAviya Erenfeld * packets belonging to that MU-MIMO groupID. 3472ec600d6SLuis Carlos Cobo */ 3482ec600d6SLuis Carlos Cobo struct vif_params { 3498b787643SFelix Fietkau int use_4addr; 3501c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 351c6e6a0c8SAviya Erenfeld u8 vht_mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN]; 3522ec600d6SLuis Carlos Cobo }; 3532ec600d6SLuis Carlos Cobo 35441ade00fSJohannes Berg /** 35541ade00fSJohannes Berg * struct key_params - key information 35641ade00fSJohannes Berg * 35741ade00fSJohannes Berg * Information about a key 35841ade00fSJohannes Berg * 35941ade00fSJohannes Berg * @key: key material 36041ade00fSJohannes Berg * @key_len: length of key material 36141ade00fSJohannes Berg * @cipher: cipher suite selector 36241ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 36341ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 36441ade00fSJohannes Berg * length given by @seq_len. 365abe37c4bSJohannes Berg * @seq_len: length of @seq. 36641ade00fSJohannes Berg */ 36741ade00fSJohannes Berg struct key_params { 368c1e5f471SJohannes Berg const u8 *key; 369c1e5f471SJohannes Berg const u8 *seq; 37041ade00fSJohannes Berg int key_len; 37141ade00fSJohannes Berg int seq_len; 37241ade00fSJohannes Berg u32 cipher; 37341ade00fSJohannes Berg }; 37441ade00fSJohannes Berg 375ed1b6cc7SJohannes Berg /** 376683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 377683b6d3bSJohannes Berg * @chan: the (control) channel 3783d9d1d66SJohannes Berg * @width: channel width 3793d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 3803d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 3813d9d1d66SJohannes Berg * (only with 80+80 MHz) 382683b6d3bSJohannes Berg */ 383683b6d3bSJohannes Berg struct cfg80211_chan_def { 384683b6d3bSJohannes Berg struct ieee80211_channel *chan; 3853d9d1d66SJohannes Berg enum nl80211_chan_width width; 3863d9d1d66SJohannes Berg u32 center_freq1; 3873d9d1d66SJohannes Berg u32 center_freq2; 388683b6d3bSJohannes Berg }; 389683b6d3bSJohannes Berg 3903d9d1d66SJohannes Berg /** 3913d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 3923d9d1d66SJohannes Berg * @chandef: the channel definition 3933d9d1d66SJohannes Berg * 3940ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 3953d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 3963d9d1d66SJohannes Berg */ 397683b6d3bSJohannes Berg static inline enum nl80211_channel_type 398683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 399683b6d3bSJohannes Berg { 4003d9d1d66SJohannes Berg switch (chandef->width) { 4013d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 4023d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 4033d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 4043d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 4053d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 4063d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 4073d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 4083d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 4093d9d1d66SJohannes Berg default: 4103d9d1d66SJohannes Berg WARN_ON(1); 4113d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 412683b6d3bSJohannes Berg } 4133d9d1d66SJohannes Berg } 4143d9d1d66SJohannes Berg 4153d9d1d66SJohannes Berg /** 4163d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 4173d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 4183d9d1d66SJohannes Berg * @channel: the control channel 4193d9d1d66SJohannes Berg * @chantype: the channel type 4203d9d1d66SJohannes Berg * 4213d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 4223d9d1d66SJohannes Berg */ 4233d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 4243d9d1d66SJohannes Berg struct ieee80211_channel *channel, 4253d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 4263d9d1d66SJohannes Berg 4273d9d1d66SJohannes Berg /** 4283d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 4293d9d1d66SJohannes Berg * @chandef1: first channel definition 4303d9d1d66SJohannes Berg * @chandef2: second channel definition 4313d9d1d66SJohannes Berg * 4320ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 4333d9d1d66SJohannes Berg * identical, %false otherwise. 4343d9d1d66SJohannes Berg */ 4353d9d1d66SJohannes Berg static inline bool 4363d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 4373d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 4383d9d1d66SJohannes Berg { 4393d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 4403d9d1d66SJohannes Berg chandef1->width == chandef2->width && 4413d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 4423d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 4433d9d1d66SJohannes Berg } 4443d9d1d66SJohannes Berg 4453d9d1d66SJohannes Berg /** 4463d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 4473d9d1d66SJohannes Berg * @chandef1: first channel definition 4483d9d1d66SJohannes Berg * @chandef2: second channel definition 4493d9d1d66SJohannes Berg * 4500ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 4513d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 4523d9d1d66SJohannes Berg */ 4533d9d1d66SJohannes Berg const struct cfg80211_chan_def * 4543d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 4553d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 456683b6d3bSJohannes Berg 457683b6d3bSJohannes Berg /** 4589f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 4599f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4600ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 4619f5e8f6eSJohannes Berg */ 4629f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 4639f5e8f6eSJohannes Berg 4649f5e8f6eSJohannes Berg /** 4659f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 4669f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 4679f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4680ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 4690ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 4709f5e8f6eSJohannes Berg */ 4719f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 4729f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 4739f5e8f6eSJohannes Berg u32 prohibited_flags); 4749f5e8f6eSJohannes Berg 4759f5e8f6eSJohannes Berg /** 476774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 477774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 478774f0734SSimon Wunderlich * @chandef: the channel definition to check 4792beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 4802beb6dabSLuciano Coelho * Returns: 4812beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 482774f0734SSimon Wunderlich */ 483774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 4842beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 485c3d62036SLuciano Coelho enum nl80211_iftype iftype); 486774f0734SSimon Wunderlich 487774f0734SSimon Wunderlich /** 48830e74732SSimon Wunderlich * ieee80211_chandef_rate_flags - returns rate flags for a channel 48930e74732SSimon Wunderlich * 49030e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 49130e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 49230e74732SSimon Wunderlich * 49330e74732SSimon Wunderlich * @chandef: channel definition for the channel 49430e74732SSimon Wunderlich * 49530e74732SSimon Wunderlich * Returns: rate flags which apply for this channel 49630e74732SSimon Wunderlich */ 49730e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 49830e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 49930e74732SSimon Wunderlich { 50030e74732SSimon Wunderlich switch (chandef->width) { 50130e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 50230e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 50330e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 50430e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 50530e74732SSimon Wunderlich default: 50630e74732SSimon Wunderlich break; 50730e74732SSimon Wunderlich } 50830e74732SSimon Wunderlich return 0; 50930e74732SSimon Wunderlich } 51030e74732SSimon Wunderlich 51130e74732SSimon Wunderlich /** 5120430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 5130430c883SSimon Wunderlich * 5140430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 5150430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 5160430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 5170430c883SSimon Wunderlich * 5180430c883SSimon Wunderlich * @chandef: channel definition for the channel 5190430c883SSimon Wunderlich * 5200430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 5210430c883SSimon Wunderlich */ 5220430c883SSimon Wunderlich static inline int 5230430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 5240430c883SSimon Wunderlich { 5250430c883SSimon Wunderlich switch (chandef->width) { 5260430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 5270430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 5280430c883SSimon Wunderlich chandef->chan->max_power); 5290430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 5300430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 5310430c883SSimon Wunderlich chandef->chan->max_power); 5320430c883SSimon Wunderlich default: 5330430c883SSimon Wunderlich break; 5340430c883SSimon Wunderlich } 5350430c883SSimon Wunderlich return chandef->chan->max_power; 5360430c883SSimon Wunderlich } 5370430c883SSimon Wunderlich 5380430c883SSimon Wunderlich /** 53961fa713cSHolger Schurig * enum survey_info_flags - survey information flags 54061fa713cSHolger Schurig * 541abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 54217e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 5434ed20bebSJohannes Berg * @SURVEY_INFO_TIME: active time (in ms) was filled in 5444ed20bebSJohannes Berg * @SURVEY_INFO_TIME_BUSY: busy time was filled in 5454ed20bebSJohannes Berg * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 5464ed20bebSJohannes Berg * @SURVEY_INFO_TIME_RX: receive time was filled in 5474ed20bebSJohannes Berg * @SURVEY_INFO_TIME_TX: transmit time was filled in 548052536abSJohannes Berg * @SURVEY_INFO_TIME_SCAN: scan time was filled in 549abe37c4bSJohannes Berg * 55061fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 55161fa713cSHolger Schurig * it has filled in during the get_survey(). 55261fa713cSHolger Schurig */ 55361fa713cSHolger Schurig enum survey_info_flags { 5544ed20bebSJohannes Berg SURVEY_INFO_NOISE_DBM = BIT(0), 5554ed20bebSJohannes Berg SURVEY_INFO_IN_USE = BIT(1), 5564ed20bebSJohannes Berg SURVEY_INFO_TIME = BIT(2), 5574ed20bebSJohannes Berg SURVEY_INFO_TIME_BUSY = BIT(3), 5584ed20bebSJohannes Berg SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 5594ed20bebSJohannes Berg SURVEY_INFO_TIME_RX = BIT(5), 5604ed20bebSJohannes Berg SURVEY_INFO_TIME_TX = BIT(6), 561052536abSJohannes Berg SURVEY_INFO_TIME_SCAN = BIT(7), 56261fa713cSHolger Schurig }; 56361fa713cSHolger Schurig 56461fa713cSHolger Schurig /** 56561fa713cSHolger Schurig * struct survey_info - channel survey response 56661fa713cSHolger Schurig * 56711f78ac3SJohannes Berg * @channel: the channel this survey record reports, may be %NULL for a single 56811f78ac3SJohannes Berg * record to report global statistics 56961fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 57061fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 57161fa713cSHolger Schurig * optional 5724ed20bebSJohannes Berg * @time: amount of time in ms the radio was turn on (on the channel) 5734ed20bebSJohannes Berg * @time_busy: amount of time the primary channel was sensed busy 5744ed20bebSJohannes Berg * @time_ext_busy: amount of time the extension channel was sensed busy 5754ed20bebSJohannes Berg * @time_rx: amount of time the radio spent receiving data 5764ed20bebSJohannes Berg * @time_tx: amount of time the radio spent transmitting data 577052536abSJohannes Berg * @time_scan: amount of time the radio spent for scanning 57861fa713cSHolger Schurig * 579abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 580abe37c4bSJohannes Berg * 58161fa713cSHolger Schurig * This structure can later be expanded with things like 58261fa713cSHolger Schurig * channel duty cycle etc. 58361fa713cSHolger Schurig */ 58461fa713cSHolger Schurig struct survey_info { 58561fa713cSHolger Schurig struct ieee80211_channel *channel; 5864ed20bebSJohannes Berg u64 time; 5874ed20bebSJohannes Berg u64 time_busy; 5884ed20bebSJohannes Berg u64 time_ext_busy; 5894ed20bebSJohannes Berg u64 time_rx; 5904ed20bebSJohannes Berg u64 time_tx; 591052536abSJohannes Berg u64 time_scan; 59261fa713cSHolger Schurig u32 filled; 59361fa713cSHolger Schurig s8 noise; 59461fa713cSHolger Schurig }; 59561fa713cSHolger Schurig 59661fa713cSHolger Schurig /** 5975fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 5985fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 5995fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 6005fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 6015fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 6025fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 6035fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 6045fb628e9SJouni Malinen * @akm_suites: AKM suites 6055fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 6065fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 6075fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 6085fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 6095fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 6105fb628e9SJouni Malinen * allowed through even on unauthorized ports 6115fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 6125fb628e9SJouni Malinen * protocol frames. 6135fb628e9SJouni Malinen */ 6145fb628e9SJouni Malinen struct cfg80211_crypto_settings { 6155fb628e9SJouni Malinen u32 wpa_versions; 6165fb628e9SJouni Malinen u32 cipher_group; 6175fb628e9SJouni Malinen int n_ciphers_pairwise; 6185fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 6195fb628e9SJouni Malinen int n_akm_suites; 6205fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 6215fb628e9SJouni Malinen bool control_port; 6225fb628e9SJouni Malinen __be16 control_port_ethertype; 6235fb628e9SJouni Malinen bool control_port_no_encrypt; 6245fb628e9SJouni Malinen }; 6255fb628e9SJouni Malinen 6265fb628e9SJouni Malinen /** 6278860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 628ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 629ed1b6cc7SJohannes Berg * or %NULL if not changed 630ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 631ed1b6cc7SJohannes Berg * or %NULL if not changed 632ed1b6cc7SJohannes Berg * @head_len: length of @head 633ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6349946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6359946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6369946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6379946ecfbSJouni Malinen * frames or %NULL 6389946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6399946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6409946ecfbSJouni Malinen * Response frames or %NULL 6419946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 64200f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 64300f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 644ed1b6cc7SJohannes Berg */ 6458860020eSJohannes Berg struct cfg80211_beacon_data { 6468860020eSJohannes Berg const u8 *head, *tail; 6478860020eSJohannes Berg const u8 *beacon_ies; 6488860020eSJohannes Berg const u8 *proberesp_ies; 6498860020eSJohannes Berg const u8 *assocresp_ies; 6508860020eSJohannes Berg const u8 *probe_resp; 6518860020eSJohannes Berg 6528860020eSJohannes Berg size_t head_len, tail_len; 6538860020eSJohannes Berg size_t beacon_ies_len; 6548860020eSJohannes Berg size_t proberesp_ies_len; 6558860020eSJohannes Berg size_t assocresp_ies_len; 6568860020eSJohannes Berg size_t probe_resp_len; 6578860020eSJohannes Berg }; 6588860020eSJohannes Berg 6596d45a74bSVasanthakumar Thiagarajan struct mac_address { 6606d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 6616d45a74bSVasanthakumar Thiagarajan }; 6626d45a74bSVasanthakumar Thiagarajan 6638860020eSJohannes Berg /** 66477765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 66577765eafSVasanthakumar Thiagarajan * 66677765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 667077f897aSJohannes Berg * entry specified by mac_addr 66877765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 66977765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 67077765eafSVasanthakumar Thiagarajan */ 67177765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 67277765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 67377765eafSVasanthakumar Thiagarajan int n_acl_entries; 67477765eafSVasanthakumar Thiagarajan 67577765eafSVasanthakumar Thiagarajan /* Keep it last */ 67677765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 67777765eafSVasanthakumar Thiagarajan }; 67877765eafSVasanthakumar Thiagarajan 6798860020eSJohannes Berg /** 6808860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 6818860020eSJohannes Berg * 6828860020eSJohannes Berg * Used to configure an AP interface. 6838860020eSJohannes Berg * 684683b6d3bSJohannes Berg * @chandef: defines the channel to use 6858860020eSJohannes Berg * @beacon: beacon data 6868860020eSJohannes Berg * @beacon_interval: beacon interval 6878860020eSJohannes Berg * @dtim_period: DTIM period 6888860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 6898860020eSJohannes Berg * user space) 6908860020eSJohannes Berg * @ssid_len: length of @ssid 6918860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 6928860020eSJohannes Berg * @crypto: crypto settings 6938860020eSJohannes Berg * @privacy: the BSS uses privacy 6948860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 69518998c38SEliad Peller * @smps_mode: SMPS mode 6961b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 69753cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 69853cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 69977765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 70077765eafSVasanthakumar Thiagarajan * MAC address based access control 70134d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 70234d50519SLior David * networks. 7038860020eSJohannes Berg */ 7048860020eSJohannes Berg struct cfg80211_ap_settings { 705683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 706aa430da4SJohannes Berg 7078860020eSJohannes Berg struct cfg80211_beacon_data beacon; 7088860020eSJohannes Berg 7098860020eSJohannes Berg int beacon_interval, dtim_period; 71032e9de84SJouni Malinen const u8 *ssid; 71132e9de84SJouni Malinen size_t ssid_len; 71232e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 7135fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 7145fb628e9SJouni Malinen bool privacy; 7155fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 71618998c38SEliad Peller enum nl80211_smps_mode smps_mode; 7171b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 71853cabad7SJohannes Berg u8 p2p_ctwindow; 71953cabad7SJohannes Berg bool p2p_opp_ps; 72077765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 72134d50519SLior David bool pbss; 722ed1b6cc7SJohannes Berg }; 723ed1b6cc7SJohannes Berg 7245727ef1bSJohannes Berg /** 72516ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 72616ef1fe2SSimon Wunderlich * 72716ef1fe2SSimon Wunderlich * Used for channel switch 72816ef1fe2SSimon Wunderlich * 72916ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 73016ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7319a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7329a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7339a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7349a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 73516ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 73616ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 73716ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 73816ef1fe2SSimon Wunderlich * @count: number of beacons until switch 73916ef1fe2SSimon Wunderlich */ 74016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 74116ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 74216ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 7439a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 7449a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 7459a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 7469a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 74716ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 74816ef1fe2SSimon Wunderlich bool radar_required; 74916ef1fe2SSimon Wunderlich bool block_tx; 75016ef1fe2SSimon Wunderlich u8 count; 75116ef1fe2SSimon Wunderlich }; 75216ef1fe2SSimon Wunderlich 75316ef1fe2SSimon Wunderlich /** 7543b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 7553b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 7569d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 757f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 7583b9ce80cSJohannes Berg * 7593b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 7603b9ce80cSJohannes Berg * for those that don't these flags will are used. 7613b9ce80cSJohannes Berg */ 7623b9ce80cSJohannes Berg enum station_parameters_apply_mask { 7633b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 7649d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 765f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 7663b9ce80cSJohannes Berg }; 7673b9ce80cSJohannes Berg 7683b9ce80cSJohannes Berg /** 7695727ef1bSJohannes Berg * struct station_parameters - station parameters 7705727ef1bSJohannes Berg * 7715727ef1bSJohannes Berg * Used to change and create a new station. 7725727ef1bSJohannes Berg * 7735727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 7745727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 7755727ef1bSJohannes Berg * (or NULL for no change) 7765727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 777eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 778eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 779eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 780eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 7815727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 7825727ef1bSJohannes Berg * @aid: AID or zero for no change 7837d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 784abe37c4bSJohannes Berg * @plink_action: plink action to take 7859c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 786abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 787f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 788910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 789910868dbSEliad Peller * as the AC bitmap in the QoS info field 790910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 791910868dbSEliad Peller * QoS info field (but already shifted down) 792c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 793c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 794c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 7953b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 7963b1c5a53SMarco Porsch * to unknown) 7979d62a986SJouni Malinen * @capability: station capability 7989d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 7999d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 800c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 801c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 802c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 803c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 80460f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 80560f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 80617b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 8075727ef1bSJohannes Berg */ 8085727ef1bSJohannes Berg struct station_parameters { 8092c1aabf3SJohannes Berg const u8 *supported_rates; 8105727ef1bSJohannes Berg struct net_device *vlan; 811eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 8123b9ce80cSJohannes Berg u32 sta_modify_mask; 8135727ef1bSJohannes Berg int listen_interval; 8145727ef1bSJohannes Berg u16 aid; 8157d27a0baSMasashi Honma u16 peer_aid; 8165727ef1bSJohannes Berg u8 supported_rates_len; 8172ec600d6SLuis Carlos Cobo u8 plink_action; 8189c3990aaSJavier Cardona u8 plink_state; 8192c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 8202c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 821c75786c9SEliad Peller u8 uapsd_queues; 822c75786c9SEliad Peller u8 max_sp; 8233b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 8249d62a986SJouni Malinen u16 capability; 8252c1aabf3SJohannes Berg const u8 *ext_capab; 8269d62a986SJouni Malinen u8 ext_capab_len; 827c01fc9adSSunil Dutt const u8 *supported_channels; 828c01fc9adSSunil Dutt u8 supported_channels_len; 829c01fc9adSSunil Dutt const u8 *supported_oper_classes; 830c01fc9adSSunil Dutt u8 supported_oper_classes_len; 83160f4a7b1SMarek Kwaczynski u8 opmode_notif; 83260f4a7b1SMarek Kwaczynski bool opmode_notif_used; 83317b94247SAyala Beker int support_p2p_ps; 8345727ef1bSJohannes Berg }; 8355727ef1bSJohannes Berg 836fd5b74dcSJohannes Berg /** 83789c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 83889c771e5SJouni Malinen * 83989c771e5SJouni Malinen * Used to delete a station entry (or all stations). 84089c771e5SJouni Malinen * 84189c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 84298856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 84398856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 84498856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 84589c771e5SJouni Malinen */ 84689c771e5SJouni Malinen struct station_del_parameters { 84789c771e5SJouni Malinen const u8 *mac; 84898856866SJouni Malinen u8 subtype; 84998856866SJouni Malinen u16 reason_code; 85089c771e5SJouni Malinen }; 85189c771e5SJouni Malinen 85289c771e5SJouni Malinen /** 85377ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 85477ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 85547edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 85647edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 85777ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 85877ee7c89SJohannes Berg * the AP MLME in the device 85977ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 86077ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 86177ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 86277ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 86377ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 86477ee7c89SJohannes Berg * supported/used) 86577ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 86677ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 867eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 868eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 86977ee7c89SJohannes Berg */ 87077ee7c89SJohannes Berg enum cfg80211_station_type { 87177ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 87247edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 87377ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 87477ee7c89SJohannes Berg CFG80211_STA_AP_STA, 87577ee7c89SJohannes Berg CFG80211_STA_IBSS, 87677ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 87777ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 878eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 879eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 88077ee7c89SJohannes Berg }; 88177ee7c89SJohannes Berg 88277ee7c89SJohannes Berg /** 88377ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 88477ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 88577ee7c89SJohannes Berg * @params: the new parameters for a station 88677ee7c89SJohannes Berg * @statype: the type of station being modified 88777ee7c89SJohannes Berg * 88877ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 88977ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 89077ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 89177ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 89277ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 89377ee7c89SJohannes Berg */ 89477ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 89577ee7c89SJohannes Berg struct station_parameters *params, 89677ee7c89SJohannes Berg enum cfg80211_station_type statype); 89777ee7c89SJohannes Berg 89877ee7c89SJohannes Berg /** 899420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 900420e7fabSHenning Rogge * 901420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 902420e7fabSHenning Rogge * type for 802.11n transmissions. 903420e7fabSHenning Rogge * 904db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 905db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 906420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 907db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 908420e7fabSHenning Rogge */ 909420e7fabSHenning Rogge enum rate_info_flags { 910db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 911db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 912b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 913b51f3beeSJohannes Berg RATE_INFO_FLAGS_60G = BIT(3), 914b51f3beeSJohannes Berg }; 915b51f3beeSJohannes Berg 916b51f3beeSJohannes Berg /** 917b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 918b51f3beeSJohannes Berg * 919b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 920b51f3beeSJohannes Berg * 921b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 922b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 923b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 924b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 925b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 926b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 927b51f3beeSJohannes Berg */ 928b51f3beeSJohannes Berg enum rate_info_bw { 929b51f3beeSJohannes Berg RATE_INFO_BW_5, 930b51f3beeSJohannes Berg RATE_INFO_BW_10, 931b51f3beeSJohannes Berg RATE_INFO_BW_20, 932b51f3beeSJohannes Berg RATE_INFO_BW_40, 933b51f3beeSJohannes Berg RATE_INFO_BW_80, 934b51f3beeSJohannes Berg RATE_INFO_BW_160, 935420e7fabSHenning Rogge }; 936420e7fabSHenning Rogge 937420e7fabSHenning Rogge /** 938420e7fabSHenning Rogge * struct rate_info - bitrate information 939420e7fabSHenning Rogge * 940420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 941420e7fabSHenning Rogge * 942420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 943420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 944420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 945db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 946b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 947420e7fabSHenning Rogge */ 948420e7fabSHenning Rogge struct rate_info { 949420e7fabSHenning Rogge u8 flags; 950420e7fabSHenning Rogge u8 mcs; 951420e7fabSHenning Rogge u16 legacy; 952db9c64cfSJohannes Berg u8 nss; 953b51f3beeSJohannes Berg u8 bw; 954fd5b74dcSJohannes Berg }; 955fd5b74dcSJohannes Berg 956fd5b74dcSJohannes Berg /** 957f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 958f4263c98SPaul Stewart * 959f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 960f4263c98SPaul Stewart * type for 802.11n transmissions. 961f4263c98SPaul Stewart * 962f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 963f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 964f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 965f4263c98SPaul Stewart */ 966f4263c98SPaul Stewart enum bss_param_flags { 967f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 968f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 969f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 970f4263c98SPaul Stewart }; 971f4263c98SPaul Stewart 972f4263c98SPaul Stewart /** 973f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 974f4263c98SPaul Stewart * 975f4263c98SPaul Stewart * Information about the currently associated BSS 976f4263c98SPaul Stewart * 977f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 978f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 979f4263c98SPaul Stewart * @beacon_interval: beacon interval 980f4263c98SPaul Stewart */ 981f4263c98SPaul Stewart struct sta_bss_parameters { 982f4263c98SPaul Stewart u8 flags; 983f4263c98SPaul Stewart u8 dtim_period; 984f4263c98SPaul Stewart u16 beacon_interval; 985f4263c98SPaul Stewart }; 986f4263c98SPaul Stewart 9876de39808SJohannes Berg /** 9886de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 9896de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 9906de39808SJohannes Berg * indicate the relevant values in this struct are filled 9916de39808SJohannes Berg * @rx_msdu: number of received MSDUs 9926de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 9936de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 9946de39808SJohannes Berg * transmitted MSDUs 9956de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 9966de39808SJohannes Berg */ 9976de39808SJohannes Berg struct cfg80211_tid_stats { 9986de39808SJohannes Berg u32 filled; 9996de39808SJohannes Berg u64 rx_msdu; 10006de39808SJohannes Berg u64 tx_msdu; 10016de39808SJohannes Berg u64 tx_msdu_retries; 10026de39808SJohannes Berg u64 tx_msdu_failed; 10036de39808SJohannes Berg }; 10046de39808SJohannes Berg 1005119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1006119363c7SFelix Fietkau 1007f4263c98SPaul Stewart /** 10082ec600d6SLuis Carlos Cobo * struct station_info - station information 1009fd5b74dcSJohannes Berg * 10102ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1011fd5b74dcSJohannes Berg * 1012319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1013319090bfSJohannes Berg * indicate the relevant values in this struct for them 1014ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1015fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 10168d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 10178d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 10182ec600d6SLuis Carlos Cobo * @llid: mesh local link id 10192ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 10202ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 102173c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 102273c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 102373c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 102473c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1025119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1026119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1027119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1028858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1029858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 10308d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 10318d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 10328d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 10338d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 10345a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 10351ba01458SRandy Dunlap * @bss_param: current BSS parameters 1036f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1037f5ea9120SJohannes Berg * This number should increase every time the list of stations 1038f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1039f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 104050d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 104150d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 104250d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 104350d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 104450d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1045c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1046a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1047d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 10483b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 10493b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 10503b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1051867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1052867d849fSAntonio Quartulli * towards this station. 1053a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1054a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1055a76b1942SJohannes Berg * from this peer 1056739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 10576de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 10586de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1059fd5b74dcSJohannes Berg */ 10602ec600d6SLuis Carlos Cobo struct station_info { 1061739960f1SMohammed Shafi Shajakhan u64 filled; 1062ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1063fd5b74dcSJohannes Berg u32 inactive_time; 106442745e03SVladimir Kondratiev u64 rx_bytes; 106542745e03SVladimir Kondratiev u64 tx_bytes; 10662ec600d6SLuis Carlos Cobo u16 llid; 10672ec600d6SLuis Carlos Cobo u16 plid; 10682ec600d6SLuis Carlos Cobo u8 plink_state; 1069420e7fabSHenning Rogge s8 signal; 1070541a45a1SBruno Randolf s8 signal_avg; 1071119363c7SFelix Fietkau 1072119363c7SFelix Fietkau u8 chains; 1073119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1074119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1075119363c7SFelix Fietkau 1076420e7fabSHenning Rogge struct rate_info txrate; 1077c8dcfd8aSFelix Fietkau struct rate_info rxrate; 107898c8a60aSJouni Malinen u32 rx_packets; 107998c8a60aSJouni Malinen u32 tx_packets; 1080b206b4efSBruno Randolf u32 tx_retries; 1081b206b4efSBruno Randolf u32 tx_failed; 10825a5c731aSBen Greear u32 rx_dropped_misc; 1083f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1084bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1085f5ea9120SJohannes Berg 1086f5ea9120SJohannes Berg int generation; 108750d3dfb7SJouni Malinen 108850d3dfb7SJouni Malinen const u8 *assoc_req_ies; 108950d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1090f612cedfSJouni Malinen 1091a85e1d55SPaul Stewart u32 beacon_loss_count; 1092d299a1f2SJavier Cardona s64 t_offset; 10933b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 10943b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 10953b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1096a85e1d55SPaul Stewart 1097867d849fSAntonio Quartulli u32 expected_throughput; 1098a76b1942SJohannes Berg 1099a76b1942SJohannes Berg u64 rx_beacon; 1100739960f1SMohammed Shafi Shajakhan u64 rx_duration; 1101a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 11026de39808SJohannes Berg struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1103fd5b74dcSJohannes Berg }; 1104fd5b74dcSJohannes Berg 110566f7ac50SMichael Wu /** 11067406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11077406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11087406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11097406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11107406353dSAntonio Quartulli * 11117406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 11127406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 11137406353dSAntonio Quartulli * considered undefined. 11147406353dSAntonio Quartulli */ 11157406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 11167406353dSAntonio Quartulli struct station_info *sinfo); 11177406353dSAntonio Quartulli 11187406353dSAntonio Quartulli /** 111966f7ac50SMichael Wu * enum monitor_flags - monitor flags 112066f7ac50SMichael Wu * 112166f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 112266f7ac50SMichael Wu * according to the nl80211 flags. 112366f7ac50SMichael Wu * 112466f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 112566f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 112666f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 112766f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 112866f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1129e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 113066f7ac50SMichael Wu */ 113166f7ac50SMichael Wu enum monitor_flags { 113266f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 113366f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 113466f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 113566f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 113666f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1137e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 113866f7ac50SMichael Wu }; 113966f7ac50SMichael Wu 11402ec600d6SLuis Carlos Cobo /** 11412ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 11422ec600d6SLuis Carlos Cobo * 11432ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 11442ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 11452ec600d6SLuis Carlos Cobo * 1146abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1147abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1148abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1149abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1150abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1151abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1152abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 11532ec600d6SLuis Carlos Cobo */ 11542ec600d6SLuis Carlos Cobo enum mpath_info_flags { 11552ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1156d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 11572ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 11582ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 11592ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 11602ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 11612ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 11622ec600d6SLuis Carlos Cobo }; 11632ec600d6SLuis Carlos Cobo 11642ec600d6SLuis Carlos Cobo /** 11652ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 11662ec600d6SLuis Carlos Cobo * 11672ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 11682ec600d6SLuis Carlos Cobo * 11692ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 11702ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1171d19b3bf6SRui Paulo * @sn: target sequence number 11722ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 11732ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 11742ec600d6SLuis Carlos Cobo * @flags: mesh path flags 11752ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 11762ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1177f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1178f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1179f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1180f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 11812ec600d6SLuis Carlos Cobo */ 11822ec600d6SLuis Carlos Cobo struct mpath_info { 11832ec600d6SLuis Carlos Cobo u32 filled; 11842ec600d6SLuis Carlos Cobo u32 frame_qlen; 1185d19b3bf6SRui Paulo u32 sn; 11862ec600d6SLuis Carlos Cobo u32 metric; 11872ec600d6SLuis Carlos Cobo u32 exptime; 11882ec600d6SLuis Carlos Cobo u32 discovery_timeout; 11892ec600d6SLuis Carlos Cobo u8 discovery_retries; 11902ec600d6SLuis Carlos Cobo u8 flags; 1191f5ea9120SJohannes Berg 1192f5ea9120SJohannes Berg int generation; 11932ec600d6SLuis Carlos Cobo }; 11942ec600d6SLuis Carlos Cobo 11959f1ba906SJouni Malinen /** 11969f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 11979f1ba906SJouni Malinen * 11989f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 11999f1ba906SJouni Malinen * 12009f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 12019f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12029f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 12039f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12049f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 12059f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 120690c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 120790c97a04SJouni Malinen * (or NULL for no change) 120890c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1209fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 121050b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 121150b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 121253cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 121353cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 12149f1ba906SJouni Malinen */ 12159f1ba906SJouni Malinen struct bss_parameters { 12169f1ba906SJouni Malinen int use_cts_prot; 12179f1ba906SJouni Malinen int use_short_preamble; 12189f1ba906SJouni Malinen int use_short_slot_time; 1219c1e5f471SJohannes Berg const u8 *basic_rates; 122090c97a04SJouni Malinen u8 basic_rates_len; 1221fd8aaaf3SFelix Fietkau int ap_isolate; 122250b12f59SHelmut Schaa int ht_opmode; 122353cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 12249f1ba906SJouni Malinen }; 12252ec600d6SLuis Carlos Cobo 12263ddd53f3SChun-Yeow Yeoh /** 122729cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 122829cbe68cSJohannes Berg * 122929cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 12303ddd53f3SChun-Yeow Yeoh * 12313ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 12323ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 12333ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 12343ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 12353ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 12363ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 12373ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 12383ddd53f3SChun-Yeow Yeoh * mesh interface 12393ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 12403ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 12413ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 12423ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 12433ddd53f3SChun-Yeow Yeoh * elements 12443ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 12453ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 12463ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 12473ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 12483ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 12493ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 12503ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 12513ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 12523ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 12533ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 12543ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 12553ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 12563ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 12573ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 12583ddd53f3SChun-Yeow Yeoh * element 12593ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 12603ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 12613ddd53f3SChun-Yeow Yeoh * element 12623ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 12633ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 12643ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 12653ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 12663ddd53f3SChun-Yeow Yeoh * announcements are transmitted 12673ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 12683ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 12693ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 12703ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 12713ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 12723ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 12733ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 12743ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 12753ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 12763ddd53f3SChun-Yeow Yeoh * station to establish a peer link 12773ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1278ac1073a6SChun-Yeow Yeoh * 1279ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1280ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1281ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1282ac1073a6SChun-Yeow Yeoh * 1283ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1284ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1285728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1286728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1287728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 12883b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 12893b1c5a53SMarco Porsch * setting for new peer links. 12903b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 12913b1c5a53SMarco Porsch * after transmitting its beacon. 12928e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 12938e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 12948e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 129529cbe68cSJohannes Berg */ 129693da9cc1Scolin@cozybit.com struct mesh_config { 129793da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 129893da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 129993da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 130093da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 130193da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 130293da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 130345904f21SJavier Cardona u8 element_ttl; 130493da9cc1Scolin@cozybit.com bool auto_open_plinks; 1305d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 130693da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 130793da9cc1Scolin@cozybit.com u32 path_refresh_time; 130893da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 130993da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 131093da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1311dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 131293da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 131363c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 13140507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 131516dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 131694f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 131755335137SAshok Nagarajan s32 rssi_threshold; 131870c33eaaSAshok Nagarajan u16 ht_opmode; 1319ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1320ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1321728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 13223b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 13233b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 13248e7c0538SColleen Twitty u32 plink_timeout; 132593da9cc1Scolin@cozybit.com }; 132693da9cc1Scolin@cozybit.com 132731888487SJouni Malinen /** 132829cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1329683b6d3bSJohannes Berg * @chandef: defines the channel to use 133029cbe68cSJohannes Berg * @mesh_id: the mesh ID 133129cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1332d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1333c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1334c80d545dSJavier Cardona * @path_metric: which metric to use 13356e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1336581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1337581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1338b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1339b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1340bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 13419bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 13429bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 13434bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1344ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 134529cbe68cSJohannes Berg * 134629cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 134729cbe68cSJohannes Berg */ 134829cbe68cSJohannes Berg struct mesh_setup { 1349683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 135029cbe68cSJohannes Berg const u8 *mesh_id; 135129cbe68cSJohannes Berg u8 mesh_id_len; 1352d299a1f2SJavier Cardona u8 sync_method; 1353c80d545dSJavier Cardona u8 path_sel_proto; 1354c80d545dSJavier Cardona u8 path_metric; 13556e16d90bSColleen Twitty u8 auth_id; 1356581a8b0fSJavier Cardona const u8 *ie; 1357581a8b0fSJavier Cardona u8 ie_len; 1358b130e5ceSJavier Cardona bool is_authenticated; 135915d5dda6SJavier Cardona bool is_secure; 1360bb2798d4SThomas Pedersen bool user_mpm; 13619bdbf04dSMarco Porsch u8 dtim_period; 13629bdbf04dSMarco Porsch u16 beacon_interval; 136357fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1364ffb3cf30SAshok Nagarajan u32 basic_rates; 136529cbe68cSJohannes Berg }; 136629cbe68cSJohannes Berg 136729cbe68cSJohannes Berg /** 13686e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 13696e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 13706e0bd6c3SRostislav Lisovy * 13716e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 13726e0bd6c3SRostislav Lisovy */ 13736e0bd6c3SRostislav Lisovy struct ocb_setup { 13746e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 13756e0bd6c3SRostislav Lisovy }; 13766e0bd6c3SRostislav Lisovy 13776e0bd6c3SRostislav Lisovy /** 137831888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1379a3304b0aSJohannes Berg * @ac: AC identifier 138031888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 138131888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 138231888487SJouni Malinen * 1..32767] 138331888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 138431888487SJouni Malinen * 1..32767] 138531888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 138631888487SJouni Malinen */ 138731888487SJouni Malinen struct ieee80211_txq_params { 1388a3304b0aSJohannes Berg enum nl80211_ac ac; 138931888487SJouni Malinen u16 txop; 139031888487SJouni Malinen u16 cwmin; 139131888487SJouni Malinen u16 cwmax; 139231888487SJouni Malinen u8 aifs; 139331888487SJouni Malinen }; 139431888487SJouni Malinen 1395d70e9693SJohannes Berg /** 1396d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1397d70e9693SJohannes Berg * 1398d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1399d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1400d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1401d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1402d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1403d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1404d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1405d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1406d70e9693SJohannes Berg * in the wiphy structure. 1407d70e9693SJohannes Berg * 1408d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1409d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1410d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1411d70e9693SJohannes Berg * 1412d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1413d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1414d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1415d70e9693SJohannes Berg * to userspace. 1416d70e9693SJohannes Berg */ 141772bdcf34SJouni Malinen 1418704232c2SJohannes Berg /** 14192a519311SJohannes Berg * struct cfg80211_ssid - SSID description 14202a519311SJohannes Berg * @ssid: the SSID 14212a519311SJohannes Berg * @ssid_len: length of the ssid 14222a519311SJohannes Berg */ 14232a519311SJohannes Berg struct cfg80211_ssid { 14242a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 14252a519311SJohannes Berg u8 ssid_len; 14262a519311SJohannes Berg }; 14272a519311SJohannes Berg 14282a519311SJohannes Berg /** 14291d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 14301d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 14311d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 14321d76250bSAvraham Stern * information is not available, this field is left zero. 14331d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 14341d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 14351d76250bSAvraham Stern * userspace will be notified of that 14361d76250bSAvraham Stern */ 14371d76250bSAvraham Stern struct cfg80211_scan_info { 14381d76250bSAvraham Stern u64 scan_start_tsf; 14391d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 14401d76250bSAvraham Stern bool aborted; 14411d76250bSAvraham Stern }; 14421d76250bSAvraham Stern 14431d76250bSAvraham Stern /** 14442a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 14452a519311SJohannes Berg * 14462a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 14472a519311SJohannes Berg * @n_ssids: number of SSIDs 14482a519311SJohannes Berg * @channels: channels to scan on. 1449ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1450dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 145170692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 145270692ad2SJouni Malinen * @ie_len: length of ie in octets 14531d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 14541d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 14551d76250bSAvraham Stern * the actual dwell time may be shorter. 14561d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 14571d76250bSAvraham Stern * %duration field. 1458ed473771SSam Leffler * @flags: bit field of flags controlling operation 145934850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 14602a519311SJohannes Berg * @wiphy: the wiphy this was for 146115d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1462fd014284SJohannes Berg * @wdev: the wireless device to scan for 14631d76250bSAvraham Stern * @info: (internal) information about completed scan 14645fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1465e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1466ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1467ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1468ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1469ad2b26abSJohannes Berg * be taken from the @mac_addr 1470818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 14712a519311SJohannes Berg */ 14722a519311SJohannes Berg struct cfg80211_scan_request { 14732a519311SJohannes Berg struct cfg80211_ssid *ssids; 14742a519311SJohannes Berg int n_ssids; 14752a519311SJohannes Berg u32 n_channels; 1476dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1477de95a54bSJohannes Berg const u8 *ie; 147870692ad2SJouni Malinen size_t ie_len; 14791d76250bSAvraham Stern u16 duration; 14801d76250bSAvraham Stern bool duration_mandatory; 1481ed473771SSam Leffler u32 flags; 14822a519311SJohannes Berg 148357fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 148434850ab2SJohannes Berg 1485fd014284SJohannes Berg struct wireless_dev *wdev; 1486fd014284SJohannes Berg 1487ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1488ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1489818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 1490ad2b26abSJohannes Berg 14912a519311SJohannes Berg /* internal */ 14922a519311SJohannes Berg struct wiphy *wiphy; 149315d6030bSSam Leffler unsigned long scan_start; 14941d76250bSAvraham Stern struct cfg80211_scan_info info; 14951d76250bSAvraham Stern bool notified; 1496e9f935e3SRajkumar Manoharan bool no_cck; 14975ba63533SJohannes Berg 14985ba63533SJohannes Berg /* keep last */ 14995ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 15002a519311SJohannes Berg }; 15012a519311SJohannes Berg 1502ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1503ad2b26abSJohannes Berg { 1504ad2b26abSJohannes Berg int i; 1505ad2b26abSJohannes Berg 1506ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1507ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1508ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1509ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1510ad2b26abSJohannes Berg } 1511ad2b26abSJohannes Berg } 1512ad2b26abSJohannes Berg 15132a519311SJohannes Berg /** 1514a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1515a1f1c21cSLuciano Coelho * 1516ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1517ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1518a1f1c21cSLuciano Coelho */ 1519a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1520a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1521ea73cbceSJohannes Berg s32 rssi_thold; 1522a1f1c21cSLuciano Coelho }; 1523a1f1c21cSLuciano Coelho 1524a1f1c21cSLuciano Coelho /** 15253b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 15263b06d277SAvraham Stern * 15273b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 15283b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 15293b06d277SAvraham Stern * infinite loop. 15303b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 15313b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 15323b06d277SAvraham Stern */ 15333b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 15343b06d277SAvraham Stern u32 interval; 15353b06d277SAvraham Stern u32 iterations; 15363b06d277SAvraham Stern }; 15373b06d277SAvraham Stern 15383b06d277SAvraham Stern /** 1539807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1540807f8a8cSLuciano Coelho * 1541807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1542807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1543807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1544dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1545807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1546807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1547ed473771SSam Leffler * @flags: bit field of flags controlling operation 1548a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1549a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1550a1f1c21cSLuciano Coelho * (others are filtered out). 1551a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1552a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1553807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1554807f8a8cSLuciano Coelho * @dev: the interface 1555077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1556807f8a8cSLuciano Coelho * @channels: channels to scan 1557ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1558ea73cbceSJohannes Berg * contains the minimum over all matchsets 1559ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1560ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1561ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1562ad2b26abSJohannes Berg * be taken from the @mac_addr 15633b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 15643b06d277SAvraham Stern * index must be executed first. 15653b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 156631a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 156793a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 156893a1e86cSJukka Rissanen * owned by a particular socket) 15699c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 15709c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 15719c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 15729c748934SLuciano Coelho * supported. 1573807f8a8cSLuciano Coelho */ 1574807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1575807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1576807f8a8cSLuciano Coelho int n_ssids; 1577807f8a8cSLuciano Coelho u32 n_channels; 1578dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1579807f8a8cSLuciano Coelho const u8 *ie; 1580807f8a8cSLuciano Coelho size_t ie_len; 1581ed473771SSam Leffler u32 flags; 1582a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1583a1f1c21cSLuciano Coelho int n_match_sets; 1584ea73cbceSJohannes Berg s32 min_rssi_thold; 15859c748934SLuciano Coelho u32 delay; 15863b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 15873b06d277SAvraham Stern int n_scan_plans; 1588807f8a8cSLuciano Coelho 1589ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1590ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1591ad2b26abSJohannes Berg 1592807f8a8cSLuciano Coelho /* internal */ 1593807f8a8cSLuciano Coelho struct wiphy *wiphy; 1594807f8a8cSLuciano Coelho struct net_device *dev; 159515d6030bSSam Leffler unsigned long scan_start; 159631a60ed1SJukka Rissanen struct rcu_head rcu_head; 159793a1e86cSJukka Rissanen u32 owner_nlportid; 1598807f8a8cSLuciano Coelho 1599807f8a8cSLuciano Coelho /* keep last */ 1600807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1601807f8a8cSLuciano Coelho }; 1602807f8a8cSLuciano Coelho 1603807f8a8cSLuciano Coelho /** 16042a519311SJohannes Berg * enum cfg80211_signal_type - signal type 16052a519311SJohannes Berg * 16062a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 16072a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 16082a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 16092a519311SJohannes Berg */ 16102a519311SJohannes Berg enum cfg80211_signal_type { 16112a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 16122a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 16132a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 16142a519311SJohannes Berg }; 16152a519311SJohannes Berg 16162a519311SJohannes Berg /** 16176e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 16186e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 16196e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 16206e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 16216e19bc4bSDmitry Shmidt * signal type 16226e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 16236e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 16246e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 16256e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 16266e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 16276e19bc4bSDmitry Shmidt * ktime_get_boot_ns() is likely appropriate. 16281d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 16291d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 16301d76250bSAvraham Stern * by %parent_bssid. 16311d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 16321d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 16336e19bc4bSDmitry Shmidt */ 16346e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 16356e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 16366e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 16376e19bc4bSDmitry Shmidt s32 signal; 16386e19bc4bSDmitry Shmidt u64 boottime_ns; 16391d76250bSAvraham Stern u64 parent_tsf; 16401d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 16416e19bc4bSDmitry Shmidt }; 16426e19bc4bSDmitry Shmidt 16436e19bc4bSDmitry Shmidt /** 16442aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 16458cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 16469caf0364SJohannes Berg * @rcu_head: internal use, for freeing 16479caf0364SJohannes Berg * @len: length of the IEs 16480e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 16499caf0364SJohannes Berg * @data: IE data 16509caf0364SJohannes Berg */ 16519caf0364SJohannes Berg struct cfg80211_bss_ies { 16528cef2c9dSJohannes Berg u64 tsf; 16539caf0364SJohannes Berg struct rcu_head rcu_head; 16549caf0364SJohannes Berg int len; 16550e227084SJohannes Berg bool from_beacon; 16569caf0364SJohannes Berg u8 data[]; 16579caf0364SJohannes Berg }; 16589caf0364SJohannes Berg 16599caf0364SJohannes Berg /** 16602a519311SJohannes Berg * struct cfg80211_bss - BSS description 16612a519311SJohannes Berg * 16622a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 16632a519311SJohannes Berg * for use in scan results and similar. 16642a519311SJohannes Berg * 1665abe37c4bSJohannes Berg * @channel: channel this BSS is on 1666dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 16672a519311SJohannes Berg * @bssid: BSSID of the BSS 16682a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 16692a519311SJohannes Berg * @capability: the capability field in host byte order 167083c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 167183c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 167283c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 167383c7aa1aSJohannes Berg * received. It is always non-%NULL. 167434a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1675776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1676776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1677776b3580SJohannes Berg * @hidden_beacon_bss struct) 167834a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1679776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1680776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1681776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1682776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 168377965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 16842a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 16852a519311SJohannes Berg */ 16862a519311SJohannes Berg struct cfg80211_bss { 16872a519311SJohannes Berg struct ieee80211_channel *channel; 1688dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 16892a519311SJohannes Berg 16909caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 16919caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 16929caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 16939caf0364SJohannes Berg 1694776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 16952a519311SJohannes Berg 16962a519311SJohannes Berg s32 signal; 16972a519311SJohannes Berg 16989caf0364SJohannes Berg u16 beacon_interval; 16999caf0364SJohannes Berg u16 capability; 17009caf0364SJohannes Berg 17019caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 17029caf0364SJohannes Berg 17031c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 17042a519311SJohannes Berg }; 17052a519311SJohannes Berg 17062a519311SJohannes Berg /** 1707517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1708517357c6SJohannes Berg * @bss: the bss to search 1709517357c6SJohannes Berg * @ie: the IE ID 17109caf0364SJohannes Berg * 17119caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 17129caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 17130ae997dcSYacine Belkadi * Return: %NULL if not found. 1714517357c6SJohannes Berg */ 1715517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1716517357c6SJohannes Berg 1717517357c6SJohannes Berg 1718517357c6SJohannes Berg /** 1719636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1720636a5d36SJouni Malinen * 1721636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1722636a5d36SJouni Malinen * authentication. 1723636a5d36SJouni Malinen * 1724959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1725959867faSJohannes Berg * to it if it needs to keep it. 1726636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1727636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1728636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1729fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1730fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1731fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1732e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1733e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1734e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1735636a5d36SJouni Malinen */ 1736636a5d36SJouni Malinen struct cfg80211_auth_request { 173719957bb3SJohannes Berg struct cfg80211_bss *bss; 1738636a5d36SJouni Malinen const u8 *ie; 1739636a5d36SJouni Malinen size_t ie_len; 174019957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1741fffd0934SJohannes Berg const u8 *key; 1742fffd0934SJohannes Berg u8 key_len, key_idx; 1743e39e5b5eSJouni Malinen const u8 *sae_data; 1744e39e5b5eSJouni Malinen size_t sae_data_len; 1745636a5d36SJouni Malinen }; 1746636a5d36SJouni Malinen 1747636a5d36SJouni Malinen /** 17487e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 17497e7c8926SBen Greear * 17507e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1751ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1752bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 17537e7c8926SBen Greear */ 17547e7c8926SBen Greear enum cfg80211_assoc_req_flags { 17557e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1756ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1757bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 17587e7c8926SBen Greear }; 17597e7c8926SBen Greear 17607e7c8926SBen Greear /** 1761636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1762636a5d36SJouni Malinen * 1763636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1764636a5d36SJouni Malinen * (re)association. 1765959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1766959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1767959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1768959867faSJohannes Berg * association requests while already associating must be rejected. 1769636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1770636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1771dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1772b23aa676SSamuel Ortiz * @crypto: crypto settings 177335eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 177435eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 177535eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 177635eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 177735eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 177835eb8f7bSJouni Malinen * frame. 17797e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 17807e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 17817e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 17827e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1783ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1784ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1785636a5d36SJouni Malinen */ 1786636a5d36SJouni Malinen struct cfg80211_assoc_request { 178719957bb3SJohannes Berg struct cfg80211_bss *bss; 17883e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1789636a5d36SJouni Malinen size_t ie_len; 1790b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 179119957bb3SJohannes Berg bool use_mfp; 17927e7c8926SBen Greear u32 flags; 17937e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 17947e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1795ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1796636a5d36SJouni Malinen }; 1797636a5d36SJouni Malinen 1798636a5d36SJouni Malinen /** 1799636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1800636a5d36SJouni Malinen * 1801636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1802636a5d36SJouni Malinen * deauthentication. 1803636a5d36SJouni Malinen * 180495de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1805636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1806636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 180719957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1808077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1809077f897aSJohannes Berg * do not set a deauth frame 1810636a5d36SJouni Malinen */ 1811636a5d36SJouni Malinen struct cfg80211_deauth_request { 181295de817bSJohannes Berg const u8 *bssid; 1813636a5d36SJouni Malinen const u8 *ie; 1814636a5d36SJouni Malinen size_t ie_len; 181519957bb3SJohannes Berg u16 reason_code; 18166863255bSStanislaw Gruszka bool local_state_change; 1817636a5d36SJouni Malinen }; 1818636a5d36SJouni Malinen 1819636a5d36SJouni Malinen /** 1820636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1821636a5d36SJouni Malinen * 1822636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1823636a5d36SJouni Malinen * disassocation. 1824636a5d36SJouni Malinen * 182519957bb3SJohannes Berg * @bss: the BSS to disassociate from 1826636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1827636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 182819957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1829d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1830d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1831636a5d36SJouni Malinen */ 1832636a5d36SJouni Malinen struct cfg80211_disassoc_request { 183319957bb3SJohannes Berg struct cfg80211_bss *bss; 1834636a5d36SJouni Malinen const u8 *ie; 1835636a5d36SJouni Malinen size_t ie_len; 183619957bb3SJohannes Berg u16 reason_code; 1837d5cdfacbSJouni Malinen bool local_state_change; 1838636a5d36SJouni Malinen }; 1839636a5d36SJouni Malinen 1840636a5d36SJouni Malinen /** 184104a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 184204a773adSJohannes Berg * 184304a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 184404a773adSJohannes Berg * method. 184504a773adSJohannes Berg * 184604a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 184704a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 184804a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 184904a773adSJohannes Berg * search for IBSSs with a different BSSID. 1850683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 185104a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 185204a773adSJohannes Berg * IBSSs to join on other channels. 185304a773adSJohannes Berg * @ie: information element(s) to include in the beacon 185404a773adSJohannes Berg * @ie_len: length of that 18558e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1856fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1857fffd0934SJohannes Berg * after joining 1858267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1859267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1860267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1861267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 18625336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 18635336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 18645336fa88SSimon Wunderlich * to operate on DFS channels. 1865fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1866dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1867803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1868803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1869803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 187004a773adSJohannes Berg */ 187104a773adSJohannes Berg struct cfg80211_ibss_params { 1872c1e5f471SJohannes Berg const u8 *ssid; 1873c1e5f471SJohannes Berg const u8 *bssid; 1874683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1875c1e5f471SJohannes Berg const u8 *ie; 187604a773adSJohannes Berg u8 ssid_len, ie_len; 18778e30bc55SJohannes Berg u16 beacon_interval; 1878fbd2c8dcSTeemu Paasikivi u32 basic_rates; 187904a773adSJohannes Berg bool channel_fixed; 1880fffd0934SJohannes Berg bool privacy; 1881267335d6SAntonio Quartulli bool control_port; 18825336fa88SSimon Wunderlich bool userspace_handles_dfs; 188357fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1884803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1885803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 188604a773adSJohannes Berg }; 188704a773adSJohannes Berg 188804a773adSJohannes Berg /** 188938de03d2SArend van Spriel * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 189038de03d2SArend van Spriel * 189138de03d2SArend van Spriel * @band: band of BSS which should match for RSSI level adjustment. 189238de03d2SArend van Spriel * @delta: value of RSSI level adjustment. 189338de03d2SArend van Spriel */ 189438de03d2SArend van Spriel struct cfg80211_bss_select_adjust { 189557fbcce3SJohannes Berg enum nl80211_band band; 189638de03d2SArend van Spriel s8 delta; 189738de03d2SArend van Spriel }; 189838de03d2SArend van Spriel 189938de03d2SArend van Spriel /** 190038de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 190138de03d2SArend van Spriel * 190238de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 190338de03d2SArend van Spriel * @param: parameters for requestion behaviour. 190438de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 190538de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 190638de03d2SArend van Spriel */ 190738de03d2SArend van Spriel struct cfg80211_bss_selection { 190838de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 190938de03d2SArend van Spriel union { 191057fbcce3SJohannes Berg enum nl80211_band band_pref; 191138de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 191238de03d2SArend van Spriel } param; 191338de03d2SArend van Spriel }; 191438de03d2SArend van Spriel 191538de03d2SArend van Spriel /** 1916b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1917b23aa676SSamuel Ortiz * 1918b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1919b23aa676SSamuel Ortiz * authentication and association. 1920b23aa676SSamuel Ortiz * 1921b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1922b23aa676SSamuel Ortiz * on scan results) 19231df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 19241df4a510SJouni Malinen * %NULL if not specified 1925b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1926b23aa676SSamuel Ortiz * results) 19271df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 19281df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 19291df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 19301df4a510SJouni Malinen * to use. 1931b23aa676SSamuel Ortiz * @ssid: SSID 1932b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1933b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1934abe37c4bSJohannes Berg * @ie: IEs for association request 1935abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1936b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1937cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1938b23aa676SSamuel Ortiz * @crypto: crypto settings 1939fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1940fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1941fffd0934SJohannes Berg * @key: WEP key for shared key authentication 19427e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 19434486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 19444486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 19457e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 19467e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 19477e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1948ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 1949ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 195034d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 195134d50519SLior David * networks. 195238de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 195335eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 195435eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 195535eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 195635eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 195735eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 195835eb8f7bSJouni Malinen * frame. 1959b23aa676SSamuel Ortiz */ 1960b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1961b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 19621df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 1963664834deSJouni Malinen const u8 *bssid; 19641df4a510SJouni Malinen const u8 *bssid_hint; 1965664834deSJouni Malinen const u8 *ssid; 1966b23aa676SSamuel Ortiz size_t ssid_len; 1967b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 19684b5800feSJohannes Berg const u8 *ie; 1969b23aa676SSamuel Ortiz size_t ie_len; 1970b23aa676SSamuel Ortiz bool privacy; 1971cee00a95SJouni Malinen enum nl80211_mfp mfp; 1972b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1973fffd0934SJohannes Berg const u8 *key; 1974fffd0934SJohannes Berg u8 key_len, key_idx; 19757e7c8926SBen Greear u32 flags; 19764486ea98SBala Shanmugam int bg_scan_period; 19777e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 19787e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1979ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 1980ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 198134d50519SLior David bool pbss; 198238de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 1983ba6fbacfSJouni Malinen const u8 *prev_bssid; 1984b23aa676SSamuel Ortiz }; 1985b23aa676SSamuel Ortiz 1986b23aa676SSamuel Ortiz /** 1987b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1988abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1989abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1990abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1991abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1992abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 19933057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 1994b9a5f8caSJouni Malinen */ 1995b9a5f8caSJouni Malinen enum wiphy_params_flags { 1996b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1997b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1998b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1999b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 200081077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 20013057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 2002b9a5f8caSJouni Malinen }; 2003b9a5f8caSJouni Malinen 20049930380fSJohannes Berg /* 20059930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 20069930380fSJohannes Berg */ 20079930380fSJohannes Berg struct cfg80211_bitrate_mask { 20089930380fSJohannes Berg struct { 20099930380fSJohannes Berg u32 legacy; 2010d1e33e65SJanusz Dziedzic u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 2011204e35a9SJanusz Dziedzic u16 vht_mcs[NL80211_VHT_NSS_MAX]; 20120b9323f6SJanusz Dziedzic enum nl80211_txrate_gi gi; 201357fbcce3SJohannes Berg } control[NUM_NL80211_BANDS]; 20149930380fSJohannes Berg }; 201567fbb16bSSamuel Ortiz /** 201667fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 201767fbb16bSSamuel Ortiz * 201867fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 201967fbb16bSSamuel Ortiz * caching. 202067fbb16bSSamuel Ortiz * 202167fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 202267fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 202367fbb16bSSamuel Ortiz */ 202467fbb16bSSamuel Ortiz struct cfg80211_pmksa { 2025c1e5f471SJohannes Berg const u8 *bssid; 2026c1e5f471SJohannes Berg const u8 *pmkid; 202767fbb16bSSamuel Ortiz }; 20289930380fSJohannes Berg 20297643a2c3SJohannes Berg /** 203050ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 2031ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 2032ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 2033ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 2034ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 2035bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 2036ff1b6e69SJohannes Berg * 2037ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 2038ff1b6e69SJohannes Berg * memory, free @mask only! 2039ff1b6e69SJohannes Berg */ 204050ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 2041922bd80fSJohannes Berg const u8 *mask, *pattern; 2042ff1b6e69SJohannes Berg int pattern_len; 2043bb92d199SAmitkumar Karwar int pkt_offset; 2044ff1b6e69SJohannes Berg }; 2045ff1b6e69SJohannes Berg 2046ff1b6e69SJohannes Berg /** 20472a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 20482a0e047eSJohannes Berg * 20492a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 20502a0e047eSJohannes Berg * @src: source IP address 20512a0e047eSJohannes Berg * @dst: destination IP address 20522a0e047eSJohannes Berg * @dst_mac: destination MAC address 20532a0e047eSJohannes Berg * @src_port: source port 20542a0e047eSJohannes Berg * @dst_port: destination port 20552a0e047eSJohannes Berg * @payload_len: data payload length 20562a0e047eSJohannes Berg * @payload: data payload buffer 20572a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 20582a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 20592a0e047eSJohannes Berg * @wake_len: wakeup payload match length 20602a0e047eSJohannes Berg * @wake_data: wakeup payload match data 20612a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 20622a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 20632a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 20642a0e047eSJohannes Berg */ 20652a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 20662a0e047eSJohannes Berg struct socket *sock; 20672a0e047eSJohannes Berg __be32 src, dst; 20682a0e047eSJohannes Berg u16 src_port, dst_port; 20692a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 20702a0e047eSJohannes Berg int payload_len; 20712a0e047eSJohannes Berg const u8 *payload; 20722a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 20732a0e047eSJohannes Berg u32 data_interval; 20742a0e047eSJohannes Berg u32 wake_len; 20752a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 20762a0e047eSJohannes Berg u32 tokens_size; 20772a0e047eSJohannes Berg /* must be last, variable member */ 20782a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 2079ff1b6e69SJohannes Berg }; 2080ff1b6e69SJohannes Berg 2081ff1b6e69SJohannes Berg /** 2082ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2083ff1b6e69SJohannes Berg * 2084ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 2085ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 2086ff1b6e69SJohannes Berg * operating as normal during suspend 2087ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 2088ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 2089ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 2090ff1b6e69SJohannes Berg * @n_patterns: number of patterns 209177dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 209277dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 209377dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 209477dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 20952a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 20962a0e047eSJohannes Berg * NULL if not configured. 20978cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 2098ff1b6e69SJohannes Berg */ 2099ff1b6e69SJohannes Berg struct cfg80211_wowlan { 210077dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 210177dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 210277dbbb13SJohannes Berg rfkill_release; 210350ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 21042a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 2105ff1b6e69SJohannes Berg int n_patterns; 21068cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 2107ff1b6e69SJohannes Berg }; 2108ff1b6e69SJohannes Berg 2109ff1b6e69SJohannes Berg /** 2110be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 2111be29b99aSAmitkumar Karwar * 2112be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 2113be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 2114be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 2115be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 2116be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 2117be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 2118be29b99aSAmitkumar Karwar */ 2119be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2120be29b99aSAmitkumar Karwar int delay; 2121be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2122be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2123be29b99aSAmitkumar Karwar int n_patterns; 2124be29b99aSAmitkumar Karwar }; 2125be29b99aSAmitkumar Karwar 2126be29b99aSAmitkumar Karwar /** 2127be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2128be29b99aSAmitkumar Karwar * 2129be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2130be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2131be29b99aSAmitkumar Karwar * @n_rules: number of rules 2132be29b99aSAmitkumar Karwar */ 2133be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2134be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2135be29b99aSAmitkumar Karwar int n_rules; 2136be29b99aSAmitkumar Karwar }; 2137be29b99aSAmitkumar Karwar 2138be29b99aSAmitkumar Karwar /** 21398cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 21408cd4d456SLuciano Coelho * 21418cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 21428cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 21438cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 21448cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 21458cd4d456SLuciano Coelho * occurred (in MHz) 21468cd4d456SLuciano Coelho */ 21478cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 21488cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 21498cd4d456SLuciano Coelho int n_channels; 21508cd4d456SLuciano Coelho u32 channels[]; 21518cd4d456SLuciano Coelho }; 21528cd4d456SLuciano Coelho 21538cd4d456SLuciano Coelho /** 21548cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 21558cd4d456SLuciano Coelho * 21568cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 21578cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 21588cd4d456SLuciano Coelho * match information. 21598cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 21608cd4d456SLuciano Coelho * the matches that triggered the wake up. 21618cd4d456SLuciano Coelho */ 21628cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 21638cd4d456SLuciano Coelho int n_matches; 21648cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 21658cd4d456SLuciano Coelho }; 21668cd4d456SLuciano Coelho 21678cd4d456SLuciano Coelho /** 2168cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2169cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2170cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2171cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2172cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2173cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2174cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2175cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2176cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2177cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2178cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2179cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2180cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2181cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2182cd8f7cb4SJohannes Berg * it is. 21832a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 21842a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 21852a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 21868cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2187cd8f7cb4SJohannes Berg */ 2188cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2189cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2190cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 21912a0e047eSJohannes Berg rfkill_release, packet_80211, 21922a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2193cd8f7cb4SJohannes Berg s32 pattern_idx; 2194cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2195cd8f7cb4SJohannes Berg const void *packet; 21968cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2197cd8f7cb4SJohannes Berg }; 2198cd8f7cb4SJohannes Berg 2199cd8f7cb4SJohannes Berg /** 2200e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 220178f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 220278f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 220378f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2204e5497d76SJohannes Berg */ 2205e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 220678f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2207e5497d76SJohannes Berg }; 2208e5497d76SJohannes Berg 2209e5497d76SJohannes Berg /** 2210355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2211355199e0SJouni Malinen * 2212355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2213355199e0SJouni Malinen * 2214355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2215355199e0SJouni Malinen * @ie: Fast Transition IEs 2216355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2217355199e0SJouni Malinen */ 2218355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2219355199e0SJouni Malinen u16 md; 2220355199e0SJouni Malinen const u8 *ie; 2221355199e0SJouni Malinen size_t ie_len; 2222355199e0SJouni Malinen }; 2223355199e0SJouni Malinen 2224355199e0SJouni Malinen /** 2225b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2226b176e629SAndrei Otcheretianski * 2227b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2228b176e629SAndrei Otcheretianski * 2229b176e629SAndrei Otcheretianski * @chan: channel to use 2230b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2231b176e629SAndrei Otcheretianski * @wait: duration for ROC 2232b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2233b176e629SAndrei Otcheretianski * @len: buffer length 2234b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2235b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 223634d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 223734d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2238b176e629SAndrei Otcheretianski */ 2239b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2240b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2241b176e629SAndrei Otcheretianski bool offchan; 2242b176e629SAndrei Otcheretianski unsigned int wait; 2243b176e629SAndrei Otcheretianski const u8 *buf; 2244b176e629SAndrei Otcheretianski size_t len; 2245b176e629SAndrei Otcheretianski bool no_cck; 2246b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 224734d22ce2SAndrei Otcheretianski int n_csa_offsets; 224834d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2249b176e629SAndrei Otcheretianski }; 2250b176e629SAndrei Otcheretianski 2251b176e629SAndrei Otcheretianski /** 2252fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2253fa9ffc74SKyeyoon Park * 2254fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2255fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2256fa9ffc74SKyeyoon Park */ 2257fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2258fa9ffc74SKyeyoon Park u8 dscp; 2259fa9ffc74SKyeyoon Park u8 up; 2260fa9ffc74SKyeyoon Park }; 2261fa9ffc74SKyeyoon Park 2262fa9ffc74SKyeyoon Park /** 2263fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2264fa9ffc74SKyeyoon Park * 2265fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2266fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2267fa9ffc74SKyeyoon Park */ 2268fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2269fa9ffc74SKyeyoon Park u8 low; 2270fa9ffc74SKyeyoon Park u8 high; 2271fa9ffc74SKyeyoon Park }; 2272fa9ffc74SKyeyoon Park 2273fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2274fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2275fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2276fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2277fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2278fa9ffc74SKyeyoon Park 2279fa9ffc74SKyeyoon Park /** 2280fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2281fa9ffc74SKyeyoon Park * 2282fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2283fa9ffc74SKyeyoon Park * 2284fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2285fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2286fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2287fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2288fa9ffc74SKyeyoon Park */ 2289fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2290fa9ffc74SKyeyoon Park u8 num_des; 2291fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2292fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2293fa9ffc74SKyeyoon Park }; 2294fa9ffc74SKyeyoon Park 2295fa9ffc74SKyeyoon Park /** 2296704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2297704232c2SJohannes Berg * 2298704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2299704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2300704232c2SJohannes Berg * 2301704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2302704232c2SJohannes Berg * on success or a negative error code. 2303704232c2SJohannes Berg * 230443fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 230543fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 230643fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 230743fb45cbSJohannes Berg * 2308ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2309ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2310ff1b6e69SJohannes Berg * configured for the device. 23110378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 23126d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 23136d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 23146d52563fSJohannes Berg * the device. 23150378b3f1SJohannes Berg * 231660719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2317463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 231884efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 231998104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 232098104fdeSJohannes Berg * also set the address member in the wdev. 2321704232c2SJohannes Berg * 232284efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 232355682965SJohannes Berg * 232460719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 232560719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 232655682965SJohannes Berg * 232741ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 232841ade00fSJohannes Berg * when adding a group key. 232941ade00fSJohannes Berg * 233041ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 233141ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 233241ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2333e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2334e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 233541ade00fSJohannes Berg * 233641ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2337e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 233841ade00fSJohannes Berg * 233941ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2340ed1b6cc7SJohannes Berg * 23413cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 23423cfcf6acSJouni Malinen * 2343e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2344e5497d76SJohannes Berg * 2345c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2346c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2347c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2348c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 23495727ef1bSJohannes Berg * 23505727ef1bSJohannes Berg * @add_station: Add a new station. 235189c771e5SJouni Malinen * @del_station: Remove a station 2352bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2353bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2354bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 235577ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 235677ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2357abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2358abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2359abe37c4bSJohannes Berg * 2360abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2361abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2362abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2363abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2364abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 236566be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 236666be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2367f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 23688d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2369f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 23708d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 23712ec600d6SLuis Carlos Cobo * 237224bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 237393da9cc1Scolin@cozybit.com * 237424bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 237593da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 237693da9cc1Scolin@cozybit.com * set, and which to leave alone. 237793da9cc1Scolin@cozybit.com * 23789f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 237931888487SJouni Malinen * 238031888487SJouni Malinen * @set_txq_params: Set TX queue parameters 238172bdcf34SJouni Malinen * 2382e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2383e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2384e8c9bd5bSJohannes Berg * join the mesh instead. 2385e8c9bd5bSJohannes Berg * 2386e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2387e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2388e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2389e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 23909aed3cc1SJouni Malinen * 23912a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 23922a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 23932a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 23942a519311SJohannes Berg * the scan/scan_done bracket too. 239591d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 239691d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 2397636a5d36SJouni Malinen * 2398636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 23998d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2400636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 24018d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2402636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 24038d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2404636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 24058d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 240604a773adSJohannes Berg * 2407b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2408bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 2409bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 2410bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 2411bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 2412bf1ecd21SJouni Malinen * was received. 2413bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 2414bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 2415bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 2416bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 2417bf1ecd21SJouni Malinen * frame instead of Association Request frame. 2418bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 2419bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 242035eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 2421bf1ecd21SJouni Malinen * indication of requesting reassociation. 2422bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 2423bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 2424bf1ecd21SJouni Malinen * cfg80211_roamed() or cfg80211_roamed_bss(). 24258d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2426*5a1f044bSEmmanuel Grumbach * @disconnect: Disconnect from the BSS/ESS. Once done, call 2427*5a1f044bSEmmanuel Grumbach * cfg80211_disconnected(). 24288d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2429b23aa676SSamuel Ortiz * 243004a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 243104a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 243204a773adSJohannes Berg * to a merge. 24338d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 243404a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 24358d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2436b9a5f8caSJouni Malinen * 2437f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2438f4e583c8SAntonio Quartulli * MESH mode) 2439f4e583c8SAntonio Quartulli * 2440b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2441b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2442b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2443b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 24447643a2c3SJohannes Berg * 24451432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2446c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2447c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2448c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2449c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 24507643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 24511f87f7d3SJohannes Berg * return 0 if successful 24521f87f7d3SJohannes Berg * 2453abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2454abe37c4bSJohannes Berg * 24551f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 24561f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2457aff89a9bSJohannes Berg * 245861fa713cSHolger Schurig * @dump_survey: get site survey information. 245961fa713cSHolger Schurig * 24609588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 24619588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 24629588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 24639588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 24649588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 24659588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 24669588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 24679588bbd5SJouni Malinen * the duration value. 2468f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2469f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2470f7ca38dfSJohannes Berg * frame on another channel 24719588bbd5SJouni Malinen * 2472fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 247371063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 247471063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 247571063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 247671063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 247771063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 247871063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 247967fbb16bSSamuel Ortiz * 2480abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2481abe37c4bSJohannes Berg * 248267fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 248367fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 248467fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 248567fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 248667fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 24879043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 24889043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2489d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 2490e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 2491e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 2492e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 2493e86abc68SJohannes Berg * disabled.) 249484f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 249584f10708SThomas Pedersen * thresholds. 2496807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2497d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2498d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2499d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2500d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2501d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2502d9b8396aSJohannes Berg * method returns 0.) 250367fbb16bSSamuel Ortiz * 2504271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 250533d8783cSJohannes Berg * registered. The callback is allowed to sleep. 2506547025d5SBruno Randolf * 2507547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2508547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2509547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2510547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2511547025d5SBruno Randolf * 2512547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 25133677713bSJohn W. Linville * 2514109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2515109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 25167f6cf311SJohannes Berg * 25177f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 25187f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 25191d9d9213SSimon Wunderlich * 25201d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2521d6199218SBen Greear * 25225b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 25235b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 25245b7ccaf3SJohannes Berg * current monitoring channel. 252598104fdeSJohannes Berg * 252698104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 252798104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 252877765eafSVasanthakumar Thiagarajan * 252977765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 253077765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 253177765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 253277765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 253377765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 253477765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 253504f39047SSimon Wunderlich * 253604f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 25378bf24293SJouni Malinen * 25388bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 25398bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 25408bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 25415de17984SArend van Spriel * 25425de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 25435de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 25445de17984SArend van Spriel * driver can take the most appropriate actions. 25455de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 25465de17984SArend van Spriel * reliability. This operation can not fail. 2547be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 254816ef1fe2SSimon Wunderlich * 254997dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 255097dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 255197dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 255297dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 255397dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 255497dc94f1SMichal Kazior * as soon as possible. 2555fa9ffc74SKyeyoon Park * 2556fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2557e16821bcSJouni Malinen * 2558e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2559e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2560e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2561960d01acSJohannes Berg * 2562960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2563960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2564960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2565960d01acSJohannes Berg * account. 2566960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2567960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2568960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2569960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2570960d01acSJohannes Berg * rejected) 2571960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 25726e0bd6c3SRostislav Lisovy * 25736e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 25746e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 25756e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 25766e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 25771057d35eSArik Nemtsov * 25781057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 25791057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 25801057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 25811057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 25821057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2583704232c2SJohannes Berg */ 2584704232c2SJohannes Berg struct cfg80211_ops { 2585ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 25860378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 25876d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 25880378b3f1SJohannes Berg 258984efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2590552bff0cSJohannes Berg const char *name, 25916bab2e19STom Gundersen unsigned char name_assign_type, 2592f9e10ce4SJohannes Berg enum nl80211_iftype type, 2593f9e10ce4SJohannes Berg u32 *flags, 25942ec600d6SLuis Carlos Cobo struct vif_params *params); 259584efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 259684efbb84SJohannes Berg struct wireless_dev *wdev); 2597e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2598e36d56b6SJohannes Berg struct net_device *dev, 25992ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 26002ec600d6SLuis Carlos Cobo struct vif_params *params); 260141ade00fSJohannes Berg 260241ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2603e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 260441ade00fSJohannes Berg struct key_params *params); 260541ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2606e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2607e31b8213SJohannes Berg void *cookie, 260841ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 260941ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2610e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 261141ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 261241ade00fSJohannes Berg struct net_device *netdev, 2613dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 26143cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 26153cfcf6acSJouni Malinen struct net_device *netdev, 26163cfcf6acSJouni Malinen u8 key_index); 2617ed1b6cc7SJohannes Berg 26188860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 26198860020eSJohannes Berg struct cfg80211_ap_settings *settings); 26208860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 26218860020eSJohannes Berg struct cfg80211_beacon_data *info); 26228860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 26235727ef1bSJohannes Berg 26245727ef1bSJohannes Berg 26255727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 26263b3a0162SJohannes Berg const u8 *mac, 26273b3a0162SJohannes Berg struct station_parameters *params); 26285727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 262989c771e5SJouni Malinen struct station_del_parameters *params); 26305727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 26313b3a0162SJohannes Berg const u8 *mac, 26323b3a0162SJohannes Berg struct station_parameters *params); 2633fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 26343b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 26352ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 26362ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 26372ec600d6SLuis Carlos Cobo 26382ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 26393b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 26402ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 26413b3a0162SJohannes Berg const u8 *dst); 26422ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 26433b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 26442ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 26453b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 26462ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 26472ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 26482ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 264966be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 265066be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 265166be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 265266be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 265366be7d2bSHenning Rogge struct mpath_info *pinfo); 265424bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 265593da9cc1Scolin@cozybit.com struct net_device *dev, 265693da9cc1Scolin@cozybit.com struct mesh_config *conf); 265724bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 265829cbe68cSJohannes Berg struct net_device *dev, u32 mask, 265929cbe68cSJohannes Berg const struct mesh_config *nconf); 266029cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 266129cbe68cSJohannes Berg const struct mesh_config *conf, 266229cbe68cSJohannes Berg const struct mesh_setup *setup); 266329cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 266429cbe68cSJohannes Berg 26656e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 26666e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 26676e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 26686e0bd6c3SRostislav Lisovy 26699f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 26709f1ba906SJouni Malinen struct bss_parameters *params); 267131888487SJouni Malinen 2672f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 267331888487SJouni Malinen struct ieee80211_txq_params *params); 267472bdcf34SJouni Malinen 2675e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2676e8c9bd5bSJohannes Berg struct net_device *dev, 2677e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2678e8c9bd5bSJohannes Berg 2679e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2680683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 26819aed3cc1SJouni Malinen 2682fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 26832a519311SJohannes Berg struct cfg80211_scan_request *request); 268491d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 2685636a5d36SJouni Malinen 2686636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2687636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2688636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2689636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2690636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 269163c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2692636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 269363c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 269404a773adSJohannes Berg 2695b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2696b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2697b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2698b23aa676SSamuel Ortiz u16 reason_code); 2699b23aa676SSamuel Ortiz 270004a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 270104a773adSJohannes Berg struct cfg80211_ibss_params *params); 270204a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2703b9a5f8caSJouni Malinen 2704f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 270557fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 2706f4e583c8SAntonio Quartulli 2707b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 27087643a2c3SJohannes Berg 2709c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2710fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2711c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2712c8442118SJohannes Berg int *dbm); 27131f87f7d3SJohannes Berg 2714ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2715388ac775SJohannes Berg const u8 *addr); 2716ab737a4fSJohannes Berg 27171f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2718aff89a9bSJohannes Berg 2719aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2720fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2721fc73f11fSDavid Spinadel void *data, int len); 272271063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 272371063f0eSWey-Yi Guy struct netlink_callback *cb, 272471063f0eSWey-Yi Guy void *data, int len); 2725aff89a9bSJohannes Berg #endif 2726bc92afd9SJohannes Berg 27279930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 27289930380fSJohannes Berg struct net_device *dev, 27299930380fSJohannes Berg const u8 *peer, 27309930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 27319930380fSJohannes Berg 273261fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 273361fa713cSHolger Schurig int idx, struct survey_info *info); 273461fa713cSHolger Schurig 273567fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 273667fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 273767fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 273867fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 273967fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 274067fbb16bSSamuel Ortiz 27419588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 274271bbc994SJohannes Berg struct wireless_dev *wdev, 27439588bbd5SJouni Malinen struct ieee80211_channel *chan, 27449588bbd5SJouni Malinen unsigned int duration, 27459588bbd5SJouni Malinen u64 *cookie); 27469588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 274771bbc994SJohannes Berg struct wireless_dev *wdev, 27489588bbd5SJouni Malinen u64 cookie); 27499588bbd5SJouni Malinen 275071bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2751b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2752b176e629SAndrei Otcheretianski u64 *cookie); 2753f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 275471bbc994SJohannes Berg struct wireless_dev *wdev, 2755f7ca38dfSJohannes Berg u64 cookie); 2756026331c4SJouni Malinen 2757bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2758bc92afd9SJohannes Berg bool enabled, int timeout); 2759d6dc1a38SJuuso Oikarinen 2760d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2761d6dc1a38SJuuso Oikarinen struct net_device *dev, 2762d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2763271733cfSJohannes Berg 276484f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 276584f10708SThomas Pedersen struct net_device *dev, 276684f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 276784f10708SThomas Pedersen 2768271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 276971bbc994SJohannes Berg struct wireless_dev *wdev, 2770271733cfSJohannes Berg u16 frame_type, bool reg); 2771afe0cbf8SBruno Randolf 2772afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2773afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 27743677713bSJohn W. Linville 2775807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2776807f8a8cSLuciano Coelho struct net_device *dev, 2777807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 277885a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2779e5497d76SJohannes Berg 2780e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2781e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2782109086ceSArik Nemtsov 2783109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 27843b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2785df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 278631fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2787109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 27883b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 27897f6cf311SJohannes Berg 27907f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 27917f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2792e999882aSJohannes Berg 27931d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 27941d9d9213SSimon Wunderlich struct net_device *dev, 27951d9d9213SSimon Wunderlich u16 noack_map); 27961d9d9213SSimon Wunderlich 2797683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 27985b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2799683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 280098104fdeSJohannes Berg 280198104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 280298104fdeSJohannes Berg struct wireless_dev *wdev); 280398104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 280498104fdeSJohannes Berg struct wireless_dev *wdev); 280577765eafSVasanthakumar Thiagarajan 280677765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 280777765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 280804f39047SSimon Wunderlich 280904f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 281004f39047SSimon Wunderlich struct net_device *dev, 281131559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 281231559f35SJanusz Dziedzic u32 cac_time_ms); 2813355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2814355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 28155de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 28165de17984SArend van Spriel struct wireless_dev *wdev, 28175de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 28185de17984SArend van Spriel u16 duration); 28195de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 28205de17984SArend van Spriel struct wireless_dev *wdev); 2821be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 2822be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 282316ef1fe2SSimon Wunderlich 282416ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 282516ef1fe2SSimon Wunderlich struct net_device *dev, 282616ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 2827e16821bcSJouni Malinen 2828fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 2829fa9ffc74SKyeyoon Park struct net_device *dev, 2830fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 2831e16821bcSJouni Malinen 2832e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2833e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 2834960d01acSJohannes Berg 2835960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2836960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 2837960d01acSJohannes Berg u16 admitted_time); 2838960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2839960d01acSJohannes Berg u8 tsid, const u8 *peer); 28401057d35eSArik Nemtsov 28411057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 28421057d35eSArik Nemtsov struct net_device *dev, 28431057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 28441057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 28451057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 28461057d35eSArik Nemtsov struct net_device *dev, 28471057d35eSArik Nemtsov const u8 *addr); 2848704232c2SJohannes Berg }; 2849704232c2SJohannes Berg 2850d3236553SJohannes Berg /* 2851d3236553SJohannes Berg * wireless hardware and networking interfaces structures 2852d3236553SJohannes Berg * and registration/helper functions 2853d3236553SJohannes Berg */ 2854d3236553SJohannes Berg 2855d3236553SJohannes Berg /** 28565be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 28575be83de5SJohannes Berg * 28585be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 28595be83de5SJohannes Berg * wiphy at all 28605be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 28615be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 28625be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 28635be83de5SJohannes Berg * reason to override the default 28649bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 28659bc383deSJohannes Berg * on a VLAN interface) 28669bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 2867c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 2868c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 2869c0692b8fSJohannes Berg * control_port_no_encrypt flag. 2870e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 287115d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 287215d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 28731ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 2874f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 2875f4b34b55SVivek Natarajan * firmware. 2876cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 2877109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 2878109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 2879109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 2880109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 2881109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 2882109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 2883562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 28845e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 28855e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 28865e760230SJohannes Berg * cfg80211_report_obss_beacon(). 288787bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 288887bbbe22SArik Nemtsov * responds to probe-requests in hardware. 28897c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 28907c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 28912f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 289216ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 289316ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 28945be83de5SJohannes Berg */ 28955be83de5SJohannes Berg enum wiphy_flags { 2896723e73acSJohannes Berg /* use hole at 0 */ 2897a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 2898a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 28995be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 29005be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 29019bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 29029bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 2903c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 2904309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 290515d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 2906807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 29078e8b41f9SJohannes Berg /* use hole at 12 */ 2908f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 2909cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 2910109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 2911109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 2912562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 29135e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 291487bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 29157c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 29167c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 29172f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 291816ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 29197527a782SJohannes Berg }; 29207527a782SJohannes Berg 29217527a782SJohannes Berg /** 29227527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 29237527a782SJohannes Berg * @max: maximum number of interfaces of these types 29247527a782SJohannes Berg * @types: interface types (bits) 29257527a782SJohannes Berg */ 29267527a782SJohannes Berg struct ieee80211_iface_limit { 29277527a782SJohannes Berg u16 max; 29287527a782SJohannes Berg u16 types; 29297527a782SJohannes Berg }; 29307527a782SJohannes Berg 29317527a782SJohannes Berg /** 29327527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 29337527a782SJohannes Berg * @limits: limits for the given interface types 29347527a782SJohannes Berg * @n_limits: number of limitations 29357527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 29367527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 29377527a782SJohannes Berg * group 29387527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 29397527a782SJohannes Berg * between infrastructure and AP types must match. This is required 29407527a782SJohannes Berg * only in special cases. 294111c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 29428c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 29437527a782SJohannes Berg * 2944b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 2945b80edbc1SLuciano Coelho * combinations it supports concurrently. 29467527a782SJohannes Berg * 2947b80edbc1SLuciano Coelho * Examples: 2948b80edbc1SLuciano Coelho * 2949b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 29507527a782SJohannes Berg * 29517527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 29527527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 29537527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 29547527a782SJohannes Berg * }; 29557527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 29567527a782SJohannes Berg * .limits = limits1, 29577527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 29587527a782SJohannes Berg * .max_interfaces = 2, 29597527a782SJohannes Berg * .beacon_int_infra_match = true, 29607527a782SJohannes Berg * }; 29617527a782SJohannes Berg * 29627527a782SJohannes Berg * 2963b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 29647527a782SJohannes Berg * 29657527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 29667527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 29677527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 29687527a782SJohannes Berg * }; 29697527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 29707527a782SJohannes Berg * .limits = limits2, 29717527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 29727527a782SJohannes Berg * .max_interfaces = 8, 29737527a782SJohannes Berg * .num_different_channels = 1, 29747527a782SJohannes Berg * }; 29757527a782SJohannes Berg * 29767527a782SJohannes Berg * 2977b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2978b80edbc1SLuciano Coelho * 29797527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 29807527a782SJohannes Berg * 29817527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 29827527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 29837527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 29847527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 29857527a782SJohannes Berg * }; 29867527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 29877527a782SJohannes Berg * .limits = limits3, 29887527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 29897527a782SJohannes Berg * .max_interfaces = 4, 29907527a782SJohannes Berg * .num_different_channels = 2, 29917527a782SJohannes Berg * }; 29927527a782SJohannes Berg */ 29937527a782SJohannes Berg struct ieee80211_iface_combination { 29947527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 29957527a782SJohannes Berg u32 num_different_channels; 29967527a782SJohannes Berg u16 max_interfaces; 29977527a782SJohannes Berg u8 n_limits; 29987527a782SJohannes Berg bool beacon_int_infra_match; 299911c4a075SSimon Wunderlich u8 radar_detect_widths; 30008c48b50aSFelix Fietkau u8 radar_detect_regions; 30015be83de5SJohannes Berg }; 30025be83de5SJohannes Berg 30032e161f78SJohannes Berg struct ieee80211_txrx_stypes { 30042e161f78SJohannes Berg u16 tx, rx; 30052e161f78SJohannes Berg }; 30062e161f78SJohannes Berg 30075be83de5SJohannes Berg /** 3008ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 3009ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 3010ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 3011ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 3012ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 3013ff1b6e69SJohannes Berg * packet should be preserved in that case 3014ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 3015ff1b6e69SJohannes Berg * (see nl80211.h) 3016ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 301777dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 301877dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 301977dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 302077dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 302177dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 30228cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 3023ff1b6e69SJohannes Berg */ 3024ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 3025ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 3026ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 3027ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 302877dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 302977dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 303077dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 303177dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 303277dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 30338cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 3034ff1b6e69SJohannes Berg }; 3035ff1b6e69SJohannes Berg 30362a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 30372a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 30382a0e047eSJohannes Berg u32 data_payload_max; 30392a0e047eSJohannes Berg u32 data_interval_max; 30402a0e047eSJohannes Berg u32 wake_payload_max; 30412a0e047eSJohannes Berg bool seq; 30422a0e047eSJohannes Berg }; 30432a0e047eSJohannes Berg 3044ff1b6e69SJohannes Berg /** 3045ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 3046ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 3047ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 3048ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 3049ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 3050ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 3051bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 30528cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 30538cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 30548cd4d456SLuciano Coelho * scheduled scans. 30558cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 30568cd4d456SLuciano Coelho * details. 30572a0e047eSJohannes Berg * @tcp: TCP wakeup support information 3058ff1b6e69SJohannes Berg */ 3059ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 3060ff1b6e69SJohannes Berg u32 flags; 3061ff1b6e69SJohannes Berg int n_patterns; 3062ff1b6e69SJohannes Berg int pattern_max_len; 3063ff1b6e69SJohannes Berg int pattern_min_len; 3064bb92d199SAmitkumar Karwar int max_pkt_offset; 30658cd4d456SLuciano Coelho int max_nd_match_sets; 30662a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 3067ff1b6e69SJohannes Berg }; 3068ff1b6e69SJohannes Berg 3069ff1b6e69SJohannes Berg /** 3070be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 3071be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 3072be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 3073be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 3074be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 3075be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 3076be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 3077be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 3078be29b99aSAmitkumar Karwar */ 3079be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 3080be29b99aSAmitkumar Karwar int n_rules; 3081be29b99aSAmitkumar Karwar int max_delay; 3082be29b99aSAmitkumar Karwar int n_patterns; 3083be29b99aSAmitkumar Karwar int pattern_max_len; 3084be29b99aSAmitkumar Karwar int pattern_min_len; 3085be29b99aSAmitkumar Karwar int max_pkt_offset; 3086be29b99aSAmitkumar Karwar }; 3087be29b99aSAmitkumar Karwar 3088be29b99aSAmitkumar Karwar /** 3089ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 3090ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 3091ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 3092ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 3093ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 3094ad7e718cSJohannes Berg */ 3095ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 3096ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 3097ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 3098ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 3099ad7e718cSJohannes Berg }; 3100ad7e718cSJohannes Berg 3101ad7e718cSJohannes Berg /** 3102ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 3103ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 3104ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 3105ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 3106ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 3107ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 31087bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 31097bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 31107bdbe400SJohannes Berg * dumpit calls. 31117bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 31127bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 31137bdbe400SJohannes Berg * are used with dump requests. 3114ad7e718cSJohannes Berg */ 3115ad7e718cSJohannes Berg struct wiphy_vendor_command { 3116ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 3117ad7e718cSJohannes Berg u32 flags; 3118ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 3119ad7e718cSJohannes Berg const void *data, int data_len); 31207bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 31217bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 31227bdbe400SJohannes Berg unsigned long *storage); 3123ad7e718cSJohannes Berg }; 3124ad7e718cSJohannes Berg 3125ad7e718cSJohannes Berg /** 3126019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 3127019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 3128019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 3129019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 3130019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 3131019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 3132019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 3133019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 3134019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 3135019ae3a9SKanchanapally, Vidyullatha */ 3136019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 3137019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 3138019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 3139019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 3140019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 3141019ae3a9SKanchanapally, Vidyullatha }; 3142019ae3a9SKanchanapally, Vidyullatha 3143019ae3a9SKanchanapally, Vidyullatha /** 31445be83de5SJohannes Berg * struct wiphy - wireless hardware description 31452784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 31462784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 31472784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 3148d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 3149d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 3150d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 3151d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 3152d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 3153d3236553SJohannes Berg * @cipher_suites: supported cipher suites 3154d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 3155b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 3156b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 3157b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 3158b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 3159b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 3160abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 3161ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 3162ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 3163ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 31640fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 3165ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 3166ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 3167ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 3168ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 3169ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 3170ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 3171ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 3172ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3173fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3174fd235913SRandy Dunlap * unregister hardware 3175abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3176abe37c4bSJohannes Berg * automatically on wiphy renames 3177abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 31784a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3179abe37c4bSJohannes Berg * @wext: wireless extension handlers 3180abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3181abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3182abe37c4bSJohannes Berg * must be set by driver 31837527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 31847527a782SJohannes Berg * list single interface types. 31857527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 31867527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 31877527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3188abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3189a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3190a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 31911f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3192d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 3193d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 3194abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3195abe37c4bSJohannes Berg * this variable determines its size 3196abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3197abe37c4bSJohannes Berg * any given scan 319893b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 319993b6aa69SLuciano Coelho * for in any given scheduled scan 3200a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3201a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3202a1f1c21cSLuciano Coelho * supported. 3203abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3204abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3205abe37c4bSJohannes Berg * include fixed IEs like supported rates 32065a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 32075a865badSLuciano Coelho * scans 32083b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 32093b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 32103b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 32113b06d277SAvraham Stern * single scan plan supported by the device. 32123b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 32133b06d277SAvraham Stern * scan plan supported by the device. 3214abe37c4bSJohannes Berg * @coverage_class: current coverage class 3215abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3216abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3217abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3218abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3219abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3220abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 32212e161f78SJohannes Berg * 32222e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 32232e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 32242e161f78SJohannes Berg * type 3225a7ffac95SBruno Randolf * 32267f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 32277f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 32287f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 32297f531e03SBruno Randolf * 32307f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 32317f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 32327f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3233a293911dSJohannes Berg * 323415f0ebc2SRandy Dunlap * @probe_resp_offload: 323515f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 323615f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 323715f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 323815f0ebc2SRandy Dunlap * 3239a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3240a293911dSJohannes Berg * may request, if implemented. 3241ff1b6e69SJohannes Berg * 3242ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 32436abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 32446abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 32456abb9cb9SJohannes Berg * to the suspend() operation instead. 3246562a7480SJohannes Berg * 3247562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 32487e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 32497e7c8926SBen Greear * If null, then none can be over-ridden. 3250ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3251ee2aca34SJohannes Berg * If null, then none can be over-ridden. 325277765eafSVasanthakumar Thiagarajan * 325353873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 325453873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 325553873f13SJohannes Berg * 325677765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 325777765eafSVasanthakumar Thiagarajan * supports for ACL. 3258a50df0c4SJohannes Berg * 3259a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3260a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3261a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3262a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3263019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 3264019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 3265019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 3266a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3267a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3268019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 3269019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 3270019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 3271be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3272ad7e718cSJohannes Berg * 3273ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3274ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3275567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3276567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3277b43504cfSJouni Malinen * 3278b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3279b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3280b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3281b43504cfSJouni Malinen * some cases, but may not always reach. 3282c2e4323bSLuciano Coelho * 3283c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3284c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3285c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3286c2e4323bSLuciano Coelho * infinite. 328767af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 328867af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 328967af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 329067af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 329167af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 329267af9811SEmmanuel Grumbach * This value should be set in MHz. 329338de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 329438de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 329538de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 3296d3236553SJohannes Berg */ 3297d3236553SJohannes Berg struct wiphy { 3298d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3299d3236553SJohannes Berg 3300ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3301d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3302ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3303ef15aac6SJohannes Berg 3304ef15aac6SJohannes Berg struct mac_address *addresses; 3305d3236553SJohannes Berg 33062e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 33072e161f78SJohannes Berg 33087527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 33097527a782SJohannes Berg int n_iface_combinations; 33107527a782SJohannes Berg u16 software_iftypes; 33117527a782SJohannes Berg 33122e161f78SJohannes Berg u16 n_addresses; 33132e161f78SJohannes Berg 3314d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3315d3236553SJohannes Berg u16 interface_modes; 3316d3236553SJohannes Berg 331777765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 331877765eafSVasanthakumar Thiagarajan 3319a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3320d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3321463d0183SJohannes Berg 3322562a7480SJohannes Berg u32 ap_sme_capa; 3323562a7480SJohannes Berg 3324d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3325d3236553SJohannes Berg 3326d3236553SJohannes Berg int bss_priv_size; 3327d3236553SJohannes Berg u8 max_scan_ssids; 332893b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3329a1f1c21cSLuciano Coelho u8 max_match_sets; 3330d3236553SJohannes Berg u16 max_scan_ie_len; 33315a865badSLuciano Coelho u16 max_sched_scan_ie_len; 33323b06d277SAvraham Stern u32 max_sched_scan_plans; 33333b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 33343b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 3335d3236553SJohannes Berg 3336d3236553SJohannes Berg int n_cipher_suites; 3337d3236553SJohannes Berg const u32 *cipher_suites; 3338d3236553SJohannes Berg 3339b9a5f8caSJouni Malinen u8 retry_short; 3340b9a5f8caSJouni Malinen u8 retry_long; 3341b9a5f8caSJouni Malinen u32 frag_threshold; 3342b9a5f8caSJouni Malinen u32 rts_threshold; 334381077e82SLukáš Turek u8 coverage_class; 3344b9a5f8caSJouni Malinen 334581135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3346dfce95f5SKalle Valo u32 hw_version; 3347dfce95f5SKalle Valo 3348dfb89c56SJohannes Berg #ifdef CONFIG_PM 3349964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 33506abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3351dfb89c56SJohannes Berg #endif 3352ff1b6e69SJohannes Berg 3353a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3354a293911dSJohannes Berg 335567fbb16bSSamuel Ortiz u8 max_num_pmkids; 335667fbb16bSSamuel Ortiz 33577f531e03SBruno Randolf u32 available_antennas_tx; 33587f531e03SBruno Randolf u32 available_antennas_rx; 3359a7ffac95SBruno Randolf 336087bbbe22SArik Nemtsov /* 336187bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 336287bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 336387bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 336487bbbe22SArik Nemtsov */ 336587bbbe22SArik Nemtsov u32 probe_resp_offload; 336687bbbe22SArik Nemtsov 3367a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3368a50df0c4SJohannes Berg u8 extended_capabilities_len; 3369a50df0c4SJohannes Berg 3370019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 3371019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 3372019ae3a9SKanchanapally, Vidyullatha 3373d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3374d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3375d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3376d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3377d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3378cf5aa2f1SDavid Kilroy const void *privid; 3379d3236553SJohannes Berg 338057fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 3381d3236553SJohannes Berg 3382d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 33830c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3384d3236553SJohannes Berg struct regulatory_request *request); 3385d3236553SJohannes Berg 3386d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3387d3236553SJohannes Berg 3388458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3389d3236553SJohannes Berg 3390d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3391d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3392d3236553SJohannes Berg struct device dev; 3393d3236553SJohannes Berg 3394ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3395ecb44335SStanislaw Gruszka bool registered; 3396ecb44335SStanislaw Gruszka 3397d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3398d3236553SJohannes Berg struct dentry *debugfsdir; 3399d3236553SJohannes Berg 34007e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3401ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 34027e7c8926SBen Greear 340353873f13SJohannes Berg struct list_head wdev_list; 340453873f13SJohannes Berg 3405463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 34060c5c9fb5SEric W. Biederman possible_net_t _net; 3407463d0183SJohannes Berg 34083d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 34093d23e349SJohannes Berg const struct iw_handler_def *wext; 34103d23e349SJohannes Berg #endif 34113d23e349SJohannes Berg 3412be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3413be29b99aSAmitkumar Karwar 3414ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3415567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3416567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3417ad7e718cSJohannes Berg 3418b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3419b43504cfSJouni Malinen 34209a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 342167af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 34229a774c78SAndrei Otcheretianski 342338de03d2SArend van Spriel u32 bss_select_support; 342438de03d2SArend van Spriel 34251c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3426d3236553SJohannes Berg }; 3427d3236553SJohannes Berg 3428463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3429463d0183SJohannes Berg { 3430c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3431463d0183SJohannes Berg } 3432463d0183SJohannes Berg 3433463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3434463d0183SJohannes Berg { 3435c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3436463d0183SJohannes Berg } 3437463d0183SJohannes Berg 3438d3236553SJohannes Berg /** 3439d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3440d3236553SJohannes Berg * 3441d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 34420ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3443d3236553SJohannes Berg */ 3444d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3445d3236553SJohannes Berg { 3446d3236553SJohannes Berg BUG_ON(!wiphy); 3447d3236553SJohannes Berg return &wiphy->priv; 3448d3236553SJohannes Berg } 3449d3236553SJohannes Berg 3450d3236553SJohannes Berg /** 3451f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3452f1f74825SDavid Kilroy * 3453f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 34540ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3455f1f74825SDavid Kilroy */ 3456f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3457f1f74825SDavid Kilroy { 3458f1f74825SDavid Kilroy BUG_ON(!priv); 3459f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3460f1f74825SDavid Kilroy } 3461f1f74825SDavid Kilroy 3462f1f74825SDavid Kilroy /** 3463d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3464d3236553SJohannes Berg * 3465d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3466d3236553SJohannes Berg * @dev: The device to parent it to 3467d3236553SJohannes Berg */ 3468d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3469d3236553SJohannes Berg { 3470d3236553SJohannes Berg wiphy->dev.parent = dev; 3471d3236553SJohannes Berg } 3472d3236553SJohannes Berg 3473d3236553SJohannes Berg /** 3474d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3475d3236553SJohannes Berg * 3476d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 34770ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3478d3236553SJohannes Berg */ 3479d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3480d3236553SJohannes Berg { 3481d3236553SJohannes Berg return wiphy->dev.parent; 3482d3236553SJohannes Berg } 3483d3236553SJohannes Berg 3484d3236553SJohannes Berg /** 3485d3236553SJohannes Berg * wiphy_name - get wiphy name 3486d3236553SJohannes Berg * 3487d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 34880ae997dcSYacine Belkadi * Return: The name of @wiphy. 3489d3236553SJohannes Berg */ 3490e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3491d3236553SJohannes Berg { 3492d3236553SJohannes Berg return dev_name(&wiphy->dev); 3493d3236553SJohannes Berg } 3494d3236553SJohannes Berg 3495d3236553SJohannes Berg /** 34961998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 34971998d90aSBen Greear * 34981998d90aSBen Greear * @ops: The configuration operations for this device 34991998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 35001998d90aSBen Greear * @requested_name: Request a particular name. 35011998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 35021998d90aSBen Greear * 35031998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 35041998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 35051998d90aSBen Greear * 35061998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 35071998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 35081998d90aSBen Greear */ 35091998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 35101998d90aSBen Greear const char *requested_name); 35111998d90aSBen Greear 35121998d90aSBen Greear /** 3513d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3514d3236553SJohannes Berg * 3515d3236553SJohannes Berg * @ops: The configuration operations for this device 3516d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3517d3236553SJohannes Berg * 3518d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3519d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3520d3236553SJohannes Berg * 35210ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 35220ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3523d3236553SJohannes Berg */ 35241998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 35251998d90aSBen Greear int sizeof_priv) 35261998d90aSBen Greear { 35271998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 35281998d90aSBen Greear } 3529d3236553SJohannes Berg 3530d3236553SJohannes Berg /** 3531d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3532d3236553SJohannes Berg * 3533d3236553SJohannes Berg * @wiphy: The wiphy to register. 3534d3236553SJohannes Berg * 35350ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3536d3236553SJohannes Berg */ 353710dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3538d3236553SJohannes Berg 3539d3236553SJohannes Berg /** 3540d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3541d3236553SJohannes Berg * 3542d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3543d3236553SJohannes Berg * 3544d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3545d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3546d3236553SJohannes Berg * request that is being handled. 3547d3236553SJohannes Berg */ 354810dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3549d3236553SJohannes Berg 3550d3236553SJohannes Berg /** 3551d3236553SJohannes Berg * wiphy_free - free wiphy 3552d3236553SJohannes Berg * 3553d3236553SJohannes Berg * @wiphy: The wiphy to free 3554d3236553SJohannes Berg */ 355510dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3556d3236553SJohannes Berg 3557fffd0934SJohannes Berg /* internal structs */ 35586829c878SJohannes Berg struct cfg80211_conn; 355919957bb3SJohannes Berg struct cfg80211_internal_bss; 3560fffd0934SJohannes Berg struct cfg80211_cached_keys; 356119957bb3SJohannes Berg 3562d3236553SJohannes Berg /** 356389a54e48SJohannes Berg * struct wireless_dev - wireless device state 3564d3236553SJohannes Berg * 356589a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 356689a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 356789a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 356889a54e48SJohannes Berg * It need not be registered then as netdev registration will 356989a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 357089a54e48SJohannes Berg * 357189a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 357289a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 357389a54e48SJohannes Berg * there's no netdev registration in that case it may not be 357489a54e48SJohannes Berg * allocated outside of callback operations that return it. 3575d3236553SJohannes Berg * 3576d3236553SJohannes Berg * @wiphy: pointer to hardware description 3577d3236553SJohannes Berg * @iftype: interface type 3578d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 357989a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 358089a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 358189a54e48SJohannes Berg * wireless device if it has no netdev 3582d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 35839e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 35849e0e2961SMichal Kazior * the user-set channel definition. 3585780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3586aa430da4SJohannes Berg * track the channel to be used for AP later 3587d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3588d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3589d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 359029cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 359129cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3592d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 35939bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 35949bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 35959bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 35969bc383deSJohannes Berg * by cfg80211 on change_interface 35972e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 35982e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 35998d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 36008d61ffa5SJohannes Berg * and some API functions require it held 360156d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 360256d1893dSJohannes Berg * beacons, 0 when not valid 360398104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 360498104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 360504f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 360604f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 360731559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3608780b40dfSJohannes Berg * @ps: powersave mode is enabled 3609780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3610780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3611780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3612780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3613780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 361434d50519SLior David * @conn_bss_type: connecting/connected BSS type 3615780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 36165336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3617780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3618780b40dfSJohannes Berg * @event_lock: (private) lock for event list 361978f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3620d3236553SJohannes Berg */ 3621d3236553SJohannes Berg struct wireless_dev { 3622d3236553SJohannes Berg struct wiphy *wiphy; 3623d3236553SJohannes Berg enum nl80211_iftype iftype; 3624d3236553SJohannes Berg 3625667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3626d3236553SJohannes Berg struct list_head list; 3627d3236553SJohannes Berg struct net_device *netdev; 3628d3236553SJohannes Berg 362989a54e48SJohannes Berg u32 identifier; 363089a54e48SJohannes Berg 36312e161f78SJohannes Berg struct list_head mgmt_registrations; 36322e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3633026331c4SJouni Malinen 3634667503ddSJohannes Berg struct mutex mtx; 3635667503ddSJohannes Berg 363698104fdeSJohannes Berg bool use_4addr, p2p_started; 363798104fdeSJohannes Berg 363898104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 36399bc383deSJohannes Berg 3640b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3641d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 364229cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 36436829c878SJohannes Berg struct cfg80211_conn *conn; 3644fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 364534d50519SLior David enum ieee80211_bss_type conn_bss_type; 3646d3236553SJohannes Berg 3647667503ddSJohannes Berg struct list_head event_list; 3648667503ddSJohannes Berg spinlock_t event_lock; 3649667503ddSJohannes Berg 365019957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3651683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 36529e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3653f4489ebeSMichal Kazior 3654c30a3d38SMichal Kazior bool ibss_fixed; 36555336fa88SSimon Wunderlich bool ibss_dfs_possible; 3656c30a3d38SMichal Kazior 3657ffb9eb3dSKalle Valo bool ps; 3658ffb9eb3dSKalle Valo int ps_timeout; 3659ffb9eb3dSKalle Valo 366056d1893dSJohannes Berg int beacon_interval; 366156d1893dSJohannes Berg 366215e47304SEric W. Biederman u32 ap_unexpected_nlportid; 366328946da7SJohannes Berg 366404f39047SSimon Wunderlich bool cac_started; 366504f39047SSimon Wunderlich unsigned long cac_start_time; 366631559f35SJanusz Dziedzic unsigned int cac_time_ms; 366704f39047SSimon Wunderlich 366878f22b6aSJohannes Berg u32 owner_nlportid; 366978f22b6aSJohannes Berg 36703d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3671d3236553SJohannes Berg /* wext data */ 3672cbe8fa9cSJohannes Berg struct { 3673cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3674f2129354SJohannes Berg struct cfg80211_connect_params connect; 3675fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3676c1e5f471SJohannes Berg const u8 *ie; 3677f2129354SJohannes Berg size_t ie_len; 3678f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3679f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 368008645126SJohannes Berg s8 default_key, default_mgmt_key; 3681ffb9eb3dSKalle Valo bool prev_bssid_valid; 3682cbe8fa9cSJohannes Berg } wext; 3683d3236553SJohannes Berg #endif 3684d3236553SJohannes Berg }; 3685d3236553SJohannes Berg 368698104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 368798104fdeSJohannes Berg { 368898104fdeSJohannes Berg if (wdev->netdev) 368998104fdeSJohannes Berg return wdev->netdev->dev_addr; 369098104fdeSJohannes Berg return wdev->address; 369198104fdeSJohannes Berg } 369298104fdeSJohannes Berg 3693d3236553SJohannes Berg /** 3694d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3695d3236553SJohannes Berg * 3696d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 36970ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3698d3236553SJohannes Berg */ 3699d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3700d3236553SJohannes Berg { 3701d3236553SJohannes Berg BUG_ON(!wdev); 3702d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3703d3236553SJohannes Berg } 3704d3236553SJohannes Berg 3705d70e9693SJohannes Berg /** 3706d70e9693SJohannes Berg * DOC: Utility functions 3707d70e9693SJohannes Berg * 3708d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3709d3236553SJohannes Berg */ 3710d3236553SJohannes Berg 3711d3236553SJohannes Berg /** 3712d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3713abe37c4bSJohannes Berg * @chan: channel number 371459eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 37150ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3716d3236553SJohannes Berg */ 371757fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); 3718d3236553SJohannes Berg 3719d3236553SJohannes Berg /** 3720d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3721abe37c4bSJohannes Berg * @freq: center frequency 37220ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3723d3236553SJohannes Berg */ 372410dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3725d3236553SJohannes Berg 3726d3236553SJohannes Berg /* 3727d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3728d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3729d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3730d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3731d3236553SJohannes Berg * clash. 3732d3236553SJohannes Berg */ 373310dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3734d3236553SJohannes Berg int freq); 3735d3236553SJohannes Berg /** 3736d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3737abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3738abe37c4bSJohannes Berg * @freq: the center frequency of the channel 37390ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3740d3236553SJohannes Berg */ 3741d3236553SJohannes Berg static inline struct ieee80211_channel * 3742d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3743d3236553SJohannes Berg { 3744d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3745d3236553SJohannes Berg } 3746d3236553SJohannes Berg 3747d3236553SJohannes Berg /** 3748d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3749d3236553SJohannes Berg * 3750d3236553SJohannes Berg * @sband: the band to look for rates in 3751d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3752d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3753d3236553SJohannes Berg * 37540ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 37550ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 37560ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 37570ae997dcSYacine Belkadi * rates in the band's bitrate table. 3758d3236553SJohannes Berg */ 3759d3236553SJohannes Berg struct ieee80211_rate * 3760d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3761d3236553SJohannes Berg u32 basic_rates, int bitrate); 3762d3236553SJohannes Berg 3763b422c6cdSAshok Nagarajan /** 3764b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3765b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 376674608acaSSimon Wunderlich * @scan_width: width of the control channel 3767b422c6cdSAshok Nagarajan * 3768b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3769b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3770b422c6cdSAshok Nagarajan */ 377174608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 377274608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3773b422c6cdSAshok Nagarajan 3774d3236553SJohannes Berg /* 3775d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3776d3236553SJohannes Berg * 3777d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3778d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3779d3236553SJohannes Berg */ 3780d3236553SJohannes Berg 378133e5a2f7SJohannes Berg struct radiotap_align_size { 378233e5a2f7SJohannes Berg uint8_t align:4, size:4; 378333e5a2f7SJohannes Berg }; 378433e5a2f7SJohannes Berg 378533e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 378633e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 378733e5a2f7SJohannes Berg int n_bits; 378833e5a2f7SJohannes Berg uint32_t oui; 378933e5a2f7SJohannes Berg uint8_t subns; 379033e5a2f7SJohannes Berg }; 379133e5a2f7SJohannes Berg 379233e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 379333e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 379433e5a2f7SJohannes Berg int n_ns; 379533e5a2f7SJohannes Berg }; 379633e5a2f7SJohannes Berg 3797d3236553SJohannes Berg /** 3798d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 379933e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 380033e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 380133e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 380233e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 380333e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 380433e5a2f7SJohannes Berg * the beginning of the actual data portion 380533e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 380633e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 380733e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 380833e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 380933e5a2f7SJohannes Berg * radiotap namespace or not 381033e5a2f7SJohannes Berg * 381133e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 381233e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 381333e5a2f7SJohannes Berg * @_arg_index: next argument index 381433e5a2f7SJohannes Berg * @_arg: next argument pointer 381533e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 381633e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 381733e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 381833e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 381933e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 382033e5a2f7SJohannes Berg * next bitmap word 382133e5a2f7SJohannes Berg * 382233e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 382333e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 3824d3236553SJohannes Berg */ 3825d3236553SJohannes Berg 3826d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 382733e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 382833e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 382933e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 3830d3236553SJohannes Berg 383133e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 383267272440SJohannes Berg __le32 *_next_bitmap; 383333e5a2f7SJohannes Berg 383433e5a2f7SJohannes Berg unsigned char *this_arg; 383533e5a2f7SJohannes Berg int this_arg_index; 383633e5a2f7SJohannes Berg int this_arg_size; 383733e5a2f7SJohannes Berg 383833e5a2f7SJohannes Berg int is_radiotap_ns; 383933e5a2f7SJohannes Berg 384033e5a2f7SJohannes Berg int _max_length; 384133e5a2f7SJohannes Berg int _arg_index; 384233e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 384333e5a2f7SJohannes Berg int _reset_on_ext; 3844d3236553SJohannes Berg }; 3845d3236553SJohannes Berg 384610dd9b7cSJoe Perches int 384710dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 3848d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 384910dd9b7cSJoe Perches int max_length, 385010dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 3851d3236553SJohannes Berg 385210dd9b7cSJoe Perches int 385310dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 3854d3236553SJohannes Berg 385533e5a2f7SJohannes Berg 3856e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 3857e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 3858e31a16d6SZhu Yi 3859e31a16d6SZhu Yi /** 3860e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 3861e31a16d6SZhu Yi * 3862e31a16d6SZhu Yi * @skb: the frame 38630ae997dcSYacine Belkadi * 38640ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 38650ae997dcSYacine Belkadi * returns the 802.11 header length. 38660ae997dcSYacine Belkadi * 38670ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 38680ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 38690ae997dcSYacine Belkadi * 802.11 header. 3870e31a16d6SZhu Yi */ 3871e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3872e31a16d6SZhu Yi 3873e31a16d6SZhu Yi /** 3874e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 3875e31a16d6SZhu Yi * @fc: frame control field in little-endian format 38760ae997dcSYacine Belkadi * Return: The header length in bytes. 3877e31a16d6SZhu Yi */ 3878633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3879e31a16d6SZhu Yi 3880e31a16d6SZhu Yi /** 38819b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 38829b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 38839b395bc3SJohannes Berg * (first byte) will be accessed 38840ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 38859b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 38869b395bc3SJohannes Berg */ 38879b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 38889b395bc3SJohannes Berg 38899b395bc3SJohannes Berg /** 3890d70e9693SJohannes Berg * DOC: Data path helpers 3891d70e9693SJohannes Berg * 3892d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 3893d70e9693SJohannes Berg * functions that help implement the data path for devices 3894d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 3895d70e9693SJohannes Berg */ 3896d70e9693SJohannes Berg 3897d70e9693SJohannes Berg /** 3898e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 3899e31a16d6SZhu Yi * @skb: the 802.11 data frame 3900e31a16d6SZhu Yi * @addr: the device MAC address 3901e31a16d6SZhu Yi * @iftype: the virtual interface type 39020ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 3903e31a16d6SZhu Yi */ 3904eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3905e31a16d6SZhu Yi enum nl80211_iftype iftype); 3906e31a16d6SZhu Yi 3907e31a16d6SZhu Yi /** 3908e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 3909e31a16d6SZhu Yi * @skb: the 802.3 frame 3910e31a16d6SZhu Yi * @addr: the device MAC address 3911e31a16d6SZhu Yi * @iftype: the virtual interface type 3912e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3913e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 39140ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 3915e31a16d6SZhu Yi */ 3916eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3917c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 3918c1e5f471SJohannes Berg bool qos); 3919e31a16d6SZhu Yi 3920e31a16d6SZhu Yi /** 3921eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3922eaf85ca7SZhu Yi * 3923eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 3924eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 3925eaf85ca7SZhu Yi * @skb is consumed after the function returns. 3926eaf85ca7SZhu Yi * 3927eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 3928eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 3929eaf85ca7SZhu Yi * initialized by by the caller. 3930eaf85ca7SZhu Yi * @addr: The device MAC address. 3931eaf85ca7SZhu Yi * @iftype: The device interface type. 3932eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 39338b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 3934eaf85ca7SZhu Yi */ 3935eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 3936eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 39378b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 39388b3becadSYogesh Ashok Powar bool has_80211_header); 3939eaf85ca7SZhu Yi 3940eaf85ca7SZhu Yi /** 3941e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3942e31a16d6SZhu Yi * @skb: the data frame 3943fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 39440ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 3945e31a16d6SZhu Yi */ 3946fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 3947fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3948e31a16d6SZhu Yi 3949c21dbf92SJohannes Berg /** 3950c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 3951c21dbf92SJohannes Berg * 3952c21dbf92SJohannes Berg * @eid: element ID 3953c21dbf92SJohannes Berg * @ies: data consisting of IEs 3954c21dbf92SJohannes Berg * @len: length of data 3955c21dbf92SJohannes Berg * 39560ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 39570ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 39580ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 39590ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 39600ae997dcSYacine Belkadi * 39610ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 39620ae997dcSYacine Belkadi * having to fit into the given data. 3963c21dbf92SJohannes Berg */ 3964c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3965c21dbf92SJohannes Berg 3966d70e9693SJohannes Berg /** 39670c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 39680c28ec58SEliad Peller * 39690c28ec58SEliad Peller * @oui: vendor OUI 39709e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 39710c28ec58SEliad Peller * @ies: data consisting of IEs 39720c28ec58SEliad Peller * @len: length of data 39730c28ec58SEliad Peller * 39740ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 39750ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 39760ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 39770ae997dcSYacine Belkadi * element ID. 39780ae997dcSYacine Belkadi * 39790ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 39800ae997dcSYacine Belkadi * the given data. 39810c28ec58SEliad Peller */ 39829e9ea439SEmmanuel Grumbach const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 39830c28ec58SEliad Peller const u8 *ies, int len); 39840c28ec58SEliad Peller 39850c28ec58SEliad Peller /** 3986d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 3987d70e9693SJohannes Berg * 3988d70e9693SJohannes Berg * TODO 3989d3236553SJohannes Berg */ 3990d3236553SJohannes Berg 3991d3236553SJohannes Berg /** 3992d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 3993d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 3994d3236553SJohannes Berg * conflicts) 3995d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 3996d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 3997d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 3998d3236553SJohannes Berg * alpha2. 3999d3236553SJohannes Berg * 4000d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 4001d3236553SJohannes Berg * what it believes should be the current regulatory domain by 4002d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 4003d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 4004d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 4005d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 4006d3236553SJohannes Berg * 4007d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 4008d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 4009d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 4010d3236553SJohannes Berg * 4011d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 4012d3236553SJohannes Berg * an -ENOMEM. 40130ae997dcSYacine Belkadi * 40140ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 4015d3236553SJohannes Berg */ 401610dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 4017d3236553SJohannes Berg 4018d3236553SJohannes Berg /** 4019b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 4020b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 4021b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 4022b0d7aa59SJonathan Doron * 4023b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 4024b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 4025b0d7aa59SJonathan Doron * information. 4026b0d7aa59SJonathan Doron * 4027b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 4028b0d7aa59SJonathan Doron */ 4029b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 4030b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 4031b0d7aa59SJonathan Doron 4032b0d7aa59SJonathan Doron /** 40332c3e861cSArik Nemtsov * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 40342c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 40352c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 40362c3e861cSArik Nemtsov * 40372c3e861cSArik Nemtsov * This functions requires the RTNL to be held and applies the new regdomain 40382c3e861cSArik Nemtsov * synchronously to this wiphy. For more details see 40392c3e861cSArik Nemtsov * regulatory_set_wiphy_regd(). 40402c3e861cSArik Nemtsov * 40412c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 40422c3e861cSArik Nemtsov */ 40432c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 40442c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 40452c3e861cSArik Nemtsov 40462c3e861cSArik Nemtsov /** 4047d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 4048d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 4049d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 4050d3236553SJohannes Berg * 4051d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 4052d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 4053d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 4054d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 4055d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 4056d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 4057222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 4058ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 4059222ea581SLuis R. Rodriguez * that called this helper. 4060d3236553SJohannes Berg */ 406110dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 4062d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 4063d3236553SJohannes Berg 4064d3236553SJohannes Berg /** 4065d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 4066d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 4067d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 4068d3236553SJohannes Berg * 4069d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 4070d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 4071d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 4072d3236553SJohannes Berg * and processed already. 4073d3236553SJohannes Berg * 40740ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 40750ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 40760ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 40770ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 40780ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 40790ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 40800ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 4081d3236553SJohannes Berg */ 4082361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 4083361c9c8bSJohannes Berg u32 center_freq); 4084d3236553SJohannes Berg 4085034c6d6eSLuis R. Rodriguez /** 4086034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 4087034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 4088034c6d6eSLuis R. Rodriguez * 4089034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 4090034c6d6eSLuis R. Rodriguez * proper string representation. 4091034c6d6eSLuis R. Rodriguez */ 4092034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 4093034c6d6eSLuis R. Rodriguez 4094d3236553SJohannes Berg /* 4095d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 4096d3236553SJohannes Berg * functions and BSS handling helpers 4097d3236553SJohannes Berg */ 4098d3236553SJohannes Berg 40992a519311SJohannes Berg /** 41002a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 41012a519311SJohannes Berg * 41022a519311SJohannes Berg * @request: the corresponding scan request 41031d76250bSAvraham Stern * @info: information about the completed scan 41042a519311SJohannes Berg */ 41051d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 41061d76250bSAvraham Stern struct cfg80211_scan_info *info); 41072a519311SJohannes Berg 41082a519311SJohannes Berg /** 4109807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 4110807f8a8cSLuciano Coelho * 4111807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 4112807f8a8cSLuciano Coelho */ 4113807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 4114807f8a8cSLuciano Coelho 4115807f8a8cSLuciano Coelho /** 4116807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 4117807f8a8cSLuciano Coelho * 4118807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 4119807f8a8cSLuciano Coelho * 4120807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 4121807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 4122807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 4123807f8a8cSLuciano Coelho */ 4124807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 4125807f8a8cSLuciano Coelho 4126807f8a8cSLuciano Coelho /** 4127792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 4128792e6aa7SEliad Peller * 4129792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 4130792e6aa7SEliad Peller * 4131792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 4132792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 4133792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 4134792e6aa7SEliad Peller * This function should be called with rtnl locked. 4135792e6aa7SEliad Peller */ 4136792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 4137792e6aa7SEliad Peller 4138792e6aa7SEliad Peller /** 41396e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 41402a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 41416e19bc4bSDmitry Shmidt * @data: the BSS metadata 4142abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 4143abe37c4bSJohannes Berg * @len: length of the management frame 41442a519311SJohannes Berg * @gfp: context flags 41452a519311SJohannes Berg * 41462a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 41472a519311SJohannes Berg * the BSS should be updated/added. 4148ef100682SJohannes Berg * 41490ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 41500ae997dcSYacine Belkadi * Or %NULL on error. 41512a519311SJohannes Berg */ 4152ef100682SJohannes Berg struct cfg80211_bss * __must_check 41536e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 41546e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 41556e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 41566e19bc4bSDmitry Shmidt gfp_t gfp); 41576e19bc4bSDmitry Shmidt 41586e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4159dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 41603afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4161dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 4162dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 41636e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 41646e19bc4bSDmitry Shmidt { 41656e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 41666e19bc4bSDmitry Shmidt .chan = rx_channel, 41676e19bc4bSDmitry Shmidt .scan_width = scan_width, 41686e19bc4bSDmitry Shmidt .signal = signal, 41696e19bc4bSDmitry Shmidt }; 41706e19bc4bSDmitry Shmidt 41716e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 41726e19bc4bSDmitry Shmidt } 4173dcd6eac1SSimon Wunderlich 4174dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 41752a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 41763afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 41772a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 4178dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4179dcd6eac1SSimon Wunderlich { 41806e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 41816e19bc4bSDmitry Shmidt .chan = rx_channel, 41826e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 41836e19bc4bSDmitry Shmidt .signal = signal, 41846e19bc4bSDmitry Shmidt }; 41856e19bc4bSDmitry Shmidt 41866e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 4187dcd6eac1SSimon Wunderlich } 41882a519311SJohannes Berg 4189abe37c4bSJohannes Berg /** 41905bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 41915bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 41925bc8c1f2SJohannes Berg * from a beacon or probe response 41935bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 41945bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 41955bc8c1f2SJohannes Berg */ 41965bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 41975bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 41985bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 41995bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 42005bc8c1f2SJohannes Berg }; 42015bc8c1f2SJohannes Berg 42025bc8c1f2SJohannes Berg /** 42036e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 4204abe37c4bSJohannes Berg * 4205abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 42066e19bc4bSDmitry Shmidt * @data: the BSS metadata 42075bc8c1f2SJohannes Berg * @ftype: frame type (if known) 4208abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 42097b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 4210abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 4211abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 4212abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 4213abe37c4bSJohannes Berg * @ielen: length of the additional IEs 4214abe37c4bSJohannes Berg * @gfp: context flags 4215abe37c4bSJohannes Berg * 4216abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 4217abe37c4bSJohannes Berg * the BSS should be updated/added. 4218ef100682SJohannes Berg * 42190ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 42200ae997dcSYacine Belkadi * Or %NULL on error. 4221abe37c4bSJohannes Berg */ 4222ef100682SJohannes Berg struct cfg80211_bss * __must_check 42236e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 42246e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 42256e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 42266e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 42276e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 42286e19bc4bSDmitry Shmidt gfp_t gfp); 42296e19bc4bSDmitry Shmidt 42306e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4231dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 42323afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4233dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 42345bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 4235dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 4236dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 42376e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 42386e19bc4bSDmitry Shmidt { 42396e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 42406e19bc4bSDmitry Shmidt .chan = rx_channel, 42416e19bc4bSDmitry Shmidt .scan_width = scan_width, 42426e19bc4bSDmitry Shmidt .signal = signal, 42436e19bc4bSDmitry Shmidt }; 42446e19bc4bSDmitry Shmidt 42456e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 42466e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 42476e19bc4bSDmitry Shmidt gfp); 42486e19bc4bSDmitry Shmidt } 4249dcd6eac1SSimon Wunderlich 4250dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 425106aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 42523afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 42535bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 42547b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 42557b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4256dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4257dcd6eac1SSimon Wunderlich { 42586e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 42596e19bc4bSDmitry Shmidt .chan = rx_channel, 42606e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 42616e19bc4bSDmitry Shmidt .signal = signal, 42626e19bc4bSDmitry Shmidt }; 42636e19bc4bSDmitry Shmidt 42646e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 42656e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 4266dcd6eac1SSimon Wunderlich gfp); 4267dcd6eac1SSimon Wunderlich } 426806aa7afaSJussi Kivilinna 42692a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 42702a519311SJohannes Berg struct ieee80211_channel *channel, 42712a519311SJohannes Berg const u8 *bssid, 427279420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 42736eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 42746eb18137SDedy Lansky enum ieee80211_privacy); 427579420f09SJohannes Berg static inline struct cfg80211_bss * 427679420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 427779420f09SJohannes Berg struct ieee80211_channel *channel, 427879420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 427979420f09SJohannes Berg { 428079420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 42816eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 42826eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 428379420f09SJohannes Berg } 428479420f09SJohannes Berg 42854c0c0b75SJohannes Berg /** 42864c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 42875b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 42884c0c0b75SJohannes Berg * @bss: the BSS struct to reference 42894c0c0b75SJohannes Berg * 42904c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 42914c0c0b75SJohannes Berg */ 42925b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 42934c0c0b75SJohannes Berg 42944c0c0b75SJohannes Berg /** 42954c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 42965b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 42974c0c0b75SJohannes Berg * @bss: the BSS struct 42984c0c0b75SJohannes Berg * 42994c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 43004c0c0b75SJohannes Berg */ 43015b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4302d3236553SJohannes Berg 4303d491af19SJohannes Berg /** 4304d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4305d491af19SJohannes Berg * @wiphy: the wiphy 4306d491af19SJohannes Berg * @bss: the bss to remove 4307d491af19SJohannes Berg * 4308d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4309d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4310d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4311d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4312d491af19SJohannes Berg */ 4313d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4314fee52678SJohannes Berg 4315dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4316dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4317dcd6eac1SSimon Wunderlich { 4318dcd6eac1SSimon Wunderlich switch (chandef->width) { 4319dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4320dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4321dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4322dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4323dcd6eac1SSimon Wunderlich default: 4324dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4325dcd6eac1SSimon Wunderlich } 4326dcd6eac1SSimon Wunderlich } 4327dcd6eac1SSimon Wunderlich 43286039f6d2SJouni Malinen /** 43296ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 43306039f6d2SJouni Malinen * @dev: network device 43316039f6d2SJouni Malinen * @buf: authentication frame (header + body) 43326039f6d2SJouni Malinen * @len: length of the frame data 43336039f6d2SJouni Malinen * 43346ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 43356ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 43366ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 43376ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 43386ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 43396ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 43406ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 43416ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 43426ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 43436ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 43446ff57cf8SJohannes Berg * 43456ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 43466039f6d2SJouni Malinen */ 43476ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 43486039f6d2SJouni Malinen 43496039f6d2SJouni Malinen /** 43506ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 43511965c853SJouni Malinen * @dev: network device 43521965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4353cb0b4bebSJohannes Berg * 43548d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 43558d61ffa5SJohannes Berg * mutex. 43561965c853SJouni Malinen */ 43576ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 43581965c853SJouni Malinen 43591965c853SJouni Malinen /** 43606ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 43616039f6d2SJouni Malinen * @dev: network device 43626ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 43636ff57cf8SJohannes Berg * moves to cfg80211 in this call 43646ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 43656039f6d2SJouni Malinen * @len: length of the frame data 4366b0b6aa2cSEliad Peller * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a. 43676039f6d2SJouni Malinen * 43686ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 43696ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 43706ff57cf8SJohannes Berg * 43716ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 43726039f6d2SJouni Malinen */ 43736ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 43746ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4375b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4376b0b6aa2cSEliad Peller int uapsd_queues); 43776039f6d2SJouni Malinen 43786039f6d2SJouni Malinen /** 43796ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 43801965c853SJouni Malinen * @dev: network device 4381959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4382cb0b4bebSJohannes Berg * 43838d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 43841965c853SJouni Malinen */ 4385959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 43861965c853SJouni Malinen 43871965c853SJouni Malinen /** 43886ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 43896039f6d2SJouni Malinen * @dev: network device 43906ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 43916039f6d2SJouni Malinen * @len: length of the frame data 43926039f6d2SJouni Malinen * 43936039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 439453b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 43958d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 43968d61ffa5SJohannes Berg * corresponding wdev's mutex. 43976039f6d2SJouni Malinen */ 43986ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4399ce470613SHolger Schurig 4400ce470613SHolger Schurig /** 44016ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4402cf4e594eSJouni Malinen * @dev: network device 4403cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4404cf4e594eSJouni Malinen * @len: length of the frame data 4405cf4e594eSJouni Malinen * 44066ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 44076ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4408cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4409cf4e594eSJouni Malinen */ 44106ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 44116ff57cf8SJohannes Berg const u8 *buf, size_t len); 4412cf4e594eSJouni Malinen 4413cf4e594eSJouni Malinen /** 4414a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4415a3b8b056SJouni Malinen * @dev: network device 4416a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4417a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4418a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4419a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4420e6d6e342SJohannes Berg * @gfp: allocation flags 4421a3b8b056SJouni Malinen * 4422a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4423a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4424a3b8b056SJouni Malinen * primitive. 4425a3b8b056SJouni Malinen */ 4426a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4427a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4428e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4429a3b8b056SJouni Malinen 443004a773adSJohannes Berg /** 443104a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 443204a773adSJohannes Berg * 443304a773adSJohannes Berg * @dev: network device 443404a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4435fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 443604a773adSJohannes Berg * @gfp: allocation flags 443704a773adSJohannes Berg * 443804a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 443904a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 444004a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 444104a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 444204a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 444304a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 444404a773adSJohannes Berg */ 4445fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4446fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 444704a773adSJohannes Berg 44481f87f7d3SJohannes Berg /** 4449c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4450c93b5e71SJavier Cardona * 4451c93b5e71SJavier Cardona * @dev: network device 4452c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4453c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4454c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4455c93b5e71SJavier Cardona * @gfp: allocation flags 4456c93b5e71SJavier Cardona * 4457c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4458c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4459c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4460c93b5e71SJavier Cardona */ 4461c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4462c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4463c93b5e71SJavier Cardona 4464c93b5e71SJavier Cardona /** 4465d70e9693SJohannes Berg * DOC: RFkill integration 4466d70e9693SJohannes Berg * 4467d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4468d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4469d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4470d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4471d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4472d70e9693SJohannes Berg * 4473d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4474d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4475d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4476d70e9693SJohannes Berg */ 4477d70e9693SJohannes Berg 4478d70e9693SJohannes Berg /** 44791f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 44801f87f7d3SJohannes Berg * @wiphy: the wiphy 44811f87f7d3SJohannes Berg * @blocked: block status 44821f87f7d3SJohannes Berg */ 44831f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 44841f87f7d3SJohannes Berg 44851f87f7d3SJohannes Berg /** 44861f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 44871f87f7d3SJohannes Berg * @wiphy: the wiphy 44881f87f7d3SJohannes Berg */ 44891f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 44901f87f7d3SJohannes Berg 44911f87f7d3SJohannes Berg /** 44921f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 44931f87f7d3SJohannes Berg * @wiphy: the wiphy 44941f87f7d3SJohannes Berg */ 44951f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 44961f87f7d3SJohannes Berg 4497ad7e718cSJohannes Berg /** 4498ad7e718cSJohannes Berg * DOC: Vendor commands 4499ad7e718cSJohannes Berg * 4500ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4501ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4502ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4503ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4504ad7e718cSJohannes Berg * the configuration mechanism. 4505ad7e718cSJohannes Berg * 4506ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4507ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4508ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4509ad7e718cSJohannes Berg * 4510ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4511ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4512ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4513ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4514ad7e718cSJohannes Berg * managers etc. need. 4515ad7e718cSJohannes Berg */ 4516ad7e718cSJohannes Berg 4517ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4518ad7e718cSJohannes Berg enum nl80211_commands cmd, 4519ad7e718cSJohannes Berg enum nl80211_attrs attr, 4520ad7e718cSJohannes Berg int approxlen); 4521ad7e718cSJohannes Berg 4522567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 45236c09e791SAhmad Kholaif struct wireless_dev *wdev, 4524567ffc35SJohannes Berg enum nl80211_commands cmd, 4525567ffc35SJohannes Berg enum nl80211_attrs attr, 4526567ffc35SJohannes Berg int vendor_event_idx, 4527567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4528567ffc35SJohannes Berg 4529567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4530567ffc35SJohannes Berg 4531ad7e718cSJohannes Berg /** 4532ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4533ad7e718cSJohannes Berg * @wiphy: the wiphy 4534ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4535ad7e718cSJohannes Berg * be put into the skb 4536ad7e718cSJohannes Berg * 4537ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4538ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4539ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4540ad7e718cSJohannes Berg * 4541ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4542ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4543ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4544ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4545ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4546ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4547ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4548ad7e718cSJohannes Berg * 4549ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4550ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4551ad7e718cSJohannes Berg * 4552ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4553ad7e718cSJohannes Berg */ 4554ad7e718cSJohannes Berg static inline struct sk_buff * 4555ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4556ad7e718cSJohannes Berg { 4557ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4558ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4559ad7e718cSJohannes Berg } 4560ad7e718cSJohannes Berg 4561ad7e718cSJohannes Berg /** 4562ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4563ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4564ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4565ad7e718cSJohannes Berg * 4566ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4567ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4568ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4569ad7e718cSJohannes Berg * skb regardless of the return value. 4570ad7e718cSJohannes Berg * 4571ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4572ad7e718cSJohannes Berg */ 4573ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4574ad7e718cSJohannes Berg 4575567ffc35SJohannes Berg /** 4576567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4577567ffc35SJohannes Berg * @wiphy: the wiphy 45786c09e791SAhmad Kholaif * @wdev: the wireless device 4579567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4580567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4581567ffc35SJohannes Berg * be put into the skb 4582567ffc35SJohannes Berg * @gfp: allocation flags 4583567ffc35SJohannes Berg * 4584567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4585567ffc35SJohannes Berg * vendor-specific multicast group. 4586567ffc35SJohannes Berg * 45876c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 45886c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 45896c09e791SAhmad Kholaif * attribute. 45906c09e791SAhmad Kholaif * 4591567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4592567ffc35SJohannes Berg * skb to send the event. 4593567ffc35SJohannes Berg * 4594567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4595567ffc35SJohannes Berg */ 4596567ffc35SJohannes Berg static inline struct sk_buff * 45976c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 45986c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 4599567ffc35SJohannes Berg { 46006c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 4601567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4602567ffc35SJohannes Berg event_idx, approxlen, gfp); 4603567ffc35SJohannes Berg } 4604567ffc35SJohannes Berg 4605567ffc35SJohannes Berg /** 4606567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4607567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4608567ffc35SJohannes Berg * @gfp: allocation flags 4609567ffc35SJohannes Berg * 4610567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4611567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4612567ffc35SJohannes Berg */ 4613567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4614567ffc35SJohannes Berg { 4615567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4616567ffc35SJohannes Berg } 4617567ffc35SJohannes Berg 4618aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4619aff89a9bSJohannes Berg /** 4620d70e9693SJohannes Berg * DOC: Test mode 4621d70e9693SJohannes Berg * 4622d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4623d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4624d70e9693SJohannes Berg * factory programming. 4625d70e9693SJohannes Berg * 4626d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4627d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4628d70e9693SJohannes Berg */ 4629d70e9693SJohannes Berg 4630d70e9693SJohannes Berg /** 4631aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4632aff89a9bSJohannes Berg * @wiphy: the wiphy 4633aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4634aff89a9bSJohannes Berg * be put into the skb 4635aff89a9bSJohannes Berg * 4636aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4637aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4638aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4639aff89a9bSJohannes Berg * 46400ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 46410ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 46420ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 46430ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 46440ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 46450ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 46460ae997dcSYacine Belkadi * must not modify the skb in any other way. 4647aff89a9bSJohannes Berg * 4648aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4649aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 46500ae997dcSYacine Belkadi * 46510ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4652aff89a9bSJohannes Berg */ 4653ad7e718cSJohannes Berg static inline struct sk_buff * 4654ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4655ad7e718cSJohannes Berg { 4656ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4657ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4658ad7e718cSJohannes Berg } 4659aff89a9bSJohannes Berg 4660aff89a9bSJohannes Berg /** 4661aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4662aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4663aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4664aff89a9bSJohannes Berg * 46650ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 46660ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 46670ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 46680ae997dcSYacine Belkadi * regardless of the return value. 46690ae997dcSYacine Belkadi * 46700ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4671aff89a9bSJohannes Berg */ 4672ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4673ad7e718cSJohannes Berg { 4674ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4675ad7e718cSJohannes Berg } 4676aff89a9bSJohannes Berg 4677aff89a9bSJohannes Berg /** 4678aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4679aff89a9bSJohannes Berg * @wiphy: the wiphy 4680aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4681aff89a9bSJohannes Berg * be put into the skb 4682aff89a9bSJohannes Berg * @gfp: allocation flags 4683aff89a9bSJohannes Berg * 4684aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4685aff89a9bSJohannes Berg * testmode multicast group. 4686aff89a9bSJohannes Berg * 46870ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 46880ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 46890ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 46900ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 46910ae997dcSYacine Belkadi * in any other way. 4692aff89a9bSJohannes Berg * 4693aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4694aff89a9bSJohannes Berg * skb to send the event. 46950ae997dcSYacine Belkadi * 46960ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4697aff89a9bSJohannes Berg */ 4698567ffc35SJohannes Berg static inline struct sk_buff * 4699567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4700567ffc35SJohannes Berg { 47016c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 4702567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4703567ffc35SJohannes Berg approxlen, gfp); 4704567ffc35SJohannes Berg } 4705aff89a9bSJohannes Berg 4706aff89a9bSJohannes Berg /** 4707aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4708aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4709aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4710aff89a9bSJohannes Berg * @gfp: allocation flags 4711aff89a9bSJohannes Berg * 4712aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4713aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4714aff89a9bSJohannes Berg * consumes it. 4715aff89a9bSJohannes Berg */ 4716567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4717567ffc35SJohannes Berg { 4718567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4719567ffc35SJohannes Berg } 4720aff89a9bSJohannes Berg 4721aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 472271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4723aff89a9bSJohannes Berg #else 4724aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 472571063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 4726aff89a9bSJohannes Berg #endif 4727aff89a9bSJohannes Berg 4728b23aa676SSamuel Ortiz /** 4729e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 4730e7054989SKanchanapally, Vidyullatha * 4731e7054989SKanchanapally, Vidyullatha * @dev: network device 4732e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 4733e7054989SKanchanapally, Vidyullatha * @bss: entry of bss to which STA got connected to, can be obtained 4734e7054989SKanchanapally, Vidyullatha * through cfg80211_get_bss (may be %NULL) 4735e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 4736e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 4737e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 4738e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 4739e7054989SKanchanapally, Vidyullatha * @status: status code, 0 for successful connection, use 4740e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4741e7054989SKanchanapally, Vidyullatha * the real status code for failures. 4742e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 4743e7054989SKanchanapally, Vidyullatha * 4744e7054989SKanchanapally, Vidyullatha * It should be called by the underlying driver whenever connect() has 4745e7054989SKanchanapally, Vidyullatha * succeeded. This is similar to cfg80211_connect_result(), but with the 4746e7054989SKanchanapally, Vidyullatha * option of identifying the exact bss entry for the connection. Only one of 4747e7054989SKanchanapally, Vidyullatha * these functions should be called. 4748e7054989SKanchanapally, Vidyullatha */ 4749e7054989SKanchanapally, Vidyullatha void cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 4750e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 4751e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 4752bf1ecd21SJouni Malinen size_t resp_ie_len, int status, gfp_t gfp); 4753e7054989SKanchanapally, Vidyullatha 4754e7054989SKanchanapally, Vidyullatha /** 4755b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 4756b23aa676SSamuel Ortiz * 4757b23aa676SSamuel Ortiz * @dev: network device 4758b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 4759b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4760b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4761b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4762b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4763b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 4764b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4765b23aa676SSamuel Ortiz * the real status code for failures. 4766b23aa676SSamuel Ortiz * @gfp: allocation flags 4767b23aa676SSamuel Ortiz * 4768b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 4769b23aa676SSamuel Ortiz * succeeded. 4770b23aa676SSamuel Ortiz */ 4771e7054989SKanchanapally, Vidyullatha static inline void 4772e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 4773b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4774b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 4775e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 4776e7054989SKanchanapally, Vidyullatha { 4777e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 4778e7054989SKanchanapally, Vidyullatha resp_ie_len, status, gfp); 4779e7054989SKanchanapally, Vidyullatha } 4780b23aa676SSamuel Ortiz 4781b23aa676SSamuel Ortiz /** 4782bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 4783bf1ecd21SJouni Malinen * 4784bf1ecd21SJouni Malinen * @dev: network device 4785bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 4786bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 4787bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 4788bf1ecd21SJouni Malinen * @gfp: allocation flags 4789bf1ecd21SJouni Malinen * 4790bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 4791bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 4792bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 4793bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 4794bf1ecd21SJouni Malinen * waiting for the response. 4795bf1ecd21SJouni Malinen */ 4796bf1ecd21SJouni Malinen static inline void 4797bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 4798bf1ecd21SJouni Malinen const u8 *req_ie, size_t req_ie_len, gfp_t gfp) 4799bf1ecd21SJouni Malinen { 4800bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 4801bf1ecd21SJouni Malinen gfp); 4802bf1ecd21SJouni Malinen } 4803bf1ecd21SJouni Malinen 4804bf1ecd21SJouni Malinen /** 4805b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 4806b23aa676SSamuel Ortiz * 4807b23aa676SSamuel Ortiz * @dev: network device 4808ed9d0102SJouni Malinen * @channel: the channel of the new AP 4809b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 4810b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4811b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4812b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4813b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4814b23aa676SSamuel Ortiz * @gfp: allocation flags 4815b23aa676SSamuel Ortiz * 4816b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 4817b23aa676SSamuel Ortiz * from one AP to another while connected. 4818b23aa676SSamuel Ortiz */ 4819ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 4820ed9d0102SJouni Malinen struct ieee80211_channel *channel, 4821ed9d0102SJouni Malinen const u8 *bssid, 4822b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4823b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4824b23aa676SSamuel Ortiz 4825b23aa676SSamuel Ortiz /** 4826adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 4827adbde344SVasanthakumar Thiagarajan * 4828adbde344SVasanthakumar Thiagarajan * @dev: network device 4829adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 4830adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 4831adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 4832adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 4833adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 4834adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 4835adbde344SVasanthakumar Thiagarajan * 4836adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 4837adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 4838adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 4839adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 4840adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 4841adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 4842adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 4843adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 4844adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 4845adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 4846adbde344SVasanthakumar Thiagarajan */ 4847adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 4848adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 4849adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4850adbde344SVasanthakumar Thiagarajan 4851adbde344SVasanthakumar Thiagarajan /** 4852b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 4853b23aa676SSamuel Ortiz * 4854b23aa676SSamuel Ortiz * @dev: network device 4855b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 4856b23aa676SSamuel Ortiz * @ie_len: length of IEs 4857b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 485880279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 4859b23aa676SSamuel Ortiz * @gfp: allocation flags 4860b23aa676SSamuel Ortiz * 4861b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 4862b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 4863b23aa676SSamuel Ortiz */ 4864b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 486580279fb7SJohannes Berg const u8 *ie, size_t ie_len, 486680279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 4867b23aa676SSamuel Ortiz 48689588bbd5SJouni Malinen /** 48699588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 487071bbc994SJohannes Berg * @wdev: wireless device 48719588bbd5SJouni Malinen * @cookie: the request cookie 48729588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 48739588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 48749588bbd5SJouni Malinen * channel 48759588bbd5SJouni Malinen * @gfp: allocation flags 48769588bbd5SJouni Malinen */ 487771bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 48789588bbd5SJouni Malinen struct ieee80211_channel *chan, 48799588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 48809588bbd5SJouni Malinen 48819588bbd5SJouni Malinen /** 48829588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 488371bbc994SJohannes Berg * @wdev: wireless device 48849588bbd5SJouni Malinen * @cookie: the request cookie 48859588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 48869588bbd5SJouni Malinen * @gfp: allocation flags 48879588bbd5SJouni Malinen */ 488871bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 48899588bbd5SJouni Malinen struct ieee80211_channel *chan, 48909588bbd5SJouni Malinen gfp_t gfp); 4891b23aa676SSamuel Ortiz 489298b62183SJohannes Berg 489398b62183SJohannes Berg /** 489498b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 489598b62183SJohannes Berg * 489698b62183SJohannes Berg * @dev: the netdev 489798b62183SJohannes Berg * @mac_addr: the station's address 489898b62183SJohannes Berg * @sinfo: the station information 489998b62183SJohannes Berg * @gfp: allocation flags 490098b62183SJohannes Berg */ 490198b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 490298b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 490398b62183SJohannes Berg 4904026331c4SJouni Malinen /** 4905cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 4906cf5ead82SJohannes Berg * @dev: the netdev 4907cf5ead82SJohannes Berg * @mac_addr: the station's address 4908cf5ead82SJohannes Berg * @sinfo: the station information/statistics 4909cf5ead82SJohannes Berg * @gfp: allocation flags 4910cf5ead82SJohannes Berg */ 4911cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 4912cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 4913cf5ead82SJohannes Berg 4914cf5ead82SJohannes Berg /** 4915ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 4916ec15e68bSJouni Malinen * 4917ec15e68bSJouni Malinen * @dev: the netdev 4918ec15e68bSJouni Malinen * @mac_addr: the station's address 4919ec15e68bSJouni Malinen * @gfp: allocation flags 4920ec15e68bSJouni Malinen */ 4921cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 4922cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 4923cf5ead82SJohannes Berg { 4924cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 4925cf5ead82SJohannes Berg } 4926ec15e68bSJouni Malinen 4927ec15e68bSJouni Malinen /** 4928ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 4929ed44a951SPandiyarajan Pitchaimuthu * 4930ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 4931ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 4932ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 4933ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 4934ed44a951SPandiyarajan Pitchaimuthu * 4935ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 4936ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 4937ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 4938ed44a951SPandiyarajan Pitchaimuthu * 4939ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 4940ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 4941ed44a951SPandiyarajan Pitchaimuthu */ 4942ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 4943ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 4944ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 4945ed44a951SPandiyarajan Pitchaimuthu 4946ed44a951SPandiyarajan Pitchaimuthu /** 49472e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 494871bbc994SJohannes Berg * @wdev: wireless device receiving the frame 4949026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 4950804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 49512e161f78SJohannes Berg * @buf: Management frame (header + body) 4952026331c4SJouni Malinen * @len: length of the frame data 495319504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 49542e161f78SJohannes Berg * 49550ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 49560ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 49570ae997dcSYacine Belkadi * 49580ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 49592e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 49602e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 49612e161f78SJohannes Berg * driver is responsible for rejecting the frame. 4962026331c4SJouni Malinen */ 496371bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 4964970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 4965026331c4SJouni Malinen 4966026331c4SJouni Malinen /** 49672e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 496871bbc994SJohannes Berg * @wdev: wireless device receiving the frame 49692e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 49702e161f78SJohannes Berg * @buf: Management frame (header + body) 4971026331c4SJouni Malinen * @len: length of the frame data 4972026331c4SJouni Malinen * @ack: Whether frame was acknowledged 4973026331c4SJouni Malinen * @gfp: context flags 4974026331c4SJouni Malinen * 49752e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 49762e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 4977026331c4SJouni Malinen * transmission attempt. 4978026331c4SJouni Malinen */ 497971bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 4980026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 4981026331c4SJouni Malinen 4982d6dc1a38SJuuso Oikarinen 4983d6dc1a38SJuuso Oikarinen /** 4984d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 4985d6dc1a38SJuuso Oikarinen * @dev: network device 4986d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 4987d6dc1a38SJuuso Oikarinen * @gfp: context flags 4988d6dc1a38SJuuso Oikarinen * 4989d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 4990d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 4991d6dc1a38SJuuso Oikarinen */ 4992d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 4993d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 4994d6dc1a38SJuuso Oikarinen gfp_t gfp); 4995d6dc1a38SJuuso Oikarinen 4996c063dbf5SJohannes Berg /** 4997c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 4998c063dbf5SJohannes Berg * @dev: network device 4999c063dbf5SJohannes Berg * @peer: peer's MAC address 5000c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 5001c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 5002c063dbf5SJohannes Berg * threshold (to account for temporary interference) 5003c063dbf5SJohannes Berg * @gfp: context flags 5004c063dbf5SJohannes Berg */ 5005c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 5006c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 5007c063dbf5SJohannes Berg 5008e5497d76SJohannes Berg /** 500984f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 501084f10708SThomas Pedersen * @dev: network device 501184f10708SThomas Pedersen * @peer: peer's MAC address 501284f10708SThomas Pedersen * @num_packets: how many packets were lost 501384f10708SThomas Pedersen * @rate: % of packets which failed transmission 501484f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 501584f10708SThomas Pedersen * @gfp: context flags 501684f10708SThomas Pedersen * 501784f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 501884f10708SThomas Pedersen * given interval is exceeded. 501984f10708SThomas Pedersen */ 502084f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 502184f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 502284f10708SThomas Pedersen 502384f10708SThomas Pedersen /** 502498f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 502598f03342SJohannes Berg * @dev: network device 502698f03342SJohannes Berg * @gfp: context flags 502798f03342SJohannes Berg * 502898f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 502998f03342SJohannes Berg */ 503098f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 503198f03342SJohannes Berg 503298f03342SJohannes Berg /** 50335b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 50345b97f49dSJohannes Berg * @wiphy: the wiphy 50355b97f49dSJohannes Berg * @chandef: chandef for the current channel 50365b97f49dSJohannes Berg * @gfp: context flags 50375b97f49dSJohannes Berg * 50385b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 50395b97f49dSJohannes Berg */ 50405b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 50415b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 50425b97f49dSJohannes Berg 50435b97f49dSJohannes Berg /** 50445b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 50455b97f49dSJohannes Berg * @netdev: network device 50465b97f49dSJohannes Berg * @chandef: chandef for the current channel 50475b97f49dSJohannes Berg * @event: type of event 50485b97f49dSJohannes Berg * @gfp: context flags 50495b97f49dSJohannes Berg * 50505b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 50515b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 50525b97f49dSJohannes Berg * also by full-MAC drivers. 50535b97f49dSJohannes Berg */ 50545b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 50555b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 50565b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 50575b97f49dSJohannes Berg 50585b97f49dSJohannes Berg 50595b97f49dSJohannes Berg /** 5060e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 5061e5497d76SJohannes Berg * @dev: network device 5062e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 5063e5497d76SJohannes Berg * @replay_ctr: new replay counter 5064af71ff85SJohannes Berg * @gfp: allocation flags 5065e5497d76SJohannes Berg */ 5066e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 5067e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 5068e5497d76SJohannes Berg 5069c9df56b4SJouni Malinen /** 5070c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 5071c9df56b4SJouni Malinen * @dev: network device 5072c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 5073c9df56b4SJouni Malinen * @bssid: BSSID of AP 5074c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 5075c9df56b4SJouni Malinen * @gfp: allocation flags 5076c9df56b4SJouni Malinen */ 5077c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 5078c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 5079c9df56b4SJouni Malinen 508028946da7SJohannes Berg /** 508128946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 508228946da7SJohannes Berg * @dev: The device the frame matched to 508328946da7SJohannes Berg * @addr: the transmitter address 508428946da7SJohannes Berg * @gfp: context flags 508528946da7SJohannes Berg * 508628946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 508728946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 508828946da7SJohannes Berg * sender. 50890ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 509028946da7SJohannes Berg * for a reason other than not having a subscription.) 509128946da7SJohannes Berg */ 509228946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 509328946da7SJohannes Berg const u8 *addr, gfp_t gfp); 509428946da7SJohannes Berg 50957f6cf311SJohannes Berg /** 5096b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 5097b92ab5d8SJohannes Berg * @dev: The device the frame matched to 5098b92ab5d8SJohannes Berg * @addr: the transmitter address 5099b92ab5d8SJohannes Berg * @gfp: context flags 5100b92ab5d8SJohannes Berg * 5101b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 5102b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 5103b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 5104b92ab5d8SJohannes Berg * station to avoid event flooding. 51050ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 5106b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 5107b92ab5d8SJohannes Berg */ 5108b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 5109b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 5110b92ab5d8SJohannes Berg 5111b92ab5d8SJohannes Berg /** 51127f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 51137f6cf311SJohannes Berg * @dev: the device the probe was sent on 51147f6cf311SJohannes Berg * @addr: the address of the peer 51157f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 51167f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 51177f6cf311SJohannes Berg * @gfp: allocation flags 51187f6cf311SJohannes Berg */ 51197f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 51207f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 51217f6cf311SJohannes Berg 51225e760230SJohannes Berg /** 51235e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 51245e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 51255e760230SJohannes Berg * @frame: the frame 51265e760230SJohannes Berg * @len: length of the frame 51275e760230SJohannes Berg * @freq: frequency the frame was received on 5128804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 51295e760230SJohannes Berg * 51305e760230SJohannes Berg * Use this function to report to userspace when a beacon was 51315e760230SJohannes Berg * received. It is not useful to call this when there is no 51325e760230SJohannes Berg * netdev that is in AP/GO mode. 51335e760230SJohannes Berg */ 51345e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 51355e760230SJohannes Berg const u8 *frame, size_t len, 513637c73b5fSBen Greear int freq, int sig_dbm); 51375e760230SJohannes Berg 5138d58e7e37SJohannes Berg /** 5139683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 514054858ee5SAlexander Simon * @wiphy: the wiphy 5141683b6d3bSJohannes Berg * @chandef: the channel definition 5142174e0cd2SIlan Peer * @iftype: interface type 5143d58e7e37SJohannes Berg * 51440ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 51450ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 514654858ee5SAlexander Simon */ 5147683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 5148174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 5149174e0cd2SIlan Peer enum nl80211_iftype iftype); 515054858ee5SAlexander Simon 5151923b352fSArik Nemtsov /** 5152923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 5153923b352fSArik Nemtsov * @wiphy: the wiphy 5154923b352fSArik Nemtsov * @chandef: the channel definition 5155923b352fSArik Nemtsov * @iftype: interface type 5156923b352fSArik Nemtsov * 5157923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 5158923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 5159923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 5160923b352fSArik Nemtsov * more permissive conditions. 5161923b352fSArik Nemtsov * 5162923b352fSArik Nemtsov * Requires the RTNL to be held. 5163923b352fSArik Nemtsov */ 5164923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 5165923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 5166923b352fSArik Nemtsov enum nl80211_iftype iftype); 5167923b352fSArik Nemtsov 51688097e149SThomas Pedersen /* 51695314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 51705314526bSThomas Pedersen * @dev: the device which switched channels 5171683b6d3bSJohannes Berg * @chandef: the new channel definition 51725314526bSThomas Pedersen * 5173e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 5174e487eaebSSimon Wunderlich * driver context! 51755314526bSThomas Pedersen */ 5176683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 5177683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 51785314526bSThomas Pedersen 5179f8d7552eSLuciano Coelho /* 5180f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 5181f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 5182f8d7552eSLuciano Coelho * @chandef: the future channel definition 5183f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 5184f8d7552eSLuciano Coelho * 5185f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 5186f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 5187f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 5188f8d7552eSLuciano Coelho */ 5189f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 5190f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 5191f8d7552eSLuciano Coelho u8 count); 5192f8d7552eSLuciano Coelho 51931ce3e82bSJohannes Berg /** 51941ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 51951ce3e82bSJohannes Berg * 51961ce3e82bSJohannes Berg * @operating_class: the operating class to convert 51971ce3e82bSJohannes Berg * @band: band pointer to fill 51981ce3e82bSJohannes Berg * 51991ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 52001ce3e82bSJohannes Berg */ 52011ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 520257fbcce3SJohannes Berg enum nl80211_band *band); 52031ce3e82bSJohannes Berg 5204a38700ddSArik Nemtsov /** 5205a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 5206a38700ddSArik Nemtsov * 5207a38700ddSArik Nemtsov * @chandef: the chandef to convert 5208a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 5209a38700ddSArik Nemtsov * 5210a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 5211a38700ddSArik Nemtsov */ 5212a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 5213a38700ddSArik Nemtsov u8 *op_class); 5214a38700ddSArik Nemtsov 52155314526bSThomas Pedersen /* 52163475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 52173475b094SJouni Malinen * @dev: the device on which the operation is requested 52183475b094SJouni Malinen * @peer: the MAC address of the peer device 52193475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 52203475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 52213475b094SJouni Malinen * @reason_code: the reason code for teardown request 52223475b094SJouni Malinen * @gfp: allocation flags 52233475b094SJouni Malinen * 52243475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 52253475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 52263475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 52273475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 52283475b094SJouni Malinen * based on traffic and signal strength for a peer). 52293475b094SJouni Malinen */ 52303475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 52313475b094SJouni Malinen enum nl80211_tdls_operation oper, 52323475b094SJouni Malinen u16 reason_code, gfp_t gfp); 52333475b094SJouni Malinen 52343475b094SJouni Malinen /* 52358097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 52368097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 52378097e149SThomas Pedersen * 52388097e149SThomas Pedersen * return 0 if MCS index >= 32 52398097e149SThomas Pedersen */ 52408eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 52418097e149SThomas Pedersen 524298104fdeSJohannes Berg /** 524398104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 524498104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 524598104fdeSJohannes Berg * 524698104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 524798104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 524898104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 524998104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 525098104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 525198104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 525298104fdeSJohannes Berg * when the device is unbound from the driver. 525398104fdeSJohannes Berg * 525498104fdeSJohannes Berg * Requires the RTNL to be held. 525598104fdeSJohannes Berg */ 525698104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 525798104fdeSJohannes Berg 52580ee45355SJohannes Berg /** 5259355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 5260355199e0SJouni Malinen * @ies: FT IEs 5261355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 5262355199e0SJouni Malinen * @target_ap: target AP's MAC address 5263355199e0SJouni Malinen * @ric_ies: RIC IE 5264355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 5265355199e0SJouni Malinen */ 5266355199e0SJouni Malinen struct cfg80211_ft_event_params { 5267355199e0SJouni Malinen const u8 *ies; 5268355199e0SJouni Malinen size_t ies_len; 5269355199e0SJouni Malinen const u8 *target_ap; 5270355199e0SJouni Malinen const u8 *ric_ies; 5271355199e0SJouni Malinen size_t ric_ies_len; 5272355199e0SJouni Malinen }; 5273355199e0SJouni Malinen 5274355199e0SJouni Malinen /** 5275355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 5276355199e0SJouni Malinen * @netdev: network device 5277355199e0SJouni Malinen * @ft_event: IE information 5278355199e0SJouni Malinen */ 5279355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 5280355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 5281355199e0SJouni Malinen 5282355199e0SJouni Malinen /** 52830ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 52840ee45355SJohannes Berg * @ies: the input IE buffer 52850ee45355SJohannes Berg * @len: the input length 52860ee45355SJohannes Berg * @attr: the attribute ID to find 52870ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 52880ee45355SJohannes Berg * if the function is only called to get the needed buffer size 52890ee45355SJohannes Berg * @bufsize: size of the output buffer 52900ee45355SJohannes Berg * 52910ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 52920ee45355SJohannes Berg * copies its contents to the given buffer. 52930ee45355SJohannes Berg * 52940ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 52950ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 52960ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 52970ee45355SJohannes Berg */ 5298c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 5299c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 5300c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 53010ee45355SJohannes Berg 5302cd8f7cb4SJohannes Berg /** 530329464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 530429464cccSJohannes Berg * @ies: the IE buffer 530529464cccSJohannes Berg * @ielen: the length of the IE buffer 530629464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 530729464cccSJohannes Berg * the split 530829464cccSJohannes Berg * @n_ids: the size of the element ID array 530929464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 531029464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 531129464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 531229464cccSJohannes Berg * 531329464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 531429464cccSJohannes Berg * variable to point to the location where the buffer should be 531529464cccSJohannes Berg * split. 531629464cccSJohannes Berg * 531729464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 531829464cccSJohannes Berg * has to be guaranteed by the caller! 531929464cccSJohannes Berg * 532029464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 532129464cccSJohannes Berg * correctly, if not the result of using this function will not 532229464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 532329464cccSJohannes Berg * 532429464cccSJohannes Berg * The function returns the offset where the next part of the 532529464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 532629464cccSJohannes Berg * of the buffer should be used. 532729464cccSJohannes Berg */ 532829464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 532929464cccSJohannes Berg const u8 *ids, int n_ids, 533029464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 533129464cccSJohannes Berg size_t offset); 533229464cccSJohannes Berg 533329464cccSJohannes Berg /** 533429464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 533529464cccSJohannes Berg * @ies: the IE buffer 533629464cccSJohannes Berg * @ielen: the length of the IE buffer 533729464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 533829464cccSJohannes Berg * the split 533929464cccSJohannes Berg * @n_ids: the size of the element ID array 534029464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 534129464cccSJohannes Berg * 534229464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 534329464cccSJohannes Berg * variable to point to the location where the buffer should be 534429464cccSJohannes Berg * split. 534529464cccSJohannes Berg * 534629464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 534729464cccSJohannes Berg * has to be guaranteed by the caller! 534829464cccSJohannes Berg * 534929464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 535029464cccSJohannes Berg * correctly, if not the result of using this function will not 535129464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 535229464cccSJohannes Berg * 535329464cccSJohannes Berg * The function returns the offset where the next part of the 535429464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 535529464cccSJohannes Berg * of the buffer should be used. 535629464cccSJohannes Berg */ 53570483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 53580483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 53590483eeacSJohannes Berg { 53600483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 53610483eeacSJohannes Berg } 536229464cccSJohannes Berg 536329464cccSJohannes Berg /** 5364cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 5365cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 5366cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 5367cd8f7cb4SJohannes Berg * @gfp: allocation flags 5368cd8f7cb4SJohannes Berg * 5369cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 5370cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 5371cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 5372cd8f7cb4SJohannes Berg * else caused the wakeup. 5373cd8f7cb4SJohannes Berg */ 5374cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 5375cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 5376cd8f7cb4SJohannes Berg gfp_t gfp); 5377cd8f7cb4SJohannes Berg 53785de17984SArend van Spriel /** 53795de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 53805de17984SArend van Spriel * 53815de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 538203f831a6SRobert P. J. Day * @gfp: allocation flags 53835de17984SArend van Spriel * 53845de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 53855de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 53865de17984SArend van Spriel * by .crit_proto_start() has expired. 53875de17984SArend van Spriel */ 53885de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 53895de17984SArend van Spriel 5390bdfbec2dSIlan Peer /** 5391bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 5392bdfbec2dSIlan Peer * @wiphy: the wiphy 5393bdfbec2dSIlan Peer * 5394bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 5395bdfbec2dSIlan Peer */ 5396bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 5397bdfbec2dSIlan Peer 5398cb2d956dSLuciano Coelho /** 5399cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 5400cb2d956dSLuciano Coelho * 5401cb2d956dSLuciano Coelho * @wiphy: the wiphy 5402cb2d956dSLuciano Coelho * @num_different_channels: the number of different channels we want 5403cb2d956dSLuciano Coelho * to use for verification 5404cb2d956dSLuciano Coelho * @radar_detect: a bitmap where each bit corresponds to a channel 5405cb2d956dSLuciano Coelho * width where radar detection is needed, as in the definition of 5406cb2d956dSLuciano Coelho * &struct ieee80211_iface_combination.@radar_detect_widths 5407cb2d956dSLuciano Coelho * @iftype_num: array with the numbers of interfaces of each interface 5408cb2d956dSLuciano Coelho * type. The index is the interface type as specified in &enum 5409cb2d956dSLuciano Coelho * nl80211_iftype. 5410cb2d956dSLuciano Coelho * 5411cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 5412cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 5413cb2d956dSLuciano Coelho * the interface combinations. 5414cb2d956dSLuciano Coelho */ 5415cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 5416cb2d956dSLuciano Coelho const int num_different_channels, 5417cb2d956dSLuciano Coelho const u8 radar_detect, 5418cb2d956dSLuciano Coelho const int iftype_num[NUM_NL80211_IFTYPES]); 5419cb2d956dSLuciano Coelho 542065a124ddSMichal Kazior /** 542165a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 542265a124ddSMichal Kazior * 542365a124ddSMichal Kazior * @wiphy: the wiphy 542465a124ddSMichal Kazior * @num_different_channels: the number of different channels we want 542565a124ddSMichal Kazior * to use for verification 542665a124ddSMichal Kazior * @radar_detect: a bitmap where each bit corresponds to a channel 542765a124ddSMichal Kazior * width where radar detection is needed, as in the definition of 542865a124ddSMichal Kazior * &struct ieee80211_iface_combination.@radar_detect_widths 542965a124ddSMichal Kazior * @iftype_num: array with the numbers of interfaces of each interface 543065a124ddSMichal Kazior * type. The index is the interface type as specified in &enum 543165a124ddSMichal Kazior * nl80211_iftype. 543265a124ddSMichal Kazior * @iter: function to call for each matching combination 543365a124ddSMichal Kazior * @data: pointer to pass to iter function 543465a124ddSMichal Kazior * 543565a124ddSMichal Kazior * This function can be called by the driver to check what possible 543665a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 543765a124ddSMichal Kazior * purposes. 543865a124ddSMichal Kazior */ 543965a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 544065a124ddSMichal Kazior const int num_different_channels, 544165a124ddSMichal Kazior const u8 radar_detect, 544265a124ddSMichal Kazior const int iftype_num[NUM_NL80211_IFTYPES], 544365a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 544465a124ddSMichal Kazior void *data), 544565a124ddSMichal Kazior void *data); 544665a124ddSMichal Kazior 5447f04c2203SMichal Kazior /* 5448f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 5449f04c2203SMichal Kazior * 5450f04c2203SMichal Kazior * @wiphy: the wiphy 5451f04c2203SMichal Kazior * @wdev: wireless device 5452f04c2203SMichal Kazior * @gfp: context flags 5453f04c2203SMichal Kazior * 5454f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 5455f04c2203SMichal Kazior * disconnected. 5456f04c2203SMichal Kazior * 5457f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 5458f04c2203SMichal Kazior */ 5459f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 5460f04c2203SMichal Kazior gfp_t gfp); 5461f04c2203SMichal Kazior 5462f6837ba8SJohannes Berg /** 5463f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 5464f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 5465f6837ba8SJohannes Berg * 5466f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 5467f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 5468f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 5469f6837ba8SJohannes Berg * that really can't be recovered in any other way. 5470f6837ba8SJohannes Berg * 5471f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 5472f6837ba8SJohannes Berg * the driver while the function is running. 5473f6837ba8SJohannes Berg */ 5474f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5475f6837ba8SJohannes Berg 5476d75bb06bSGautam Kumar Shukla /** 5477d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 5478d75bb06bSGautam Kumar Shukla * 5479d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5480d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5481d75bb06bSGautam Kumar Shukla * 5482d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5483d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5484d75bb06bSGautam Kumar Shukla */ 5485d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 5486d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5487d75bb06bSGautam Kumar Shukla { 5488d75bb06bSGautam Kumar Shukla u8 *ft_byte; 5489d75bb06bSGautam Kumar Shukla 5490d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 5491d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 5492d75bb06bSGautam Kumar Shukla } 5493d75bb06bSGautam Kumar Shukla 5494d75bb06bSGautam Kumar Shukla /** 5495d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 5496d75bb06bSGautam Kumar Shukla * 5497d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5498d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5499d75bb06bSGautam Kumar Shukla * 5500d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5501d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5502d75bb06bSGautam Kumar Shukla */ 5503d75bb06bSGautam Kumar Shukla static inline bool 5504d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 5505d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5506d75bb06bSGautam Kumar Shukla { 5507d75bb06bSGautam Kumar Shukla u8 ft_byte; 5508d75bb06bSGautam Kumar Shukla 5509d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 5510d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 5511d75bb06bSGautam Kumar Shukla } 5512b7ffbd7eSJohannes Berg 5513b7ffbd7eSJohannes Berg /* ethtool helper */ 5514b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 5515b7ffbd7eSJohannes Berg 5516e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 5517e1db74fcSJoe Perches 5518e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 5519e1db74fcSJoe Perches 5520e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 55219c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 5522e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 55239c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 5524e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 55259c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 5526e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 55279c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 5528e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 55299c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 5530e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 55319c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 5532e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 55339c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 5534e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 55359c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 5536073730d7SJoe Perches 55379c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 5538e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 55399c376639SJoe Perches 5540e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 55419c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 5542e1db74fcSJoe Perches 5543e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 5544e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 5545e1db74fcSJoe Perches #else 5546e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 5547e1db74fcSJoe Perches ({ \ 5548e1db74fcSJoe Perches if (0) \ 5549e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 5550e1db74fcSJoe Perches 0; \ 5551e1db74fcSJoe Perches }) 5552e1db74fcSJoe Perches #endif 5553e1db74fcSJoe Perches 5554e1db74fcSJoe Perches /* 5555e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5556e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5557e1db74fcSJoe Perches * file/line information and a backtrace. 5558e1db74fcSJoe Perches */ 5559e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5560e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5561e1db74fcSJoe Perches 5562704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5563