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 8b8676221SDavid Spinadel * Copyright 2015-2016 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 596b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS 4 597b8676221SDavid Spinadel 59861fa713cSHolger Schurig /** 5995fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 6005fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 6015fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 6025fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 6035fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 6045fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 6055fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 6065fb628e9SJouni Malinen * @akm_suites: AKM suites 6075fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 6085fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 6095fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 6105fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 6115fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 6125fb628e9SJouni Malinen * allowed through even on unauthorized ports 6135fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 6145fb628e9SJouni Malinen * protocol frames. 615b8676221SDavid Spinadel * @wep_keys: static WEP keys, if not NULL points to an array of 616b8676221SDavid Spinadel * CFG80211_MAX_WEP_KEYS WEP keys 617b8676221SDavid Spinadel * @wep_tx_key: key index (0..3) of the default TX static WEP key 6185fb628e9SJouni Malinen */ 6195fb628e9SJouni Malinen struct cfg80211_crypto_settings { 6205fb628e9SJouni Malinen u32 wpa_versions; 6215fb628e9SJouni Malinen u32 cipher_group; 6225fb628e9SJouni Malinen int n_ciphers_pairwise; 6235fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 6245fb628e9SJouni Malinen int n_akm_suites; 6255fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 6265fb628e9SJouni Malinen bool control_port; 6275fb628e9SJouni Malinen __be16 control_port_ethertype; 6285fb628e9SJouni Malinen bool control_port_no_encrypt; 629b8676221SDavid Spinadel struct key_params *wep_keys; 630b8676221SDavid Spinadel int wep_tx_key; 6315fb628e9SJouni Malinen }; 6325fb628e9SJouni Malinen 6335fb628e9SJouni Malinen /** 6348860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 635ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 636ed1b6cc7SJohannes Berg * or %NULL if not changed 637ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 638ed1b6cc7SJohannes Berg * or %NULL if not changed 639ed1b6cc7SJohannes Berg * @head_len: length of @head 640ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6419946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6429946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6439946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6449946ecfbSJouni Malinen * frames or %NULL 6459946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6469946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6479946ecfbSJouni Malinen * Response frames or %NULL 6489946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 64900f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 65000f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 651ed1b6cc7SJohannes Berg */ 6528860020eSJohannes Berg struct cfg80211_beacon_data { 6538860020eSJohannes Berg const u8 *head, *tail; 6548860020eSJohannes Berg const u8 *beacon_ies; 6558860020eSJohannes Berg const u8 *proberesp_ies; 6568860020eSJohannes Berg const u8 *assocresp_ies; 6578860020eSJohannes Berg const u8 *probe_resp; 6588860020eSJohannes Berg 6598860020eSJohannes Berg size_t head_len, tail_len; 6608860020eSJohannes Berg size_t beacon_ies_len; 6618860020eSJohannes Berg size_t proberesp_ies_len; 6628860020eSJohannes Berg size_t assocresp_ies_len; 6638860020eSJohannes Berg size_t probe_resp_len; 6648860020eSJohannes Berg }; 6658860020eSJohannes Berg 6666d45a74bSVasanthakumar Thiagarajan struct mac_address { 6676d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 6686d45a74bSVasanthakumar Thiagarajan }; 6696d45a74bSVasanthakumar Thiagarajan 6708860020eSJohannes Berg /** 67177765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 67277765eafSVasanthakumar Thiagarajan * 67377765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 674077f897aSJohannes Berg * entry specified by mac_addr 67577765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 67677765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 67777765eafSVasanthakumar Thiagarajan */ 67877765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 67977765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 68077765eafSVasanthakumar Thiagarajan int n_acl_entries; 68177765eafSVasanthakumar Thiagarajan 68277765eafSVasanthakumar Thiagarajan /* Keep it last */ 68377765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 68477765eafSVasanthakumar Thiagarajan }; 68577765eafSVasanthakumar Thiagarajan 686a7c7fbffSPurushottam Kushwaha /* 687a7c7fbffSPurushottam Kushwaha * cfg80211_bitrate_mask - masks for bitrate control 688a7c7fbffSPurushottam Kushwaha */ 689a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask { 690a7c7fbffSPurushottam Kushwaha struct { 691a7c7fbffSPurushottam Kushwaha u32 legacy; 692a7c7fbffSPurushottam Kushwaha u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 693a7c7fbffSPurushottam Kushwaha u16 vht_mcs[NL80211_VHT_NSS_MAX]; 694a7c7fbffSPurushottam Kushwaha enum nl80211_txrate_gi gi; 695a7c7fbffSPurushottam Kushwaha } control[NUM_NL80211_BANDS]; 696a7c7fbffSPurushottam Kushwaha }; 697a7c7fbffSPurushottam Kushwaha 6988860020eSJohannes Berg /** 6998860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 7008860020eSJohannes Berg * 7018860020eSJohannes Berg * Used to configure an AP interface. 7028860020eSJohannes Berg * 703683b6d3bSJohannes Berg * @chandef: defines the channel to use 7048860020eSJohannes Berg * @beacon: beacon data 7058860020eSJohannes Berg * @beacon_interval: beacon interval 7068860020eSJohannes Berg * @dtim_period: DTIM period 7078860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 7088860020eSJohannes Berg * user space) 7098860020eSJohannes Berg * @ssid_len: length of @ssid 7108860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 7118860020eSJohannes Berg * @crypto: crypto settings 7128860020eSJohannes Berg * @privacy: the BSS uses privacy 7138860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 71418998c38SEliad Peller * @smps_mode: SMPS mode 7151b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 71653cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 71753cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 71877765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 71977765eafSVasanthakumar Thiagarajan * MAC address based access control 72034d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 72134d50519SLior David * networks. 7228564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 7238860020eSJohannes Berg */ 7248860020eSJohannes Berg struct cfg80211_ap_settings { 725683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 726aa430da4SJohannes Berg 7278860020eSJohannes Berg struct cfg80211_beacon_data beacon; 7288860020eSJohannes Berg 7298860020eSJohannes Berg int beacon_interval, dtim_period; 73032e9de84SJouni Malinen const u8 *ssid; 73132e9de84SJouni Malinen size_t ssid_len; 73232e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 7335fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 7345fb628e9SJouni Malinen bool privacy; 7355fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 73618998c38SEliad Peller enum nl80211_smps_mode smps_mode; 7371b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 73853cabad7SJohannes Berg u8 p2p_ctwindow; 73953cabad7SJohannes Berg bool p2p_opp_ps; 74077765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 74134d50519SLior David bool pbss; 742a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask beacon_rate; 743ed1b6cc7SJohannes Berg }; 744ed1b6cc7SJohannes Berg 7455727ef1bSJohannes Berg /** 74616ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 74716ef1fe2SSimon Wunderlich * 74816ef1fe2SSimon Wunderlich * Used for channel switch 74916ef1fe2SSimon Wunderlich * 75016ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 75116ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7529a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7539a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7549a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7559a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 75616ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 75716ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 75816ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 75916ef1fe2SSimon Wunderlich * @count: number of beacons until switch 76016ef1fe2SSimon Wunderlich */ 76116ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 76216ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 76316ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 7649a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 7659a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 7669a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 7679a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 76816ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 76916ef1fe2SSimon Wunderlich bool radar_required; 77016ef1fe2SSimon Wunderlich bool block_tx; 77116ef1fe2SSimon Wunderlich u8 count; 77216ef1fe2SSimon Wunderlich }; 77316ef1fe2SSimon Wunderlich 77416ef1fe2SSimon Wunderlich /** 775e227300cSPurushottam Kushwaha * struct iface_combination_params - input parameters for interface combinations 776e227300cSPurushottam Kushwaha * 777e227300cSPurushottam Kushwaha * Used to pass interface combination parameters 778e227300cSPurushottam Kushwaha * 779e227300cSPurushottam Kushwaha * @num_different_channels: the number of different channels we want 780e227300cSPurushottam Kushwaha * to use for verification 781e227300cSPurushottam Kushwaha * @radar_detect: a bitmap where each bit corresponds to a channel 782e227300cSPurushottam Kushwaha * width where radar detection is needed, as in the definition of 783e227300cSPurushottam Kushwaha * &struct ieee80211_iface_combination.@radar_detect_widths 784e227300cSPurushottam Kushwaha * @iftype_num: array with the number of interfaces of each interface 785e227300cSPurushottam Kushwaha * type. The index is the interface type as specified in &enum 786e227300cSPurushottam Kushwaha * nl80211_iftype. 7874c8dea63SJohannes Berg * @new_beacon_int: set this to the beacon interval of a new interface 7884c8dea63SJohannes Berg * that's not operating yet, if such is to be checked as part of 7894c8dea63SJohannes Berg * the verification 790e227300cSPurushottam Kushwaha */ 791e227300cSPurushottam Kushwaha struct iface_combination_params { 792e227300cSPurushottam Kushwaha int num_different_channels; 793e227300cSPurushottam Kushwaha u8 radar_detect; 794e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 7954c8dea63SJohannes Berg u32 new_beacon_int; 796e227300cSPurushottam Kushwaha }; 797e227300cSPurushottam Kushwaha 798e227300cSPurushottam Kushwaha /** 7993b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 8003b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 8019d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 802f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 8033b9ce80cSJohannes Berg * 8043b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 8053b9ce80cSJohannes Berg * for those that don't these flags will are used. 8063b9ce80cSJohannes Berg */ 8073b9ce80cSJohannes Berg enum station_parameters_apply_mask { 8083b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 8099d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 810f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 8113b9ce80cSJohannes Berg }; 8123b9ce80cSJohannes Berg 8133b9ce80cSJohannes Berg /** 8145727ef1bSJohannes Berg * struct station_parameters - station parameters 8155727ef1bSJohannes Berg * 8165727ef1bSJohannes Berg * Used to change and create a new station. 8175727ef1bSJohannes Berg * 8185727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 8195727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 8205727ef1bSJohannes Berg * (or NULL for no change) 8215727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 822eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 823eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 824eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 825eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 8265727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 8275727ef1bSJohannes Berg * @aid: AID or zero for no change 8287d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 829abe37c4bSJohannes Berg * @plink_action: plink action to take 8309c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 831abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 832f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 833910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 834910868dbSEliad Peller * as the AC bitmap in the QoS info field 835910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 836910868dbSEliad Peller * QoS info field (but already shifted down) 837c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 838c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 839c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 8403b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 8413b1c5a53SMarco Porsch * to unknown) 8429d62a986SJouni Malinen * @capability: station capability 8439d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 8449d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 845c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 846c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 847c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 848c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 84960f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 85060f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 85117b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 8525727ef1bSJohannes Berg */ 8535727ef1bSJohannes Berg struct station_parameters { 8542c1aabf3SJohannes Berg const u8 *supported_rates; 8555727ef1bSJohannes Berg struct net_device *vlan; 856eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 8573b9ce80cSJohannes Berg u32 sta_modify_mask; 8585727ef1bSJohannes Berg int listen_interval; 8595727ef1bSJohannes Berg u16 aid; 8607d27a0baSMasashi Honma u16 peer_aid; 8615727ef1bSJohannes Berg u8 supported_rates_len; 8622ec600d6SLuis Carlos Cobo u8 plink_action; 8639c3990aaSJavier Cardona u8 plink_state; 8642c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 8652c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 866c75786c9SEliad Peller u8 uapsd_queues; 867c75786c9SEliad Peller u8 max_sp; 8683b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 8699d62a986SJouni Malinen u16 capability; 8702c1aabf3SJohannes Berg const u8 *ext_capab; 8719d62a986SJouni Malinen u8 ext_capab_len; 872c01fc9adSSunil Dutt const u8 *supported_channels; 873c01fc9adSSunil Dutt u8 supported_channels_len; 874c01fc9adSSunil Dutt const u8 *supported_oper_classes; 875c01fc9adSSunil Dutt u8 supported_oper_classes_len; 87660f4a7b1SMarek Kwaczynski u8 opmode_notif; 87760f4a7b1SMarek Kwaczynski bool opmode_notif_used; 87817b94247SAyala Beker int support_p2p_ps; 8795727ef1bSJohannes Berg }; 8805727ef1bSJohannes Berg 881fd5b74dcSJohannes Berg /** 88289c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 88389c771e5SJouni Malinen * 88489c771e5SJouni Malinen * Used to delete a station entry (or all stations). 88589c771e5SJouni Malinen * 88689c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 88798856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 88898856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 88998856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 89089c771e5SJouni Malinen */ 89189c771e5SJouni Malinen struct station_del_parameters { 89289c771e5SJouni Malinen const u8 *mac; 89398856866SJouni Malinen u8 subtype; 89498856866SJouni Malinen u16 reason_code; 89589c771e5SJouni Malinen }; 89689c771e5SJouni Malinen 89789c771e5SJouni Malinen /** 89877ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 89977ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 90047edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 90147edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 90277ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 90377ee7c89SJohannes Berg * the AP MLME in the device 90477ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 90577ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 90677ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 90777ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 90877ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 90977ee7c89SJohannes Berg * supported/used) 91077ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 91177ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 912eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 913eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 91477ee7c89SJohannes Berg */ 91577ee7c89SJohannes Berg enum cfg80211_station_type { 91677ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 91747edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 91877ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 91977ee7c89SJohannes Berg CFG80211_STA_AP_STA, 92077ee7c89SJohannes Berg CFG80211_STA_IBSS, 92177ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 92277ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 923eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 924eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 92577ee7c89SJohannes Berg }; 92677ee7c89SJohannes Berg 92777ee7c89SJohannes Berg /** 92877ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 92977ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 93077ee7c89SJohannes Berg * @params: the new parameters for a station 93177ee7c89SJohannes Berg * @statype: the type of station being modified 93277ee7c89SJohannes Berg * 93377ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 93477ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 93577ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 93677ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 93777ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 93877ee7c89SJohannes Berg */ 93977ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 94077ee7c89SJohannes Berg struct station_parameters *params, 94177ee7c89SJohannes Berg enum cfg80211_station_type statype); 94277ee7c89SJohannes Berg 94377ee7c89SJohannes Berg /** 944420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 945420e7fabSHenning Rogge * 946420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 947420e7fabSHenning Rogge * type for 802.11n transmissions. 948420e7fabSHenning Rogge * 949db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 950db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 951420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 952db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 953420e7fabSHenning Rogge */ 954420e7fabSHenning Rogge enum rate_info_flags { 955db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 956db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 957b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 958b51f3beeSJohannes Berg RATE_INFO_FLAGS_60G = BIT(3), 959b51f3beeSJohannes Berg }; 960b51f3beeSJohannes Berg 961b51f3beeSJohannes Berg /** 962b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 963b51f3beeSJohannes Berg * 964b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 965b51f3beeSJohannes Berg * 966b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 967b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 968b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 969b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 970b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 971b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 972b51f3beeSJohannes Berg */ 973b51f3beeSJohannes Berg enum rate_info_bw { 974b51f3beeSJohannes Berg RATE_INFO_BW_5, 975b51f3beeSJohannes Berg RATE_INFO_BW_10, 976b51f3beeSJohannes Berg RATE_INFO_BW_20, 977b51f3beeSJohannes Berg RATE_INFO_BW_40, 978b51f3beeSJohannes Berg RATE_INFO_BW_80, 979b51f3beeSJohannes Berg RATE_INFO_BW_160, 980420e7fabSHenning Rogge }; 981420e7fabSHenning Rogge 982420e7fabSHenning Rogge /** 983420e7fabSHenning Rogge * struct rate_info - bitrate information 984420e7fabSHenning Rogge * 985420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 986420e7fabSHenning Rogge * 987420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 988420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 989420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 990db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 991b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 992420e7fabSHenning Rogge */ 993420e7fabSHenning Rogge struct rate_info { 994420e7fabSHenning Rogge u8 flags; 995420e7fabSHenning Rogge u8 mcs; 996420e7fabSHenning Rogge u16 legacy; 997db9c64cfSJohannes Berg u8 nss; 998b51f3beeSJohannes Berg u8 bw; 999fd5b74dcSJohannes Berg }; 1000fd5b74dcSJohannes Berg 1001fd5b74dcSJohannes Berg /** 1002f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 1003f4263c98SPaul Stewart * 1004f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1005f4263c98SPaul Stewart * type for 802.11n transmissions. 1006f4263c98SPaul Stewart * 1007f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1008f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1009f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1010f4263c98SPaul Stewart */ 1011f4263c98SPaul Stewart enum bss_param_flags { 1012f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1013f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1014f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1015f4263c98SPaul Stewart }; 1016f4263c98SPaul Stewart 1017f4263c98SPaul Stewart /** 1018f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1019f4263c98SPaul Stewart * 1020f4263c98SPaul Stewart * Information about the currently associated BSS 1021f4263c98SPaul Stewart * 1022f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1023f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1024f4263c98SPaul Stewart * @beacon_interval: beacon interval 1025f4263c98SPaul Stewart */ 1026f4263c98SPaul Stewart struct sta_bss_parameters { 1027f4263c98SPaul Stewart u8 flags; 1028f4263c98SPaul Stewart u8 dtim_period; 1029f4263c98SPaul Stewart u16 beacon_interval; 1030f4263c98SPaul Stewart }; 1031f4263c98SPaul Stewart 10326de39808SJohannes Berg /** 10336de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 10346de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 10356de39808SJohannes Berg * indicate the relevant values in this struct are filled 10366de39808SJohannes Berg * @rx_msdu: number of received MSDUs 10376de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 10386de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 10396de39808SJohannes Berg * transmitted MSDUs 10406de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 10416de39808SJohannes Berg */ 10426de39808SJohannes Berg struct cfg80211_tid_stats { 10436de39808SJohannes Berg u32 filled; 10446de39808SJohannes Berg u64 rx_msdu; 10456de39808SJohannes Berg u64 tx_msdu; 10466de39808SJohannes Berg u64 tx_msdu_retries; 10476de39808SJohannes Berg u64 tx_msdu_failed; 10486de39808SJohannes Berg }; 10496de39808SJohannes Berg 1050119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1051119363c7SFelix Fietkau 1052f4263c98SPaul Stewart /** 10532ec600d6SLuis Carlos Cobo * struct station_info - station information 1054fd5b74dcSJohannes Berg * 10552ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1056fd5b74dcSJohannes Berg * 1057319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1058319090bfSJohannes Berg * indicate the relevant values in this struct for them 1059ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1060fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 10618d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 10628d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 10632ec600d6SLuis Carlos Cobo * @llid: mesh local link id 10642ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 10652ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 106673c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 106773c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 106873c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 106973c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1070119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1071119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1072119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1073858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1074858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 10758d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 10768d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 10778d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 10788d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 10795a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 10801ba01458SRandy Dunlap * @bss_param: current BSS parameters 1081f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1082f5ea9120SJohannes Berg * This number should increase every time the list of stations 1083f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1084f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 108550d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 108650d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 108750d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 108850d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 108950d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1090c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1091a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1092d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 10933b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 10943b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 10953b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1096867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1097867d849fSAntonio Quartulli * towards this station. 1098a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1099a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1100a76b1942SJohannes Berg * from this peer 1101739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 11026de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 11036de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1104fd5b74dcSJohannes Berg */ 11052ec600d6SLuis Carlos Cobo struct station_info { 1106739960f1SMohammed Shafi Shajakhan u64 filled; 1107ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1108fd5b74dcSJohannes Berg u32 inactive_time; 110942745e03SVladimir Kondratiev u64 rx_bytes; 111042745e03SVladimir Kondratiev u64 tx_bytes; 11112ec600d6SLuis Carlos Cobo u16 llid; 11122ec600d6SLuis Carlos Cobo u16 plid; 11132ec600d6SLuis Carlos Cobo u8 plink_state; 1114420e7fabSHenning Rogge s8 signal; 1115541a45a1SBruno Randolf s8 signal_avg; 1116119363c7SFelix Fietkau 1117119363c7SFelix Fietkau u8 chains; 1118119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1119119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1120119363c7SFelix Fietkau 1121420e7fabSHenning Rogge struct rate_info txrate; 1122c8dcfd8aSFelix Fietkau struct rate_info rxrate; 112398c8a60aSJouni Malinen u32 rx_packets; 112498c8a60aSJouni Malinen u32 tx_packets; 1125b206b4efSBruno Randolf u32 tx_retries; 1126b206b4efSBruno Randolf u32 tx_failed; 11275a5c731aSBen Greear u32 rx_dropped_misc; 1128f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1129bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1130f5ea9120SJohannes Berg 1131f5ea9120SJohannes Berg int generation; 113250d3dfb7SJouni Malinen 113350d3dfb7SJouni Malinen const u8 *assoc_req_ies; 113450d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1135f612cedfSJouni Malinen 1136a85e1d55SPaul Stewart u32 beacon_loss_count; 1137d299a1f2SJavier Cardona s64 t_offset; 11383b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 11393b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 11403b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1141a85e1d55SPaul Stewart 1142867d849fSAntonio Quartulli u32 expected_throughput; 1143a76b1942SJohannes Berg 1144a76b1942SJohannes Berg u64 rx_beacon; 1145739960f1SMohammed Shafi Shajakhan u64 rx_duration; 1146a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 11476de39808SJohannes Berg struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1148fd5b74dcSJohannes Berg }; 1149fd5b74dcSJohannes Berg 115061aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 115166f7ac50SMichael Wu /** 11527406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11537406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11547406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11557406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11567406353dSAntonio Quartulli * 11577406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 11587406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 11597406353dSAntonio Quartulli * considered undefined. 11607406353dSAntonio Quartulli */ 11617406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 11627406353dSAntonio Quartulli struct station_info *sinfo); 116361aaa0e8SLinus Lüssing #else 116461aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 116561aaa0e8SLinus Lüssing const u8 *mac_addr, 116661aaa0e8SLinus Lüssing struct station_info *sinfo) 116761aaa0e8SLinus Lüssing { 116861aaa0e8SLinus Lüssing return -ENOENT; 116961aaa0e8SLinus Lüssing } 117061aaa0e8SLinus Lüssing #endif 11717406353dSAntonio Quartulli 11727406353dSAntonio Quartulli /** 117366f7ac50SMichael Wu * enum monitor_flags - monitor flags 117466f7ac50SMichael Wu * 117566f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 117666f7ac50SMichael Wu * according to the nl80211 flags. 117766f7ac50SMichael Wu * 117866f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 117966f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 118066f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 118166f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 118266f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1183e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 118466f7ac50SMichael Wu */ 118566f7ac50SMichael Wu enum monitor_flags { 118666f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 118766f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 118866f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 118966f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 119066f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1191e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 119266f7ac50SMichael Wu }; 119366f7ac50SMichael Wu 11942ec600d6SLuis Carlos Cobo /** 11952ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 11962ec600d6SLuis Carlos Cobo * 11972ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 11982ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 11992ec600d6SLuis Carlos Cobo * 1200abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1201abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1202abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1203abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1204abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1205abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1206abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 12072ec600d6SLuis Carlos Cobo */ 12082ec600d6SLuis Carlos Cobo enum mpath_info_flags { 12092ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1210d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 12112ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 12122ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 12132ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 12142ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 12152ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 12162ec600d6SLuis Carlos Cobo }; 12172ec600d6SLuis Carlos Cobo 12182ec600d6SLuis Carlos Cobo /** 12192ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 12202ec600d6SLuis Carlos Cobo * 12212ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 12222ec600d6SLuis Carlos Cobo * 12232ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 12242ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1225d19b3bf6SRui Paulo * @sn: target sequence number 12262ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 12272ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 12282ec600d6SLuis Carlos Cobo * @flags: mesh path flags 12292ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 12302ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1231f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1232f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1233f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1234f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 12352ec600d6SLuis Carlos Cobo */ 12362ec600d6SLuis Carlos Cobo struct mpath_info { 12372ec600d6SLuis Carlos Cobo u32 filled; 12382ec600d6SLuis Carlos Cobo u32 frame_qlen; 1239d19b3bf6SRui Paulo u32 sn; 12402ec600d6SLuis Carlos Cobo u32 metric; 12412ec600d6SLuis Carlos Cobo u32 exptime; 12422ec600d6SLuis Carlos Cobo u32 discovery_timeout; 12432ec600d6SLuis Carlos Cobo u8 discovery_retries; 12442ec600d6SLuis Carlos Cobo u8 flags; 1245f5ea9120SJohannes Berg 1246f5ea9120SJohannes Berg int generation; 12472ec600d6SLuis Carlos Cobo }; 12482ec600d6SLuis Carlos Cobo 12499f1ba906SJouni Malinen /** 12509f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 12519f1ba906SJouni Malinen * 12529f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 12539f1ba906SJouni Malinen * 12549f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 12559f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12569f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 12579f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12589f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 12599f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 126090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 126190c97a04SJouni Malinen * (or NULL for no change) 126290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1263fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 126450b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 126550b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 126653cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 126753cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 12689f1ba906SJouni Malinen */ 12699f1ba906SJouni Malinen struct bss_parameters { 12709f1ba906SJouni Malinen int use_cts_prot; 12719f1ba906SJouni Malinen int use_short_preamble; 12729f1ba906SJouni Malinen int use_short_slot_time; 1273c1e5f471SJohannes Berg const u8 *basic_rates; 127490c97a04SJouni Malinen u8 basic_rates_len; 1275fd8aaaf3SFelix Fietkau int ap_isolate; 127650b12f59SHelmut Schaa int ht_opmode; 127753cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 12789f1ba906SJouni Malinen }; 12792ec600d6SLuis Carlos Cobo 12803ddd53f3SChun-Yeow Yeoh /** 128129cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 128229cbe68cSJohannes Berg * 128329cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 12843ddd53f3SChun-Yeow Yeoh * 12853ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 12863ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 12873ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 12883ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 12893ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 12903ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 12913ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 12923ddd53f3SChun-Yeow Yeoh * mesh interface 12933ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 12943ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 12953ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 12963ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 12973ddd53f3SChun-Yeow Yeoh * elements 12983ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 12993ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 13003ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 13013ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 13023ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 13033ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 13043ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 13053ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 13063ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 13073ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 13083ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 13093ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 13103ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 13113ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 13123ddd53f3SChun-Yeow Yeoh * element 13133ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 13143ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 13153ddd53f3SChun-Yeow Yeoh * element 13163ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 13173ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 13183ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 13193ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 13203ddd53f3SChun-Yeow Yeoh * announcements are transmitted 13213ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 13223ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 13233ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 13243ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 13253ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 13263ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 13273ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 13283ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 13293ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 13303ddd53f3SChun-Yeow Yeoh * station to establish a peer link 13313ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1332ac1073a6SChun-Yeow Yeoh * 1333ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1334ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1335ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1336ac1073a6SChun-Yeow Yeoh * 1337ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1338ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1339728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1340728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1341728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 13423b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 13433b1c5a53SMarco Porsch * setting for new peer links. 13443b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 13453b1c5a53SMarco Porsch * after transmitting its beacon. 13468e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 13478e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 13488e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 134929cbe68cSJohannes Berg */ 135093da9cc1Scolin@cozybit.com struct mesh_config { 135193da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 135293da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 135393da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 135493da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 135593da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 135693da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 135745904f21SJavier Cardona u8 element_ttl; 135893da9cc1Scolin@cozybit.com bool auto_open_plinks; 1359d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 136093da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 136193da9cc1Scolin@cozybit.com u32 path_refresh_time; 136293da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 136393da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 136493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1365dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 136693da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 136763c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 13680507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 136916dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 137094f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 137155335137SAshok Nagarajan s32 rssi_threshold; 137270c33eaaSAshok Nagarajan u16 ht_opmode; 1373ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1374ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1375728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 13763b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 13773b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 13788e7c0538SColleen Twitty u32 plink_timeout; 137993da9cc1Scolin@cozybit.com }; 138093da9cc1Scolin@cozybit.com 138131888487SJouni Malinen /** 138229cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1383683b6d3bSJohannes Berg * @chandef: defines the channel to use 138429cbe68cSJohannes Berg * @mesh_id: the mesh ID 138529cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1386d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1387c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1388c80d545dSJavier Cardona * @path_metric: which metric to use 13896e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1390581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1391581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1392b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1393b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1394bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 13959bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 13969bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 13974bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1398ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 13998564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 140029cbe68cSJohannes Berg * 140129cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 140229cbe68cSJohannes Berg */ 140329cbe68cSJohannes Berg struct mesh_setup { 1404683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 140529cbe68cSJohannes Berg const u8 *mesh_id; 140629cbe68cSJohannes Berg u8 mesh_id_len; 1407d299a1f2SJavier Cardona u8 sync_method; 1408c80d545dSJavier Cardona u8 path_sel_proto; 1409c80d545dSJavier Cardona u8 path_metric; 14106e16d90bSColleen Twitty u8 auth_id; 1411581a8b0fSJavier Cardona const u8 *ie; 1412581a8b0fSJavier Cardona u8 ie_len; 1413b130e5ceSJavier Cardona bool is_authenticated; 141415d5dda6SJavier Cardona bool is_secure; 1415bb2798d4SThomas Pedersen bool user_mpm; 14169bdbf04dSMarco Porsch u8 dtim_period; 14179bdbf04dSMarco Porsch u16 beacon_interval; 141857fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1419ffb3cf30SAshok Nagarajan u32 basic_rates; 14208564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 142129cbe68cSJohannes Berg }; 142229cbe68cSJohannes Berg 142329cbe68cSJohannes Berg /** 14246e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 14256e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 14266e0bd6c3SRostislav Lisovy * 14276e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 14286e0bd6c3SRostislav Lisovy */ 14296e0bd6c3SRostislav Lisovy struct ocb_setup { 14306e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 14316e0bd6c3SRostislav Lisovy }; 14326e0bd6c3SRostislav Lisovy 14336e0bd6c3SRostislav Lisovy /** 143431888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1435a3304b0aSJohannes Berg * @ac: AC identifier 143631888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 143731888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 143831888487SJouni Malinen * 1..32767] 143931888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 144031888487SJouni Malinen * 1..32767] 144131888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 144231888487SJouni Malinen */ 144331888487SJouni Malinen struct ieee80211_txq_params { 1444a3304b0aSJohannes Berg enum nl80211_ac ac; 144531888487SJouni Malinen u16 txop; 144631888487SJouni Malinen u16 cwmin; 144731888487SJouni Malinen u16 cwmax; 144831888487SJouni Malinen u8 aifs; 144931888487SJouni Malinen }; 145031888487SJouni Malinen 1451d70e9693SJohannes Berg /** 1452d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1453d70e9693SJohannes Berg * 1454d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1455d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1456d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1457d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1458d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1459d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1460d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1461d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1462d70e9693SJohannes Berg * in the wiphy structure. 1463d70e9693SJohannes Berg * 1464d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1465d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1466d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1467d70e9693SJohannes Berg * 1468d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1469d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1470d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1471d70e9693SJohannes Berg * to userspace. 1472d70e9693SJohannes Berg */ 147372bdcf34SJouni Malinen 1474704232c2SJohannes Berg /** 14752a519311SJohannes Berg * struct cfg80211_ssid - SSID description 14762a519311SJohannes Berg * @ssid: the SSID 14772a519311SJohannes Berg * @ssid_len: length of the ssid 14782a519311SJohannes Berg */ 14792a519311SJohannes Berg struct cfg80211_ssid { 14802a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 14812a519311SJohannes Berg u8 ssid_len; 14822a519311SJohannes Berg }; 14832a519311SJohannes Berg 14842a519311SJohannes Berg /** 14851d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 14861d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 14871d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 14881d76250bSAvraham Stern * information is not available, this field is left zero. 14891d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 14901d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 14911d76250bSAvraham Stern * userspace will be notified of that 14921d76250bSAvraham Stern */ 14931d76250bSAvraham Stern struct cfg80211_scan_info { 14941d76250bSAvraham Stern u64 scan_start_tsf; 14951d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 14961d76250bSAvraham Stern bool aborted; 14971d76250bSAvraham Stern }; 14981d76250bSAvraham Stern 14991d76250bSAvraham Stern /** 15002a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 15012a519311SJohannes Berg * 15022a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 15032a519311SJohannes Berg * @n_ssids: number of SSIDs 15042a519311SJohannes Berg * @channels: channels to scan on. 1505ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1506dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 150770692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 150870692ad2SJouni Malinen * @ie_len: length of ie in octets 15091d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 15101d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 15111d76250bSAvraham Stern * the actual dwell time may be shorter. 15121d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 15131d76250bSAvraham Stern * %duration field. 1514ed473771SSam Leffler * @flags: bit field of flags controlling operation 151534850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 15162a519311SJohannes Berg * @wiphy: the wiphy this was for 151715d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1518fd014284SJohannes Berg * @wdev: the wireless device to scan for 15191d76250bSAvraham Stern * @info: (internal) information about completed scan 15205fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1521e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1522ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1523ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1524ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1525ad2b26abSJohannes Berg * be taken from the @mac_addr 1526818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 15272a519311SJohannes Berg */ 15282a519311SJohannes Berg struct cfg80211_scan_request { 15292a519311SJohannes Berg struct cfg80211_ssid *ssids; 15302a519311SJohannes Berg int n_ssids; 15312a519311SJohannes Berg u32 n_channels; 1532dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1533de95a54bSJohannes Berg const u8 *ie; 153470692ad2SJouni Malinen size_t ie_len; 15351d76250bSAvraham Stern u16 duration; 15361d76250bSAvraham Stern bool duration_mandatory; 1537ed473771SSam Leffler u32 flags; 15382a519311SJohannes Berg 153957fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 154034850ab2SJohannes Berg 1541fd014284SJohannes Berg struct wireless_dev *wdev; 1542fd014284SJohannes Berg 1543ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1544ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1545818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 1546ad2b26abSJohannes Berg 15472a519311SJohannes Berg /* internal */ 15482a519311SJohannes Berg struct wiphy *wiphy; 154915d6030bSSam Leffler unsigned long scan_start; 15501d76250bSAvraham Stern struct cfg80211_scan_info info; 15511d76250bSAvraham Stern bool notified; 1552e9f935e3SRajkumar Manoharan bool no_cck; 15535ba63533SJohannes Berg 15545ba63533SJohannes Berg /* keep last */ 15555ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 15562a519311SJohannes Berg }; 15572a519311SJohannes Berg 1558ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1559ad2b26abSJohannes Berg { 1560ad2b26abSJohannes Berg int i; 1561ad2b26abSJohannes Berg 1562ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1563ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1564ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1565ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1566ad2b26abSJohannes Berg } 1567ad2b26abSJohannes Berg } 1568ad2b26abSJohannes Berg 15692a519311SJohannes Berg /** 1570a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1571a1f1c21cSLuciano Coelho * 1572ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1573ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1574a1f1c21cSLuciano Coelho */ 1575a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1576a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1577ea73cbceSJohannes Berg s32 rssi_thold; 1578a1f1c21cSLuciano Coelho }; 1579a1f1c21cSLuciano Coelho 1580a1f1c21cSLuciano Coelho /** 15813b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 15823b06d277SAvraham Stern * 15833b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 15843b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 15853b06d277SAvraham Stern * infinite loop. 15863b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 15873b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 15883b06d277SAvraham Stern */ 15893b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 15903b06d277SAvraham Stern u32 interval; 15913b06d277SAvraham Stern u32 iterations; 15923b06d277SAvraham Stern }; 15933b06d277SAvraham Stern 15943b06d277SAvraham Stern /** 1595807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1596807f8a8cSLuciano Coelho * 1597807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1598807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1599807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1600dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1601807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1602807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1603ed473771SSam Leffler * @flags: bit field of flags controlling operation 1604a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1605a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1606a1f1c21cSLuciano Coelho * (others are filtered out). 1607a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1608a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1609807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1610807f8a8cSLuciano Coelho * @dev: the interface 1611077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1612807f8a8cSLuciano Coelho * @channels: channels to scan 1613ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1614ea73cbceSJohannes Berg * contains the minimum over all matchsets 1615ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1616ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1617ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1618ad2b26abSJohannes Berg * be taken from the @mac_addr 16193b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 16203b06d277SAvraham Stern * index must be executed first. 16213b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 162231a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 162393a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 162493a1e86cSJukka Rissanen * owned by a particular socket) 16259c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 16269c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 16279c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 16289c748934SLuciano Coelho * supported. 1629807f8a8cSLuciano Coelho */ 1630807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1631807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1632807f8a8cSLuciano Coelho int n_ssids; 1633807f8a8cSLuciano Coelho u32 n_channels; 1634dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1635807f8a8cSLuciano Coelho const u8 *ie; 1636807f8a8cSLuciano Coelho size_t ie_len; 1637ed473771SSam Leffler u32 flags; 1638a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1639a1f1c21cSLuciano Coelho int n_match_sets; 1640ea73cbceSJohannes Berg s32 min_rssi_thold; 16419c748934SLuciano Coelho u32 delay; 16423b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 16433b06d277SAvraham Stern int n_scan_plans; 1644807f8a8cSLuciano Coelho 1645ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1646ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1647ad2b26abSJohannes Berg 1648807f8a8cSLuciano Coelho /* internal */ 1649807f8a8cSLuciano Coelho struct wiphy *wiphy; 1650807f8a8cSLuciano Coelho struct net_device *dev; 165115d6030bSSam Leffler unsigned long scan_start; 165231a60ed1SJukka Rissanen struct rcu_head rcu_head; 165393a1e86cSJukka Rissanen u32 owner_nlportid; 1654807f8a8cSLuciano Coelho 1655807f8a8cSLuciano Coelho /* keep last */ 1656807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1657807f8a8cSLuciano Coelho }; 1658807f8a8cSLuciano Coelho 1659807f8a8cSLuciano Coelho /** 16602a519311SJohannes Berg * enum cfg80211_signal_type - signal type 16612a519311SJohannes Berg * 16622a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 16632a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 16642a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 16652a519311SJohannes Berg */ 16662a519311SJohannes Berg enum cfg80211_signal_type { 16672a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 16682a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 16692a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 16702a519311SJohannes Berg }; 16712a519311SJohannes Berg 16722a519311SJohannes Berg /** 16736e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 16746e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 16756e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 16766e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 16776e19bc4bSDmitry Shmidt * signal type 16786e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 16796e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 16806e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 16816e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 16826e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 16836e19bc4bSDmitry Shmidt * ktime_get_boot_ns() is likely appropriate. 16841d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 16851d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 16861d76250bSAvraham Stern * by %parent_bssid. 16871d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 16881d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 16896e19bc4bSDmitry Shmidt */ 16906e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 16916e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 16926e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 16936e19bc4bSDmitry Shmidt s32 signal; 16946e19bc4bSDmitry Shmidt u64 boottime_ns; 16951d76250bSAvraham Stern u64 parent_tsf; 16961d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 16976e19bc4bSDmitry Shmidt }; 16986e19bc4bSDmitry Shmidt 16996e19bc4bSDmitry Shmidt /** 17002aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 17018cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 17029caf0364SJohannes Berg * @rcu_head: internal use, for freeing 17039caf0364SJohannes Berg * @len: length of the IEs 17040e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 17059caf0364SJohannes Berg * @data: IE data 17069caf0364SJohannes Berg */ 17079caf0364SJohannes Berg struct cfg80211_bss_ies { 17088cef2c9dSJohannes Berg u64 tsf; 17099caf0364SJohannes Berg struct rcu_head rcu_head; 17109caf0364SJohannes Berg int len; 17110e227084SJohannes Berg bool from_beacon; 17129caf0364SJohannes Berg u8 data[]; 17139caf0364SJohannes Berg }; 17149caf0364SJohannes Berg 17159caf0364SJohannes Berg /** 17162a519311SJohannes Berg * struct cfg80211_bss - BSS description 17172a519311SJohannes Berg * 17182a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 17192a519311SJohannes Berg * for use in scan results and similar. 17202a519311SJohannes Berg * 1721abe37c4bSJohannes Berg * @channel: channel this BSS is on 1722dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 17232a519311SJohannes Berg * @bssid: BSSID of the BSS 17242a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 17252a519311SJohannes Berg * @capability: the capability field in host byte order 172683c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 172783c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 172883c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 172983c7aa1aSJohannes Berg * received. It is always non-%NULL. 173034a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1731776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1732776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1733776b3580SJohannes Berg * @hidden_beacon_bss struct) 173434a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1735776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1736776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1737776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1738776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 173977965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 17402a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 17412a519311SJohannes Berg */ 17422a519311SJohannes Berg struct cfg80211_bss { 17432a519311SJohannes Berg struct ieee80211_channel *channel; 1744dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 17452a519311SJohannes Berg 17469caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 17479caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 17489caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 17499caf0364SJohannes Berg 1750776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 17512a519311SJohannes Berg 17522a519311SJohannes Berg s32 signal; 17532a519311SJohannes Berg 17549caf0364SJohannes Berg u16 beacon_interval; 17559caf0364SJohannes Berg u16 capability; 17569caf0364SJohannes Berg 17579caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 17589caf0364SJohannes Berg 17591c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 17602a519311SJohannes Berg }; 17612a519311SJohannes Berg 17622a519311SJohannes Berg /** 1763517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1764517357c6SJohannes Berg * @bss: the bss to search 1765517357c6SJohannes Berg * @ie: the IE ID 17669caf0364SJohannes Berg * 17679caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 17689caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 17690ae997dcSYacine Belkadi * Return: %NULL if not found. 1770517357c6SJohannes Berg */ 1771517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1772517357c6SJohannes Berg 1773517357c6SJohannes Berg 1774517357c6SJohannes Berg /** 1775636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1776636a5d36SJouni Malinen * 1777636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1778636a5d36SJouni Malinen * authentication. 1779636a5d36SJouni Malinen * 1780959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1781959867faSJohannes Berg * to it if it needs to keep it. 1782636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1783636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1784636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1785fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1786fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1787fffd0934SJohannes Berg * @key: WEP key for shared key authentication 178811b6b5a4SJouni Malinen * @auth_data: Fields and elements in Authentication frames. This contains 178911b6b5a4SJouni Malinen * the authentication frame body (non-IE and IE data), excluding the 179011b6b5a4SJouni Malinen * Authentication algorithm number, i.e., starting at the Authentication 179111b6b5a4SJouni Malinen * transaction sequence number field. 179211b6b5a4SJouni Malinen * @auth_data_len: Length of auth_data buffer in octets 1793636a5d36SJouni Malinen */ 1794636a5d36SJouni Malinen struct cfg80211_auth_request { 179519957bb3SJohannes Berg struct cfg80211_bss *bss; 1796636a5d36SJouni Malinen const u8 *ie; 1797636a5d36SJouni Malinen size_t ie_len; 179819957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1799fffd0934SJohannes Berg const u8 *key; 1800fffd0934SJohannes Berg u8 key_len, key_idx; 180111b6b5a4SJouni Malinen const u8 *auth_data; 180211b6b5a4SJouni Malinen size_t auth_data_len; 1803636a5d36SJouni Malinen }; 1804636a5d36SJouni Malinen 1805636a5d36SJouni Malinen /** 18067e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 18077e7c8926SBen Greear * 18087e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1809ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1810bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 18117e7c8926SBen Greear */ 18127e7c8926SBen Greear enum cfg80211_assoc_req_flags { 18137e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1814ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1815bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 18167e7c8926SBen Greear }; 18177e7c8926SBen Greear 18187e7c8926SBen Greear /** 1819636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1820636a5d36SJouni Malinen * 1821636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1822636a5d36SJouni Malinen * (re)association. 1823959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1824959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1825959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1826959867faSJohannes Berg * association requests while already associating must be rejected. 1827636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1828636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1829dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1830b23aa676SSamuel Ortiz * @crypto: crypto settings 183135eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 183235eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 183335eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 183435eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 183535eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 183635eb8f7bSJouni Malinen * frame. 18377e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 18387e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 18397e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 18407e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1841ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1842ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1843348bd456SJouni Malinen * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 1844348bd456SJouni Malinen * %NULL if FILS is not used. 1845348bd456SJouni Malinen * @fils_kek_len: Length of fils_kek in octets 1846348bd456SJouni Malinen * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 1847348bd456SJouni Malinen * Request/Response frame or %NULL if FILS is not used. This field starts 1848348bd456SJouni Malinen * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 1849636a5d36SJouni Malinen */ 1850636a5d36SJouni Malinen struct cfg80211_assoc_request { 185119957bb3SJohannes Berg struct cfg80211_bss *bss; 18523e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1853636a5d36SJouni Malinen size_t ie_len; 1854b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 185519957bb3SJohannes Berg bool use_mfp; 18567e7c8926SBen Greear u32 flags; 18577e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 18587e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1859ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1860348bd456SJouni Malinen const u8 *fils_kek; 1861348bd456SJouni Malinen size_t fils_kek_len; 1862348bd456SJouni Malinen const u8 *fils_nonces; 1863636a5d36SJouni Malinen }; 1864636a5d36SJouni Malinen 1865636a5d36SJouni Malinen /** 1866636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1867636a5d36SJouni Malinen * 1868636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1869636a5d36SJouni Malinen * deauthentication. 1870636a5d36SJouni Malinen * 187195de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1872636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1873636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 187419957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1875077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1876077f897aSJohannes Berg * do not set a deauth frame 1877636a5d36SJouni Malinen */ 1878636a5d36SJouni Malinen struct cfg80211_deauth_request { 187995de817bSJohannes Berg const u8 *bssid; 1880636a5d36SJouni Malinen const u8 *ie; 1881636a5d36SJouni Malinen size_t ie_len; 188219957bb3SJohannes Berg u16 reason_code; 18836863255bSStanislaw Gruszka bool local_state_change; 1884636a5d36SJouni Malinen }; 1885636a5d36SJouni Malinen 1886636a5d36SJouni Malinen /** 1887636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1888636a5d36SJouni Malinen * 1889636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1890636a5d36SJouni Malinen * disassocation. 1891636a5d36SJouni Malinen * 189219957bb3SJohannes Berg * @bss: the BSS to disassociate from 1893636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1894636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 189519957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1896d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1897d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1898636a5d36SJouni Malinen */ 1899636a5d36SJouni Malinen struct cfg80211_disassoc_request { 190019957bb3SJohannes Berg struct cfg80211_bss *bss; 1901636a5d36SJouni Malinen const u8 *ie; 1902636a5d36SJouni Malinen size_t ie_len; 190319957bb3SJohannes Berg u16 reason_code; 1904d5cdfacbSJouni Malinen bool local_state_change; 1905636a5d36SJouni Malinen }; 1906636a5d36SJouni Malinen 1907636a5d36SJouni Malinen /** 190804a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 190904a773adSJohannes Berg * 191004a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 191104a773adSJohannes Berg * method. 191204a773adSJohannes Berg * 191304a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 191404a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 191504a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 191604a773adSJohannes Berg * search for IBSSs with a different BSSID. 1917683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 191804a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 191904a773adSJohannes Berg * IBSSs to join on other channels. 192004a773adSJohannes Berg * @ie: information element(s) to include in the beacon 192104a773adSJohannes Berg * @ie_len: length of that 19228e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1923fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1924fffd0934SJohannes Berg * after joining 1925267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1926267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1927267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1928267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 19295336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 19305336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 19315336fa88SSimon Wunderlich * to operate on DFS channels. 1932fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1933dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1934803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1935803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1936803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 193704a773adSJohannes Berg */ 193804a773adSJohannes Berg struct cfg80211_ibss_params { 1939c1e5f471SJohannes Berg const u8 *ssid; 1940c1e5f471SJohannes Berg const u8 *bssid; 1941683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1942c1e5f471SJohannes Berg const u8 *ie; 194304a773adSJohannes Berg u8 ssid_len, ie_len; 19448e30bc55SJohannes Berg u16 beacon_interval; 1945fbd2c8dcSTeemu Paasikivi u32 basic_rates; 194604a773adSJohannes Berg bool channel_fixed; 1947fffd0934SJohannes Berg bool privacy; 1948267335d6SAntonio Quartulli bool control_port; 19495336fa88SSimon Wunderlich bool userspace_handles_dfs; 195057fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1951803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1952803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 195304a773adSJohannes Berg }; 195404a773adSJohannes Berg 195504a773adSJohannes Berg /** 195638de03d2SArend van Spriel * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 195738de03d2SArend van Spriel * 195838de03d2SArend van Spriel * @band: band of BSS which should match for RSSI level adjustment. 195938de03d2SArend van Spriel * @delta: value of RSSI level adjustment. 196038de03d2SArend van Spriel */ 196138de03d2SArend van Spriel struct cfg80211_bss_select_adjust { 196257fbcce3SJohannes Berg enum nl80211_band band; 196338de03d2SArend van Spriel s8 delta; 196438de03d2SArend van Spriel }; 196538de03d2SArend van Spriel 196638de03d2SArend van Spriel /** 196738de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 196838de03d2SArend van Spriel * 196938de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 197038de03d2SArend van Spriel * @param: parameters for requestion behaviour. 197138de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 197238de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 197338de03d2SArend van Spriel */ 197438de03d2SArend van Spriel struct cfg80211_bss_selection { 197538de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 197638de03d2SArend van Spriel union { 197757fbcce3SJohannes Berg enum nl80211_band band_pref; 197838de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 197938de03d2SArend van Spriel } param; 198038de03d2SArend van Spriel }; 198138de03d2SArend van Spriel 198238de03d2SArend van Spriel /** 1983b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1984b23aa676SSamuel Ortiz * 1985b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1986b23aa676SSamuel Ortiz * authentication and association. 1987b23aa676SSamuel Ortiz * 1988b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1989b23aa676SSamuel Ortiz * on scan results) 19901df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 19911df4a510SJouni Malinen * %NULL if not specified 1992b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1993b23aa676SSamuel Ortiz * results) 19941df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 19951df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 19961df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 19971df4a510SJouni Malinen * to use. 1998b23aa676SSamuel Ortiz * @ssid: SSID 1999b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 2000b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 2001abe37c4bSJohannes Berg * @ie: IEs for association request 2002abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 2003b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 2004cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 2005b23aa676SSamuel Ortiz * @crypto: crypto settings 2006fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2007fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2008fffd0934SJohannes Berg * @key: WEP key for shared key authentication 20097e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 20104486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 20114486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 20127e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 20137e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 20147e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2015ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 2016ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 201734d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 201834d50519SLior David * networks. 201938de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 202035eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 202135eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 202235eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 202335eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 202435eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 202535eb8f7bSJouni Malinen * frame. 2026b23aa676SSamuel Ortiz */ 2027b23aa676SSamuel Ortiz struct cfg80211_connect_params { 2028b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 20291df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 2030664834deSJouni Malinen const u8 *bssid; 20311df4a510SJouni Malinen const u8 *bssid_hint; 2032664834deSJouni Malinen const u8 *ssid; 2033b23aa676SSamuel Ortiz size_t ssid_len; 2034b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 20354b5800feSJohannes Berg const u8 *ie; 2036b23aa676SSamuel Ortiz size_t ie_len; 2037b23aa676SSamuel Ortiz bool privacy; 2038cee00a95SJouni Malinen enum nl80211_mfp mfp; 2039b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 2040fffd0934SJohannes Berg const u8 *key; 2041fffd0934SJohannes Berg u8 key_len, key_idx; 20427e7c8926SBen Greear u32 flags; 20434486ea98SBala Shanmugam int bg_scan_period; 20447e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 20457e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2046ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 2047ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 204834d50519SLior David bool pbss; 204938de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 2050ba6fbacfSJouni Malinen const u8 *prev_bssid; 2051b23aa676SSamuel Ortiz }; 2052b23aa676SSamuel Ortiz 2053b23aa676SSamuel Ortiz /** 2054*088e8df8Svamsi krishna * enum cfg80211_connect_params_changed - Connection parameters being updated 2055*088e8df8Svamsi krishna * 2056*088e8df8Svamsi krishna * This enum provides information of all connect parameters that 2057*088e8df8Svamsi krishna * have to be updated as part of update_connect_params() call. 2058*088e8df8Svamsi krishna * 2059*088e8df8Svamsi krishna * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 2060*088e8df8Svamsi krishna */ 2061*088e8df8Svamsi krishna enum cfg80211_connect_params_changed { 2062*088e8df8Svamsi krishna UPDATE_ASSOC_IES = BIT(0), 2063*088e8df8Svamsi krishna }; 2064*088e8df8Svamsi krishna 2065*088e8df8Svamsi krishna /** 2066b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 2067abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 2068abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 2069abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 2070abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2071abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 20723057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 2073b9a5f8caSJouni Malinen */ 2074b9a5f8caSJouni Malinen enum wiphy_params_flags { 2075b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2076b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 2077b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 2078b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 207981077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 20803057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 2081b9a5f8caSJouni Malinen }; 2082b9a5f8caSJouni Malinen 208367fbb16bSSamuel Ortiz /** 208467fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 208567fbb16bSSamuel Ortiz * 208667fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 208767fbb16bSSamuel Ortiz * caching. 208867fbb16bSSamuel Ortiz * 208967fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 209067fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 209167fbb16bSSamuel Ortiz */ 209267fbb16bSSamuel Ortiz struct cfg80211_pmksa { 2093c1e5f471SJohannes Berg const u8 *bssid; 2094c1e5f471SJohannes Berg const u8 *pmkid; 209567fbb16bSSamuel Ortiz }; 20969930380fSJohannes Berg 20977643a2c3SJohannes Berg /** 209850ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 2099ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 2100ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 2101ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 2102ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 2103bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 2104ff1b6e69SJohannes Berg * 2105ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 2106ff1b6e69SJohannes Berg * memory, free @mask only! 2107ff1b6e69SJohannes Berg */ 210850ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 2109922bd80fSJohannes Berg const u8 *mask, *pattern; 2110ff1b6e69SJohannes Berg int pattern_len; 2111bb92d199SAmitkumar Karwar int pkt_offset; 2112ff1b6e69SJohannes Berg }; 2113ff1b6e69SJohannes Berg 2114ff1b6e69SJohannes Berg /** 21152a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 21162a0e047eSJohannes Berg * 21172a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 21182a0e047eSJohannes Berg * @src: source IP address 21192a0e047eSJohannes Berg * @dst: destination IP address 21202a0e047eSJohannes Berg * @dst_mac: destination MAC address 21212a0e047eSJohannes Berg * @src_port: source port 21222a0e047eSJohannes Berg * @dst_port: destination port 21232a0e047eSJohannes Berg * @payload_len: data payload length 21242a0e047eSJohannes Berg * @payload: data payload buffer 21252a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 21262a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 21272a0e047eSJohannes Berg * @wake_len: wakeup payload match length 21282a0e047eSJohannes Berg * @wake_data: wakeup payload match data 21292a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 21302a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 21312a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 21322a0e047eSJohannes Berg */ 21332a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 21342a0e047eSJohannes Berg struct socket *sock; 21352a0e047eSJohannes Berg __be32 src, dst; 21362a0e047eSJohannes Berg u16 src_port, dst_port; 21372a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 21382a0e047eSJohannes Berg int payload_len; 21392a0e047eSJohannes Berg const u8 *payload; 21402a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 21412a0e047eSJohannes Berg u32 data_interval; 21422a0e047eSJohannes Berg u32 wake_len; 21432a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 21442a0e047eSJohannes Berg u32 tokens_size; 21452a0e047eSJohannes Berg /* must be last, variable member */ 21462a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 2147ff1b6e69SJohannes Berg }; 2148ff1b6e69SJohannes Berg 2149ff1b6e69SJohannes Berg /** 2150ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2151ff1b6e69SJohannes Berg * 2152ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 2153ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 2154ff1b6e69SJohannes Berg * operating as normal during suspend 2155ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 2156ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 2157ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 2158ff1b6e69SJohannes Berg * @n_patterns: number of patterns 215977dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 216077dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 216177dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 216277dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 21632a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 21642a0e047eSJohannes Berg * NULL if not configured. 21658cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 2166ff1b6e69SJohannes Berg */ 2167ff1b6e69SJohannes Berg struct cfg80211_wowlan { 216877dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 216977dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 217077dbbb13SJohannes Berg rfkill_release; 217150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 21722a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 2173ff1b6e69SJohannes Berg int n_patterns; 21748cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 2175ff1b6e69SJohannes Berg }; 2176ff1b6e69SJohannes Berg 2177ff1b6e69SJohannes Berg /** 2178be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 2179be29b99aSAmitkumar Karwar * 2180be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 2181be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 2182be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 2183be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 2184be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 2185be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 2186be29b99aSAmitkumar Karwar */ 2187be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2188be29b99aSAmitkumar Karwar int delay; 2189be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2190be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2191be29b99aSAmitkumar Karwar int n_patterns; 2192be29b99aSAmitkumar Karwar }; 2193be29b99aSAmitkumar Karwar 2194be29b99aSAmitkumar Karwar /** 2195be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2196be29b99aSAmitkumar Karwar * 2197be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2198be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2199be29b99aSAmitkumar Karwar * @n_rules: number of rules 2200be29b99aSAmitkumar Karwar */ 2201be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2202be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2203be29b99aSAmitkumar Karwar int n_rules; 2204be29b99aSAmitkumar Karwar }; 2205be29b99aSAmitkumar Karwar 2206be29b99aSAmitkumar Karwar /** 22078cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 22088cd4d456SLuciano Coelho * 22098cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 22108cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 22118cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 22128cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 22138cd4d456SLuciano Coelho * occurred (in MHz) 22148cd4d456SLuciano Coelho */ 22158cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 22168cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 22178cd4d456SLuciano Coelho int n_channels; 22188cd4d456SLuciano Coelho u32 channels[]; 22198cd4d456SLuciano Coelho }; 22208cd4d456SLuciano Coelho 22218cd4d456SLuciano Coelho /** 22228cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 22238cd4d456SLuciano Coelho * 22248cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 22258cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 22268cd4d456SLuciano Coelho * match information. 22278cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 22288cd4d456SLuciano Coelho * the matches that triggered the wake up. 22298cd4d456SLuciano Coelho */ 22308cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 22318cd4d456SLuciano Coelho int n_matches; 22328cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 22338cd4d456SLuciano Coelho }; 22348cd4d456SLuciano Coelho 22358cd4d456SLuciano Coelho /** 2236cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2237cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2238cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2239cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2240cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2241cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2242cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2243cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2244cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2245cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2246cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2247cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2248cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2249cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2250cd8f7cb4SJohannes Berg * it is. 22512a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 22522a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 22532a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 22548cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2255cd8f7cb4SJohannes Berg */ 2256cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2257cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2258cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 22592a0e047eSJohannes Berg rfkill_release, packet_80211, 22602a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2261cd8f7cb4SJohannes Berg s32 pattern_idx; 2262cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2263cd8f7cb4SJohannes Berg const void *packet; 22648cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2265cd8f7cb4SJohannes Berg }; 2266cd8f7cb4SJohannes Berg 2267cd8f7cb4SJohannes Berg /** 2268e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 226978f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 227078f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 227178f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2272e5497d76SJohannes Berg */ 2273e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 227478f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2275e5497d76SJohannes Berg }; 2276e5497d76SJohannes Berg 2277e5497d76SJohannes Berg /** 2278355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2279355199e0SJouni Malinen * 2280355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2281355199e0SJouni Malinen * 2282355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2283355199e0SJouni Malinen * @ie: Fast Transition IEs 2284355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2285355199e0SJouni Malinen */ 2286355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2287355199e0SJouni Malinen u16 md; 2288355199e0SJouni Malinen const u8 *ie; 2289355199e0SJouni Malinen size_t ie_len; 2290355199e0SJouni Malinen }; 2291355199e0SJouni Malinen 2292355199e0SJouni Malinen /** 2293b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2294b176e629SAndrei Otcheretianski * 2295b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2296b176e629SAndrei Otcheretianski * 2297b176e629SAndrei Otcheretianski * @chan: channel to use 2298b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2299b176e629SAndrei Otcheretianski * @wait: duration for ROC 2300b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2301b176e629SAndrei Otcheretianski * @len: buffer length 2302b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2303b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 230434d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 230534d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2306b176e629SAndrei Otcheretianski */ 2307b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2308b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2309b176e629SAndrei Otcheretianski bool offchan; 2310b176e629SAndrei Otcheretianski unsigned int wait; 2311b176e629SAndrei Otcheretianski const u8 *buf; 2312b176e629SAndrei Otcheretianski size_t len; 2313b176e629SAndrei Otcheretianski bool no_cck; 2314b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 231534d22ce2SAndrei Otcheretianski int n_csa_offsets; 231634d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2317b176e629SAndrei Otcheretianski }; 2318b176e629SAndrei Otcheretianski 2319b176e629SAndrei Otcheretianski /** 2320fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2321fa9ffc74SKyeyoon Park * 2322fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2323fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2324fa9ffc74SKyeyoon Park */ 2325fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2326fa9ffc74SKyeyoon Park u8 dscp; 2327fa9ffc74SKyeyoon Park u8 up; 2328fa9ffc74SKyeyoon Park }; 2329fa9ffc74SKyeyoon Park 2330fa9ffc74SKyeyoon Park /** 2331fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2332fa9ffc74SKyeyoon Park * 2333fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2334fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2335fa9ffc74SKyeyoon Park */ 2336fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2337fa9ffc74SKyeyoon Park u8 low; 2338fa9ffc74SKyeyoon Park u8 high; 2339fa9ffc74SKyeyoon Park }; 2340fa9ffc74SKyeyoon Park 2341fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2342fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2343fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2344fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2345fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2346fa9ffc74SKyeyoon Park 2347fa9ffc74SKyeyoon Park /** 2348fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2349fa9ffc74SKyeyoon Park * 2350fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2351fa9ffc74SKyeyoon Park * 2352fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2353fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2354fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2355fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2356fa9ffc74SKyeyoon Park */ 2357fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2358fa9ffc74SKyeyoon Park u8 num_des; 2359fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2360fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2361fa9ffc74SKyeyoon Park }; 2362fa9ffc74SKyeyoon Park 2363fa9ffc74SKyeyoon Park /** 2364cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 2365cb3b7d87SAyala Beker * 2366cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 2367cb3b7d87SAyala Beker * 2368cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 2369cb3b7d87SAyala Beker * @dual: dual band operation mode, see &enum nl80211_nan_dual_band_conf 2370cb3b7d87SAyala Beker */ 2371cb3b7d87SAyala Beker struct cfg80211_nan_conf { 2372cb3b7d87SAyala Beker u8 master_pref; 2373cb3b7d87SAyala Beker u8 dual; 2374cb3b7d87SAyala Beker }; 2375cb3b7d87SAyala Beker 2376cb3b7d87SAyala Beker /** 2377a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 2378a5a9dcf2SAyala Beker * configuration 2379a5a9dcf2SAyala Beker * 2380a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 2381a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_DUAL: dual band operation 2382a5a9dcf2SAyala Beker */ 2383a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 2384a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 2385a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_DUAL = BIT(1), 2386a5a9dcf2SAyala Beker }; 2387a5a9dcf2SAyala Beker 2388a5a9dcf2SAyala Beker /** 2389a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 2390a442b761SAyala Beker * 2391a442b761SAyala Beker * @filter: the content of the filter 2392a442b761SAyala Beker * @len: the length of the filter 2393a442b761SAyala Beker */ 2394a442b761SAyala Beker struct cfg80211_nan_func_filter { 2395a442b761SAyala Beker const u8 *filter; 2396a442b761SAyala Beker u8 len; 2397a442b761SAyala Beker }; 2398a442b761SAyala Beker 2399a442b761SAyala Beker /** 2400a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 2401a442b761SAyala Beker * 2402a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 2403a442b761SAyala Beker * @service_id: the service ID of the function 2404a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 2405a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 2406a442b761SAyala Beker * implementation specific. 2407a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 2408a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 2409a442b761SAyala Beker * @followup_id: the instance ID for follow up 2410a442b761SAyala Beker * @followup_reqid: the requestor instance ID for follow up 2411a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 2412a442b761SAyala Beker * @ttl: time to live counter in DW. 2413a442b761SAyala Beker * @serv_spec_info: Service Specific Info 2414a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 2415a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 2416a442b761SAyala Beker * @srf_bf: Bloom Filter 2417a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 2418a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 2419a442b761SAyala Beker * @srf_macs: SRF MAC addresses 2420a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 2421a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 2422a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 2423a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 2424a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 2425a442b761SAyala Beker * @instance_id: driver allocated id of the function. 2426a442b761SAyala Beker * @cookie: unique NAN function identifier. 2427a442b761SAyala Beker */ 2428a442b761SAyala Beker struct cfg80211_nan_func { 2429a442b761SAyala Beker enum nl80211_nan_function_type type; 2430a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 2431a442b761SAyala Beker u8 publish_type; 2432a442b761SAyala Beker bool close_range; 2433a442b761SAyala Beker bool publish_bcast; 2434a442b761SAyala Beker bool subscribe_active; 2435a442b761SAyala Beker u8 followup_id; 2436a442b761SAyala Beker u8 followup_reqid; 2437a442b761SAyala Beker struct mac_address followup_dest; 2438a442b761SAyala Beker u32 ttl; 2439a442b761SAyala Beker const u8 *serv_spec_info; 2440a442b761SAyala Beker u8 serv_spec_info_len; 2441a442b761SAyala Beker bool srf_include; 2442a442b761SAyala Beker const u8 *srf_bf; 2443a442b761SAyala Beker u8 srf_bf_len; 2444a442b761SAyala Beker u8 srf_bf_idx; 2445a442b761SAyala Beker struct mac_address *srf_macs; 2446a442b761SAyala Beker int srf_num_macs; 2447a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 2448a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 2449a442b761SAyala Beker u8 num_tx_filters; 2450a442b761SAyala Beker u8 num_rx_filters; 2451a442b761SAyala Beker u8 instance_id; 2452a442b761SAyala Beker u64 cookie; 2453a442b761SAyala Beker }; 2454a442b761SAyala Beker 2455a442b761SAyala Beker /** 2456704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2457704232c2SJohannes Berg * 2458704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2459704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2460704232c2SJohannes Berg * 2461704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2462704232c2SJohannes Berg * on success or a negative error code. 2463704232c2SJohannes Berg * 246443fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 246543fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 246643fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 246743fb45cbSJohannes Berg * 2468ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2469ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2470ff1b6e69SJohannes Berg * configured for the device. 24710378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 24726d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 24736d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 24746d52563fSJohannes Berg * the device. 24750378b3f1SJohannes Berg * 247660719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2477463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 247884efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 247998104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 248098104fdeSJohannes Berg * also set the address member in the wdev. 2481704232c2SJohannes Berg * 248284efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 248355682965SJohannes Berg * 248460719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 248560719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 248655682965SJohannes Berg * 248741ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 248841ade00fSJohannes Berg * when adding a group key. 248941ade00fSJohannes Berg * 249041ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 249141ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 249241ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2493e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2494e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 249541ade00fSJohannes Berg * 249641ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2497e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 249841ade00fSJohannes Berg * 249941ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2500ed1b6cc7SJohannes Berg * 25013cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 25023cfcf6acSJouni Malinen * 2503e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2504e5497d76SJohannes Berg * 2505c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2506c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2507c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2508c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 25095727ef1bSJohannes Berg * 25105727ef1bSJohannes Berg * @add_station: Add a new station. 251189c771e5SJouni Malinen * @del_station: Remove a station 2512bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2513bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2514bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 251577ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 251677ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2517abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2518abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2519abe37c4bSJohannes Berg * 2520abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2521abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2522abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2523abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2524abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 252566be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 252666be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2527f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 25288d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2529f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 25308d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 25312ec600d6SLuis Carlos Cobo * 253224bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 253393da9cc1Scolin@cozybit.com * 253424bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 253593da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 253693da9cc1Scolin@cozybit.com * set, and which to leave alone. 253793da9cc1Scolin@cozybit.com * 25389f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 253931888487SJouni Malinen * 254031888487SJouni Malinen * @set_txq_params: Set TX queue parameters 254172bdcf34SJouni Malinen * 2542e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2543e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2544e8c9bd5bSJohannes Berg * join the mesh instead. 2545e8c9bd5bSJohannes Berg * 2546e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2547e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2548e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2549e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 25509aed3cc1SJouni Malinen * 25512a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 25522a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 25532a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 25542a519311SJohannes Berg * the scan/scan_done bracket too. 255591d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 255691d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 2557636a5d36SJouni Malinen * 2558636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 25598d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2560636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 25618d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2562636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 25638d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2564636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 25658d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 256604a773adSJohannes Berg * 2567b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2568bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 2569bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 2570bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 2571bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 2572bf1ecd21SJouni Malinen * was received. 2573bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 2574bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 2575bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 2576bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 2577bf1ecd21SJouni Malinen * frame instead of Association Request frame. 2578bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 2579bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 258035eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 2581bf1ecd21SJouni Malinen * indication of requesting reassociation. 2582bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 2583bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 2584bf1ecd21SJouni Malinen * cfg80211_roamed() or cfg80211_roamed_bss(). 25858d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2586*088e8df8Svamsi krishna * @update_connect_params: Update the connect parameters while connected to a 2587*088e8df8Svamsi krishna * BSS. The updated parameters can be used by driver/firmware for 2588*088e8df8Svamsi krishna * subsequent BSS selection (roaming) decisions and to form the 2589*088e8df8Svamsi krishna * Authentication/(Re)Association Request frames. This call does not 2590*088e8df8Svamsi krishna * request an immediate disassociation or reassociation with the current 2591*088e8df8Svamsi krishna * BSS, i.e., this impacts only subsequent (re)associations. The bits in 2592*088e8df8Svamsi krishna * changed are defined in &enum cfg80211_connect_params_changed. 2593*088e8df8Svamsi krishna * (invoked with the wireless_dev mutex held) 25940711d638SIlan Peer * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 25950711d638SIlan Peer * connection is in progress. Once done, call cfg80211_disconnected() in 25960711d638SIlan Peer * case connection was already established (invoked with the 25970711d638SIlan Peer * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 2598b23aa676SSamuel Ortiz * 259904a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 260004a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 260104a773adSJohannes Berg * to a merge. 26028d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 260304a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 26048d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2605b9a5f8caSJouni Malinen * 2606f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2607f4e583c8SAntonio Quartulli * MESH mode) 2608f4e583c8SAntonio Quartulli * 2609b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2610b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2611b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2612b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 26137643a2c3SJohannes Berg * 26141432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2615c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2616c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2617c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2618c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 26197643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 26201f87f7d3SJohannes Berg * return 0 if successful 26211f87f7d3SJohannes Berg * 2622abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2623abe37c4bSJohannes Berg * 26241f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 26251f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2626aff89a9bSJohannes Berg * 262761fa713cSHolger Schurig * @dump_survey: get site survey information. 262861fa713cSHolger Schurig * 26299588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 26309588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 26319588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 26329588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 26339588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 26349588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 26359588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 26369588bbd5SJouni Malinen * the duration value. 2637f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2638f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2639f7ca38dfSJohannes Berg * frame on another channel 26409588bbd5SJouni Malinen * 2641fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 264271063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 264371063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 264471063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 264571063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 264671063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 264771063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 264867fbb16bSSamuel Ortiz * 2649abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2650abe37c4bSJohannes Berg * 265167fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 265267fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 265367fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 265467fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 265567fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 26569043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 26579043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2658d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 2659e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 2660e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 2661e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 2662e86abc68SJohannes Berg * disabled.) 266384f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 266484f10708SThomas Pedersen * thresholds. 2665807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2666d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2667d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2668d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2669d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2670d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2671d9b8396aSJohannes Berg * method returns 0.) 267267fbb16bSSamuel Ortiz * 2673271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 267433d8783cSJohannes Berg * registered. The callback is allowed to sleep. 2675547025d5SBruno Randolf * 2676547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2677547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2678547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2679547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2680547025d5SBruno Randolf * 2681547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 26823677713bSJohn W. Linville * 2683109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2684109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 26857f6cf311SJohannes Berg * 26867f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 26877f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 26881d9d9213SSimon Wunderlich * 26891d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2690d6199218SBen Greear * 26915b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 26925b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 26935b7ccaf3SJohannes Berg * current monitoring channel. 269498104fdeSJohannes Berg * 269598104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 269698104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 269777765eafSVasanthakumar Thiagarajan * 269877765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 269977765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 270077765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 270177765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 270277765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 270377765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 270404f39047SSimon Wunderlich * 270504f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 27068bf24293SJouni Malinen * 27078bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 27088bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 27098bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 27105de17984SArend van Spriel * 27115de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 27125de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 27135de17984SArend van Spriel * driver can take the most appropriate actions. 27145de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 27155de17984SArend van Spriel * reliability. This operation can not fail. 2716be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 271716ef1fe2SSimon Wunderlich * 271897dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 271997dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 272097dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 272197dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 272297dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 272397dc94f1SMichal Kazior * as soon as possible. 2724fa9ffc74SKyeyoon Park * 2725fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2726e16821bcSJouni Malinen * 2727e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2728e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2729e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2730960d01acSJohannes Berg * 2731960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2732960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2733960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2734960d01acSJohannes Berg * account. 2735960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2736960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2737960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2738960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2739960d01acSJohannes Berg * rejected) 2740960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 27416e0bd6c3SRostislav Lisovy * 27426e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 27436e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 27446e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 27456e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 27461057d35eSArik Nemtsov * 27471057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 27481057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 27491057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 27501057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 27511057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2752cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 2753cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 2754a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 2755a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 2756a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 2757a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 2758a442b761SAyala Beker * cfg80211_free_nan_func(). 2759a442b761SAyala Beker * On success the driver should assign an instance_id in the 2760a442b761SAyala Beker * provided @nan_func. 2761a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 2762a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 2763a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 2764a5a9dcf2SAyala Beker * All other parameters must be ignored. 2765ce0ce13aSMichael Braun * 2766ce0ce13aSMichael Braun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 2767704232c2SJohannes Berg */ 2768704232c2SJohannes Berg struct cfg80211_ops { 2769ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 27700378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 27716d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 27720378b3f1SJohannes Berg 277384efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2774552bff0cSJohannes Berg const char *name, 27756bab2e19STom Gundersen unsigned char name_assign_type, 2776f9e10ce4SJohannes Berg enum nl80211_iftype type, 2777f9e10ce4SJohannes Berg u32 *flags, 27782ec600d6SLuis Carlos Cobo struct vif_params *params); 277984efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 278084efbb84SJohannes Berg struct wireless_dev *wdev); 2781e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2782e36d56b6SJohannes Berg struct net_device *dev, 27832ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 27842ec600d6SLuis Carlos Cobo struct vif_params *params); 278541ade00fSJohannes Berg 278641ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2787e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 278841ade00fSJohannes Berg struct key_params *params); 278941ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2790e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2791e31b8213SJohannes Berg void *cookie, 279241ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 279341ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2794e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 279541ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 279641ade00fSJohannes Berg struct net_device *netdev, 2797dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 27983cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 27993cfcf6acSJouni Malinen struct net_device *netdev, 28003cfcf6acSJouni Malinen u8 key_index); 2801ed1b6cc7SJohannes Berg 28028860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 28038860020eSJohannes Berg struct cfg80211_ap_settings *settings); 28048860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 28058860020eSJohannes Berg struct cfg80211_beacon_data *info); 28068860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 28075727ef1bSJohannes Berg 28085727ef1bSJohannes Berg 28095727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 28103b3a0162SJohannes Berg const u8 *mac, 28113b3a0162SJohannes Berg struct station_parameters *params); 28125727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 281389c771e5SJouni Malinen struct station_del_parameters *params); 28145727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 28153b3a0162SJohannes Berg const u8 *mac, 28163b3a0162SJohannes Berg struct station_parameters *params); 2817fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 28183b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 28192ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 28202ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 28212ec600d6SLuis Carlos Cobo 28222ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 28233b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 28242ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 28253b3a0162SJohannes Berg const u8 *dst); 28262ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 28273b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 28282ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 28293b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 28302ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 28312ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 28322ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 283366be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 283466be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 283566be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 283666be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 283766be7d2bSHenning Rogge struct mpath_info *pinfo); 283824bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 283993da9cc1Scolin@cozybit.com struct net_device *dev, 284093da9cc1Scolin@cozybit.com struct mesh_config *conf); 284124bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 284229cbe68cSJohannes Berg struct net_device *dev, u32 mask, 284329cbe68cSJohannes Berg const struct mesh_config *nconf); 284429cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 284529cbe68cSJohannes Berg const struct mesh_config *conf, 284629cbe68cSJohannes Berg const struct mesh_setup *setup); 284729cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 284829cbe68cSJohannes Berg 28496e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 28506e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 28516e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 28526e0bd6c3SRostislav Lisovy 28539f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 28549f1ba906SJouni Malinen struct bss_parameters *params); 285531888487SJouni Malinen 2856f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 285731888487SJouni Malinen struct ieee80211_txq_params *params); 285872bdcf34SJouni Malinen 2859e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2860e8c9bd5bSJohannes Berg struct net_device *dev, 2861e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2862e8c9bd5bSJohannes Berg 2863e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2864683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 28659aed3cc1SJouni Malinen 2866fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 28672a519311SJohannes Berg struct cfg80211_scan_request *request); 286891d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 2869636a5d36SJouni Malinen 2870636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2871636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2872636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2873636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2874636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 287563c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2876636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 287763c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 287804a773adSJohannes Berg 2879b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2880b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2881*088e8df8Svamsi krishna int (*update_connect_params)(struct wiphy *wiphy, 2882*088e8df8Svamsi krishna struct net_device *dev, 2883*088e8df8Svamsi krishna struct cfg80211_connect_params *sme, 2884*088e8df8Svamsi krishna u32 changed); 2885b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2886b23aa676SSamuel Ortiz u16 reason_code); 2887b23aa676SSamuel Ortiz 288804a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 288904a773adSJohannes Berg struct cfg80211_ibss_params *params); 289004a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2891b9a5f8caSJouni Malinen 2892f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 289357fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 2894f4e583c8SAntonio Quartulli 2895b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 28967643a2c3SJohannes Berg 2897c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2898fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2899c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2900c8442118SJohannes Berg int *dbm); 29011f87f7d3SJohannes Berg 2902ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2903388ac775SJohannes Berg const u8 *addr); 2904ab737a4fSJohannes Berg 29051f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2906aff89a9bSJohannes Berg 2907aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2908fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2909fc73f11fSDavid Spinadel void *data, int len); 291071063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 291171063f0eSWey-Yi Guy struct netlink_callback *cb, 291271063f0eSWey-Yi Guy void *data, int len); 2913aff89a9bSJohannes Berg #endif 2914bc92afd9SJohannes Berg 29159930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 29169930380fSJohannes Berg struct net_device *dev, 29179930380fSJohannes Berg const u8 *peer, 29189930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 29199930380fSJohannes Berg 292061fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 292161fa713cSHolger Schurig int idx, struct survey_info *info); 292261fa713cSHolger Schurig 292367fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 292467fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 292567fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 292667fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 292767fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 292867fbb16bSSamuel Ortiz 29299588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 293071bbc994SJohannes Berg struct wireless_dev *wdev, 29319588bbd5SJouni Malinen struct ieee80211_channel *chan, 29329588bbd5SJouni Malinen unsigned int duration, 29339588bbd5SJouni Malinen u64 *cookie); 29349588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 293571bbc994SJohannes Berg struct wireless_dev *wdev, 29369588bbd5SJouni Malinen u64 cookie); 29379588bbd5SJouni Malinen 293871bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2939b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2940b176e629SAndrei Otcheretianski u64 *cookie); 2941f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 294271bbc994SJohannes Berg struct wireless_dev *wdev, 2943f7ca38dfSJohannes Berg u64 cookie); 2944026331c4SJouni Malinen 2945bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2946bc92afd9SJohannes Berg bool enabled, int timeout); 2947d6dc1a38SJuuso Oikarinen 2948d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2949d6dc1a38SJuuso Oikarinen struct net_device *dev, 2950d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2951271733cfSJohannes Berg 295284f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 295384f10708SThomas Pedersen struct net_device *dev, 295484f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 295584f10708SThomas Pedersen 2956271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 295771bbc994SJohannes Berg struct wireless_dev *wdev, 2958271733cfSJohannes Berg u16 frame_type, bool reg); 2959afe0cbf8SBruno Randolf 2960afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2961afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 29623677713bSJohn W. Linville 2963807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2964807f8a8cSLuciano Coelho struct net_device *dev, 2965807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 296685a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2967e5497d76SJohannes Berg 2968e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2969e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2970109086ceSArik Nemtsov 2971109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 29723b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2973df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 297431fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2975109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 29763b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 29777f6cf311SJohannes Berg 29787f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 29797f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2980e999882aSJohannes Berg 29811d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 29821d9d9213SSimon Wunderlich struct net_device *dev, 29831d9d9213SSimon Wunderlich u16 noack_map); 29841d9d9213SSimon Wunderlich 2985683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 29865b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2987683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 298898104fdeSJohannes Berg 298998104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 299098104fdeSJohannes Berg struct wireless_dev *wdev); 299198104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 299298104fdeSJohannes Berg struct wireless_dev *wdev); 299377765eafSVasanthakumar Thiagarajan 299477765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 299577765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 299604f39047SSimon Wunderlich 299704f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 299804f39047SSimon Wunderlich struct net_device *dev, 299931559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 300031559f35SJanusz Dziedzic u32 cac_time_ms); 3001355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 3002355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 30035de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 30045de17984SArend van Spriel struct wireless_dev *wdev, 30055de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 30065de17984SArend van Spriel u16 duration); 30075de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 30085de17984SArend van Spriel struct wireless_dev *wdev); 3009be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 3010be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 301116ef1fe2SSimon Wunderlich 301216ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 301316ef1fe2SSimon Wunderlich struct net_device *dev, 301416ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 3015e16821bcSJouni Malinen 3016fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 3017fa9ffc74SKyeyoon Park struct net_device *dev, 3018fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3019e16821bcSJouni Malinen 3020e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 3021e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 3022960d01acSJohannes Berg 3023960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 3024960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 3025960d01acSJohannes Berg u16 admitted_time); 3026960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 3027960d01acSJohannes Berg u8 tsid, const u8 *peer); 30281057d35eSArik Nemtsov 30291057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 30301057d35eSArik Nemtsov struct net_device *dev, 30311057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 30321057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 30331057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 30341057d35eSArik Nemtsov struct net_device *dev, 30351057d35eSArik Nemtsov const u8 *addr); 3036cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 3037cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 3038cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 3039a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3040a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 3041a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3042a442b761SAyala Beker u64 cookie); 3043a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 3044a5a9dcf2SAyala Beker struct wireless_dev *wdev, 3045a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 3046a5a9dcf2SAyala Beker u32 changes); 3047ce0ce13aSMichael Braun 3048ce0ce13aSMichael Braun int (*set_multicast_to_unicast)(struct wiphy *wiphy, 3049ce0ce13aSMichael Braun struct net_device *dev, 3050ce0ce13aSMichael Braun const bool enabled); 3051704232c2SJohannes Berg }; 3052704232c2SJohannes Berg 3053d3236553SJohannes Berg /* 3054d3236553SJohannes Berg * wireless hardware and networking interfaces structures 3055d3236553SJohannes Berg * and registration/helper functions 3056d3236553SJohannes Berg */ 3057d3236553SJohannes Berg 3058d3236553SJohannes Berg /** 30595be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 30605be83de5SJohannes Berg * 30615be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 30625be83de5SJohannes Berg * wiphy at all 30635be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 30645be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 30655be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 30665be83de5SJohannes Berg * reason to override the default 30679bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 30689bc383deSJohannes Berg * on a VLAN interface) 30699bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 3070c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 3071c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 3072c0692b8fSJohannes Berg * control_port_no_encrypt flag. 3073e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 307415d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 307515d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 30761ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 3077f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 3078f4b34b55SVivek Natarajan * firmware. 3079cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 3080109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 3081109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 3082109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 3083109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 3084109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 3085109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 3086562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 30875e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 30885e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 30895e760230SJohannes Berg * cfg80211_report_obss_beacon(). 309087bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 309187bbbe22SArik Nemtsov * responds to probe-requests in hardware. 30927c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 30937c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 30942f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 309516ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 309616ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 3097b8676221SDavid Spinadel * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 3098b8676221SDavid Spinadel * before connection. 30995be83de5SJohannes Berg */ 31005be83de5SJohannes Berg enum wiphy_flags { 3101723e73acSJohannes Berg /* use hole at 0 */ 3102a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 3103a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 31045be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 31055be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 31069bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 31079bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 3108c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 3109309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 311015d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 3111807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 31128e8b41f9SJohannes Berg /* use hole at 12 */ 3113f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 3114cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 3115109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 3116109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 3117562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 31185e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 311987bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 31207c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 31217c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 31222f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 312316ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 3124b8676221SDavid Spinadel WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 31257527a782SJohannes Berg }; 31267527a782SJohannes Berg 31277527a782SJohannes Berg /** 31287527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 31297527a782SJohannes Berg * @max: maximum number of interfaces of these types 31307527a782SJohannes Berg * @types: interface types (bits) 31317527a782SJohannes Berg */ 31327527a782SJohannes Berg struct ieee80211_iface_limit { 31337527a782SJohannes Berg u16 max; 31347527a782SJohannes Berg u16 types; 31357527a782SJohannes Berg }; 31367527a782SJohannes Berg 31377527a782SJohannes Berg /** 31387527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 31397527a782SJohannes Berg * @limits: limits for the given interface types 31407527a782SJohannes Berg * @n_limits: number of limitations 31417527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 31427527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 31437527a782SJohannes Berg * group 31447527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 31457527a782SJohannes Berg * between infrastructure and AP types must match. This is required 31467527a782SJohannes Berg * only in special cases. 314711c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 31488c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 31490c317a02SPurushottam Kushwaha * @beacon_int_min_gcd: This interface combination supports different 31500c317a02SPurushottam Kushwaha * beacon intervals. 31510c317a02SPurushottam Kushwaha * = 0 - all beacon intervals for different interface must be same. 31520c317a02SPurushottam Kushwaha * > 0 - any beacon interval for the interface part of this combination AND 31530c317a02SPurushottam Kushwaha * *GCD* of all beacon intervals from beaconing interfaces of this 31540c317a02SPurushottam Kushwaha * combination must be greater or equal to this value. 31557527a782SJohannes Berg * 3156b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 3157b80edbc1SLuciano Coelho * combinations it supports concurrently. 31587527a782SJohannes Berg * 3159b80edbc1SLuciano Coelho * Examples: 3160b80edbc1SLuciano Coelho * 3161b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 31627527a782SJohannes Berg * 31637527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 31647527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 31657527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 31667527a782SJohannes Berg * }; 31677527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 31687527a782SJohannes Berg * .limits = limits1, 31697527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 31707527a782SJohannes Berg * .max_interfaces = 2, 31717527a782SJohannes Berg * .beacon_int_infra_match = true, 31727527a782SJohannes Berg * }; 31737527a782SJohannes Berg * 31747527a782SJohannes Berg * 3175b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 31767527a782SJohannes Berg * 31777527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 31787527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 31797527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 31807527a782SJohannes Berg * }; 31817527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 31827527a782SJohannes Berg * .limits = limits2, 31837527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 31847527a782SJohannes Berg * .max_interfaces = 8, 31857527a782SJohannes Berg * .num_different_channels = 1, 31867527a782SJohannes Berg * }; 31877527a782SJohannes Berg * 31887527a782SJohannes Berg * 3189b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 3190b80edbc1SLuciano Coelho * 31917527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 31927527a782SJohannes Berg * 31937527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 31947527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 31957527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 31967527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 31977527a782SJohannes Berg * }; 31987527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 31997527a782SJohannes Berg * .limits = limits3, 32007527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 32017527a782SJohannes Berg * .max_interfaces = 4, 32027527a782SJohannes Berg * .num_different_channels = 2, 32037527a782SJohannes Berg * }; 32047527a782SJohannes Berg */ 32057527a782SJohannes Berg struct ieee80211_iface_combination { 32067527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 32077527a782SJohannes Berg u32 num_different_channels; 32087527a782SJohannes Berg u16 max_interfaces; 32097527a782SJohannes Berg u8 n_limits; 32107527a782SJohannes Berg bool beacon_int_infra_match; 321111c4a075SSimon Wunderlich u8 radar_detect_widths; 32128c48b50aSFelix Fietkau u8 radar_detect_regions; 32130c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 32145be83de5SJohannes Berg }; 32155be83de5SJohannes Berg 32162e161f78SJohannes Berg struct ieee80211_txrx_stypes { 32172e161f78SJohannes Berg u16 tx, rx; 32182e161f78SJohannes Berg }; 32192e161f78SJohannes Berg 32205be83de5SJohannes Berg /** 3221ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 3222ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 3223ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 3224ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 3225ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 3226ff1b6e69SJohannes Berg * packet should be preserved in that case 3227ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 3228ff1b6e69SJohannes Berg * (see nl80211.h) 3229ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 323077dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 323177dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 323277dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 323377dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 323477dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 32358cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 3236ff1b6e69SJohannes Berg */ 3237ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 3238ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 3239ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 3240ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 324177dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 324277dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 324377dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 324477dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 324577dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 32468cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 3247ff1b6e69SJohannes Berg }; 3248ff1b6e69SJohannes Berg 32492a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 32502a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 32512a0e047eSJohannes Berg u32 data_payload_max; 32522a0e047eSJohannes Berg u32 data_interval_max; 32532a0e047eSJohannes Berg u32 wake_payload_max; 32542a0e047eSJohannes Berg bool seq; 32552a0e047eSJohannes Berg }; 32562a0e047eSJohannes Berg 3257ff1b6e69SJohannes Berg /** 3258ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 3259ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 3260ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 3261ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 3262ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 3263ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 3264bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 32658cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 32668cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 32678cd4d456SLuciano Coelho * scheduled scans. 32688cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 32698cd4d456SLuciano Coelho * details. 32702a0e047eSJohannes Berg * @tcp: TCP wakeup support information 3271ff1b6e69SJohannes Berg */ 3272ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 3273ff1b6e69SJohannes Berg u32 flags; 3274ff1b6e69SJohannes Berg int n_patterns; 3275ff1b6e69SJohannes Berg int pattern_max_len; 3276ff1b6e69SJohannes Berg int pattern_min_len; 3277bb92d199SAmitkumar Karwar int max_pkt_offset; 32788cd4d456SLuciano Coelho int max_nd_match_sets; 32792a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 3280ff1b6e69SJohannes Berg }; 3281ff1b6e69SJohannes Berg 3282ff1b6e69SJohannes Berg /** 3283be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 3284be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 3285be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 3286be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 3287be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 3288be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 3289be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 3290be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 3291be29b99aSAmitkumar Karwar */ 3292be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 3293be29b99aSAmitkumar Karwar int n_rules; 3294be29b99aSAmitkumar Karwar int max_delay; 3295be29b99aSAmitkumar Karwar int n_patterns; 3296be29b99aSAmitkumar Karwar int pattern_max_len; 3297be29b99aSAmitkumar Karwar int pattern_min_len; 3298be29b99aSAmitkumar Karwar int max_pkt_offset; 3299be29b99aSAmitkumar Karwar }; 3300be29b99aSAmitkumar Karwar 3301be29b99aSAmitkumar Karwar /** 3302ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 3303ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 3304ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 3305ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 3306ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 3307ad7e718cSJohannes Berg */ 3308ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 3309ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 3310ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 3311ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 3312ad7e718cSJohannes Berg }; 3313ad7e718cSJohannes Berg 3314ad7e718cSJohannes Berg /** 3315ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 3316ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 3317ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 3318ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 3319ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 3320ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 33217bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 33227bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 33237bdbe400SJohannes Berg * dumpit calls. 33247bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 33257bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 33267bdbe400SJohannes Berg * are used with dump requests. 3327ad7e718cSJohannes Berg */ 3328ad7e718cSJohannes Berg struct wiphy_vendor_command { 3329ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 3330ad7e718cSJohannes Berg u32 flags; 3331ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 3332ad7e718cSJohannes Berg const void *data, int data_len); 33337bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 33347bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 33357bdbe400SJohannes Berg unsigned long *storage); 3336ad7e718cSJohannes Berg }; 3337ad7e718cSJohannes Berg 3338ad7e718cSJohannes Berg /** 3339019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 3340019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 3341019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 3342019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 3343019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 3344019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 3345019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 3346019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 3347019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 3348019ae3a9SKanchanapally, Vidyullatha */ 3349019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 3350019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 3351019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 3352019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 3353019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 3354019ae3a9SKanchanapally, Vidyullatha }; 3355019ae3a9SKanchanapally, Vidyullatha 3356019ae3a9SKanchanapally, Vidyullatha /** 33575be83de5SJohannes Berg * struct wiphy - wireless hardware description 33582784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 33592784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 33602784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 3361d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 3362d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 3363d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 3364d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 3365d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 3366d3236553SJohannes Berg * @cipher_suites: supported cipher suites 3367d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 3368b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 3369b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 3370b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 3371b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 3372b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 3373abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 3374ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 3375ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 3376ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 33770fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 3378ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 3379ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 3380ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 3381ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 3382ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 3383ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 3384ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 3385ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3386fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3387fd235913SRandy Dunlap * unregister hardware 3388abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3389abe37c4bSJohannes Berg * automatically on wiphy renames 3390abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 33914a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3392abe37c4bSJohannes Berg * @wext: wireless extension handlers 3393abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3394abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3395abe37c4bSJohannes Berg * must be set by driver 33967527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 33977527a782SJohannes Berg * list single interface types. 33987527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 33997527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 34007527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3401abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3402a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3403a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 34041f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3405d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 3406d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 3407abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3408abe37c4bSJohannes Berg * this variable determines its size 3409abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3410abe37c4bSJohannes Berg * any given scan 341193b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 341293b6aa69SLuciano Coelho * for in any given scheduled scan 3413a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3414a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3415a1f1c21cSLuciano Coelho * supported. 3416abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3417abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3418abe37c4bSJohannes Berg * include fixed IEs like supported rates 34195a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 34205a865badSLuciano Coelho * scans 34213b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 34223b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 34233b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 34243b06d277SAvraham Stern * single scan plan supported by the device. 34253b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 34263b06d277SAvraham Stern * scan plan supported by the device. 3427abe37c4bSJohannes Berg * @coverage_class: current coverage class 3428abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3429abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3430abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3431abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3432abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3433abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 34342e161f78SJohannes Berg * 34352e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 34362e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 34372e161f78SJohannes Berg * type 3438a7ffac95SBruno Randolf * 34397f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 34407f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 34417f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 34427f531e03SBruno Randolf * 34437f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 34447f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 34457f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3446a293911dSJohannes Berg * 344715f0ebc2SRandy Dunlap * @probe_resp_offload: 344815f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 344915f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 345015f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 345115f0ebc2SRandy Dunlap * 3452a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3453a293911dSJohannes Berg * may request, if implemented. 3454ff1b6e69SJohannes Berg * 3455ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 34566abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 34576abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 34586abb9cb9SJohannes Berg * to the suspend() operation instead. 3459562a7480SJohannes Berg * 3460562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 34617e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 34627e7c8926SBen Greear * If null, then none can be over-ridden. 3463ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3464ee2aca34SJohannes Berg * If null, then none can be over-ridden. 346577765eafSVasanthakumar Thiagarajan * 346653873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 346753873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 346853873f13SJohannes Berg * 346977765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 347077765eafSVasanthakumar Thiagarajan * supports for ACL. 3471a50df0c4SJohannes Berg * 3472a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3473a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3474a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3475a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3476019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 3477019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 3478019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 3479a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3480a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3481019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 3482019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 3483019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 3484be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3485ad7e718cSJohannes Berg * 3486ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3487ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3488567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3489567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3490b43504cfSJouni Malinen * 3491b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3492b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3493b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3494b43504cfSJouni Malinen * some cases, but may not always reach. 3495c2e4323bSLuciano Coelho * 3496c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3497c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3498c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3499c2e4323bSLuciano Coelho * infinite. 350067af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 350167af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 350267af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 350367af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 350467af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 350567af9811SEmmanuel Grumbach * This value should be set in MHz. 350638de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 350738de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 350838de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 3509a442b761SAyala Beker * 3510a442b761SAyala Beker * @cookie_counter: unique generic cookie counter, used to identify objects. 3511d3236553SJohannes Berg */ 3512d3236553SJohannes Berg struct wiphy { 3513d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3514d3236553SJohannes Berg 3515ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3516d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3517ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3518ef15aac6SJohannes Berg 3519ef15aac6SJohannes Berg struct mac_address *addresses; 3520d3236553SJohannes Berg 35212e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 35222e161f78SJohannes Berg 35237527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 35247527a782SJohannes Berg int n_iface_combinations; 35257527a782SJohannes Berg u16 software_iftypes; 35267527a782SJohannes Berg 35272e161f78SJohannes Berg u16 n_addresses; 35282e161f78SJohannes Berg 3529d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3530d3236553SJohannes Berg u16 interface_modes; 3531d3236553SJohannes Berg 353277765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 353377765eafSVasanthakumar Thiagarajan 3534a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3535d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3536463d0183SJohannes Berg 3537562a7480SJohannes Berg u32 ap_sme_capa; 3538562a7480SJohannes Berg 3539d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3540d3236553SJohannes Berg 3541d3236553SJohannes Berg int bss_priv_size; 3542d3236553SJohannes Berg u8 max_scan_ssids; 354393b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3544a1f1c21cSLuciano Coelho u8 max_match_sets; 3545d3236553SJohannes Berg u16 max_scan_ie_len; 35465a865badSLuciano Coelho u16 max_sched_scan_ie_len; 35473b06d277SAvraham Stern u32 max_sched_scan_plans; 35483b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 35493b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 3550d3236553SJohannes Berg 3551d3236553SJohannes Berg int n_cipher_suites; 3552d3236553SJohannes Berg const u32 *cipher_suites; 3553d3236553SJohannes Berg 3554b9a5f8caSJouni Malinen u8 retry_short; 3555b9a5f8caSJouni Malinen u8 retry_long; 3556b9a5f8caSJouni Malinen u32 frag_threshold; 3557b9a5f8caSJouni Malinen u32 rts_threshold; 355881077e82SLukáš Turek u8 coverage_class; 3559b9a5f8caSJouni Malinen 356081135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3561dfce95f5SKalle Valo u32 hw_version; 3562dfce95f5SKalle Valo 3563dfb89c56SJohannes Berg #ifdef CONFIG_PM 3564964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 35656abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3566dfb89c56SJohannes Berg #endif 3567ff1b6e69SJohannes Berg 3568a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3569a293911dSJohannes Berg 357067fbb16bSSamuel Ortiz u8 max_num_pmkids; 357167fbb16bSSamuel Ortiz 35727f531e03SBruno Randolf u32 available_antennas_tx; 35737f531e03SBruno Randolf u32 available_antennas_rx; 3574a7ffac95SBruno Randolf 357587bbbe22SArik Nemtsov /* 357687bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 357787bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 357887bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 357987bbbe22SArik Nemtsov */ 358087bbbe22SArik Nemtsov u32 probe_resp_offload; 358187bbbe22SArik Nemtsov 3582a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3583a50df0c4SJohannes Berg u8 extended_capabilities_len; 3584a50df0c4SJohannes Berg 3585019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 3586019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 3587019ae3a9SKanchanapally, Vidyullatha 3588d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3589d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3590d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3591d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3592d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3593cf5aa2f1SDavid Kilroy const void *privid; 3594d3236553SJohannes Berg 359557fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 3596d3236553SJohannes Berg 3597d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 35980c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3599d3236553SJohannes Berg struct regulatory_request *request); 3600d3236553SJohannes Berg 3601d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3602d3236553SJohannes Berg 3603458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3604d3236553SJohannes Berg 3605d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3606d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3607d3236553SJohannes Berg struct device dev; 3608d3236553SJohannes Berg 3609ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3610ecb44335SStanislaw Gruszka bool registered; 3611ecb44335SStanislaw Gruszka 3612d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3613d3236553SJohannes Berg struct dentry *debugfsdir; 3614d3236553SJohannes Berg 36157e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3616ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 36177e7c8926SBen Greear 361853873f13SJohannes Berg struct list_head wdev_list; 361953873f13SJohannes Berg 3620463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 36210c5c9fb5SEric W. Biederman possible_net_t _net; 3622463d0183SJohannes Berg 36233d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 36243d23e349SJohannes Berg const struct iw_handler_def *wext; 36253d23e349SJohannes Berg #endif 36263d23e349SJohannes Berg 3627be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3628be29b99aSAmitkumar Karwar 3629ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3630567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3631567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3632ad7e718cSJohannes Berg 3633b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3634b43504cfSJouni Malinen 36359a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 363667af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 36379a774c78SAndrei Otcheretianski 363838de03d2SArend van Spriel u32 bss_select_support; 363938de03d2SArend van Spriel 3640a442b761SAyala Beker u64 cookie_counter; 3641a442b761SAyala Beker 36421c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3643d3236553SJohannes Berg }; 3644d3236553SJohannes Berg 3645463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3646463d0183SJohannes Berg { 3647c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3648463d0183SJohannes Berg } 3649463d0183SJohannes Berg 3650463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3651463d0183SJohannes Berg { 3652c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3653463d0183SJohannes Berg } 3654463d0183SJohannes Berg 3655d3236553SJohannes Berg /** 3656d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3657d3236553SJohannes Berg * 3658d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 36590ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3660d3236553SJohannes Berg */ 3661d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3662d3236553SJohannes Berg { 3663d3236553SJohannes Berg BUG_ON(!wiphy); 3664d3236553SJohannes Berg return &wiphy->priv; 3665d3236553SJohannes Berg } 3666d3236553SJohannes Berg 3667d3236553SJohannes Berg /** 3668f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3669f1f74825SDavid Kilroy * 3670f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 36710ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3672f1f74825SDavid Kilroy */ 3673f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3674f1f74825SDavid Kilroy { 3675f1f74825SDavid Kilroy BUG_ON(!priv); 3676f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3677f1f74825SDavid Kilroy } 3678f1f74825SDavid Kilroy 3679f1f74825SDavid Kilroy /** 3680d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3681d3236553SJohannes Berg * 3682d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3683d3236553SJohannes Berg * @dev: The device to parent it to 3684d3236553SJohannes Berg */ 3685d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3686d3236553SJohannes Berg { 3687d3236553SJohannes Berg wiphy->dev.parent = dev; 3688d3236553SJohannes Berg } 3689d3236553SJohannes Berg 3690d3236553SJohannes Berg /** 3691d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3692d3236553SJohannes Berg * 3693d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 36940ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3695d3236553SJohannes Berg */ 3696d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3697d3236553SJohannes Berg { 3698d3236553SJohannes Berg return wiphy->dev.parent; 3699d3236553SJohannes Berg } 3700d3236553SJohannes Berg 3701d3236553SJohannes Berg /** 3702d3236553SJohannes Berg * wiphy_name - get wiphy name 3703d3236553SJohannes Berg * 3704d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 37050ae997dcSYacine Belkadi * Return: The name of @wiphy. 3706d3236553SJohannes Berg */ 3707e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3708d3236553SJohannes Berg { 3709d3236553SJohannes Berg return dev_name(&wiphy->dev); 3710d3236553SJohannes Berg } 3711d3236553SJohannes Berg 3712d3236553SJohannes Berg /** 37131998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 37141998d90aSBen Greear * 37151998d90aSBen Greear * @ops: The configuration operations for this device 37161998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 37171998d90aSBen Greear * @requested_name: Request a particular name. 37181998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 37191998d90aSBen Greear * 37201998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 37211998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 37221998d90aSBen Greear * 37231998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 37241998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 37251998d90aSBen Greear */ 37261998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 37271998d90aSBen Greear const char *requested_name); 37281998d90aSBen Greear 37291998d90aSBen Greear /** 3730d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3731d3236553SJohannes Berg * 3732d3236553SJohannes Berg * @ops: The configuration operations for this device 3733d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3734d3236553SJohannes Berg * 3735d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3736d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3737d3236553SJohannes Berg * 37380ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 37390ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3740d3236553SJohannes Berg */ 37411998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 37421998d90aSBen Greear int sizeof_priv) 37431998d90aSBen Greear { 37441998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 37451998d90aSBen Greear } 3746d3236553SJohannes Berg 3747d3236553SJohannes Berg /** 3748d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3749d3236553SJohannes Berg * 3750d3236553SJohannes Berg * @wiphy: The wiphy to register. 3751d3236553SJohannes Berg * 37520ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3753d3236553SJohannes Berg */ 375410dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3755d3236553SJohannes Berg 3756d3236553SJohannes Berg /** 3757d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3758d3236553SJohannes Berg * 3759d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3760d3236553SJohannes Berg * 3761d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3762d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3763d3236553SJohannes Berg * request that is being handled. 3764d3236553SJohannes Berg */ 376510dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3766d3236553SJohannes Berg 3767d3236553SJohannes Berg /** 3768d3236553SJohannes Berg * wiphy_free - free wiphy 3769d3236553SJohannes Berg * 3770d3236553SJohannes Berg * @wiphy: The wiphy to free 3771d3236553SJohannes Berg */ 377210dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3773d3236553SJohannes Berg 3774fffd0934SJohannes Berg /* internal structs */ 37756829c878SJohannes Berg struct cfg80211_conn; 377619957bb3SJohannes Berg struct cfg80211_internal_bss; 3777fffd0934SJohannes Berg struct cfg80211_cached_keys; 377819957bb3SJohannes Berg 3779d3236553SJohannes Berg /** 378089a54e48SJohannes Berg * struct wireless_dev - wireless device state 3781d3236553SJohannes Berg * 378289a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 378389a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 378489a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 378589a54e48SJohannes Berg * It need not be registered then as netdev registration will 378689a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 378789a54e48SJohannes Berg * 378889a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 378989a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 379089a54e48SJohannes Berg * there's no netdev registration in that case it may not be 379189a54e48SJohannes Berg * allocated outside of callback operations that return it. 3792d3236553SJohannes Berg * 3793d3236553SJohannes Berg * @wiphy: pointer to hardware description 3794d3236553SJohannes Berg * @iftype: interface type 3795d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 379689a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 379789a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 379889a54e48SJohannes Berg * wireless device if it has no netdev 3799d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 38009e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 38019e0e2961SMichal Kazior * the user-set channel definition. 3802780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3803aa430da4SJohannes Berg * track the channel to be used for AP later 3804d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3805d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3806d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 380729cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 380829cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3809d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 38109bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 38119bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 38129bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 38139bc383deSJohannes Berg * by cfg80211 on change_interface 38142e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 38152e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 38168d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 38178d61ffa5SJohannes Berg * and some API functions require it held 381856d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 381956d1893dSJohannes Berg * beacons, 0 when not valid 382098104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 382173c7da3dSArend Van Spriel * @is_running: true if this is a non-netdev device that has been started, e.g. 382273c7da3dSArend Van Spriel * the P2P Device. 382304f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 382404f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 382531559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3826780b40dfSJohannes Berg * @ps: powersave mode is enabled 3827780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3828780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3829780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3830780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3831780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 383234d50519SLior David * @conn_bss_type: connecting/connected BSS type 3833780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 38345336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3835780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3836780b40dfSJohannes Berg * @event_lock: (private) lock for event list 383778f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3838d3236553SJohannes Berg */ 3839d3236553SJohannes Berg struct wireless_dev { 3840d3236553SJohannes Berg struct wiphy *wiphy; 3841d3236553SJohannes Berg enum nl80211_iftype iftype; 3842d3236553SJohannes Berg 3843667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3844d3236553SJohannes Berg struct list_head list; 3845d3236553SJohannes Berg struct net_device *netdev; 3846d3236553SJohannes Berg 384789a54e48SJohannes Berg u32 identifier; 384889a54e48SJohannes Berg 38492e161f78SJohannes Berg struct list_head mgmt_registrations; 38502e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3851026331c4SJouni Malinen 3852667503ddSJohannes Berg struct mutex mtx; 3853667503ddSJohannes Berg 385473c7da3dSArend Van Spriel bool use_4addr, is_running; 385598104fdeSJohannes Berg 385698104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 38579bc383deSJohannes Berg 3858b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3859d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 386029cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 38616829c878SJohannes Berg struct cfg80211_conn *conn; 3862fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 386334d50519SLior David enum ieee80211_bss_type conn_bss_type; 3864d3236553SJohannes Berg 3865667503ddSJohannes Berg struct list_head event_list; 3866667503ddSJohannes Berg spinlock_t event_lock; 3867667503ddSJohannes Berg 386819957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3869683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 38709e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3871f4489ebeSMichal Kazior 3872c30a3d38SMichal Kazior bool ibss_fixed; 38735336fa88SSimon Wunderlich bool ibss_dfs_possible; 3874c30a3d38SMichal Kazior 3875ffb9eb3dSKalle Valo bool ps; 3876ffb9eb3dSKalle Valo int ps_timeout; 3877ffb9eb3dSKalle Valo 387856d1893dSJohannes Berg int beacon_interval; 387956d1893dSJohannes Berg 388015e47304SEric W. Biederman u32 ap_unexpected_nlportid; 388128946da7SJohannes Berg 388204f39047SSimon Wunderlich bool cac_started; 388304f39047SSimon Wunderlich unsigned long cac_start_time; 388431559f35SJanusz Dziedzic unsigned int cac_time_ms; 388504f39047SSimon Wunderlich 388678f22b6aSJohannes Berg u32 owner_nlportid; 388778f22b6aSJohannes Berg 38883d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3889d3236553SJohannes Berg /* wext data */ 3890cbe8fa9cSJohannes Berg struct { 3891cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3892f2129354SJohannes Berg struct cfg80211_connect_params connect; 3893fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3894c1e5f471SJohannes Berg const u8 *ie; 3895f2129354SJohannes Berg size_t ie_len; 3896f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3897f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 389808645126SJohannes Berg s8 default_key, default_mgmt_key; 3899ffb9eb3dSKalle Valo bool prev_bssid_valid; 3900cbe8fa9cSJohannes Berg } wext; 3901d3236553SJohannes Berg #endif 3902d3236553SJohannes Berg }; 3903d3236553SJohannes Berg 390498104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 390598104fdeSJohannes Berg { 390698104fdeSJohannes Berg if (wdev->netdev) 390798104fdeSJohannes Berg return wdev->netdev->dev_addr; 390898104fdeSJohannes Berg return wdev->address; 390998104fdeSJohannes Berg } 391098104fdeSJohannes Berg 391173c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev) 391273c7da3dSArend Van Spriel { 391373c7da3dSArend Van Spriel if (wdev->netdev) 391473c7da3dSArend Van Spriel return netif_running(wdev->netdev); 391573c7da3dSArend Van Spriel return wdev->is_running; 391673c7da3dSArend Van Spriel } 391773c7da3dSArend Van Spriel 3918d3236553SJohannes Berg /** 3919d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3920d3236553SJohannes Berg * 3921d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 39220ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3923d3236553SJohannes Berg */ 3924d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3925d3236553SJohannes Berg { 3926d3236553SJohannes Berg BUG_ON(!wdev); 3927d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3928d3236553SJohannes Berg } 3929d3236553SJohannes Berg 3930d70e9693SJohannes Berg /** 3931d70e9693SJohannes Berg * DOC: Utility functions 3932d70e9693SJohannes Berg * 3933d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3934d3236553SJohannes Berg */ 3935d3236553SJohannes Berg 3936d3236553SJohannes Berg /** 3937d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3938abe37c4bSJohannes Berg * @chan: channel number 393959eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 39400ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3941d3236553SJohannes Berg */ 394257fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); 3943d3236553SJohannes Berg 3944d3236553SJohannes Berg /** 3945d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3946abe37c4bSJohannes Berg * @freq: center frequency 39470ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3948d3236553SJohannes Berg */ 394910dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3950d3236553SJohannes Berg 3951d3236553SJohannes Berg /* 3952d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3953d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3954d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3955d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3956d3236553SJohannes Berg * clash. 3957d3236553SJohannes Berg */ 395810dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3959d3236553SJohannes Berg int freq); 3960d3236553SJohannes Berg /** 3961d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3962abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3963abe37c4bSJohannes Berg * @freq: the center frequency of the channel 39640ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3965d3236553SJohannes Berg */ 3966d3236553SJohannes Berg static inline struct ieee80211_channel * 3967d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3968d3236553SJohannes Berg { 3969d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3970d3236553SJohannes Berg } 3971d3236553SJohannes Berg 3972d3236553SJohannes Berg /** 3973d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3974d3236553SJohannes Berg * 3975d3236553SJohannes Berg * @sband: the band to look for rates in 3976d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3977d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3978d3236553SJohannes Berg * 39790ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 39800ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 39810ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 39820ae997dcSYacine Belkadi * rates in the band's bitrate table. 3983d3236553SJohannes Berg */ 3984d3236553SJohannes Berg struct ieee80211_rate * 3985d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3986d3236553SJohannes Berg u32 basic_rates, int bitrate); 3987d3236553SJohannes Berg 3988b422c6cdSAshok Nagarajan /** 3989b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3990b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 399174608acaSSimon Wunderlich * @scan_width: width of the control channel 3992b422c6cdSAshok Nagarajan * 3993b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3994b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3995b422c6cdSAshok Nagarajan */ 399674608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 399774608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3998b422c6cdSAshok Nagarajan 3999d3236553SJohannes Berg /* 4000d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 4001d3236553SJohannes Berg * 4002d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 4003d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 4004d3236553SJohannes Berg */ 4005d3236553SJohannes Berg 400633e5a2f7SJohannes Berg struct radiotap_align_size { 400733e5a2f7SJohannes Berg uint8_t align:4, size:4; 400833e5a2f7SJohannes Berg }; 400933e5a2f7SJohannes Berg 401033e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 401133e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 401233e5a2f7SJohannes Berg int n_bits; 401333e5a2f7SJohannes Berg uint32_t oui; 401433e5a2f7SJohannes Berg uint8_t subns; 401533e5a2f7SJohannes Berg }; 401633e5a2f7SJohannes Berg 401733e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 401833e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 401933e5a2f7SJohannes Berg int n_ns; 402033e5a2f7SJohannes Berg }; 402133e5a2f7SJohannes Berg 4022d3236553SJohannes Berg /** 4023d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 402433e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 402533e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 402633e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 402733e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 402833e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 402933e5a2f7SJohannes Berg * the beginning of the actual data portion 403033e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 403133e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 403233e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 403333e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 403433e5a2f7SJohannes Berg * radiotap namespace or not 403533e5a2f7SJohannes Berg * 403633e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 403733e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 403833e5a2f7SJohannes Berg * @_arg_index: next argument index 403933e5a2f7SJohannes Berg * @_arg: next argument pointer 404033e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 404133e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 404233e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 404333e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 404433e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 404533e5a2f7SJohannes Berg * next bitmap word 404633e5a2f7SJohannes Berg * 404733e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 404833e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 4049d3236553SJohannes Berg */ 4050d3236553SJohannes Berg 4051d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 405233e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 405333e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 405433e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 4055d3236553SJohannes Berg 405633e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 405767272440SJohannes Berg __le32 *_next_bitmap; 405833e5a2f7SJohannes Berg 405933e5a2f7SJohannes Berg unsigned char *this_arg; 406033e5a2f7SJohannes Berg int this_arg_index; 406133e5a2f7SJohannes Berg int this_arg_size; 406233e5a2f7SJohannes Berg 406333e5a2f7SJohannes Berg int is_radiotap_ns; 406433e5a2f7SJohannes Berg 406533e5a2f7SJohannes Berg int _max_length; 406633e5a2f7SJohannes Berg int _arg_index; 406733e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 406833e5a2f7SJohannes Berg int _reset_on_ext; 4069d3236553SJohannes Berg }; 4070d3236553SJohannes Berg 407110dd9b7cSJoe Perches int 407210dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 4073d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 407410dd9b7cSJoe Perches int max_length, 407510dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 4076d3236553SJohannes Berg 407710dd9b7cSJoe Perches int 407810dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 4079d3236553SJohannes Berg 408033e5a2f7SJohannes Berg 4081e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 4082e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 4083e31a16d6SZhu Yi 4084e31a16d6SZhu Yi /** 4085e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 4086e31a16d6SZhu Yi * 4087e31a16d6SZhu Yi * @skb: the frame 40880ae997dcSYacine Belkadi * 40890ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 40900ae997dcSYacine Belkadi * returns the 802.11 header length. 40910ae997dcSYacine Belkadi * 40920ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 40930ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 40940ae997dcSYacine Belkadi * 802.11 header. 4095e31a16d6SZhu Yi */ 4096e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 4097e31a16d6SZhu Yi 4098e31a16d6SZhu Yi /** 4099e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 4100e31a16d6SZhu Yi * @fc: frame control field in little-endian format 41010ae997dcSYacine Belkadi * Return: The header length in bytes. 4102e31a16d6SZhu Yi */ 4103633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 4104e31a16d6SZhu Yi 4105e31a16d6SZhu Yi /** 41069b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 41079b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 41089b395bc3SJohannes Berg * (first byte) will be accessed 41090ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 41109b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 41119b395bc3SJohannes Berg */ 41129b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 41139b395bc3SJohannes Berg 41149b395bc3SJohannes Berg /** 4115d70e9693SJohannes Berg * DOC: Data path helpers 4116d70e9693SJohannes Berg * 4117d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 4118d70e9693SJohannes Berg * functions that help implement the data path for devices 4119d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 4120d70e9693SJohannes Berg */ 4121d70e9693SJohannes Berg 4122d70e9693SJohannes Berg /** 4123e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 4124e31a16d6SZhu Yi * @skb: the 802.11 data frame 4125e31a16d6SZhu Yi * @addr: the device MAC address 4126e31a16d6SZhu Yi * @iftype: the virtual interface type 41270ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 4128e31a16d6SZhu Yi */ 4129eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 4130e31a16d6SZhu Yi enum nl80211_iftype iftype); 4131e31a16d6SZhu Yi 4132e31a16d6SZhu Yi /** 4133e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 4134e31a16d6SZhu Yi * @skb: the 802.3 frame 4135e31a16d6SZhu Yi * @addr: the device MAC address 4136e31a16d6SZhu Yi * @iftype: the virtual interface type 4137e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 4138e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 41390ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 4140e31a16d6SZhu Yi */ 4141eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 4142c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 4143c1e5f471SJohannes Berg bool qos); 4144e31a16d6SZhu Yi 4145e31a16d6SZhu Yi /** 4146eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 4147eaf85ca7SZhu Yi * 4148eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 4149eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 4150eaf85ca7SZhu Yi * @skb is consumed after the function returns. 4151eaf85ca7SZhu Yi * 4152eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 4153eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 4154eaf85ca7SZhu Yi * initialized by by the caller. 4155eaf85ca7SZhu Yi * @addr: The device MAC address. 4156eaf85ca7SZhu Yi * @iftype: The device interface type. 4157eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 41588b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 4159eaf85ca7SZhu Yi */ 4160eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 4161eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 41628b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 41638b3becadSYogesh Ashok Powar bool has_80211_header); 4164eaf85ca7SZhu Yi 4165eaf85ca7SZhu Yi /** 4166e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 4167e31a16d6SZhu Yi * @skb: the data frame 4168fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 41690ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 4170e31a16d6SZhu Yi */ 4171fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 4172fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4173e31a16d6SZhu Yi 4174c21dbf92SJohannes Berg /** 4175fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 4176fbd05e4aSLuca Coelho * 4177fbd05e4aSLuca Coelho * @eid: element ID 4178fbd05e4aSLuca Coelho * @ies: data consisting of IEs 4179fbd05e4aSLuca Coelho * @len: length of data 4180fbd05e4aSLuca Coelho * @match: byte array to match 4181fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 4182fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 4183fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 4184fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 4185fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 4186fbd05e4aSLuca Coelho * the second byte is the IE length. 4187fbd05e4aSLuca Coelho * 4188fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 4189fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 4190fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 4191fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 4192fbd05e4aSLuca Coelho * element ID. 4193fbd05e4aSLuca Coelho * 4194fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 4195fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 4196fbd05e4aSLuca Coelho * byte array to match. 4197fbd05e4aSLuca Coelho */ 4198fbd05e4aSLuca Coelho const u8 *cfg80211_find_ie_match(u8 eid, const u8 *ies, int len, 4199fbd05e4aSLuca Coelho const u8 *match, int match_len, 4200fbd05e4aSLuca Coelho int match_offset); 4201fbd05e4aSLuca Coelho 4202fbd05e4aSLuca Coelho /** 4203c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 4204c21dbf92SJohannes Berg * 4205c21dbf92SJohannes Berg * @eid: element ID 4206c21dbf92SJohannes Berg * @ies: data consisting of IEs 4207c21dbf92SJohannes Berg * @len: length of data 4208c21dbf92SJohannes Berg * 42090ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 42100ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 42110ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 42120ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 42130ae997dcSYacine Belkadi * 42140ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 42150ae997dcSYacine Belkadi * having to fit into the given data. 4216c21dbf92SJohannes Berg */ 4217fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 4218fbd05e4aSLuca Coelho { 4219fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 4220fbd05e4aSLuca Coelho } 4221c21dbf92SJohannes Berg 4222d70e9693SJohannes Berg /** 42233f817fe7SJouni Malinen * cfg80211_find_ext_ie - find information element with EID Extension in data 42243f817fe7SJouni Malinen * 42253f817fe7SJouni Malinen * @ext_eid: element ID Extension 42263f817fe7SJouni Malinen * @ies: data consisting of IEs 42273f817fe7SJouni Malinen * @len: length of data 42283f817fe7SJouni Malinen * 42293f817fe7SJouni Malinen * Return: %NULL if the extended element ID could not be found or if 42303f817fe7SJouni Malinen * the element is invalid (claims to be longer than the given 42313f817fe7SJouni Malinen * data), or a pointer to the first byte of the requested 42323f817fe7SJouni Malinen * element, that is the byte containing the element ID. 42333f817fe7SJouni Malinen * 42343f817fe7SJouni Malinen * Note: There are no checks on the element length other than 42353f817fe7SJouni Malinen * having to fit into the given data. 42363f817fe7SJouni Malinen */ 42373f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 42383f817fe7SJouni Malinen { 42393f817fe7SJouni Malinen return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 42403f817fe7SJouni Malinen &ext_eid, 1, 2); 42413f817fe7SJouni Malinen } 42423f817fe7SJouni Malinen 42433f817fe7SJouni Malinen /** 42440c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 42450c28ec58SEliad Peller * 42460c28ec58SEliad Peller * @oui: vendor OUI 42479e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 42480c28ec58SEliad Peller * @ies: data consisting of IEs 42490c28ec58SEliad Peller * @len: length of data 42500c28ec58SEliad Peller * 42510ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 42520ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 42530ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 42540ae997dcSYacine Belkadi * element ID. 42550ae997dcSYacine Belkadi * 42560ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 42570ae997dcSYacine Belkadi * the given data. 42580c28ec58SEliad Peller */ 42599e9ea439SEmmanuel Grumbach const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 42600c28ec58SEliad Peller const u8 *ies, int len); 42610c28ec58SEliad Peller 42620c28ec58SEliad Peller /** 4263d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 4264d70e9693SJohannes Berg * 4265d70e9693SJohannes Berg * TODO 4266d3236553SJohannes Berg */ 4267d3236553SJohannes Berg 4268d3236553SJohannes Berg /** 4269d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 4270d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 4271d3236553SJohannes Berg * conflicts) 4272d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 4273d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 4274d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 4275d3236553SJohannes Berg * alpha2. 4276d3236553SJohannes Berg * 4277d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 4278d3236553SJohannes Berg * what it believes should be the current regulatory domain by 4279d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 4280d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 4281d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 4282d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 4283d3236553SJohannes Berg * 4284d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 4285d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 4286d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 4287d3236553SJohannes Berg * 4288d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 4289d3236553SJohannes Berg * an -ENOMEM. 42900ae997dcSYacine Belkadi * 42910ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 4292d3236553SJohannes Berg */ 429310dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 4294d3236553SJohannes Berg 4295d3236553SJohannes Berg /** 4296b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 4297b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 4298b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 4299b0d7aa59SJonathan Doron * 4300b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 4301b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 4302b0d7aa59SJonathan Doron * information. 4303b0d7aa59SJonathan Doron * 4304b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 4305b0d7aa59SJonathan Doron */ 4306b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 4307b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 4308b0d7aa59SJonathan Doron 4309b0d7aa59SJonathan Doron /** 43102c3e861cSArik Nemtsov * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 43112c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 43122c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 43132c3e861cSArik Nemtsov * 43142c3e861cSArik Nemtsov * This functions requires the RTNL to be held and applies the new regdomain 43152c3e861cSArik Nemtsov * synchronously to this wiphy. For more details see 43162c3e861cSArik Nemtsov * regulatory_set_wiphy_regd(). 43172c3e861cSArik Nemtsov * 43182c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 43192c3e861cSArik Nemtsov */ 43202c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 43212c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 43222c3e861cSArik Nemtsov 43232c3e861cSArik Nemtsov /** 4324d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 4325d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 4326d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 4327d3236553SJohannes Berg * 4328d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 4329d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 4330d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 4331d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 4332d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 4333d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 4334222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 4335ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 4336222ea581SLuis R. Rodriguez * that called this helper. 4337d3236553SJohannes Berg */ 433810dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 4339d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 4340d3236553SJohannes Berg 4341d3236553SJohannes Berg /** 4342d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 4343d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 4344d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 4345d3236553SJohannes Berg * 4346d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 4347d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 4348d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 4349d3236553SJohannes Berg * and processed already. 4350d3236553SJohannes Berg * 43510ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 43520ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 43530ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 43540ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 43550ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 43560ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 43570ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 4358d3236553SJohannes Berg */ 4359361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 4360361c9c8bSJohannes Berg u32 center_freq); 4361d3236553SJohannes Berg 4362034c6d6eSLuis R. Rodriguez /** 4363034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 4364034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 4365034c6d6eSLuis R. Rodriguez * 4366034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 4367034c6d6eSLuis R. Rodriguez * proper string representation. 4368034c6d6eSLuis R. Rodriguez */ 4369034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 4370034c6d6eSLuis R. Rodriguez 4371d3236553SJohannes Berg /* 4372d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 4373d3236553SJohannes Berg * functions and BSS handling helpers 4374d3236553SJohannes Berg */ 4375d3236553SJohannes Berg 43762a519311SJohannes Berg /** 43772a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 43782a519311SJohannes Berg * 43792a519311SJohannes Berg * @request: the corresponding scan request 43801d76250bSAvraham Stern * @info: information about the completed scan 43812a519311SJohannes Berg */ 43821d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 43831d76250bSAvraham Stern struct cfg80211_scan_info *info); 43842a519311SJohannes Berg 43852a519311SJohannes Berg /** 4386807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 4387807f8a8cSLuciano Coelho * 4388807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 4389807f8a8cSLuciano Coelho */ 4390807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 4391807f8a8cSLuciano Coelho 4392807f8a8cSLuciano Coelho /** 4393807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 4394807f8a8cSLuciano Coelho * 4395807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 4396807f8a8cSLuciano Coelho * 4397807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 4398807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 4399807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 4400807f8a8cSLuciano Coelho */ 4401807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 4402807f8a8cSLuciano Coelho 4403807f8a8cSLuciano Coelho /** 4404792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 4405792e6aa7SEliad Peller * 4406792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 4407792e6aa7SEliad Peller * 4408792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 4409792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 4410792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 4411792e6aa7SEliad Peller * This function should be called with rtnl locked. 4412792e6aa7SEliad Peller */ 4413792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 4414792e6aa7SEliad Peller 4415792e6aa7SEliad Peller /** 44166e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 44172a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 44186e19bc4bSDmitry Shmidt * @data: the BSS metadata 4419abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 4420abe37c4bSJohannes Berg * @len: length of the management frame 44212a519311SJohannes Berg * @gfp: context flags 44222a519311SJohannes Berg * 44232a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 44242a519311SJohannes Berg * the BSS should be updated/added. 4425ef100682SJohannes Berg * 44260ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 44270ae997dcSYacine Belkadi * Or %NULL on error. 44282a519311SJohannes Berg */ 4429ef100682SJohannes Berg struct cfg80211_bss * __must_check 44306e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 44316e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 44326e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 44336e19bc4bSDmitry Shmidt gfp_t gfp); 44346e19bc4bSDmitry Shmidt 44356e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4436dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 44373afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4438dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 4439dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 44406e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 44416e19bc4bSDmitry Shmidt { 44426e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 44436e19bc4bSDmitry Shmidt .chan = rx_channel, 44446e19bc4bSDmitry Shmidt .scan_width = scan_width, 44456e19bc4bSDmitry Shmidt .signal = signal, 44466e19bc4bSDmitry Shmidt }; 44476e19bc4bSDmitry Shmidt 44486e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 44496e19bc4bSDmitry Shmidt } 4450dcd6eac1SSimon Wunderlich 4451dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 44522a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 44533afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 44542a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 4455dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4456dcd6eac1SSimon Wunderlich { 44576e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 44586e19bc4bSDmitry Shmidt .chan = rx_channel, 44596e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 44606e19bc4bSDmitry Shmidt .signal = signal, 44616e19bc4bSDmitry Shmidt }; 44626e19bc4bSDmitry Shmidt 44636e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 4464dcd6eac1SSimon Wunderlich } 44652a519311SJohannes Berg 4466abe37c4bSJohannes Berg /** 44675bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 44685bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 44695bc8c1f2SJohannes Berg * from a beacon or probe response 44705bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 44715bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 44725bc8c1f2SJohannes Berg */ 44735bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 44745bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 44755bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 44765bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 44775bc8c1f2SJohannes Berg }; 44785bc8c1f2SJohannes Berg 44795bc8c1f2SJohannes Berg /** 44806e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 4481abe37c4bSJohannes Berg * 4482abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 44836e19bc4bSDmitry Shmidt * @data: the BSS metadata 44845bc8c1f2SJohannes Berg * @ftype: frame type (if known) 4485abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 44867b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 4487abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 4488abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 4489abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 4490abe37c4bSJohannes Berg * @ielen: length of the additional IEs 4491abe37c4bSJohannes Berg * @gfp: context flags 4492abe37c4bSJohannes Berg * 4493abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 4494abe37c4bSJohannes Berg * the BSS should be updated/added. 4495ef100682SJohannes Berg * 44960ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 44970ae997dcSYacine Belkadi * Or %NULL on error. 4498abe37c4bSJohannes Berg */ 4499ef100682SJohannes Berg struct cfg80211_bss * __must_check 45006e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 45016e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 45026e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 45036e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 45046e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 45056e19bc4bSDmitry Shmidt gfp_t gfp); 45066e19bc4bSDmitry Shmidt 45076e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4508dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 45093afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4510dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 45115bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 4512dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 4513dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 45146e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 45156e19bc4bSDmitry Shmidt { 45166e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 45176e19bc4bSDmitry Shmidt .chan = rx_channel, 45186e19bc4bSDmitry Shmidt .scan_width = scan_width, 45196e19bc4bSDmitry Shmidt .signal = signal, 45206e19bc4bSDmitry Shmidt }; 45216e19bc4bSDmitry Shmidt 45226e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 45236e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 45246e19bc4bSDmitry Shmidt gfp); 45256e19bc4bSDmitry Shmidt } 4526dcd6eac1SSimon Wunderlich 4527dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 452806aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 45293afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 45305bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 45317b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 45327b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4533dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4534dcd6eac1SSimon Wunderlich { 45356e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 45366e19bc4bSDmitry Shmidt .chan = rx_channel, 45376e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 45386e19bc4bSDmitry Shmidt .signal = signal, 45396e19bc4bSDmitry Shmidt }; 45406e19bc4bSDmitry Shmidt 45416e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 45426e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 4543dcd6eac1SSimon Wunderlich gfp); 4544dcd6eac1SSimon Wunderlich } 454506aa7afaSJussi Kivilinna 45462a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 45472a519311SJohannes Berg struct ieee80211_channel *channel, 45482a519311SJohannes Berg const u8 *bssid, 454979420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 45506eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 45516eb18137SDedy Lansky enum ieee80211_privacy); 455279420f09SJohannes Berg static inline struct cfg80211_bss * 455379420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 455479420f09SJohannes Berg struct ieee80211_channel *channel, 455579420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 455679420f09SJohannes Berg { 455779420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 45586eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 45596eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 456079420f09SJohannes Berg } 456179420f09SJohannes Berg 45624c0c0b75SJohannes Berg /** 45634c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 45645b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 45654c0c0b75SJohannes Berg * @bss: the BSS struct to reference 45664c0c0b75SJohannes Berg * 45674c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 45684c0c0b75SJohannes Berg */ 45695b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 45704c0c0b75SJohannes Berg 45714c0c0b75SJohannes Berg /** 45724c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 45735b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 45744c0c0b75SJohannes Berg * @bss: the BSS struct 45754c0c0b75SJohannes Berg * 45764c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 45774c0c0b75SJohannes Berg */ 45785b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4579d3236553SJohannes Berg 4580d491af19SJohannes Berg /** 4581d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4582d491af19SJohannes Berg * @wiphy: the wiphy 4583d491af19SJohannes Berg * @bss: the bss to remove 4584d491af19SJohannes Berg * 4585d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4586d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4587d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4588d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4589d491af19SJohannes Berg */ 4590d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4591fee52678SJohannes Berg 4592dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4593dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4594dcd6eac1SSimon Wunderlich { 4595dcd6eac1SSimon Wunderlich switch (chandef->width) { 4596dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4597dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4598dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4599dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4600dcd6eac1SSimon Wunderlich default: 4601dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4602dcd6eac1SSimon Wunderlich } 4603dcd6eac1SSimon Wunderlich } 4604dcd6eac1SSimon Wunderlich 46056039f6d2SJouni Malinen /** 46066ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 46076039f6d2SJouni Malinen * @dev: network device 46086039f6d2SJouni Malinen * @buf: authentication frame (header + body) 46096039f6d2SJouni Malinen * @len: length of the frame data 46106039f6d2SJouni Malinen * 46116ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 46126ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 46136ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 46146ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 46156ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 46166ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 46176ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 46186ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 46196ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 46206ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 46216ff57cf8SJohannes Berg * 46226ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 46236039f6d2SJouni Malinen */ 46246ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 46256039f6d2SJouni Malinen 46266039f6d2SJouni Malinen /** 46276ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 46281965c853SJouni Malinen * @dev: network device 46291965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4630cb0b4bebSJohannes Berg * 46318d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 46328d61ffa5SJohannes Berg * mutex. 46331965c853SJouni Malinen */ 46346ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 46351965c853SJouni Malinen 46361965c853SJouni Malinen /** 46376ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 46386039f6d2SJouni Malinen * @dev: network device 46396ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 46406ff57cf8SJohannes Berg * moves to cfg80211 in this call 46416ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 46426039f6d2SJouni Malinen * @len: length of the frame data 4643f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 4644f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 46456039f6d2SJouni Malinen * 46466ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 46476ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 46486ff57cf8SJohannes Berg * 46496ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 46506039f6d2SJouni Malinen */ 46516ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 46526ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4653b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4654b0b6aa2cSEliad Peller int uapsd_queues); 46556039f6d2SJouni Malinen 46566039f6d2SJouni Malinen /** 46576ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 46581965c853SJouni Malinen * @dev: network device 4659959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4660cb0b4bebSJohannes Berg * 46618d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 46621965c853SJouni Malinen */ 4663959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 46641965c853SJouni Malinen 46651965c853SJouni Malinen /** 46666ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 46676039f6d2SJouni Malinen * @dev: network device 46686ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 46696039f6d2SJouni Malinen * @len: length of the frame data 46706039f6d2SJouni Malinen * 46716039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 467253b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 46738d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 46748d61ffa5SJohannes Berg * corresponding wdev's mutex. 46756039f6d2SJouni Malinen */ 46766ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4677ce470613SHolger Schurig 4678ce470613SHolger Schurig /** 46796ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4680cf4e594eSJouni Malinen * @dev: network device 4681cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4682cf4e594eSJouni Malinen * @len: length of the frame data 4683cf4e594eSJouni Malinen * 46846ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 46856ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4686cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4687cf4e594eSJouni Malinen */ 46886ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 46896ff57cf8SJohannes Berg const u8 *buf, size_t len); 4690cf4e594eSJouni Malinen 4691cf4e594eSJouni Malinen /** 4692a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4693a3b8b056SJouni Malinen * @dev: network device 4694a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4695a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4696a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4697a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4698e6d6e342SJohannes Berg * @gfp: allocation flags 4699a3b8b056SJouni Malinen * 4700a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4701a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4702a3b8b056SJouni Malinen * primitive. 4703a3b8b056SJouni Malinen */ 4704a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4705a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4706e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4707a3b8b056SJouni Malinen 470804a773adSJohannes Berg /** 470904a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 471004a773adSJohannes Berg * 471104a773adSJohannes Berg * @dev: network device 471204a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4713fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 471404a773adSJohannes Berg * @gfp: allocation flags 471504a773adSJohannes Berg * 471604a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 471704a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 471804a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 471904a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 472004a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 472104a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 472204a773adSJohannes Berg */ 4723fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4724fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 472504a773adSJohannes Berg 47261f87f7d3SJohannes Berg /** 4727c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4728c93b5e71SJavier Cardona * 4729c93b5e71SJavier Cardona * @dev: network device 4730c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4731c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4732c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4733c93b5e71SJavier Cardona * @gfp: allocation flags 4734c93b5e71SJavier Cardona * 4735c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4736c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4737c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4738c93b5e71SJavier Cardona */ 4739c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4740c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4741c93b5e71SJavier Cardona 4742c93b5e71SJavier Cardona /** 4743d70e9693SJohannes Berg * DOC: RFkill integration 4744d70e9693SJohannes Berg * 4745d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4746d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4747d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4748d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4749d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4750d70e9693SJohannes Berg * 4751d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4752d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4753d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4754d70e9693SJohannes Berg */ 4755d70e9693SJohannes Berg 4756d70e9693SJohannes Berg /** 47571f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 47581f87f7d3SJohannes Berg * @wiphy: the wiphy 47591f87f7d3SJohannes Berg * @blocked: block status 47601f87f7d3SJohannes Berg */ 47611f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 47621f87f7d3SJohannes Berg 47631f87f7d3SJohannes Berg /** 47641f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 47651f87f7d3SJohannes Berg * @wiphy: the wiphy 47661f87f7d3SJohannes Berg */ 47671f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 47681f87f7d3SJohannes Berg 47691f87f7d3SJohannes Berg /** 47701f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 47711f87f7d3SJohannes Berg * @wiphy: the wiphy 47721f87f7d3SJohannes Berg */ 47731f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 47741f87f7d3SJohannes Berg 4775ad7e718cSJohannes Berg /** 4776ad7e718cSJohannes Berg * DOC: Vendor commands 4777ad7e718cSJohannes Berg * 4778ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4779ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4780ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4781ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4782ad7e718cSJohannes Berg * the configuration mechanism. 4783ad7e718cSJohannes Berg * 4784ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4785ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4786ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4787ad7e718cSJohannes Berg * 4788ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4789ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4790ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4791ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4792ad7e718cSJohannes Berg * managers etc. need. 4793ad7e718cSJohannes Berg */ 4794ad7e718cSJohannes Berg 4795ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4796ad7e718cSJohannes Berg enum nl80211_commands cmd, 4797ad7e718cSJohannes Berg enum nl80211_attrs attr, 4798ad7e718cSJohannes Berg int approxlen); 4799ad7e718cSJohannes Berg 4800567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 48016c09e791SAhmad Kholaif struct wireless_dev *wdev, 4802567ffc35SJohannes Berg enum nl80211_commands cmd, 4803567ffc35SJohannes Berg enum nl80211_attrs attr, 4804567ffc35SJohannes Berg int vendor_event_idx, 4805567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4806567ffc35SJohannes Berg 4807567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4808567ffc35SJohannes Berg 4809ad7e718cSJohannes Berg /** 4810ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4811ad7e718cSJohannes Berg * @wiphy: the wiphy 4812ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4813ad7e718cSJohannes Berg * be put into the skb 4814ad7e718cSJohannes Berg * 4815ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4816ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4817ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4818ad7e718cSJohannes Berg * 4819ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4820ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4821ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4822ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4823ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4824ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4825ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4826ad7e718cSJohannes Berg * 4827ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4828ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4829ad7e718cSJohannes Berg * 4830ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4831ad7e718cSJohannes Berg */ 4832ad7e718cSJohannes Berg static inline struct sk_buff * 4833ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4834ad7e718cSJohannes Berg { 4835ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4836ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4837ad7e718cSJohannes Berg } 4838ad7e718cSJohannes Berg 4839ad7e718cSJohannes Berg /** 4840ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4841ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4842ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4843ad7e718cSJohannes Berg * 4844ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4845ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4846ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4847ad7e718cSJohannes Berg * skb regardless of the return value. 4848ad7e718cSJohannes Berg * 4849ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4850ad7e718cSJohannes Berg */ 4851ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4852ad7e718cSJohannes Berg 4853567ffc35SJohannes Berg /** 4854567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4855567ffc35SJohannes Berg * @wiphy: the wiphy 48566c09e791SAhmad Kholaif * @wdev: the wireless device 4857567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4858567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4859567ffc35SJohannes Berg * be put into the skb 4860567ffc35SJohannes Berg * @gfp: allocation flags 4861567ffc35SJohannes Berg * 4862567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4863567ffc35SJohannes Berg * vendor-specific multicast group. 4864567ffc35SJohannes Berg * 48656c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 48666c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 48676c09e791SAhmad Kholaif * attribute. 48686c09e791SAhmad Kholaif * 4869567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4870567ffc35SJohannes Berg * skb to send the event. 4871567ffc35SJohannes Berg * 4872567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4873567ffc35SJohannes Berg */ 4874567ffc35SJohannes Berg static inline struct sk_buff * 48756c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 48766c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 4877567ffc35SJohannes Berg { 48786c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 4879567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4880567ffc35SJohannes Berg event_idx, approxlen, gfp); 4881567ffc35SJohannes Berg } 4882567ffc35SJohannes Berg 4883567ffc35SJohannes Berg /** 4884567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4885567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4886567ffc35SJohannes Berg * @gfp: allocation flags 4887567ffc35SJohannes Berg * 4888567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4889567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4890567ffc35SJohannes Berg */ 4891567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4892567ffc35SJohannes Berg { 4893567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4894567ffc35SJohannes Berg } 4895567ffc35SJohannes Berg 4896aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4897aff89a9bSJohannes Berg /** 4898d70e9693SJohannes Berg * DOC: Test mode 4899d70e9693SJohannes Berg * 4900d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4901d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4902d70e9693SJohannes Berg * factory programming. 4903d70e9693SJohannes Berg * 4904d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4905d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4906d70e9693SJohannes Berg */ 4907d70e9693SJohannes Berg 4908d70e9693SJohannes Berg /** 4909aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4910aff89a9bSJohannes Berg * @wiphy: the wiphy 4911aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4912aff89a9bSJohannes Berg * be put into the skb 4913aff89a9bSJohannes Berg * 4914aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4915aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4916aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4917aff89a9bSJohannes Berg * 49180ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 49190ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 49200ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 49210ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 49220ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 49230ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 49240ae997dcSYacine Belkadi * must not modify the skb in any other way. 4925aff89a9bSJohannes Berg * 4926aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4927aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 49280ae997dcSYacine Belkadi * 49290ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4930aff89a9bSJohannes Berg */ 4931ad7e718cSJohannes Berg static inline struct sk_buff * 4932ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4933ad7e718cSJohannes Berg { 4934ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4935ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4936ad7e718cSJohannes Berg } 4937aff89a9bSJohannes Berg 4938aff89a9bSJohannes Berg /** 4939aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4940aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4941aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4942aff89a9bSJohannes Berg * 49430ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 49440ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 49450ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 49460ae997dcSYacine Belkadi * regardless of the return value. 49470ae997dcSYacine Belkadi * 49480ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4949aff89a9bSJohannes Berg */ 4950ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4951ad7e718cSJohannes Berg { 4952ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4953ad7e718cSJohannes Berg } 4954aff89a9bSJohannes Berg 4955aff89a9bSJohannes Berg /** 4956aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4957aff89a9bSJohannes Berg * @wiphy: the wiphy 4958aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4959aff89a9bSJohannes Berg * be put into the skb 4960aff89a9bSJohannes Berg * @gfp: allocation flags 4961aff89a9bSJohannes Berg * 4962aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4963aff89a9bSJohannes Berg * testmode multicast group. 4964aff89a9bSJohannes Berg * 49650ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 49660ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 49670ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 49680ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 49690ae997dcSYacine Belkadi * in any other way. 4970aff89a9bSJohannes Berg * 4971aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4972aff89a9bSJohannes Berg * skb to send the event. 49730ae997dcSYacine Belkadi * 49740ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4975aff89a9bSJohannes Berg */ 4976567ffc35SJohannes Berg static inline struct sk_buff * 4977567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4978567ffc35SJohannes Berg { 49796c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 4980567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4981567ffc35SJohannes Berg approxlen, gfp); 4982567ffc35SJohannes Berg } 4983aff89a9bSJohannes Berg 4984aff89a9bSJohannes Berg /** 4985aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4986aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4987aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4988aff89a9bSJohannes Berg * @gfp: allocation flags 4989aff89a9bSJohannes Berg * 4990aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4991aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4992aff89a9bSJohannes Berg * consumes it. 4993aff89a9bSJohannes Berg */ 4994567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4995567ffc35SJohannes Berg { 4996567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4997567ffc35SJohannes Berg } 4998aff89a9bSJohannes Berg 4999aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 500071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 5001aff89a9bSJohannes Berg #else 5002aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 500371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 5004aff89a9bSJohannes Berg #endif 5005aff89a9bSJohannes Berg 5006b23aa676SSamuel Ortiz /** 5007e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 5008e7054989SKanchanapally, Vidyullatha * 5009e7054989SKanchanapally, Vidyullatha * @dev: network device 5010e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 5011e7054989SKanchanapally, Vidyullatha * @bss: entry of bss to which STA got connected to, can be obtained 5012e7054989SKanchanapally, Vidyullatha * through cfg80211_get_bss (may be %NULL) 5013e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 5014e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 5015e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 5016e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 5017e7054989SKanchanapally, Vidyullatha * @status: status code, 0 for successful connection, use 5018e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5019e7054989SKanchanapally, Vidyullatha * the real status code for failures. 5020e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 5021e7054989SKanchanapally, Vidyullatha * 5022e7054989SKanchanapally, Vidyullatha * It should be called by the underlying driver whenever connect() has 5023e7054989SKanchanapally, Vidyullatha * succeeded. This is similar to cfg80211_connect_result(), but with the 5024e7054989SKanchanapally, Vidyullatha * option of identifying the exact bss entry for the connection. Only one of 5025e7054989SKanchanapally, Vidyullatha * these functions should be called. 5026e7054989SKanchanapally, Vidyullatha */ 5027e7054989SKanchanapally, Vidyullatha void cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 5028e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 5029e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 5030bf1ecd21SJouni Malinen size_t resp_ie_len, int status, gfp_t gfp); 5031e7054989SKanchanapally, Vidyullatha 5032e7054989SKanchanapally, Vidyullatha /** 5033b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 5034b23aa676SSamuel Ortiz * 5035b23aa676SSamuel Ortiz * @dev: network device 5036b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 5037b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 5038b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 5039b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 5040b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 5041b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 5042b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5043b23aa676SSamuel Ortiz * the real status code for failures. 5044b23aa676SSamuel Ortiz * @gfp: allocation flags 5045b23aa676SSamuel Ortiz * 5046b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 5047b23aa676SSamuel Ortiz * succeeded. 5048b23aa676SSamuel Ortiz */ 5049e7054989SKanchanapally, Vidyullatha static inline void 5050e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 5051b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 5052b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 5053e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 5054e7054989SKanchanapally, Vidyullatha { 5055e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 5056e7054989SKanchanapally, Vidyullatha resp_ie_len, status, gfp); 5057e7054989SKanchanapally, Vidyullatha } 5058b23aa676SSamuel Ortiz 5059b23aa676SSamuel Ortiz /** 5060bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 5061bf1ecd21SJouni Malinen * 5062bf1ecd21SJouni Malinen * @dev: network device 5063bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 5064bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 5065bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 5066bf1ecd21SJouni Malinen * @gfp: allocation flags 5067bf1ecd21SJouni Malinen * 5068bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 5069bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 5070bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 5071bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 5072bf1ecd21SJouni Malinen * waiting for the response. 5073bf1ecd21SJouni Malinen */ 5074bf1ecd21SJouni Malinen static inline void 5075bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 5076bf1ecd21SJouni Malinen const u8 *req_ie, size_t req_ie_len, gfp_t gfp) 5077bf1ecd21SJouni Malinen { 5078bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 5079bf1ecd21SJouni Malinen gfp); 5080bf1ecd21SJouni Malinen } 5081bf1ecd21SJouni Malinen 5082bf1ecd21SJouni Malinen /** 5083b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 5084b23aa676SSamuel Ortiz * 5085b23aa676SSamuel Ortiz * @dev: network device 5086ed9d0102SJouni Malinen * @channel: the channel of the new AP 5087b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 5088b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 5089b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 5090b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 5091b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 5092b23aa676SSamuel Ortiz * @gfp: allocation flags 5093b23aa676SSamuel Ortiz * 5094b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 5095b23aa676SSamuel Ortiz * from one AP to another while connected. 5096b23aa676SSamuel Ortiz */ 5097ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 5098ed9d0102SJouni Malinen struct ieee80211_channel *channel, 5099ed9d0102SJouni Malinen const u8 *bssid, 5100b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 5101b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 5102b23aa676SSamuel Ortiz 5103b23aa676SSamuel Ortiz /** 5104adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 5105adbde344SVasanthakumar Thiagarajan * 5106adbde344SVasanthakumar Thiagarajan * @dev: network device 5107adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 5108adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 5109adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 5110adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 5111adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 5112adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 5113adbde344SVasanthakumar Thiagarajan * 5114adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 5115adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 5116adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 5117adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 5118adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 5119adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 5120adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 5121adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 5122adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 5123adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 5124adbde344SVasanthakumar Thiagarajan */ 5125adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 5126adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 5127adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 5128adbde344SVasanthakumar Thiagarajan 5129adbde344SVasanthakumar Thiagarajan /** 5130b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 5131b23aa676SSamuel Ortiz * 5132b23aa676SSamuel Ortiz * @dev: network device 5133b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 5134b23aa676SSamuel Ortiz * @ie_len: length of IEs 5135b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 513680279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 5137b23aa676SSamuel Ortiz * @gfp: allocation flags 5138b23aa676SSamuel Ortiz * 5139b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 5140b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 5141b23aa676SSamuel Ortiz */ 5142b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 514380279fb7SJohannes Berg const u8 *ie, size_t ie_len, 514480279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 5145b23aa676SSamuel Ortiz 51469588bbd5SJouni Malinen /** 51479588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 514871bbc994SJohannes Berg * @wdev: wireless device 51499588bbd5SJouni Malinen * @cookie: the request cookie 51509588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 51519588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 51529588bbd5SJouni Malinen * channel 51539588bbd5SJouni Malinen * @gfp: allocation flags 51549588bbd5SJouni Malinen */ 515571bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 51569588bbd5SJouni Malinen struct ieee80211_channel *chan, 51579588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 51589588bbd5SJouni Malinen 51599588bbd5SJouni Malinen /** 51609588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 516171bbc994SJohannes Berg * @wdev: wireless device 51629588bbd5SJouni Malinen * @cookie: the request cookie 51639588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 51649588bbd5SJouni Malinen * @gfp: allocation flags 51659588bbd5SJouni Malinen */ 516671bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 51679588bbd5SJouni Malinen struct ieee80211_channel *chan, 51689588bbd5SJouni Malinen gfp_t gfp); 5169b23aa676SSamuel Ortiz 517098b62183SJohannes Berg 517198b62183SJohannes Berg /** 517298b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 517398b62183SJohannes Berg * 517498b62183SJohannes Berg * @dev: the netdev 517598b62183SJohannes Berg * @mac_addr: the station's address 517698b62183SJohannes Berg * @sinfo: the station information 517798b62183SJohannes Berg * @gfp: allocation flags 517898b62183SJohannes Berg */ 517998b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 518098b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 518198b62183SJohannes Berg 5182026331c4SJouni Malinen /** 5183cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 5184cf5ead82SJohannes Berg * @dev: the netdev 5185cf5ead82SJohannes Berg * @mac_addr: the station's address 5186cf5ead82SJohannes Berg * @sinfo: the station information/statistics 5187cf5ead82SJohannes Berg * @gfp: allocation flags 5188cf5ead82SJohannes Berg */ 5189cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 5190cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 5191cf5ead82SJohannes Berg 5192cf5ead82SJohannes Berg /** 5193ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 5194ec15e68bSJouni Malinen * 5195ec15e68bSJouni Malinen * @dev: the netdev 5196ec15e68bSJouni Malinen * @mac_addr: the station's address 5197ec15e68bSJouni Malinen * @gfp: allocation flags 5198ec15e68bSJouni Malinen */ 5199cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 5200cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 5201cf5ead82SJohannes Berg { 5202cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 5203cf5ead82SJohannes Berg } 5204ec15e68bSJouni Malinen 5205ec15e68bSJouni Malinen /** 5206ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 5207ed44a951SPandiyarajan Pitchaimuthu * 5208ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 5209ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 5210ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 5211ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 5212ed44a951SPandiyarajan Pitchaimuthu * 5213ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 5214ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 5215ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 5216ed44a951SPandiyarajan Pitchaimuthu * 5217ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 5218ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 5219ed44a951SPandiyarajan Pitchaimuthu */ 5220ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 5221ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 5222ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 5223ed44a951SPandiyarajan Pitchaimuthu 5224ed44a951SPandiyarajan Pitchaimuthu /** 52252e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 522671bbc994SJohannes Berg * @wdev: wireless device receiving the frame 5227026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 5228804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 52292e161f78SJohannes Berg * @buf: Management frame (header + body) 5230026331c4SJouni Malinen * @len: length of the frame data 523119504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 52322e161f78SJohannes Berg * 52330ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 52340ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 52350ae997dcSYacine Belkadi * 52360ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 52372e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 52382e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 52392e161f78SJohannes Berg * driver is responsible for rejecting the frame. 5240026331c4SJouni Malinen */ 524171bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 5242970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 5243026331c4SJouni Malinen 5244026331c4SJouni Malinen /** 52452e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 524671bbc994SJohannes Berg * @wdev: wireless device receiving the frame 52472e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 52482e161f78SJohannes Berg * @buf: Management frame (header + body) 5249026331c4SJouni Malinen * @len: length of the frame data 5250026331c4SJouni Malinen * @ack: Whether frame was acknowledged 5251026331c4SJouni Malinen * @gfp: context flags 5252026331c4SJouni Malinen * 52532e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 52542e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 5255026331c4SJouni Malinen * transmission attempt. 5256026331c4SJouni Malinen */ 525771bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 5258026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 5259026331c4SJouni Malinen 5260d6dc1a38SJuuso Oikarinen 5261d6dc1a38SJuuso Oikarinen /** 5262d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 5263d6dc1a38SJuuso Oikarinen * @dev: network device 5264d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 5265d6dc1a38SJuuso Oikarinen * @gfp: context flags 5266d6dc1a38SJuuso Oikarinen * 5267d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 5268d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 5269d6dc1a38SJuuso Oikarinen */ 5270d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 5271d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 5272d6dc1a38SJuuso Oikarinen gfp_t gfp); 5273d6dc1a38SJuuso Oikarinen 5274c063dbf5SJohannes Berg /** 5275c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 5276c063dbf5SJohannes Berg * @dev: network device 5277c063dbf5SJohannes Berg * @peer: peer's MAC address 5278c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 5279c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 5280c063dbf5SJohannes Berg * threshold (to account for temporary interference) 5281c063dbf5SJohannes Berg * @gfp: context flags 5282c063dbf5SJohannes Berg */ 5283c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 5284c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 5285c063dbf5SJohannes Berg 5286e5497d76SJohannes Berg /** 528784f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 528884f10708SThomas Pedersen * @dev: network device 528984f10708SThomas Pedersen * @peer: peer's MAC address 529084f10708SThomas Pedersen * @num_packets: how many packets were lost 529184f10708SThomas Pedersen * @rate: % of packets which failed transmission 529284f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 529384f10708SThomas Pedersen * @gfp: context flags 529484f10708SThomas Pedersen * 529584f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 529684f10708SThomas Pedersen * given interval is exceeded. 529784f10708SThomas Pedersen */ 529884f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 529984f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 530084f10708SThomas Pedersen 530184f10708SThomas Pedersen /** 530298f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 530398f03342SJohannes Berg * @dev: network device 530498f03342SJohannes Berg * @gfp: context flags 530598f03342SJohannes Berg * 530698f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 530798f03342SJohannes Berg */ 530898f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 530998f03342SJohannes Berg 531098f03342SJohannes Berg /** 53115b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 53125b97f49dSJohannes Berg * @wiphy: the wiphy 53135b97f49dSJohannes Berg * @chandef: chandef for the current channel 53145b97f49dSJohannes Berg * @gfp: context flags 53155b97f49dSJohannes Berg * 53165b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 53175b97f49dSJohannes Berg */ 53185b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 53195b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 53205b97f49dSJohannes Berg 53215b97f49dSJohannes Berg /** 53225b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 53235b97f49dSJohannes Berg * @netdev: network device 53245b97f49dSJohannes Berg * @chandef: chandef for the current channel 53255b97f49dSJohannes Berg * @event: type of event 53265b97f49dSJohannes Berg * @gfp: context flags 53275b97f49dSJohannes Berg * 53285b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 53295b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 53305b97f49dSJohannes Berg * also by full-MAC drivers. 53315b97f49dSJohannes Berg */ 53325b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 53335b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 53345b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 53355b97f49dSJohannes Berg 53365b97f49dSJohannes Berg 53375b97f49dSJohannes Berg /** 5338e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 5339e5497d76SJohannes Berg * @dev: network device 5340e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 5341e5497d76SJohannes Berg * @replay_ctr: new replay counter 5342af71ff85SJohannes Berg * @gfp: allocation flags 5343e5497d76SJohannes Berg */ 5344e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 5345e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 5346e5497d76SJohannes Berg 5347c9df56b4SJouni Malinen /** 5348c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 5349c9df56b4SJouni Malinen * @dev: network device 5350c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 5351c9df56b4SJouni Malinen * @bssid: BSSID of AP 5352c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 5353c9df56b4SJouni Malinen * @gfp: allocation flags 5354c9df56b4SJouni Malinen */ 5355c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 5356c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 5357c9df56b4SJouni Malinen 535828946da7SJohannes Berg /** 535928946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 536028946da7SJohannes Berg * @dev: The device the frame matched to 536128946da7SJohannes Berg * @addr: the transmitter address 536228946da7SJohannes Berg * @gfp: context flags 536328946da7SJohannes Berg * 536428946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 536528946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 536628946da7SJohannes Berg * sender. 53670ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 536828946da7SJohannes Berg * for a reason other than not having a subscription.) 536928946da7SJohannes Berg */ 537028946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 537128946da7SJohannes Berg const u8 *addr, gfp_t gfp); 537228946da7SJohannes Berg 53737f6cf311SJohannes Berg /** 5374b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 5375b92ab5d8SJohannes Berg * @dev: The device the frame matched to 5376b92ab5d8SJohannes Berg * @addr: the transmitter address 5377b92ab5d8SJohannes Berg * @gfp: context flags 5378b92ab5d8SJohannes Berg * 5379b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 5380b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 5381b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 5382b92ab5d8SJohannes Berg * station to avoid event flooding. 53830ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 5384b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 5385b92ab5d8SJohannes Berg */ 5386b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 5387b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 5388b92ab5d8SJohannes Berg 5389b92ab5d8SJohannes Berg /** 53907f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 53917f6cf311SJohannes Berg * @dev: the device the probe was sent on 53927f6cf311SJohannes Berg * @addr: the address of the peer 53937f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 53947f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 53957f6cf311SJohannes Berg * @gfp: allocation flags 53967f6cf311SJohannes Berg */ 53977f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 53987f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 53997f6cf311SJohannes Berg 54005e760230SJohannes Berg /** 54015e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 54025e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 54035e760230SJohannes Berg * @frame: the frame 54045e760230SJohannes Berg * @len: length of the frame 54055e760230SJohannes Berg * @freq: frequency the frame was received on 5406804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 54075e760230SJohannes Berg * 54085e760230SJohannes Berg * Use this function to report to userspace when a beacon was 54095e760230SJohannes Berg * received. It is not useful to call this when there is no 54105e760230SJohannes Berg * netdev that is in AP/GO mode. 54115e760230SJohannes Berg */ 54125e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 54135e760230SJohannes Berg const u8 *frame, size_t len, 541437c73b5fSBen Greear int freq, int sig_dbm); 54155e760230SJohannes Berg 5416d58e7e37SJohannes Berg /** 5417683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 541854858ee5SAlexander Simon * @wiphy: the wiphy 5419683b6d3bSJohannes Berg * @chandef: the channel definition 5420174e0cd2SIlan Peer * @iftype: interface type 5421d58e7e37SJohannes Berg * 54220ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 54230ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 542454858ee5SAlexander Simon */ 5425683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 5426174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 5427174e0cd2SIlan Peer enum nl80211_iftype iftype); 542854858ee5SAlexander Simon 5429923b352fSArik Nemtsov /** 5430923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 5431923b352fSArik Nemtsov * @wiphy: the wiphy 5432923b352fSArik Nemtsov * @chandef: the channel definition 5433923b352fSArik Nemtsov * @iftype: interface type 5434923b352fSArik Nemtsov * 5435923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 5436923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 5437923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 5438923b352fSArik Nemtsov * more permissive conditions. 5439923b352fSArik Nemtsov * 5440923b352fSArik Nemtsov * Requires the RTNL to be held. 5441923b352fSArik Nemtsov */ 5442923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 5443923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 5444923b352fSArik Nemtsov enum nl80211_iftype iftype); 5445923b352fSArik Nemtsov 54468097e149SThomas Pedersen /* 54475314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 54485314526bSThomas Pedersen * @dev: the device which switched channels 5449683b6d3bSJohannes Berg * @chandef: the new channel definition 54505314526bSThomas Pedersen * 5451e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 5452e487eaebSSimon Wunderlich * driver context! 54535314526bSThomas Pedersen */ 5454683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 5455683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 54565314526bSThomas Pedersen 5457f8d7552eSLuciano Coelho /* 5458f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 5459f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 5460f8d7552eSLuciano Coelho * @chandef: the future channel definition 5461f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 5462f8d7552eSLuciano Coelho * 5463f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 5464f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 5465f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 5466f8d7552eSLuciano Coelho */ 5467f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 5468f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 5469f8d7552eSLuciano Coelho u8 count); 5470f8d7552eSLuciano Coelho 54711ce3e82bSJohannes Berg /** 54721ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 54731ce3e82bSJohannes Berg * 54741ce3e82bSJohannes Berg * @operating_class: the operating class to convert 54751ce3e82bSJohannes Berg * @band: band pointer to fill 54761ce3e82bSJohannes Berg * 54771ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 54781ce3e82bSJohannes Berg */ 54791ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 548057fbcce3SJohannes Berg enum nl80211_band *band); 54811ce3e82bSJohannes Berg 5482a38700ddSArik Nemtsov /** 5483a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 5484a38700ddSArik Nemtsov * 5485a38700ddSArik Nemtsov * @chandef: the chandef to convert 5486a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 5487a38700ddSArik Nemtsov * 5488a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 5489a38700ddSArik Nemtsov */ 5490a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 5491a38700ddSArik Nemtsov u8 *op_class); 5492a38700ddSArik Nemtsov 54935314526bSThomas Pedersen /* 54943475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 54953475b094SJouni Malinen * @dev: the device on which the operation is requested 54963475b094SJouni Malinen * @peer: the MAC address of the peer device 54973475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 54983475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 54993475b094SJouni Malinen * @reason_code: the reason code for teardown request 55003475b094SJouni Malinen * @gfp: allocation flags 55013475b094SJouni Malinen * 55023475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 55033475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 55043475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 55053475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 55063475b094SJouni Malinen * based on traffic and signal strength for a peer). 55073475b094SJouni Malinen */ 55083475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 55093475b094SJouni Malinen enum nl80211_tdls_operation oper, 55103475b094SJouni Malinen u16 reason_code, gfp_t gfp); 55113475b094SJouni Malinen 55123475b094SJouni Malinen /* 55138097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 55148097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 55158097e149SThomas Pedersen * 55168097e149SThomas Pedersen * return 0 if MCS index >= 32 55178097e149SThomas Pedersen */ 55188eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 55198097e149SThomas Pedersen 552098104fdeSJohannes Berg /** 552198104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 552298104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 552398104fdeSJohannes Berg * 552498104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 552598104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 552698104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 552798104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 552898104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 552998104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 553098104fdeSJohannes Berg * when the device is unbound from the driver. 553198104fdeSJohannes Berg * 553298104fdeSJohannes Berg * Requires the RTNL to be held. 553398104fdeSJohannes Berg */ 553498104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 553598104fdeSJohannes Berg 55360ee45355SJohannes Berg /** 5537355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 5538355199e0SJouni Malinen * @ies: FT IEs 5539355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 5540355199e0SJouni Malinen * @target_ap: target AP's MAC address 5541355199e0SJouni Malinen * @ric_ies: RIC IE 5542355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 5543355199e0SJouni Malinen */ 5544355199e0SJouni Malinen struct cfg80211_ft_event_params { 5545355199e0SJouni Malinen const u8 *ies; 5546355199e0SJouni Malinen size_t ies_len; 5547355199e0SJouni Malinen const u8 *target_ap; 5548355199e0SJouni Malinen const u8 *ric_ies; 5549355199e0SJouni Malinen size_t ric_ies_len; 5550355199e0SJouni Malinen }; 5551355199e0SJouni Malinen 5552355199e0SJouni Malinen /** 5553355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 5554355199e0SJouni Malinen * @netdev: network device 5555355199e0SJouni Malinen * @ft_event: IE information 5556355199e0SJouni Malinen */ 5557355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 5558355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 5559355199e0SJouni Malinen 5560355199e0SJouni Malinen /** 55610ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 55620ee45355SJohannes Berg * @ies: the input IE buffer 55630ee45355SJohannes Berg * @len: the input length 55640ee45355SJohannes Berg * @attr: the attribute ID to find 55650ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 55660ee45355SJohannes Berg * if the function is only called to get the needed buffer size 55670ee45355SJohannes Berg * @bufsize: size of the output buffer 55680ee45355SJohannes Berg * 55690ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 55700ee45355SJohannes Berg * copies its contents to the given buffer. 55710ee45355SJohannes Berg * 55720ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 55730ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 55740ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 55750ee45355SJohannes Berg */ 5576c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 5577c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 5578c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 55790ee45355SJohannes Berg 5580cd8f7cb4SJohannes Berg /** 558129464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 558229464cccSJohannes Berg * @ies: the IE buffer 558329464cccSJohannes Berg * @ielen: the length of the IE buffer 558429464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 558529464cccSJohannes Berg * the split 558629464cccSJohannes Berg * @n_ids: the size of the element ID array 558729464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 558829464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 558929464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 559029464cccSJohannes Berg * 559129464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 559229464cccSJohannes Berg * variable to point to the location where the buffer should be 559329464cccSJohannes Berg * split. 559429464cccSJohannes Berg * 559529464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 559629464cccSJohannes Berg * has to be guaranteed by the caller! 559729464cccSJohannes Berg * 559829464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 559929464cccSJohannes Berg * correctly, if not the result of using this function will not 560029464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 560129464cccSJohannes Berg * 560229464cccSJohannes Berg * The function returns the offset where the next part of the 560329464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 560429464cccSJohannes Berg * of the buffer should be used. 560529464cccSJohannes Berg */ 560629464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 560729464cccSJohannes Berg const u8 *ids, int n_ids, 560829464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 560929464cccSJohannes Berg size_t offset); 561029464cccSJohannes Berg 561129464cccSJohannes Berg /** 561229464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 561329464cccSJohannes Berg * @ies: the IE buffer 561429464cccSJohannes Berg * @ielen: the length of the IE buffer 561529464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 561629464cccSJohannes Berg * the split 561729464cccSJohannes Berg * @n_ids: the size of the element ID array 561829464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 561929464cccSJohannes Berg * 562029464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 562129464cccSJohannes Berg * variable to point to the location where the buffer should be 562229464cccSJohannes Berg * split. 562329464cccSJohannes Berg * 562429464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 562529464cccSJohannes Berg * has to be guaranteed by the caller! 562629464cccSJohannes Berg * 562729464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 562829464cccSJohannes Berg * correctly, if not the result of using this function will not 562929464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 563029464cccSJohannes Berg * 563129464cccSJohannes Berg * The function returns the offset where the next part of the 563229464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 563329464cccSJohannes Berg * of the buffer should be used. 563429464cccSJohannes Berg */ 56350483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 56360483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 56370483eeacSJohannes Berg { 56380483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 56390483eeacSJohannes Berg } 564029464cccSJohannes Berg 564129464cccSJohannes Berg /** 5642cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 5643cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 5644cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 5645cd8f7cb4SJohannes Berg * @gfp: allocation flags 5646cd8f7cb4SJohannes Berg * 5647cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 5648cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 5649cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 5650cd8f7cb4SJohannes Berg * else caused the wakeup. 5651cd8f7cb4SJohannes Berg */ 5652cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 5653cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 5654cd8f7cb4SJohannes Berg gfp_t gfp); 5655cd8f7cb4SJohannes Berg 56565de17984SArend van Spriel /** 56575de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 56585de17984SArend van Spriel * 56595de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 566003f831a6SRobert P. J. Day * @gfp: allocation flags 56615de17984SArend van Spriel * 56625de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 56635de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 56645de17984SArend van Spriel * by .crit_proto_start() has expired. 56655de17984SArend van Spriel */ 56665de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 56675de17984SArend van Spriel 5668bdfbec2dSIlan Peer /** 5669bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 5670bdfbec2dSIlan Peer * @wiphy: the wiphy 5671bdfbec2dSIlan Peer * 5672bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 5673bdfbec2dSIlan Peer */ 5674bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 5675bdfbec2dSIlan Peer 5676cb2d956dSLuciano Coelho /** 5677cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 5678cb2d956dSLuciano Coelho * 5679cb2d956dSLuciano Coelho * @wiphy: the wiphy 5680e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 5681cb2d956dSLuciano Coelho * 5682cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 5683cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 5684cb2d956dSLuciano Coelho * the interface combinations. 5685cb2d956dSLuciano Coelho */ 5686cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 5687e227300cSPurushottam Kushwaha struct iface_combination_params *params); 5688cb2d956dSLuciano Coelho 568965a124ddSMichal Kazior /** 569065a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 569165a124ddSMichal Kazior * 569265a124ddSMichal Kazior * @wiphy: the wiphy 5693e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 569465a124ddSMichal Kazior * @iter: function to call for each matching combination 569565a124ddSMichal Kazior * @data: pointer to pass to iter function 569665a124ddSMichal Kazior * 569765a124ddSMichal Kazior * This function can be called by the driver to check what possible 569865a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 569965a124ddSMichal Kazior * purposes. 570065a124ddSMichal Kazior */ 570165a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 5702e227300cSPurushottam Kushwaha struct iface_combination_params *params, 570365a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 570465a124ddSMichal Kazior void *data), 570565a124ddSMichal Kazior void *data); 570665a124ddSMichal Kazior 5707f04c2203SMichal Kazior /* 5708f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 5709f04c2203SMichal Kazior * 5710f04c2203SMichal Kazior * @wiphy: the wiphy 5711f04c2203SMichal Kazior * @wdev: wireless device 5712f04c2203SMichal Kazior * @gfp: context flags 5713f04c2203SMichal Kazior * 5714f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 5715f04c2203SMichal Kazior * disconnected. 5716f04c2203SMichal Kazior * 5717f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 5718f04c2203SMichal Kazior */ 5719f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 5720f04c2203SMichal Kazior gfp_t gfp); 5721f04c2203SMichal Kazior 5722f6837ba8SJohannes Berg /** 5723f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 5724f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 5725f6837ba8SJohannes Berg * 5726f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 5727f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 5728f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 5729f6837ba8SJohannes Berg * that really can't be recovered in any other way. 5730f6837ba8SJohannes Berg * 5731f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 5732f6837ba8SJohannes Berg * the driver while the function is running. 5733f6837ba8SJohannes Berg */ 5734f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5735f6837ba8SJohannes Berg 5736d75bb06bSGautam Kumar Shukla /** 5737d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 5738d75bb06bSGautam Kumar Shukla * 5739d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5740d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5741d75bb06bSGautam Kumar Shukla * 5742d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5743d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5744d75bb06bSGautam Kumar Shukla */ 5745d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 5746d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5747d75bb06bSGautam Kumar Shukla { 5748d75bb06bSGautam Kumar Shukla u8 *ft_byte; 5749d75bb06bSGautam Kumar Shukla 5750d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 5751d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 5752d75bb06bSGautam Kumar Shukla } 5753d75bb06bSGautam Kumar Shukla 5754d75bb06bSGautam Kumar Shukla /** 5755d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 5756d75bb06bSGautam Kumar Shukla * 5757d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5758d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5759d75bb06bSGautam Kumar Shukla * 5760d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5761d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5762d75bb06bSGautam Kumar Shukla */ 5763d75bb06bSGautam Kumar Shukla static inline bool 5764d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 5765d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5766d75bb06bSGautam Kumar Shukla { 5767d75bb06bSGautam Kumar Shukla u8 ft_byte; 5768d75bb06bSGautam Kumar Shukla 5769d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 5770d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 5771d75bb06bSGautam Kumar Shukla } 5772b7ffbd7eSJohannes Berg 5773a442b761SAyala Beker /** 5774a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 5775a442b761SAyala Beker * @f: NAN function that should be freed 5776a442b761SAyala Beker * 5777a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 5778a442b761SAyala Beker */ 5779a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 5780a442b761SAyala Beker 578150bcd31dSAyala Beker /** 578250bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 578350bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 578450bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 578550bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 578650bcd31dSAyala Beker * result. 578750bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 578850bcd31dSAyala Beker * @inst_id: the local instance id 578950bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 579050bcd31dSAyala Beker * @addr: the MAC address of the peer 579150bcd31dSAyala Beker * @info_len: the length of the &info 579250bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 579350bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 579450bcd31dSAyala Beker */ 579550bcd31dSAyala Beker struct cfg80211_nan_match_params { 579650bcd31dSAyala Beker enum nl80211_nan_function_type type; 579750bcd31dSAyala Beker u8 inst_id; 579850bcd31dSAyala Beker u8 peer_inst_id; 579950bcd31dSAyala Beker const u8 *addr; 580050bcd31dSAyala Beker u8 info_len; 580150bcd31dSAyala Beker const u8 *info; 580250bcd31dSAyala Beker u64 cookie; 580350bcd31dSAyala Beker }; 580450bcd31dSAyala Beker 580550bcd31dSAyala Beker /** 580650bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 580750bcd31dSAyala Beker * @wdev: the wireless device reporting the match 580850bcd31dSAyala Beker * @match: match notification parameters 580950bcd31dSAyala Beker * @gfp: allocation flags 581050bcd31dSAyala Beker * 581150bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 581250bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 581350bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 581450bcd31dSAyala Beker */ 581550bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 581650bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 581750bcd31dSAyala Beker 5818368e5a7bSAyala Beker /** 5819368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 5820368e5a7bSAyala Beker * 5821368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 5822368e5a7bSAyala Beker * @inst_id: the local instance id 5823368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 5824368e5a7bSAyala Beker * @cookie: unique NAN function identifier 5825368e5a7bSAyala Beker * @gfp: allocation flags 5826368e5a7bSAyala Beker * 5827368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 5828368e5a7bSAyala Beker */ 5829368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 5830368e5a7bSAyala Beker u8 inst_id, 5831368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 5832368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 5833368e5a7bSAyala Beker 5834b7ffbd7eSJohannes Berg /* ethtool helper */ 5835b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 5836b7ffbd7eSJohannes Berg 5837e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 5838e1db74fcSJoe Perches 5839e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 5840e1db74fcSJoe Perches 5841e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 58429c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 5843e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 58449c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 5845e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 58469c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 5847e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 58489c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 5849e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 58509c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 5851e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 58529c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 5853e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 58549c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 5855e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 58569c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 5857073730d7SJoe Perches 58589c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 5859e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 58609c376639SJoe Perches 5861e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 58629c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 5863e1db74fcSJoe Perches 5864e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 5865e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 5866e1db74fcSJoe Perches #else 5867e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 5868e1db74fcSJoe Perches ({ \ 5869e1db74fcSJoe Perches if (0) \ 5870e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 5871e1db74fcSJoe Perches 0; \ 5872e1db74fcSJoe Perches }) 5873e1db74fcSJoe Perches #endif 5874e1db74fcSJoe Perches 5875e1db74fcSJoe Perches /* 5876e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5877e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5878e1db74fcSJoe Perches * file/line information and a backtrace. 5879e1db74fcSJoe Perches */ 5880e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5881e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5882e1db74fcSJoe Perches 5883704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5884