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. 7870c317a02SPurushottam Kushwaha * @beacon_int_gcd: a value specifying GCD of all beaconing interfaces, 7880c317a02SPurushottam Kushwaha * the GCD of a single value is considered the value itself, so for 7890c317a02SPurushottam Kushwaha * a single interface this should be set to that interface's beacon 7900c317a02SPurushottam Kushwaha * interval 7910c317a02SPurushottam Kushwaha * @beacon_int_different: a flag indicating whether or not all beacon 7920c317a02SPurushottam Kushwaha * intervals (of beaconing interfaces) are different or not. 793e227300cSPurushottam Kushwaha */ 794e227300cSPurushottam Kushwaha struct iface_combination_params { 795e227300cSPurushottam Kushwaha int num_different_channels; 796e227300cSPurushottam Kushwaha u8 radar_detect; 797e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 7980c317a02SPurushottam Kushwaha u32 beacon_int_gcd; 7990c317a02SPurushottam Kushwaha bool beacon_int_different; 800e227300cSPurushottam Kushwaha }; 801e227300cSPurushottam Kushwaha 802e227300cSPurushottam Kushwaha /** 8033b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 8043b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 8059d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 806f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 8073b9ce80cSJohannes Berg * 8083b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 8093b9ce80cSJohannes Berg * for those that don't these flags will are used. 8103b9ce80cSJohannes Berg */ 8113b9ce80cSJohannes Berg enum station_parameters_apply_mask { 8123b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 8139d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 814f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 8153b9ce80cSJohannes Berg }; 8163b9ce80cSJohannes Berg 8173b9ce80cSJohannes Berg /** 8185727ef1bSJohannes Berg * struct station_parameters - station parameters 8195727ef1bSJohannes Berg * 8205727ef1bSJohannes Berg * Used to change and create a new station. 8215727ef1bSJohannes Berg * 8225727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 8235727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 8245727ef1bSJohannes Berg * (or NULL for no change) 8255727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 826eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 827eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 828eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 829eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 8305727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 8315727ef1bSJohannes Berg * @aid: AID or zero for no change 8327d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 833abe37c4bSJohannes Berg * @plink_action: plink action to take 8349c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 835abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 836f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 837910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 838910868dbSEliad Peller * as the AC bitmap in the QoS info field 839910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 840910868dbSEliad Peller * QoS info field (but already shifted down) 841c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 842c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 843c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 8443b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 8453b1c5a53SMarco Porsch * to unknown) 8469d62a986SJouni Malinen * @capability: station capability 8479d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 8489d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 849c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 850c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 851c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 852c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 85360f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 85460f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 85517b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 8565727ef1bSJohannes Berg */ 8575727ef1bSJohannes Berg struct station_parameters { 8582c1aabf3SJohannes Berg const u8 *supported_rates; 8595727ef1bSJohannes Berg struct net_device *vlan; 860eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 8613b9ce80cSJohannes Berg u32 sta_modify_mask; 8625727ef1bSJohannes Berg int listen_interval; 8635727ef1bSJohannes Berg u16 aid; 8647d27a0baSMasashi Honma u16 peer_aid; 8655727ef1bSJohannes Berg u8 supported_rates_len; 8662ec600d6SLuis Carlos Cobo u8 plink_action; 8679c3990aaSJavier Cardona u8 plink_state; 8682c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 8692c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 870c75786c9SEliad Peller u8 uapsd_queues; 871c75786c9SEliad Peller u8 max_sp; 8723b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 8739d62a986SJouni Malinen u16 capability; 8742c1aabf3SJohannes Berg const u8 *ext_capab; 8759d62a986SJouni Malinen u8 ext_capab_len; 876c01fc9adSSunil Dutt const u8 *supported_channels; 877c01fc9adSSunil Dutt u8 supported_channels_len; 878c01fc9adSSunil Dutt const u8 *supported_oper_classes; 879c01fc9adSSunil Dutt u8 supported_oper_classes_len; 88060f4a7b1SMarek Kwaczynski u8 opmode_notif; 88160f4a7b1SMarek Kwaczynski bool opmode_notif_used; 88217b94247SAyala Beker int support_p2p_ps; 8835727ef1bSJohannes Berg }; 8845727ef1bSJohannes Berg 885fd5b74dcSJohannes Berg /** 88689c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 88789c771e5SJouni Malinen * 88889c771e5SJouni Malinen * Used to delete a station entry (or all stations). 88989c771e5SJouni Malinen * 89089c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 89198856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 89298856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 89398856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 89489c771e5SJouni Malinen */ 89589c771e5SJouni Malinen struct station_del_parameters { 89689c771e5SJouni Malinen const u8 *mac; 89798856866SJouni Malinen u8 subtype; 89898856866SJouni Malinen u16 reason_code; 89989c771e5SJouni Malinen }; 90089c771e5SJouni Malinen 90189c771e5SJouni Malinen /** 90277ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 90377ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 90447edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 90547edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 90677ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 90777ee7c89SJohannes Berg * the AP MLME in the device 90877ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 90977ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 91077ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 91177ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 91277ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 91377ee7c89SJohannes Berg * supported/used) 91477ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 91577ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 916eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 917eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 91877ee7c89SJohannes Berg */ 91977ee7c89SJohannes Berg enum cfg80211_station_type { 92077ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 92147edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 92277ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 92377ee7c89SJohannes Berg CFG80211_STA_AP_STA, 92477ee7c89SJohannes Berg CFG80211_STA_IBSS, 92577ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 92677ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 927eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 928eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 92977ee7c89SJohannes Berg }; 93077ee7c89SJohannes Berg 93177ee7c89SJohannes Berg /** 93277ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 93377ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 93477ee7c89SJohannes Berg * @params: the new parameters for a station 93577ee7c89SJohannes Berg * @statype: the type of station being modified 93677ee7c89SJohannes Berg * 93777ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 93877ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 93977ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 94077ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 94177ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 94277ee7c89SJohannes Berg */ 94377ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 94477ee7c89SJohannes Berg struct station_parameters *params, 94577ee7c89SJohannes Berg enum cfg80211_station_type statype); 94677ee7c89SJohannes Berg 94777ee7c89SJohannes Berg /** 948420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 949420e7fabSHenning Rogge * 950420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 951420e7fabSHenning Rogge * type for 802.11n transmissions. 952420e7fabSHenning Rogge * 953db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 954db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 955420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 956db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 957420e7fabSHenning Rogge */ 958420e7fabSHenning Rogge enum rate_info_flags { 959db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 960db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 961b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 962b51f3beeSJohannes Berg RATE_INFO_FLAGS_60G = BIT(3), 963b51f3beeSJohannes Berg }; 964b51f3beeSJohannes Berg 965b51f3beeSJohannes Berg /** 966b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 967b51f3beeSJohannes Berg * 968b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 969b51f3beeSJohannes Berg * 970b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 971b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 972b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 973b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 974b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 975b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 976b51f3beeSJohannes Berg */ 977b51f3beeSJohannes Berg enum rate_info_bw { 978b51f3beeSJohannes Berg RATE_INFO_BW_5, 979b51f3beeSJohannes Berg RATE_INFO_BW_10, 980b51f3beeSJohannes Berg RATE_INFO_BW_20, 981b51f3beeSJohannes Berg RATE_INFO_BW_40, 982b51f3beeSJohannes Berg RATE_INFO_BW_80, 983b51f3beeSJohannes Berg RATE_INFO_BW_160, 984420e7fabSHenning Rogge }; 985420e7fabSHenning Rogge 986420e7fabSHenning Rogge /** 987420e7fabSHenning Rogge * struct rate_info - bitrate information 988420e7fabSHenning Rogge * 989420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 990420e7fabSHenning Rogge * 991420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 992420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 993420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 994db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 995b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 996420e7fabSHenning Rogge */ 997420e7fabSHenning Rogge struct rate_info { 998420e7fabSHenning Rogge u8 flags; 999420e7fabSHenning Rogge u8 mcs; 1000420e7fabSHenning Rogge u16 legacy; 1001db9c64cfSJohannes Berg u8 nss; 1002b51f3beeSJohannes Berg u8 bw; 1003fd5b74dcSJohannes Berg }; 1004fd5b74dcSJohannes Berg 1005fd5b74dcSJohannes Berg /** 1006f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 1007f4263c98SPaul Stewart * 1008f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1009f4263c98SPaul Stewart * type for 802.11n transmissions. 1010f4263c98SPaul Stewart * 1011f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1012f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1013f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1014f4263c98SPaul Stewart */ 1015f4263c98SPaul Stewart enum bss_param_flags { 1016f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1017f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1018f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1019f4263c98SPaul Stewart }; 1020f4263c98SPaul Stewart 1021f4263c98SPaul Stewart /** 1022f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1023f4263c98SPaul Stewart * 1024f4263c98SPaul Stewart * Information about the currently associated BSS 1025f4263c98SPaul Stewart * 1026f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1027f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1028f4263c98SPaul Stewart * @beacon_interval: beacon interval 1029f4263c98SPaul Stewart */ 1030f4263c98SPaul Stewart struct sta_bss_parameters { 1031f4263c98SPaul Stewart u8 flags; 1032f4263c98SPaul Stewart u8 dtim_period; 1033f4263c98SPaul Stewart u16 beacon_interval; 1034f4263c98SPaul Stewart }; 1035f4263c98SPaul Stewart 10366de39808SJohannes Berg /** 10376de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 10386de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 10396de39808SJohannes Berg * indicate the relevant values in this struct are filled 10406de39808SJohannes Berg * @rx_msdu: number of received MSDUs 10416de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 10426de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 10436de39808SJohannes Berg * transmitted MSDUs 10446de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 10456de39808SJohannes Berg */ 10466de39808SJohannes Berg struct cfg80211_tid_stats { 10476de39808SJohannes Berg u32 filled; 10486de39808SJohannes Berg u64 rx_msdu; 10496de39808SJohannes Berg u64 tx_msdu; 10506de39808SJohannes Berg u64 tx_msdu_retries; 10516de39808SJohannes Berg u64 tx_msdu_failed; 10526de39808SJohannes Berg }; 10536de39808SJohannes Berg 1054119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1055119363c7SFelix Fietkau 1056f4263c98SPaul Stewart /** 10572ec600d6SLuis Carlos Cobo * struct station_info - station information 1058fd5b74dcSJohannes Berg * 10592ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1060fd5b74dcSJohannes Berg * 1061319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1062319090bfSJohannes Berg * indicate the relevant values in this struct for them 1063ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1064fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 10658d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 10668d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 10672ec600d6SLuis Carlos Cobo * @llid: mesh local link id 10682ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 10692ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 107073c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 107173c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 107273c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 107373c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1074119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1075119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1076119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1077858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1078858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 10798d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 10808d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 10818d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 10828d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 10835a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 10841ba01458SRandy Dunlap * @bss_param: current BSS parameters 1085f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1086f5ea9120SJohannes Berg * This number should increase every time the list of stations 1087f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1088f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 108950d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 109050d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 109150d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 109250d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 109350d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1094c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1095a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1096d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 10973b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 10983b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 10993b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1100867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1101867d849fSAntonio Quartulli * towards this station. 1102a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1103a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1104a76b1942SJohannes Berg * from this peer 1105739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 11066de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 11076de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1108fd5b74dcSJohannes Berg */ 11092ec600d6SLuis Carlos Cobo struct station_info { 1110739960f1SMohammed Shafi Shajakhan u64 filled; 1111ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1112fd5b74dcSJohannes Berg u32 inactive_time; 111342745e03SVladimir Kondratiev u64 rx_bytes; 111442745e03SVladimir Kondratiev u64 tx_bytes; 11152ec600d6SLuis Carlos Cobo u16 llid; 11162ec600d6SLuis Carlos Cobo u16 plid; 11172ec600d6SLuis Carlos Cobo u8 plink_state; 1118420e7fabSHenning Rogge s8 signal; 1119541a45a1SBruno Randolf s8 signal_avg; 1120119363c7SFelix Fietkau 1121119363c7SFelix Fietkau u8 chains; 1122119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1123119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1124119363c7SFelix Fietkau 1125420e7fabSHenning Rogge struct rate_info txrate; 1126c8dcfd8aSFelix Fietkau struct rate_info rxrate; 112798c8a60aSJouni Malinen u32 rx_packets; 112898c8a60aSJouni Malinen u32 tx_packets; 1129b206b4efSBruno Randolf u32 tx_retries; 1130b206b4efSBruno Randolf u32 tx_failed; 11315a5c731aSBen Greear u32 rx_dropped_misc; 1132f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1133bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1134f5ea9120SJohannes Berg 1135f5ea9120SJohannes Berg int generation; 113650d3dfb7SJouni Malinen 113750d3dfb7SJouni Malinen const u8 *assoc_req_ies; 113850d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1139f612cedfSJouni Malinen 1140a85e1d55SPaul Stewart u32 beacon_loss_count; 1141d299a1f2SJavier Cardona s64 t_offset; 11423b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 11433b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 11443b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1145a85e1d55SPaul Stewart 1146867d849fSAntonio Quartulli u32 expected_throughput; 1147a76b1942SJohannes Berg 1148a76b1942SJohannes Berg u64 rx_beacon; 1149739960f1SMohammed Shafi Shajakhan u64 rx_duration; 1150a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 11516de39808SJohannes Berg struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1152fd5b74dcSJohannes Berg }; 1153fd5b74dcSJohannes Berg 115461aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 115566f7ac50SMichael Wu /** 11567406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11577406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11587406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11597406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11607406353dSAntonio Quartulli * 11617406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 11627406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 11637406353dSAntonio Quartulli * considered undefined. 11647406353dSAntonio Quartulli */ 11657406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 11667406353dSAntonio Quartulli struct station_info *sinfo); 116761aaa0e8SLinus Lüssing #else 116861aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 116961aaa0e8SLinus Lüssing const u8 *mac_addr, 117061aaa0e8SLinus Lüssing struct station_info *sinfo) 117161aaa0e8SLinus Lüssing { 117261aaa0e8SLinus Lüssing return -ENOENT; 117361aaa0e8SLinus Lüssing } 117461aaa0e8SLinus Lüssing #endif 11757406353dSAntonio Quartulli 11767406353dSAntonio Quartulli /** 117766f7ac50SMichael Wu * enum monitor_flags - monitor flags 117866f7ac50SMichael Wu * 117966f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 118066f7ac50SMichael Wu * according to the nl80211 flags. 118166f7ac50SMichael Wu * 118266f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 118366f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 118466f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 118566f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 118666f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1187e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 118866f7ac50SMichael Wu */ 118966f7ac50SMichael Wu enum monitor_flags { 119066f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 119166f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 119266f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 119366f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 119466f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1195e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 119666f7ac50SMichael Wu }; 119766f7ac50SMichael Wu 11982ec600d6SLuis Carlos Cobo /** 11992ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 12002ec600d6SLuis Carlos Cobo * 12012ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 12022ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 12032ec600d6SLuis Carlos Cobo * 1204abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1205abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1206abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1207abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1208abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1209abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1210abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 12112ec600d6SLuis Carlos Cobo */ 12122ec600d6SLuis Carlos Cobo enum mpath_info_flags { 12132ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1214d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 12152ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 12162ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 12172ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 12182ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 12192ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 12202ec600d6SLuis Carlos Cobo }; 12212ec600d6SLuis Carlos Cobo 12222ec600d6SLuis Carlos Cobo /** 12232ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 12242ec600d6SLuis Carlos Cobo * 12252ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 12262ec600d6SLuis Carlos Cobo * 12272ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 12282ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1229d19b3bf6SRui Paulo * @sn: target sequence number 12302ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 12312ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 12322ec600d6SLuis Carlos Cobo * @flags: mesh path flags 12332ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 12342ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1235f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1236f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1237f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1238f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 12392ec600d6SLuis Carlos Cobo */ 12402ec600d6SLuis Carlos Cobo struct mpath_info { 12412ec600d6SLuis Carlos Cobo u32 filled; 12422ec600d6SLuis Carlos Cobo u32 frame_qlen; 1243d19b3bf6SRui Paulo u32 sn; 12442ec600d6SLuis Carlos Cobo u32 metric; 12452ec600d6SLuis Carlos Cobo u32 exptime; 12462ec600d6SLuis Carlos Cobo u32 discovery_timeout; 12472ec600d6SLuis Carlos Cobo u8 discovery_retries; 12482ec600d6SLuis Carlos Cobo u8 flags; 1249f5ea9120SJohannes Berg 1250f5ea9120SJohannes Berg int generation; 12512ec600d6SLuis Carlos Cobo }; 12522ec600d6SLuis Carlos Cobo 12539f1ba906SJouni Malinen /** 12549f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 12559f1ba906SJouni Malinen * 12569f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 12579f1ba906SJouni Malinen * 12589f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 12599f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12609f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 12619f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 12629f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 12639f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 126490c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 126590c97a04SJouni Malinen * (or NULL for no change) 126690c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1267fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 126850b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 126950b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 127053cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 127153cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 12729f1ba906SJouni Malinen */ 12739f1ba906SJouni Malinen struct bss_parameters { 12749f1ba906SJouni Malinen int use_cts_prot; 12759f1ba906SJouni Malinen int use_short_preamble; 12769f1ba906SJouni Malinen int use_short_slot_time; 1277c1e5f471SJohannes Berg const u8 *basic_rates; 127890c97a04SJouni Malinen u8 basic_rates_len; 1279fd8aaaf3SFelix Fietkau int ap_isolate; 128050b12f59SHelmut Schaa int ht_opmode; 128153cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 12829f1ba906SJouni Malinen }; 12832ec600d6SLuis Carlos Cobo 12843ddd53f3SChun-Yeow Yeoh /** 128529cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 128629cbe68cSJohannes Berg * 128729cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 12883ddd53f3SChun-Yeow Yeoh * 12893ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 12903ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 12913ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 12923ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 12933ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 12943ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 12953ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 12963ddd53f3SChun-Yeow Yeoh * mesh interface 12973ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 12983ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 12993ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 13003ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 13013ddd53f3SChun-Yeow Yeoh * elements 13023ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 13033ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 13043ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 13053ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 13063ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 13073ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 13083ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 13093ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 13103ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 13113ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 13123ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 13133ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 13143ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 13153ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 13163ddd53f3SChun-Yeow Yeoh * element 13173ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 13183ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 13193ddd53f3SChun-Yeow Yeoh * element 13203ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 13213ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 13223ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 13233ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 13243ddd53f3SChun-Yeow Yeoh * announcements are transmitted 13253ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 13263ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 13273ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 13283ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 13293ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 13303ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 13313ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 13323ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 13333ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 13343ddd53f3SChun-Yeow Yeoh * station to establish a peer link 13353ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1336ac1073a6SChun-Yeow Yeoh * 1337ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1338ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1339ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1340ac1073a6SChun-Yeow Yeoh * 1341ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1342ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1343728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1344728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1345728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 13463b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 13473b1c5a53SMarco Porsch * setting for new peer links. 13483b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 13493b1c5a53SMarco Porsch * after transmitting its beacon. 13508e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 13518e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 13528e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 135329cbe68cSJohannes Berg */ 135493da9cc1Scolin@cozybit.com struct mesh_config { 135593da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 135693da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 135793da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 135893da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 135993da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 136093da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 136145904f21SJavier Cardona u8 element_ttl; 136293da9cc1Scolin@cozybit.com bool auto_open_plinks; 1363d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 136493da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 136593da9cc1Scolin@cozybit.com u32 path_refresh_time; 136693da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 136793da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 136893da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1369dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 137093da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 137163c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 13720507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 137316dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 137494f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 137555335137SAshok Nagarajan s32 rssi_threshold; 137670c33eaaSAshok Nagarajan u16 ht_opmode; 1377ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1378ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1379728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 13803b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 13813b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 13828e7c0538SColleen Twitty u32 plink_timeout; 138393da9cc1Scolin@cozybit.com }; 138493da9cc1Scolin@cozybit.com 138531888487SJouni Malinen /** 138629cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1387683b6d3bSJohannes Berg * @chandef: defines the channel to use 138829cbe68cSJohannes Berg * @mesh_id: the mesh ID 138929cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1390d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1391c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1392c80d545dSJavier Cardona * @path_metric: which metric to use 13936e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1394581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1395581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1396b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1397b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1398bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 13999bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 14009bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 14014bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1402ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 14038564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 140429cbe68cSJohannes Berg * 140529cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 140629cbe68cSJohannes Berg */ 140729cbe68cSJohannes Berg struct mesh_setup { 1408683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 140929cbe68cSJohannes Berg const u8 *mesh_id; 141029cbe68cSJohannes Berg u8 mesh_id_len; 1411d299a1f2SJavier Cardona u8 sync_method; 1412c80d545dSJavier Cardona u8 path_sel_proto; 1413c80d545dSJavier Cardona u8 path_metric; 14146e16d90bSColleen Twitty u8 auth_id; 1415581a8b0fSJavier Cardona const u8 *ie; 1416581a8b0fSJavier Cardona u8 ie_len; 1417b130e5ceSJavier Cardona bool is_authenticated; 141815d5dda6SJavier Cardona bool is_secure; 1419bb2798d4SThomas Pedersen bool user_mpm; 14209bdbf04dSMarco Porsch u8 dtim_period; 14219bdbf04dSMarco Porsch u16 beacon_interval; 142257fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1423ffb3cf30SAshok Nagarajan u32 basic_rates; 14248564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 142529cbe68cSJohannes Berg }; 142629cbe68cSJohannes Berg 142729cbe68cSJohannes Berg /** 14286e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 14296e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 14306e0bd6c3SRostislav Lisovy * 14316e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 14326e0bd6c3SRostislav Lisovy */ 14336e0bd6c3SRostislav Lisovy struct ocb_setup { 14346e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 14356e0bd6c3SRostislav Lisovy }; 14366e0bd6c3SRostislav Lisovy 14376e0bd6c3SRostislav Lisovy /** 143831888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1439a3304b0aSJohannes Berg * @ac: AC identifier 144031888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 144131888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 144231888487SJouni Malinen * 1..32767] 144331888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 144431888487SJouni Malinen * 1..32767] 144531888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 144631888487SJouni Malinen */ 144731888487SJouni Malinen struct ieee80211_txq_params { 1448a3304b0aSJohannes Berg enum nl80211_ac ac; 144931888487SJouni Malinen u16 txop; 145031888487SJouni Malinen u16 cwmin; 145131888487SJouni Malinen u16 cwmax; 145231888487SJouni Malinen u8 aifs; 145331888487SJouni Malinen }; 145431888487SJouni Malinen 1455d70e9693SJohannes Berg /** 1456d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1457d70e9693SJohannes Berg * 1458d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1459d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1460d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1461d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1462d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1463d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1464d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1465d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1466d70e9693SJohannes Berg * in the wiphy structure. 1467d70e9693SJohannes Berg * 1468d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1469d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1470d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1471d70e9693SJohannes Berg * 1472d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1473d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1474d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1475d70e9693SJohannes Berg * to userspace. 1476d70e9693SJohannes Berg */ 147772bdcf34SJouni Malinen 1478704232c2SJohannes Berg /** 14792a519311SJohannes Berg * struct cfg80211_ssid - SSID description 14802a519311SJohannes Berg * @ssid: the SSID 14812a519311SJohannes Berg * @ssid_len: length of the ssid 14822a519311SJohannes Berg */ 14832a519311SJohannes Berg struct cfg80211_ssid { 14842a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 14852a519311SJohannes Berg u8 ssid_len; 14862a519311SJohannes Berg }; 14872a519311SJohannes Berg 14882a519311SJohannes Berg /** 14891d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 14901d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 14911d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 14921d76250bSAvraham Stern * information is not available, this field is left zero. 14931d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 14941d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 14951d76250bSAvraham Stern * userspace will be notified of that 14961d76250bSAvraham Stern */ 14971d76250bSAvraham Stern struct cfg80211_scan_info { 14981d76250bSAvraham Stern u64 scan_start_tsf; 14991d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 15001d76250bSAvraham Stern bool aborted; 15011d76250bSAvraham Stern }; 15021d76250bSAvraham Stern 15031d76250bSAvraham Stern /** 15042a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 15052a519311SJohannes Berg * 15062a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 15072a519311SJohannes Berg * @n_ssids: number of SSIDs 15082a519311SJohannes Berg * @channels: channels to scan on. 1509ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1510dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 151170692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 151270692ad2SJouni Malinen * @ie_len: length of ie in octets 15131d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 15141d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 15151d76250bSAvraham Stern * the actual dwell time may be shorter. 15161d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 15171d76250bSAvraham Stern * %duration field. 1518ed473771SSam Leffler * @flags: bit field of flags controlling operation 151934850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 15202a519311SJohannes Berg * @wiphy: the wiphy this was for 152115d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1522fd014284SJohannes Berg * @wdev: the wireless device to scan for 15231d76250bSAvraham Stern * @info: (internal) information about completed scan 15245fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1525e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1526ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1527ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1528ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1529ad2b26abSJohannes Berg * be taken from the @mac_addr 1530818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 15312a519311SJohannes Berg */ 15322a519311SJohannes Berg struct cfg80211_scan_request { 15332a519311SJohannes Berg struct cfg80211_ssid *ssids; 15342a519311SJohannes Berg int n_ssids; 15352a519311SJohannes Berg u32 n_channels; 1536dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1537de95a54bSJohannes Berg const u8 *ie; 153870692ad2SJouni Malinen size_t ie_len; 15391d76250bSAvraham Stern u16 duration; 15401d76250bSAvraham Stern bool duration_mandatory; 1541ed473771SSam Leffler u32 flags; 15422a519311SJohannes Berg 154357fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 154434850ab2SJohannes Berg 1545fd014284SJohannes Berg struct wireless_dev *wdev; 1546fd014284SJohannes Berg 1547ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1548ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1549818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 1550ad2b26abSJohannes Berg 15512a519311SJohannes Berg /* internal */ 15522a519311SJohannes Berg struct wiphy *wiphy; 155315d6030bSSam Leffler unsigned long scan_start; 15541d76250bSAvraham Stern struct cfg80211_scan_info info; 15551d76250bSAvraham Stern bool notified; 1556e9f935e3SRajkumar Manoharan bool no_cck; 15575ba63533SJohannes Berg 15585ba63533SJohannes Berg /* keep last */ 15595ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 15602a519311SJohannes Berg }; 15612a519311SJohannes Berg 1562ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1563ad2b26abSJohannes Berg { 1564ad2b26abSJohannes Berg int i; 1565ad2b26abSJohannes Berg 1566ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1567ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1568ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1569ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1570ad2b26abSJohannes Berg } 1571ad2b26abSJohannes Berg } 1572ad2b26abSJohannes Berg 15732a519311SJohannes Berg /** 1574a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1575a1f1c21cSLuciano Coelho * 1576ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1577ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1578a1f1c21cSLuciano Coelho */ 1579a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1580a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1581ea73cbceSJohannes Berg s32 rssi_thold; 1582a1f1c21cSLuciano Coelho }; 1583a1f1c21cSLuciano Coelho 1584a1f1c21cSLuciano Coelho /** 15853b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 15863b06d277SAvraham Stern * 15873b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 15883b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 15893b06d277SAvraham Stern * infinite loop. 15903b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 15913b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 15923b06d277SAvraham Stern */ 15933b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 15943b06d277SAvraham Stern u32 interval; 15953b06d277SAvraham Stern u32 iterations; 15963b06d277SAvraham Stern }; 15973b06d277SAvraham Stern 15983b06d277SAvraham Stern /** 1599807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1600807f8a8cSLuciano Coelho * 1601807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1602807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1603807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1604dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1605807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1606807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1607ed473771SSam Leffler * @flags: bit field of flags controlling operation 1608a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1609a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1610a1f1c21cSLuciano Coelho * (others are filtered out). 1611a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1612a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1613807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1614807f8a8cSLuciano Coelho * @dev: the interface 1615077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1616807f8a8cSLuciano Coelho * @channels: channels to scan 1617ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1618ea73cbceSJohannes Berg * contains the minimum over all matchsets 1619ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1620ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1621ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1622ad2b26abSJohannes Berg * be taken from the @mac_addr 16233b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 16243b06d277SAvraham Stern * index must be executed first. 16253b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 162631a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 162793a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 162893a1e86cSJukka Rissanen * owned by a particular socket) 16299c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 16309c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 16319c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 16329c748934SLuciano Coelho * supported. 1633807f8a8cSLuciano Coelho */ 1634807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1635807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1636807f8a8cSLuciano Coelho int n_ssids; 1637807f8a8cSLuciano Coelho u32 n_channels; 1638dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1639807f8a8cSLuciano Coelho const u8 *ie; 1640807f8a8cSLuciano Coelho size_t ie_len; 1641ed473771SSam Leffler u32 flags; 1642a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1643a1f1c21cSLuciano Coelho int n_match_sets; 1644ea73cbceSJohannes Berg s32 min_rssi_thold; 16459c748934SLuciano Coelho u32 delay; 16463b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 16473b06d277SAvraham Stern int n_scan_plans; 1648807f8a8cSLuciano Coelho 1649ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1650ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1651ad2b26abSJohannes Berg 1652807f8a8cSLuciano Coelho /* internal */ 1653807f8a8cSLuciano Coelho struct wiphy *wiphy; 1654807f8a8cSLuciano Coelho struct net_device *dev; 165515d6030bSSam Leffler unsigned long scan_start; 165631a60ed1SJukka Rissanen struct rcu_head rcu_head; 165793a1e86cSJukka Rissanen u32 owner_nlportid; 1658807f8a8cSLuciano Coelho 1659807f8a8cSLuciano Coelho /* keep last */ 1660807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1661807f8a8cSLuciano Coelho }; 1662807f8a8cSLuciano Coelho 1663807f8a8cSLuciano Coelho /** 16642a519311SJohannes Berg * enum cfg80211_signal_type - signal type 16652a519311SJohannes Berg * 16662a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 16672a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 16682a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 16692a519311SJohannes Berg */ 16702a519311SJohannes Berg enum cfg80211_signal_type { 16712a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 16722a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 16732a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 16742a519311SJohannes Berg }; 16752a519311SJohannes Berg 16762a519311SJohannes Berg /** 16776e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 16786e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 16796e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 16806e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 16816e19bc4bSDmitry Shmidt * signal type 16826e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 16836e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 16846e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 16856e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 16866e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 16876e19bc4bSDmitry Shmidt * ktime_get_boot_ns() is likely appropriate. 16881d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 16891d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 16901d76250bSAvraham Stern * by %parent_bssid. 16911d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 16921d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 16936e19bc4bSDmitry Shmidt */ 16946e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 16956e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 16966e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 16976e19bc4bSDmitry Shmidt s32 signal; 16986e19bc4bSDmitry Shmidt u64 boottime_ns; 16991d76250bSAvraham Stern u64 parent_tsf; 17001d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 17016e19bc4bSDmitry Shmidt }; 17026e19bc4bSDmitry Shmidt 17036e19bc4bSDmitry Shmidt /** 17042aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 17058cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 17069caf0364SJohannes Berg * @rcu_head: internal use, for freeing 17079caf0364SJohannes Berg * @len: length of the IEs 17080e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 17099caf0364SJohannes Berg * @data: IE data 17109caf0364SJohannes Berg */ 17119caf0364SJohannes Berg struct cfg80211_bss_ies { 17128cef2c9dSJohannes Berg u64 tsf; 17139caf0364SJohannes Berg struct rcu_head rcu_head; 17149caf0364SJohannes Berg int len; 17150e227084SJohannes Berg bool from_beacon; 17169caf0364SJohannes Berg u8 data[]; 17179caf0364SJohannes Berg }; 17189caf0364SJohannes Berg 17199caf0364SJohannes Berg /** 17202a519311SJohannes Berg * struct cfg80211_bss - BSS description 17212a519311SJohannes Berg * 17222a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 17232a519311SJohannes Berg * for use in scan results and similar. 17242a519311SJohannes Berg * 1725abe37c4bSJohannes Berg * @channel: channel this BSS is on 1726dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 17272a519311SJohannes Berg * @bssid: BSSID of the BSS 17282a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 17292a519311SJohannes Berg * @capability: the capability field in host byte order 173083c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 173183c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 173283c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 173383c7aa1aSJohannes Berg * received. It is always non-%NULL. 173434a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1735776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1736776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1737776b3580SJohannes Berg * @hidden_beacon_bss struct) 173834a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1739776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1740776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1741776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1742776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 174377965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 17442a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 17452a519311SJohannes Berg */ 17462a519311SJohannes Berg struct cfg80211_bss { 17472a519311SJohannes Berg struct ieee80211_channel *channel; 1748dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 17492a519311SJohannes Berg 17509caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 17519caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 17529caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 17539caf0364SJohannes Berg 1754776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 17552a519311SJohannes Berg 17562a519311SJohannes Berg s32 signal; 17572a519311SJohannes Berg 17589caf0364SJohannes Berg u16 beacon_interval; 17599caf0364SJohannes Berg u16 capability; 17609caf0364SJohannes Berg 17619caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 17629caf0364SJohannes Berg 17631c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 17642a519311SJohannes Berg }; 17652a519311SJohannes Berg 17662a519311SJohannes Berg /** 1767517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1768517357c6SJohannes Berg * @bss: the bss to search 1769517357c6SJohannes Berg * @ie: the IE ID 17709caf0364SJohannes Berg * 17719caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 17729caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 17730ae997dcSYacine Belkadi * Return: %NULL if not found. 1774517357c6SJohannes Berg */ 1775517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1776517357c6SJohannes Berg 1777517357c6SJohannes Berg 1778517357c6SJohannes Berg /** 1779636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1780636a5d36SJouni Malinen * 1781636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1782636a5d36SJouni Malinen * authentication. 1783636a5d36SJouni Malinen * 1784959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1785959867faSJohannes Berg * to it if it needs to keep it. 1786636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1787636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1788636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1789fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1790fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1791fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1792e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1793e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1794e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1795636a5d36SJouni Malinen */ 1796636a5d36SJouni Malinen struct cfg80211_auth_request { 179719957bb3SJohannes Berg struct cfg80211_bss *bss; 1798636a5d36SJouni Malinen const u8 *ie; 1799636a5d36SJouni Malinen size_t ie_len; 180019957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1801fffd0934SJohannes Berg const u8 *key; 1802fffd0934SJohannes Berg u8 key_len, key_idx; 1803e39e5b5eSJouni Malinen const u8 *sae_data; 1804e39e5b5eSJouni Malinen size_t sae_data_len; 1805636a5d36SJouni Malinen }; 1806636a5d36SJouni Malinen 1807636a5d36SJouni Malinen /** 18087e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 18097e7c8926SBen Greear * 18107e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1811ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1812bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 18137e7c8926SBen Greear */ 18147e7c8926SBen Greear enum cfg80211_assoc_req_flags { 18157e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1816ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1817bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 18187e7c8926SBen Greear }; 18197e7c8926SBen Greear 18207e7c8926SBen Greear /** 1821636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1822636a5d36SJouni Malinen * 1823636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1824636a5d36SJouni Malinen * (re)association. 1825959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1826959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1827959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1828959867faSJohannes Berg * association requests while already associating must be rejected. 1829636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1830636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1831dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1832b23aa676SSamuel Ortiz * @crypto: crypto settings 183335eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 183435eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 183535eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 183635eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 183735eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 183835eb8f7bSJouni Malinen * frame. 18397e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 18407e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 18417e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 18427e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1843ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1844ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1845636a5d36SJouni Malinen */ 1846636a5d36SJouni Malinen struct cfg80211_assoc_request { 184719957bb3SJohannes Berg struct cfg80211_bss *bss; 18483e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1849636a5d36SJouni Malinen size_t ie_len; 1850b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 185119957bb3SJohannes Berg bool use_mfp; 18527e7c8926SBen Greear u32 flags; 18537e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 18547e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1855ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1856636a5d36SJouni Malinen }; 1857636a5d36SJouni Malinen 1858636a5d36SJouni Malinen /** 1859636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1860636a5d36SJouni Malinen * 1861636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1862636a5d36SJouni Malinen * deauthentication. 1863636a5d36SJouni Malinen * 186495de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1865636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1866636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 186719957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1868077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1869077f897aSJohannes Berg * do not set a deauth frame 1870636a5d36SJouni Malinen */ 1871636a5d36SJouni Malinen struct cfg80211_deauth_request { 187295de817bSJohannes Berg const u8 *bssid; 1873636a5d36SJouni Malinen const u8 *ie; 1874636a5d36SJouni Malinen size_t ie_len; 187519957bb3SJohannes Berg u16 reason_code; 18766863255bSStanislaw Gruszka bool local_state_change; 1877636a5d36SJouni Malinen }; 1878636a5d36SJouni Malinen 1879636a5d36SJouni Malinen /** 1880636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1881636a5d36SJouni Malinen * 1882636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1883636a5d36SJouni Malinen * disassocation. 1884636a5d36SJouni Malinen * 188519957bb3SJohannes Berg * @bss: the BSS to disassociate from 1886636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1887636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 188819957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1889d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1890d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1891636a5d36SJouni Malinen */ 1892636a5d36SJouni Malinen struct cfg80211_disassoc_request { 189319957bb3SJohannes Berg struct cfg80211_bss *bss; 1894636a5d36SJouni Malinen const u8 *ie; 1895636a5d36SJouni Malinen size_t ie_len; 189619957bb3SJohannes Berg u16 reason_code; 1897d5cdfacbSJouni Malinen bool local_state_change; 1898636a5d36SJouni Malinen }; 1899636a5d36SJouni Malinen 1900636a5d36SJouni Malinen /** 190104a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 190204a773adSJohannes Berg * 190304a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 190404a773adSJohannes Berg * method. 190504a773adSJohannes Berg * 190604a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 190704a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 190804a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 190904a773adSJohannes Berg * search for IBSSs with a different BSSID. 1910683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 191104a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 191204a773adSJohannes Berg * IBSSs to join on other channels. 191304a773adSJohannes Berg * @ie: information element(s) to include in the beacon 191404a773adSJohannes Berg * @ie_len: length of that 19158e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1916fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1917fffd0934SJohannes Berg * after joining 1918267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1919267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1920267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1921267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 19225336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 19235336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 19245336fa88SSimon Wunderlich * to operate on DFS channels. 1925fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1926dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1927803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1928803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1929803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 193004a773adSJohannes Berg */ 193104a773adSJohannes Berg struct cfg80211_ibss_params { 1932c1e5f471SJohannes Berg const u8 *ssid; 1933c1e5f471SJohannes Berg const u8 *bssid; 1934683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1935c1e5f471SJohannes Berg const u8 *ie; 193604a773adSJohannes Berg u8 ssid_len, ie_len; 19378e30bc55SJohannes Berg u16 beacon_interval; 1938fbd2c8dcSTeemu Paasikivi u32 basic_rates; 193904a773adSJohannes Berg bool channel_fixed; 1940fffd0934SJohannes Berg bool privacy; 1941267335d6SAntonio Quartulli bool control_port; 19425336fa88SSimon Wunderlich bool userspace_handles_dfs; 194357fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 1944803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1945803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 194604a773adSJohannes Berg }; 194704a773adSJohannes Berg 194804a773adSJohannes Berg /** 194938de03d2SArend van Spriel * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 195038de03d2SArend van Spriel * 195138de03d2SArend van Spriel * @band: band of BSS which should match for RSSI level adjustment. 195238de03d2SArend van Spriel * @delta: value of RSSI level adjustment. 195338de03d2SArend van Spriel */ 195438de03d2SArend van Spriel struct cfg80211_bss_select_adjust { 195557fbcce3SJohannes Berg enum nl80211_band band; 195638de03d2SArend van Spriel s8 delta; 195738de03d2SArend van Spriel }; 195838de03d2SArend van Spriel 195938de03d2SArend van Spriel /** 196038de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 196138de03d2SArend van Spriel * 196238de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 196338de03d2SArend van Spriel * @param: parameters for requestion behaviour. 196438de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 196538de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 196638de03d2SArend van Spriel */ 196738de03d2SArend van Spriel struct cfg80211_bss_selection { 196838de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 196938de03d2SArend van Spriel union { 197057fbcce3SJohannes Berg enum nl80211_band band_pref; 197138de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 197238de03d2SArend van Spriel } param; 197338de03d2SArend van Spriel }; 197438de03d2SArend van Spriel 197538de03d2SArend van Spriel /** 1976b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1977b23aa676SSamuel Ortiz * 1978b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1979b23aa676SSamuel Ortiz * authentication and association. 1980b23aa676SSamuel Ortiz * 1981b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1982b23aa676SSamuel Ortiz * on scan results) 19831df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 19841df4a510SJouni Malinen * %NULL if not specified 1985b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1986b23aa676SSamuel Ortiz * results) 19871df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 19881df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 19891df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 19901df4a510SJouni Malinen * to use. 1991b23aa676SSamuel Ortiz * @ssid: SSID 1992b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1993b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1994abe37c4bSJohannes Berg * @ie: IEs for association request 1995abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1996b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1997cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1998b23aa676SSamuel Ortiz * @crypto: crypto settings 1999fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2000fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2001fffd0934SJohannes Berg * @key: WEP key for shared key authentication 20027e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 20034486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 20044486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 20057e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 20067e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 20077e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2008ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 2009ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 201034d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 201134d50519SLior David * networks. 201238de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 201335eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 201435eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 201535eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 201635eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 201735eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 201835eb8f7bSJouni Malinen * frame. 2019b23aa676SSamuel Ortiz */ 2020b23aa676SSamuel Ortiz struct cfg80211_connect_params { 2021b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 20221df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 2023664834deSJouni Malinen const u8 *bssid; 20241df4a510SJouni Malinen const u8 *bssid_hint; 2025664834deSJouni Malinen const u8 *ssid; 2026b23aa676SSamuel Ortiz size_t ssid_len; 2027b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 20284b5800feSJohannes Berg const u8 *ie; 2029b23aa676SSamuel Ortiz size_t ie_len; 2030b23aa676SSamuel Ortiz bool privacy; 2031cee00a95SJouni Malinen enum nl80211_mfp mfp; 2032b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 2033fffd0934SJohannes Berg const u8 *key; 2034fffd0934SJohannes Berg u8 key_len, key_idx; 20357e7c8926SBen Greear u32 flags; 20364486ea98SBala Shanmugam int bg_scan_period; 20377e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 20387e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2039ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 2040ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 204134d50519SLior David bool pbss; 204238de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 2043ba6fbacfSJouni Malinen const u8 *prev_bssid; 2044b23aa676SSamuel Ortiz }; 2045b23aa676SSamuel Ortiz 2046b23aa676SSamuel Ortiz /** 2047b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 2048abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 2049abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 2050abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 2051abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2052abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 20533057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 2054b9a5f8caSJouni Malinen */ 2055b9a5f8caSJouni Malinen enum wiphy_params_flags { 2056b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2057b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 2058b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 2059b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 206081077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 20613057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 2062b9a5f8caSJouni Malinen }; 2063b9a5f8caSJouni Malinen 206467fbb16bSSamuel Ortiz /** 206567fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 206667fbb16bSSamuel Ortiz * 206767fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 206867fbb16bSSamuel Ortiz * caching. 206967fbb16bSSamuel Ortiz * 207067fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 207167fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 207267fbb16bSSamuel Ortiz */ 207367fbb16bSSamuel Ortiz struct cfg80211_pmksa { 2074c1e5f471SJohannes Berg const u8 *bssid; 2075c1e5f471SJohannes Berg const u8 *pmkid; 207667fbb16bSSamuel Ortiz }; 20779930380fSJohannes Berg 20787643a2c3SJohannes Berg /** 207950ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 2080ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 2081ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 2082ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 2083ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 2084bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 2085ff1b6e69SJohannes Berg * 2086ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 2087ff1b6e69SJohannes Berg * memory, free @mask only! 2088ff1b6e69SJohannes Berg */ 208950ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 2090922bd80fSJohannes Berg const u8 *mask, *pattern; 2091ff1b6e69SJohannes Berg int pattern_len; 2092bb92d199SAmitkumar Karwar int pkt_offset; 2093ff1b6e69SJohannes Berg }; 2094ff1b6e69SJohannes Berg 2095ff1b6e69SJohannes Berg /** 20962a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 20972a0e047eSJohannes Berg * 20982a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 20992a0e047eSJohannes Berg * @src: source IP address 21002a0e047eSJohannes Berg * @dst: destination IP address 21012a0e047eSJohannes Berg * @dst_mac: destination MAC address 21022a0e047eSJohannes Berg * @src_port: source port 21032a0e047eSJohannes Berg * @dst_port: destination port 21042a0e047eSJohannes Berg * @payload_len: data payload length 21052a0e047eSJohannes Berg * @payload: data payload buffer 21062a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 21072a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 21082a0e047eSJohannes Berg * @wake_len: wakeup payload match length 21092a0e047eSJohannes Berg * @wake_data: wakeup payload match data 21102a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 21112a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 21122a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 21132a0e047eSJohannes Berg */ 21142a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 21152a0e047eSJohannes Berg struct socket *sock; 21162a0e047eSJohannes Berg __be32 src, dst; 21172a0e047eSJohannes Berg u16 src_port, dst_port; 21182a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 21192a0e047eSJohannes Berg int payload_len; 21202a0e047eSJohannes Berg const u8 *payload; 21212a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 21222a0e047eSJohannes Berg u32 data_interval; 21232a0e047eSJohannes Berg u32 wake_len; 21242a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 21252a0e047eSJohannes Berg u32 tokens_size; 21262a0e047eSJohannes Berg /* must be last, variable member */ 21272a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 2128ff1b6e69SJohannes Berg }; 2129ff1b6e69SJohannes Berg 2130ff1b6e69SJohannes Berg /** 2131ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2132ff1b6e69SJohannes Berg * 2133ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 2134ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 2135ff1b6e69SJohannes Berg * operating as normal during suspend 2136ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 2137ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 2138ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 2139ff1b6e69SJohannes Berg * @n_patterns: number of patterns 214077dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 214177dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 214277dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 214377dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 21442a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 21452a0e047eSJohannes Berg * NULL if not configured. 21468cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 2147ff1b6e69SJohannes Berg */ 2148ff1b6e69SJohannes Berg struct cfg80211_wowlan { 214977dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 215077dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 215177dbbb13SJohannes Berg rfkill_release; 215250ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 21532a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 2154ff1b6e69SJohannes Berg int n_patterns; 21558cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 2156ff1b6e69SJohannes Berg }; 2157ff1b6e69SJohannes Berg 2158ff1b6e69SJohannes Berg /** 2159be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 2160be29b99aSAmitkumar Karwar * 2161be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 2162be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 2163be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 2164be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 2165be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 2166be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 2167be29b99aSAmitkumar Karwar */ 2168be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2169be29b99aSAmitkumar Karwar int delay; 2170be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2171be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2172be29b99aSAmitkumar Karwar int n_patterns; 2173be29b99aSAmitkumar Karwar }; 2174be29b99aSAmitkumar Karwar 2175be29b99aSAmitkumar Karwar /** 2176be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2177be29b99aSAmitkumar Karwar * 2178be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2179be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2180be29b99aSAmitkumar Karwar * @n_rules: number of rules 2181be29b99aSAmitkumar Karwar */ 2182be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2183be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2184be29b99aSAmitkumar Karwar int n_rules; 2185be29b99aSAmitkumar Karwar }; 2186be29b99aSAmitkumar Karwar 2187be29b99aSAmitkumar Karwar /** 21888cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 21898cd4d456SLuciano Coelho * 21908cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 21918cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 21928cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 21938cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 21948cd4d456SLuciano Coelho * occurred (in MHz) 21958cd4d456SLuciano Coelho */ 21968cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 21978cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 21988cd4d456SLuciano Coelho int n_channels; 21998cd4d456SLuciano Coelho u32 channels[]; 22008cd4d456SLuciano Coelho }; 22018cd4d456SLuciano Coelho 22028cd4d456SLuciano Coelho /** 22038cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 22048cd4d456SLuciano Coelho * 22058cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 22068cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 22078cd4d456SLuciano Coelho * match information. 22088cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 22098cd4d456SLuciano Coelho * the matches that triggered the wake up. 22108cd4d456SLuciano Coelho */ 22118cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 22128cd4d456SLuciano Coelho int n_matches; 22138cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 22148cd4d456SLuciano Coelho }; 22158cd4d456SLuciano Coelho 22168cd4d456SLuciano Coelho /** 2217cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2218cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2219cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2220cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2221cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2222cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2223cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2224cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2225cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2226cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2227cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2228cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2229cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2230cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2231cd8f7cb4SJohannes Berg * it is. 22322a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 22332a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 22342a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 22358cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2236cd8f7cb4SJohannes Berg */ 2237cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2238cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2239cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 22402a0e047eSJohannes Berg rfkill_release, packet_80211, 22412a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2242cd8f7cb4SJohannes Berg s32 pattern_idx; 2243cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2244cd8f7cb4SJohannes Berg const void *packet; 22458cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2246cd8f7cb4SJohannes Berg }; 2247cd8f7cb4SJohannes Berg 2248cd8f7cb4SJohannes Berg /** 2249e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 225078f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 225178f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 225278f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2253e5497d76SJohannes Berg */ 2254e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 225578f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2256e5497d76SJohannes Berg }; 2257e5497d76SJohannes Berg 2258e5497d76SJohannes Berg /** 2259355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2260355199e0SJouni Malinen * 2261355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2262355199e0SJouni Malinen * 2263355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2264355199e0SJouni Malinen * @ie: Fast Transition IEs 2265355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2266355199e0SJouni Malinen */ 2267355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2268355199e0SJouni Malinen u16 md; 2269355199e0SJouni Malinen const u8 *ie; 2270355199e0SJouni Malinen size_t ie_len; 2271355199e0SJouni Malinen }; 2272355199e0SJouni Malinen 2273355199e0SJouni Malinen /** 2274b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2275b176e629SAndrei Otcheretianski * 2276b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2277b176e629SAndrei Otcheretianski * 2278b176e629SAndrei Otcheretianski * @chan: channel to use 2279b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2280b176e629SAndrei Otcheretianski * @wait: duration for ROC 2281b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2282b176e629SAndrei Otcheretianski * @len: buffer length 2283b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2284b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 228534d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 228634d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2287b176e629SAndrei Otcheretianski */ 2288b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2289b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2290b176e629SAndrei Otcheretianski bool offchan; 2291b176e629SAndrei Otcheretianski unsigned int wait; 2292b176e629SAndrei Otcheretianski const u8 *buf; 2293b176e629SAndrei Otcheretianski size_t len; 2294b176e629SAndrei Otcheretianski bool no_cck; 2295b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 229634d22ce2SAndrei Otcheretianski int n_csa_offsets; 229734d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2298b176e629SAndrei Otcheretianski }; 2299b176e629SAndrei Otcheretianski 2300b176e629SAndrei Otcheretianski /** 2301fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2302fa9ffc74SKyeyoon Park * 2303fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2304fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2305fa9ffc74SKyeyoon Park */ 2306fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2307fa9ffc74SKyeyoon Park u8 dscp; 2308fa9ffc74SKyeyoon Park u8 up; 2309fa9ffc74SKyeyoon Park }; 2310fa9ffc74SKyeyoon Park 2311fa9ffc74SKyeyoon Park /** 2312fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2313fa9ffc74SKyeyoon Park * 2314fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2315fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2316fa9ffc74SKyeyoon Park */ 2317fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2318fa9ffc74SKyeyoon Park u8 low; 2319fa9ffc74SKyeyoon Park u8 high; 2320fa9ffc74SKyeyoon Park }; 2321fa9ffc74SKyeyoon Park 2322fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2323fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2324fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2325fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2326fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2327fa9ffc74SKyeyoon Park 2328fa9ffc74SKyeyoon Park /** 2329fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2330fa9ffc74SKyeyoon Park * 2331fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2332fa9ffc74SKyeyoon Park * 2333fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2334fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2335fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2336fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2337fa9ffc74SKyeyoon Park */ 2338fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2339fa9ffc74SKyeyoon Park u8 num_des; 2340fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2341fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2342fa9ffc74SKyeyoon Park }; 2343fa9ffc74SKyeyoon Park 2344fa9ffc74SKyeyoon Park /** 2345cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 2346cb3b7d87SAyala Beker * 2347cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 2348cb3b7d87SAyala Beker * 2349cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 2350cb3b7d87SAyala Beker * @dual: dual band operation mode, see &enum nl80211_nan_dual_band_conf 2351cb3b7d87SAyala Beker */ 2352cb3b7d87SAyala Beker struct cfg80211_nan_conf { 2353cb3b7d87SAyala Beker u8 master_pref; 2354cb3b7d87SAyala Beker u8 dual; 2355cb3b7d87SAyala Beker }; 2356cb3b7d87SAyala Beker 2357cb3b7d87SAyala Beker /** 2358a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 2359a5a9dcf2SAyala Beker * configuration 2360a5a9dcf2SAyala Beker * 2361a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 2362a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_DUAL: dual band operation 2363a5a9dcf2SAyala Beker */ 2364a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 2365a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 2366a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_DUAL = BIT(1), 2367a5a9dcf2SAyala Beker }; 2368a5a9dcf2SAyala Beker 2369a5a9dcf2SAyala Beker /** 2370a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 2371a442b761SAyala Beker * 2372a442b761SAyala Beker * @filter: the content of the filter 2373a442b761SAyala Beker * @len: the length of the filter 2374a442b761SAyala Beker */ 2375a442b761SAyala Beker struct cfg80211_nan_func_filter { 2376a442b761SAyala Beker const u8 *filter; 2377a442b761SAyala Beker u8 len; 2378a442b761SAyala Beker }; 2379a442b761SAyala Beker 2380a442b761SAyala Beker /** 2381a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 2382a442b761SAyala Beker * 2383a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 2384a442b761SAyala Beker * @service_id: the service ID of the function 2385a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 2386a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 2387a442b761SAyala Beker * implementation specific. 2388a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 2389a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 2390a442b761SAyala Beker * @followup_id: the instance ID for follow up 2391a442b761SAyala Beker * @followup_reqid: the requestor instance ID for follow up 2392a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 2393a442b761SAyala Beker * @ttl: time to live counter in DW. 2394a442b761SAyala Beker * @serv_spec_info: Service Specific Info 2395a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 2396a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 2397a442b761SAyala Beker * @srf_bf: Bloom Filter 2398a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 2399a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 2400a442b761SAyala Beker * @srf_macs: SRF MAC addresses 2401a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 2402a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 2403a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 2404a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 2405a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 2406a442b761SAyala Beker * @instance_id: driver allocated id of the function. 2407a442b761SAyala Beker * @cookie: unique NAN function identifier. 2408a442b761SAyala Beker */ 2409a442b761SAyala Beker struct cfg80211_nan_func { 2410a442b761SAyala Beker enum nl80211_nan_function_type type; 2411a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 2412a442b761SAyala Beker u8 publish_type; 2413a442b761SAyala Beker bool close_range; 2414a442b761SAyala Beker bool publish_bcast; 2415a442b761SAyala Beker bool subscribe_active; 2416a442b761SAyala Beker u8 followup_id; 2417a442b761SAyala Beker u8 followup_reqid; 2418a442b761SAyala Beker struct mac_address followup_dest; 2419a442b761SAyala Beker u32 ttl; 2420a442b761SAyala Beker const u8 *serv_spec_info; 2421a442b761SAyala Beker u8 serv_spec_info_len; 2422a442b761SAyala Beker bool srf_include; 2423a442b761SAyala Beker const u8 *srf_bf; 2424a442b761SAyala Beker u8 srf_bf_len; 2425a442b761SAyala Beker u8 srf_bf_idx; 2426a442b761SAyala Beker struct mac_address *srf_macs; 2427a442b761SAyala Beker int srf_num_macs; 2428a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 2429a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 2430a442b761SAyala Beker u8 num_tx_filters; 2431a442b761SAyala Beker u8 num_rx_filters; 2432a442b761SAyala Beker u8 instance_id; 2433a442b761SAyala Beker u64 cookie; 2434a442b761SAyala Beker }; 2435a442b761SAyala Beker 2436a442b761SAyala Beker /** 2437704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2438704232c2SJohannes Berg * 2439704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2440704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2441704232c2SJohannes Berg * 2442704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2443704232c2SJohannes Berg * on success or a negative error code. 2444704232c2SJohannes Berg * 244543fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 244643fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 244743fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 244843fb45cbSJohannes Berg * 2449ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2450ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2451ff1b6e69SJohannes Berg * configured for the device. 24520378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 24536d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 24546d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 24556d52563fSJohannes Berg * the device. 24560378b3f1SJohannes Berg * 245760719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2458463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 245984efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 246098104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 246198104fdeSJohannes Berg * also set the address member in the wdev. 2462704232c2SJohannes Berg * 246384efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 246455682965SJohannes Berg * 246560719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 246660719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 246755682965SJohannes Berg * 246841ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 246941ade00fSJohannes Berg * when adding a group key. 247041ade00fSJohannes Berg * 247141ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 247241ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 247341ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2474e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2475e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 247641ade00fSJohannes Berg * 247741ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2478e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 247941ade00fSJohannes Berg * 248041ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2481ed1b6cc7SJohannes Berg * 24823cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 24833cfcf6acSJouni Malinen * 2484e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2485e5497d76SJohannes Berg * 2486c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2487c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2488c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2489c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 24905727ef1bSJohannes Berg * 24915727ef1bSJohannes Berg * @add_station: Add a new station. 249289c771e5SJouni Malinen * @del_station: Remove a station 2493bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2494bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2495bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 249677ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 249777ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2498abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2499abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2500abe37c4bSJohannes Berg * 2501abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2502abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2503abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2504abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2505abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 250666be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 250766be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2508f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 25098d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2510f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 25118d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 25122ec600d6SLuis Carlos Cobo * 251324bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 251493da9cc1Scolin@cozybit.com * 251524bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 251693da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 251793da9cc1Scolin@cozybit.com * set, and which to leave alone. 251893da9cc1Scolin@cozybit.com * 25199f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 252031888487SJouni Malinen * 252131888487SJouni Malinen * @set_txq_params: Set TX queue parameters 252272bdcf34SJouni Malinen * 2523e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2524e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2525e8c9bd5bSJohannes Berg * join the mesh instead. 2526e8c9bd5bSJohannes Berg * 2527e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2528e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2529e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2530e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 25319aed3cc1SJouni Malinen * 25322a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 25332a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 25342a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 25352a519311SJohannes Berg * the scan/scan_done bracket too. 253691d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 253791d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 2538636a5d36SJouni Malinen * 2539636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 25408d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2541636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 25428d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2543636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 25448d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2545636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 25468d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 254704a773adSJohannes Berg * 2548b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2549bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 2550bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 2551bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 2552bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 2553bf1ecd21SJouni Malinen * was received. 2554bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 2555bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 2556bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 2557bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 2558bf1ecd21SJouni Malinen * frame instead of Association Request frame. 2559bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 2560bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 256135eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 2562bf1ecd21SJouni Malinen * indication of requesting reassociation. 2563bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 2564bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 2565bf1ecd21SJouni Malinen * cfg80211_roamed() or cfg80211_roamed_bss(). 25668d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 25675a1f044bSEmmanuel Grumbach * @disconnect: Disconnect from the BSS/ESS. Once done, call 25685a1f044bSEmmanuel Grumbach * cfg80211_disconnected(). 25698d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2570b23aa676SSamuel Ortiz * 257104a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 257204a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 257304a773adSJohannes Berg * to a merge. 25748d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 257504a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 25768d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2577b9a5f8caSJouni Malinen * 2578f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2579f4e583c8SAntonio Quartulli * MESH mode) 2580f4e583c8SAntonio Quartulli * 2581b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2582b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2583b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2584b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 25857643a2c3SJohannes Berg * 25861432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2587c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2588c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2589c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2590c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 25917643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 25921f87f7d3SJohannes Berg * return 0 if successful 25931f87f7d3SJohannes Berg * 2594abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2595abe37c4bSJohannes Berg * 25961f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 25971f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2598aff89a9bSJohannes Berg * 259961fa713cSHolger Schurig * @dump_survey: get site survey information. 260061fa713cSHolger Schurig * 26019588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 26029588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 26039588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 26049588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 26059588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 26069588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 26079588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 26089588bbd5SJouni Malinen * the duration value. 2609f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2610f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2611f7ca38dfSJohannes Berg * frame on another channel 26129588bbd5SJouni Malinen * 2613fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 261471063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 261571063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 261671063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 261771063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 261871063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 261971063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 262067fbb16bSSamuel Ortiz * 2621abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2622abe37c4bSJohannes Berg * 262367fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 262467fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 262567fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 262667fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 262767fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 26289043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 26299043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2630d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 2631e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 2632e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 2633e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 2634e86abc68SJohannes Berg * disabled.) 263584f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 263684f10708SThomas Pedersen * thresholds. 2637807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2638d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2639d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2640d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2641d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2642d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2643d9b8396aSJohannes Berg * method returns 0.) 264467fbb16bSSamuel Ortiz * 2645271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 264633d8783cSJohannes Berg * registered. The callback is allowed to sleep. 2647547025d5SBruno Randolf * 2648547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2649547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2650547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2651547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2652547025d5SBruno Randolf * 2653547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 26543677713bSJohn W. Linville * 2655109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2656109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 26577f6cf311SJohannes Berg * 26587f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 26597f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 26601d9d9213SSimon Wunderlich * 26611d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2662d6199218SBen Greear * 26635b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 26645b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 26655b7ccaf3SJohannes Berg * current monitoring channel. 266698104fdeSJohannes Berg * 266798104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 266898104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 266977765eafSVasanthakumar Thiagarajan * 267077765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 267177765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 267277765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 267377765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 267477765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 267577765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 267604f39047SSimon Wunderlich * 267704f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 26788bf24293SJouni Malinen * 26798bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 26808bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 26818bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 26825de17984SArend van Spriel * 26835de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 26845de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 26855de17984SArend van Spriel * driver can take the most appropriate actions. 26865de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 26875de17984SArend van Spriel * reliability. This operation can not fail. 2688be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 268916ef1fe2SSimon Wunderlich * 269097dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 269197dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 269297dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 269397dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 269497dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 269597dc94f1SMichal Kazior * as soon as possible. 2696fa9ffc74SKyeyoon Park * 2697fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2698e16821bcSJouni Malinen * 2699e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2700e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2701e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2702960d01acSJohannes Berg * 2703960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2704960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2705960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2706960d01acSJohannes Berg * account. 2707960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2708960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2709960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2710960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2711960d01acSJohannes Berg * rejected) 2712960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 27136e0bd6c3SRostislav Lisovy * 27146e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 27156e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 27166e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 27176e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 27181057d35eSArik Nemtsov * 27191057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 27201057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 27211057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 27221057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 27231057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2724cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 2725cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 2726a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 2727a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 2728a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 2729a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 2730a442b761SAyala Beker * cfg80211_free_nan_func(). 2731a442b761SAyala Beker * On success the driver should assign an instance_id in the 2732a442b761SAyala Beker * provided @nan_func. 2733a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 2734a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 2735a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 2736a5a9dcf2SAyala Beker * All other parameters must be ignored. 2737704232c2SJohannes Berg */ 2738704232c2SJohannes Berg struct cfg80211_ops { 2739ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 27400378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 27416d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 27420378b3f1SJohannes Berg 274384efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2744552bff0cSJohannes Berg const char *name, 27456bab2e19STom Gundersen unsigned char name_assign_type, 2746f9e10ce4SJohannes Berg enum nl80211_iftype type, 2747f9e10ce4SJohannes Berg u32 *flags, 27482ec600d6SLuis Carlos Cobo struct vif_params *params); 274984efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 275084efbb84SJohannes Berg struct wireless_dev *wdev); 2751e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2752e36d56b6SJohannes Berg struct net_device *dev, 27532ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 27542ec600d6SLuis Carlos Cobo struct vif_params *params); 275541ade00fSJohannes Berg 275641ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2757e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 275841ade00fSJohannes Berg struct key_params *params); 275941ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2760e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2761e31b8213SJohannes Berg void *cookie, 276241ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 276341ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2764e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 276541ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 276641ade00fSJohannes Berg struct net_device *netdev, 2767dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 27683cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 27693cfcf6acSJouni Malinen struct net_device *netdev, 27703cfcf6acSJouni Malinen u8 key_index); 2771ed1b6cc7SJohannes Berg 27728860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 27738860020eSJohannes Berg struct cfg80211_ap_settings *settings); 27748860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 27758860020eSJohannes Berg struct cfg80211_beacon_data *info); 27768860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 27775727ef1bSJohannes Berg 27785727ef1bSJohannes Berg 27795727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 27803b3a0162SJohannes Berg const u8 *mac, 27813b3a0162SJohannes Berg struct station_parameters *params); 27825727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 278389c771e5SJouni Malinen struct station_del_parameters *params); 27845727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 27853b3a0162SJohannes Berg const u8 *mac, 27863b3a0162SJohannes Berg struct station_parameters *params); 2787fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 27883b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 27892ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 27902ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 27912ec600d6SLuis Carlos Cobo 27922ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 27933b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 27942ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 27953b3a0162SJohannes Berg const u8 *dst); 27962ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 27973b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 27982ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 27993b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 28002ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 28012ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 28022ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 280366be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 280466be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 280566be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 280666be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 280766be7d2bSHenning Rogge struct mpath_info *pinfo); 280824bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 280993da9cc1Scolin@cozybit.com struct net_device *dev, 281093da9cc1Scolin@cozybit.com struct mesh_config *conf); 281124bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 281229cbe68cSJohannes Berg struct net_device *dev, u32 mask, 281329cbe68cSJohannes Berg const struct mesh_config *nconf); 281429cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 281529cbe68cSJohannes Berg const struct mesh_config *conf, 281629cbe68cSJohannes Berg const struct mesh_setup *setup); 281729cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 281829cbe68cSJohannes Berg 28196e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 28206e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 28216e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 28226e0bd6c3SRostislav Lisovy 28239f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 28249f1ba906SJouni Malinen struct bss_parameters *params); 282531888487SJouni Malinen 2826f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 282731888487SJouni Malinen struct ieee80211_txq_params *params); 282872bdcf34SJouni Malinen 2829e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2830e8c9bd5bSJohannes Berg struct net_device *dev, 2831e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2832e8c9bd5bSJohannes Berg 2833e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2834683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 28359aed3cc1SJouni Malinen 2836fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 28372a519311SJohannes Berg struct cfg80211_scan_request *request); 283891d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 2839636a5d36SJouni Malinen 2840636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2841636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2842636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2843636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2844636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 284563c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2846636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 284763c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 284804a773adSJohannes Berg 2849b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2850b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2851b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2852b23aa676SSamuel Ortiz u16 reason_code); 2853b23aa676SSamuel Ortiz 285404a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 285504a773adSJohannes Berg struct cfg80211_ibss_params *params); 285604a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2857b9a5f8caSJouni Malinen 2858f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 285957fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 2860f4e583c8SAntonio Quartulli 2861b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 28627643a2c3SJohannes Berg 2863c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2864fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2865c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2866c8442118SJohannes Berg int *dbm); 28671f87f7d3SJohannes Berg 2868ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2869388ac775SJohannes Berg const u8 *addr); 2870ab737a4fSJohannes Berg 28711f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2872aff89a9bSJohannes Berg 2873aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2874fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2875fc73f11fSDavid Spinadel void *data, int len); 287671063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 287771063f0eSWey-Yi Guy struct netlink_callback *cb, 287871063f0eSWey-Yi Guy void *data, int len); 2879aff89a9bSJohannes Berg #endif 2880bc92afd9SJohannes Berg 28819930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 28829930380fSJohannes Berg struct net_device *dev, 28839930380fSJohannes Berg const u8 *peer, 28849930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 28859930380fSJohannes Berg 288661fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 288761fa713cSHolger Schurig int idx, struct survey_info *info); 288861fa713cSHolger Schurig 288967fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 289067fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 289167fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 289267fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 289367fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 289467fbb16bSSamuel Ortiz 28959588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 289671bbc994SJohannes Berg struct wireless_dev *wdev, 28979588bbd5SJouni Malinen struct ieee80211_channel *chan, 28989588bbd5SJouni Malinen unsigned int duration, 28999588bbd5SJouni Malinen u64 *cookie); 29009588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 290171bbc994SJohannes Berg struct wireless_dev *wdev, 29029588bbd5SJouni Malinen u64 cookie); 29039588bbd5SJouni Malinen 290471bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2905b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2906b176e629SAndrei Otcheretianski u64 *cookie); 2907f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 290871bbc994SJohannes Berg struct wireless_dev *wdev, 2909f7ca38dfSJohannes Berg u64 cookie); 2910026331c4SJouni Malinen 2911bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2912bc92afd9SJohannes Berg bool enabled, int timeout); 2913d6dc1a38SJuuso Oikarinen 2914d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2915d6dc1a38SJuuso Oikarinen struct net_device *dev, 2916d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2917271733cfSJohannes Berg 291884f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 291984f10708SThomas Pedersen struct net_device *dev, 292084f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 292184f10708SThomas Pedersen 2922271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 292371bbc994SJohannes Berg struct wireless_dev *wdev, 2924271733cfSJohannes Berg u16 frame_type, bool reg); 2925afe0cbf8SBruno Randolf 2926afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2927afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 29283677713bSJohn W. Linville 2929807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2930807f8a8cSLuciano Coelho struct net_device *dev, 2931807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 293285a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2933e5497d76SJohannes Berg 2934e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2935e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2936109086ceSArik Nemtsov 2937109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 29383b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2939df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 294031fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2941109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 29423b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 29437f6cf311SJohannes Berg 29447f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 29457f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2946e999882aSJohannes Berg 29471d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 29481d9d9213SSimon Wunderlich struct net_device *dev, 29491d9d9213SSimon Wunderlich u16 noack_map); 29501d9d9213SSimon Wunderlich 2951683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 29525b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2953683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 295498104fdeSJohannes Berg 295598104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 295698104fdeSJohannes Berg struct wireless_dev *wdev); 295798104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 295898104fdeSJohannes Berg struct wireless_dev *wdev); 295977765eafSVasanthakumar Thiagarajan 296077765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 296177765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 296204f39047SSimon Wunderlich 296304f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 296404f39047SSimon Wunderlich struct net_device *dev, 296531559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 296631559f35SJanusz Dziedzic u32 cac_time_ms); 2967355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2968355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 29695de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 29705de17984SArend van Spriel struct wireless_dev *wdev, 29715de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 29725de17984SArend van Spriel u16 duration); 29735de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 29745de17984SArend van Spriel struct wireless_dev *wdev); 2975be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 2976be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 297716ef1fe2SSimon Wunderlich 297816ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 297916ef1fe2SSimon Wunderlich struct net_device *dev, 298016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 2981e16821bcSJouni Malinen 2982fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 2983fa9ffc74SKyeyoon Park struct net_device *dev, 2984fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 2985e16821bcSJouni Malinen 2986e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2987e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 2988960d01acSJohannes Berg 2989960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2990960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 2991960d01acSJohannes Berg u16 admitted_time); 2992960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2993960d01acSJohannes Berg u8 tsid, const u8 *peer); 29941057d35eSArik Nemtsov 29951057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 29961057d35eSArik Nemtsov struct net_device *dev, 29971057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 29981057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 29991057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 30001057d35eSArik Nemtsov struct net_device *dev, 30011057d35eSArik Nemtsov const u8 *addr); 3002cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 3003cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 3004cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 3005a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3006a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 3007a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 3008a442b761SAyala Beker u64 cookie); 3009a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 3010a5a9dcf2SAyala Beker struct wireless_dev *wdev, 3011a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 3012a5a9dcf2SAyala Beker u32 changes); 3013704232c2SJohannes Berg }; 3014704232c2SJohannes Berg 3015d3236553SJohannes Berg /* 3016d3236553SJohannes Berg * wireless hardware and networking interfaces structures 3017d3236553SJohannes Berg * and registration/helper functions 3018d3236553SJohannes Berg */ 3019d3236553SJohannes Berg 3020d3236553SJohannes Berg /** 30215be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 30225be83de5SJohannes Berg * 30235be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 30245be83de5SJohannes Berg * wiphy at all 30255be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 30265be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 30275be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 30285be83de5SJohannes Berg * reason to override the default 30299bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 30309bc383deSJohannes Berg * on a VLAN interface) 30319bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 3032c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 3033c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 3034c0692b8fSJohannes Berg * control_port_no_encrypt flag. 3035e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 303615d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 303715d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 30381ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 3039f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 3040f4b34b55SVivek Natarajan * firmware. 3041cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 3042109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 3043109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 3044109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 3045109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 3046109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 3047109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 3048562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 30495e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 30505e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 30515e760230SJohannes Berg * cfg80211_report_obss_beacon(). 305287bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 305387bbbe22SArik Nemtsov * responds to probe-requests in hardware. 30547c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 30557c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 30562f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 305716ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 305816ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 3059b8676221SDavid Spinadel * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 3060b8676221SDavid Spinadel * before connection. 30615be83de5SJohannes Berg */ 30625be83de5SJohannes Berg enum wiphy_flags { 3063723e73acSJohannes Berg /* use hole at 0 */ 3064a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 3065a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 30665be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 30675be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 30689bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 30699bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 3070c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 3071309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 307215d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 3073807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 30748e8b41f9SJohannes Berg /* use hole at 12 */ 3075f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 3076cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 3077109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 3078109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 3079562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 30805e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 308187bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 30827c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 30837c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 30842f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 308516ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 3086b8676221SDavid Spinadel WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 30877527a782SJohannes Berg }; 30887527a782SJohannes Berg 30897527a782SJohannes Berg /** 30907527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 30917527a782SJohannes Berg * @max: maximum number of interfaces of these types 30927527a782SJohannes Berg * @types: interface types (bits) 30937527a782SJohannes Berg */ 30947527a782SJohannes Berg struct ieee80211_iface_limit { 30957527a782SJohannes Berg u16 max; 30967527a782SJohannes Berg u16 types; 30977527a782SJohannes Berg }; 30987527a782SJohannes Berg 30997527a782SJohannes Berg /** 31007527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 31017527a782SJohannes Berg * @limits: limits for the given interface types 31027527a782SJohannes Berg * @n_limits: number of limitations 31037527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 31047527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 31057527a782SJohannes Berg * group 31067527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 31077527a782SJohannes Berg * between infrastructure and AP types must match. This is required 31087527a782SJohannes Berg * only in special cases. 310911c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 31108c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 31110c317a02SPurushottam Kushwaha * @beacon_int_min_gcd: This interface combination supports different 31120c317a02SPurushottam Kushwaha * beacon intervals. 31130c317a02SPurushottam Kushwaha * = 0 - all beacon intervals for different interface must be same. 31140c317a02SPurushottam Kushwaha * > 0 - any beacon interval for the interface part of this combination AND 31150c317a02SPurushottam Kushwaha * *GCD* of all beacon intervals from beaconing interfaces of this 31160c317a02SPurushottam Kushwaha * combination must be greater or equal to this value. 31177527a782SJohannes Berg * 3118b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 3119b80edbc1SLuciano Coelho * combinations it supports concurrently. 31207527a782SJohannes Berg * 3121b80edbc1SLuciano Coelho * Examples: 3122b80edbc1SLuciano Coelho * 3123b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 31247527a782SJohannes Berg * 31257527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 31267527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 31277527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 31287527a782SJohannes Berg * }; 31297527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 31307527a782SJohannes Berg * .limits = limits1, 31317527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 31327527a782SJohannes Berg * .max_interfaces = 2, 31337527a782SJohannes Berg * .beacon_int_infra_match = true, 31347527a782SJohannes Berg * }; 31357527a782SJohannes Berg * 31367527a782SJohannes Berg * 3137b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 31387527a782SJohannes Berg * 31397527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 31407527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 31417527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 31427527a782SJohannes Berg * }; 31437527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 31447527a782SJohannes Berg * .limits = limits2, 31457527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 31467527a782SJohannes Berg * .max_interfaces = 8, 31477527a782SJohannes Berg * .num_different_channels = 1, 31487527a782SJohannes Berg * }; 31497527a782SJohannes Berg * 31507527a782SJohannes Berg * 3151b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 3152b80edbc1SLuciano Coelho * 31537527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 31547527a782SJohannes Berg * 31557527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 31567527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 31577527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 31587527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 31597527a782SJohannes Berg * }; 31607527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 31617527a782SJohannes Berg * .limits = limits3, 31627527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 31637527a782SJohannes Berg * .max_interfaces = 4, 31647527a782SJohannes Berg * .num_different_channels = 2, 31657527a782SJohannes Berg * }; 31667527a782SJohannes Berg */ 31677527a782SJohannes Berg struct ieee80211_iface_combination { 31687527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 31697527a782SJohannes Berg u32 num_different_channels; 31707527a782SJohannes Berg u16 max_interfaces; 31717527a782SJohannes Berg u8 n_limits; 31727527a782SJohannes Berg bool beacon_int_infra_match; 317311c4a075SSimon Wunderlich u8 radar_detect_widths; 31748c48b50aSFelix Fietkau u8 radar_detect_regions; 31750c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 31765be83de5SJohannes Berg }; 31775be83de5SJohannes Berg 31782e161f78SJohannes Berg struct ieee80211_txrx_stypes { 31792e161f78SJohannes Berg u16 tx, rx; 31802e161f78SJohannes Berg }; 31812e161f78SJohannes Berg 31825be83de5SJohannes Berg /** 3183ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 3184ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 3185ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 3186ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 3187ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 3188ff1b6e69SJohannes Berg * packet should be preserved in that case 3189ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 3190ff1b6e69SJohannes Berg * (see nl80211.h) 3191ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 319277dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 319377dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 319477dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 319577dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 319677dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 31978cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 3198ff1b6e69SJohannes Berg */ 3199ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 3200ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 3201ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 3202ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 320377dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 320477dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 320577dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 320677dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 320777dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 32088cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 3209ff1b6e69SJohannes Berg }; 3210ff1b6e69SJohannes Berg 32112a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 32122a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 32132a0e047eSJohannes Berg u32 data_payload_max; 32142a0e047eSJohannes Berg u32 data_interval_max; 32152a0e047eSJohannes Berg u32 wake_payload_max; 32162a0e047eSJohannes Berg bool seq; 32172a0e047eSJohannes Berg }; 32182a0e047eSJohannes Berg 3219ff1b6e69SJohannes Berg /** 3220ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 3221ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 3222ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 3223ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 3224ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 3225ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 3226bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 32278cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 32288cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 32298cd4d456SLuciano Coelho * scheduled scans. 32308cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 32318cd4d456SLuciano Coelho * details. 32322a0e047eSJohannes Berg * @tcp: TCP wakeup support information 3233ff1b6e69SJohannes Berg */ 3234ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 3235ff1b6e69SJohannes Berg u32 flags; 3236ff1b6e69SJohannes Berg int n_patterns; 3237ff1b6e69SJohannes Berg int pattern_max_len; 3238ff1b6e69SJohannes Berg int pattern_min_len; 3239bb92d199SAmitkumar Karwar int max_pkt_offset; 32408cd4d456SLuciano Coelho int max_nd_match_sets; 32412a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 3242ff1b6e69SJohannes Berg }; 3243ff1b6e69SJohannes Berg 3244ff1b6e69SJohannes Berg /** 3245be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 3246be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 3247be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 3248be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 3249be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 3250be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 3251be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 3252be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 3253be29b99aSAmitkumar Karwar */ 3254be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 3255be29b99aSAmitkumar Karwar int n_rules; 3256be29b99aSAmitkumar Karwar int max_delay; 3257be29b99aSAmitkumar Karwar int n_patterns; 3258be29b99aSAmitkumar Karwar int pattern_max_len; 3259be29b99aSAmitkumar Karwar int pattern_min_len; 3260be29b99aSAmitkumar Karwar int max_pkt_offset; 3261be29b99aSAmitkumar Karwar }; 3262be29b99aSAmitkumar Karwar 3263be29b99aSAmitkumar Karwar /** 3264ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 3265ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 3266ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 3267ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 3268ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 3269ad7e718cSJohannes Berg */ 3270ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 3271ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 3272ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 3273ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 3274ad7e718cSJohannes Berg }; 3275ad7e718cSJohannes Berg 3276ad7e718cSJohannes Berg /** 3277ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 3278ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 3279ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 3280ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 3281ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 3282ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 32837bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 32847bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 32857bdbe400SJohannes Berg * dumpit calls. 32867bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 32877bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 32887bdbe400SJohannes Berg * are used with dump requests. 3289ad7e718cSJohannes Berg */ 3290ad7e718cSJohannes Berg struct wiphy_vendor_command { 3291ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 3292ad7e718cSJohannes Berg u32 flags; 3293ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 3294ad7e718cSJohannes Berg const void *data, int data_len); 32957bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 32967bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 32977bdbe400SJohannes Berg unsigned long *storage); 3298ad7e718cSJohannes Berg }; 3299ad7e718cSJohannes Berg 3300ad7e718cSJohannes Berg /** 3301019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 3302019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 3303019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 3304019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 3305019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 3306019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 3307019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 3308019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 3309019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 3310019ae3a9SKanchanapally, Vidyullatha */ 3311019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 3312019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 3313019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 3314019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 3315019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 3316019ae3a9SKanchanapally, Vidyullatha }; 3317019ae3a9SKanchanapally, Vidyullatha 3318019ae3a9SKanchanapally, Vidyullatha /** 33195be83de5SJohannes Berg * struct wiphy - wireless hardware description 33202784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 33212784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 33222784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 3323d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 3324d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 3325d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 3326d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 3327d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 3328d3236553SJohannes Berg * @cipher_suites: supported cipher suites 3329d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 3330b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 3331b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 3332b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 3333b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 3334b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 3335abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 3336ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 3337ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 3338ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 33390fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 3340ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 3341ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 3342ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 3343ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 3344ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 3345ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 3346ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 3347ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3348fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3349fd235913SRandy Dunlap * unregister hardware 3350abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3351abe37c4bSJohannes Berg * automatically on wiphy renames 3352abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 33534a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3354abe37c4bSJohannes Berg * @wext: wireless extension handlers 3355abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3356abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3357abe37c4bSJohannes Berg * must be set by driver 33587527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 33597527a782SJohannes Berg * list single interface types. 33607527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 33617527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 33627527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3363abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3364a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3365a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 33661f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3367d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 3368d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 3369abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3370abe37c4bSJohannes Berg * this variable determines its size 3371abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3372abe37c4bSJohannes Berg * any given scan 337393b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 337493b6aa69SLuciano Coelho * for in any given scheduled scan 3375a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3376a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3377a1f1c21cSLuciano Coelho * supported. 3378abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3379abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3380abe37c4bSJohannes Berg * include fixed IEs like supported rates 33815a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 33825a865badSLuciano Coelho * scans 33833b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 33843b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 33853b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 33863b06d277SAvraham Stern * single scan plan supported by the device. 33873b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 33883b06d277SAvraham Stern * scan plan supported by the device. 3389abe37c4bSJohannes Berg * @coverage_class: current coverage class 3390abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3391abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3392abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3393abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3394abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3395abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 33962e161f78SJohannes Berg * 33972e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 33982e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 33992e161f78SJohannes Berg * type 3400a7ffac95SBruno Randolf * 34017f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 34027f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 34037f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 34047f531e03SBruno Randolf * 34057f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 34067f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 34077f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3408a293911dSJohannes Berg * 340915f0ebc2SRandy Dunlap * @probe_resp_offload: 341015f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 341115f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 341215f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 341315f0ebc2SRandy Dunlap * 3414a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3415a293911dSJohannes Berg * may request, if implemented. 3416ff1b6e69SJohannes Berg * 3417ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 34186abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 34196abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 34206abb9cb9SJohannes Berg * to the suspend() operation instead. 3421562a7480SJohannes Berg * 3422562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 34237e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 34247e7c8926SBen Greear * If null, then none can be over-ridden. 3425ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3426ee2aca34SJohannes Berg * If null, then none can be over-ridden. 342777765eafSVasanthakumar Thiagarajan * 342853873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 342953873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 343053873f13SJohannes Berg * 343177765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 343277765eafSVasanthakumar Thiagarajan * supports for ACL. 3433a50df0c4SJohannes Berg * 3434a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3435a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3436a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3437a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3438019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 3439019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 3440019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 3441a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3442a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3443019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 3444019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 3445019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 3446be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3447ad7e718cSJohannes Berg * 3448ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3449ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3450567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3451567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3452b43504cfSJouni Malinen * 3453b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3454b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3455b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3456b43504cfSJouni Malinen * some cases, but may not always reach. 3457c2e4323bSLuciano Coelho * 3458c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3459c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3460c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3461c2e4323bSLuciano Coelho * infinite. 346267af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 346367af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 346467af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 346567af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 346667af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 346767af9811SEmmanuel Grumbach * This value should be set in MHz. 346838de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 346938de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 347038de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 3471a442b761SAyala Beker * 3472a442b761SAyala Beker * @cookie_counter: unique generic cookie counter, used to identify objects. 3473d3236553SJohannes Berg */ 3474d3236553SJohannes Berg struct wiphy { 3475d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3476d3236553SJohannes Berg 3477ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3478d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3479ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3480ef15aac6SJohannes Berg 3481ef15aac6SJohannes Berg struct mac_address *addresses; 3482d3236553SJohannes Berg 34832e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 34842e161f78SJohannes Berg 34857527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 34867527a782SJohannes Berg int n_iface_combinations; 34877527a782SJohannes Berg u16 software_iftypes; 34887527a782SJohannes Berg 34892e161f78SJohannes Berg u16 n_addresses; 34902e161f78SJohannes Berg 3491d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3492d3236553SJohannes Berg u16 interface_modes; 3493d3236553SJohannes Berg 349477765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 349577765eafSVasanthakumar Thiagarajan 3496a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3497d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 3498463d0183SJohannes Berg 3499562a7480SJohannes Berg u32 ap_sme_capa; 3500562a7480SJohannes Berg 3501d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3502d3236553SJohannes Berg 3503d3236553SJohannes Berg int bss_priv_size; 3504d3236553SJohannes Berg u8 max_scan_ssids; 350593b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3506a1f1c21cSLuciano Coelho u8 max_match_sets; 3507d3236553SJohannes Berg u16 max_scan_ie_len; 35085a865badSLuciano Coelho u16 max_sched_scan_ie_len; 35093b06d277SAvraham Stern u32 max_sched_scan_plans; 35103b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 35113b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 3512d3236553SJohannes Berg 3513d3236553SJohannes Berg int n_cipher_suites; 3514d3236553SJohannes Berg const u32 *cipher_suites; 3515d3236553SJohannes Berg 3516b9a5f8caSJouni Malinen u8 retry_short; 3517b9a5f8caSJouni Malinen u8 retry_long; 3518b9a5f8caSJouni Malinen u32 frag_threshold; 3519b9a5f8caSJouni Malinen u32 rts_threshold; 352081077e82SLukáš Turek u8 coverage_class; 3521b9a5f8caSJouni Malinen 352281135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3523dfce95f5SKalle Valo u32 hw_version; 3524dfce95f5SKalle Valo 3525dfb89c56SJohannes Berg #ifdef CONFIG_PM 3526964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 35276abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3528dfb89c56SJohannes Berg #endif 3529ff1b6e69SJohannes Berg 3530a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3531a293911dSJohannes Berg 353267fbb16bSSamuel Ortiz u8 max_num_pmkids; 353367fbb16bSSamuel Ortiz 35347f531e03SBruno Randolf u32 available_antennas_tx; 35357f531e03SBruno Randolf u32 available_antennas_rx; 3536a7ffac95SBruno Randolf 353787bbbe22SArik Nemtsov /* 353887bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 353987bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 354087bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 354187bbbe22SArik Nemtsov */ 354287bbbe22SArik Nemtsov u32 probe_resp_offload; 354387bbbe22SArik Nemtsov 3544a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3545a50df0c4SJohannes Berg u8 extended_capabilities_len; 3546a50df0c4SJohannes Berg 3547019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 3548019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 3549019ae3a9SKanchanapally, Vidyullatha 3550d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3551d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3552d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3553d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3554d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3555cf5aa2f1SDavid Kilroy const void *privid; 3556d3236553SJohannes Berg 355757fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 3558d3236553SJohannes Berg 3559d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 35600c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3561d3236553SJohannes Berg struct regulatory_request *request); 3562d3236553SJohannes Berg 3563d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3564d3236553SJohannes Berg 3565458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3566d3236553SJohannes Berg 3567d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3568d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3569d3236553SJohannes Berg struct device dev; 3570d3236553SJohannes Berg 3571ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3572ecb44335SStanislaw Gruszka bool registered; 3573ecb44335SStanislaw Gruszka 3574d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3575d3236553SJohannes Berg struct dentry *debugfsdir; 3576d3236553SJohannes Berg 35777e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3578ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 35797e7c8926SBen Greear 358053873f13SJohannes Berg struct list_head wdev_list; 358153873f13SJohannes Berg 3582463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 35830c5c9fb5SEric W. Biederman possible_net_t _net; 3584463d0183SJohannes Berg 35853d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 35863d23e349SJohannes Berg const struct iw_handler_def *wext; 35873d23e349SJohannes Berg #endif 35883d23e349SJohannes Berg 3589be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3590be29b99aSAmitkumar Karwar 3591ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3592567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3593567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3594ad7e718cSJohannes Berg 3595b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3596b43504cfSJouni Malinen 35979a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 359867af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 35999a774c78SAndrei Otcheretianski 360038de03d2SArend van Spriel u32 bss_select_support; 360138de03d2SArend van Spriel 3602a442b761SAyala Beker u64 cookie_counter; 3603a442b761SAyala Beker 36041c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3605d3236553SJohannes Berg }; 3606d3236553SJohannes Berg 3607463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3608463d0183SJohannes Berg { 3609c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3610463d0183SJohannes Berg } 3611463d0183SJohannes Berg 3612463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3613463d0183SJohannes Berg { 3614c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3615463d0183SJohannes Berg } 3616463d0183SJohannes Berg 3617d3236553SJohannes Berg /** 3618d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3619d3236553SJohannes Berg * 3620d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 36210ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3622d3236553SJohannes Berg */ 3623d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3624d3236553SJohannes Berg { 3625d3236553SJohannes Berg BUG_ON(!wiphy); 3626d3236553SJohannes Berg return &wiphy->priv; 3627d3236553SJohannes Berg } 3628d3236553SJohannes Berg 3629d3236553SJohannes Berg /** 3630f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3631f1f74825SDavid Kilroy * 3632f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 36330ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3634f1f74825SDavid Kilroy */ 3635f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3636f1f74825SDavid Kilroy { 3637f1f74825SDavid Kilroy BUG_ON(!priv); 3638f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3639f1f74825SDavid Kilroy } 3640f1f74825SDavid Kilroy 3641f1f74825SDavid Kilroy /** 3642d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3643d3236553SJohannes Berg * 3644d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3645d3236553SJohannes Berg * @dev: The device to parent it to 3646d3236553SJohannes Berg */ 3647d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3648d3236553SJohannes Berg { 3649d3236553SJohannes Berg wiphy->dev.parent = dev; 3650d3236553SJohannes Berg } 3651d3236553SJohannes Berg 3652d3236553SJohannes Berg /** 3653d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3654d3236553SJohannes Berg * 3655d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 36560ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3657d3236553SJohannes Berg */ 3658d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3659d3236553SJohannes Berg { 3660d3236553SJohannes Berg return wiphy->dev.parent; 3661d3236553SJohannes Berg } 3662d3236553SJohannes Berg 3663d3236553SJohannes Berg /** 3664d3236553SJohannes Berg * wiphy_name - get wiphy name 3665d3236553SJohannes Berg * 3666d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 36670ae997dcSYacine Belkadi * Return: The name of @wiphy. 3668d3236553SJohannes Berg */ 3669e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3670d3236553SJohannes Berg { 3671d3236553SJohannes Berg return dev_name(&wiphy->dev); 3672d3236553SJohannes Berg } 3673d3236553SJohannes Berg 3674d3236553SJohannes Berg /** 36751998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 36761998d90aSBen Greear * 36771998d90aSBen Greear * @ops: The configuration operations for this device 36781998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 36791998d90aSBen Greear * @requested_name: Request a particular name. 36801998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 36811998d90aSBen Greear * 36821998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 36831998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 36841998d90aSBen Greear * 36851998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 36861998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 36871998d90aSBen Greear */ 36881998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 36891998d90aSBen Greear const char *requested_name); 36901998d90aSBen Greear 36911998d90aSBen Greear /** 3692d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3693d3236553SJohannes Berg * 3694d3236553SJohannes Berg * @ops: The configuration operations for this device 3695d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3696d3236553SJohannes Berg * 3697d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3698d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3699d3236553SJohannes Berg * 37000ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 37010ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3702d3236553SJohannes Berg */ 37031998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 37041998d90aSBen Greear int sizeof_priv) 37051998d90aSBen Greear { 37061998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 37071998d90aSBen Greear } 3708d3236553SJohannes Berg 3709d3236553SJohannes Berg /** 3710d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3711d3236553SJohannes Berg * 3712d3236553SJohannes Berg * @wiphy: The wiphy to register. 3713d3236553SJohannes Berg * 37140ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3715d3236553SJohannes Berg */ 371610dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3717d3236553SJohannes Berg 3718d3236553SJohannes Berg /** 3719d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3720d3236553SJohannes Berg * 3721d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3722d3236553SJohannes Berg * 3723d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3724d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3725d3236553SJohannes Berg * request that is being handled. 3726d3236553SJohannes Berg */ 372710dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3728d3236553SJohannes Berg 3729d3236553SJohannes Berg /** 3730d3236553SJohannes Berg * wiphy_free - free wiphy 3731d3236553SJohannes Berg * 3732d3236553SJohannes Berg * @wiphy: The wiphy to free 3733d3236553SJohannes Berg */ 373410dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3735d3236553SJohannes Berg 3736fffd0934SJohannes Berg /* internal structs */ 37376829c878SJohannes Berg struct cfg80211_conn; 373819957bb3SJohannes Berg struct cfg80211_internal_bss; 3739fffd0934SJohannes Berg struct cfg80211_cached_keys; 374019957bb3SJohannes Berg 3741d3236553SJohannes Berg /** 374289a54e48SJohannes Berg * struct wireless_dev - wireless device state 3743d3236553SJohannes Berg * 374489a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 374589a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 374689a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 374789a54e48SJohannes Berg * It need not be registered then as netdev registration will 374889a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 374989a54e48SJohannes Berg * 375089a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 375189a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 375289a54e48SJohannes Berg * there's no netdev registration in that case it may not be 375389a54e48SJohannes Berg * allocated outside of callback operations that return it. 3754d3236553SJohannes Berg * 3755d3236553SJohannes Berg * @wiphy: pointer to hardware description 3756d3236553SJohannes Berg * @iftype: interface type 3757d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 375889a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 375989a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 376089a54e48SJohannes Berg * wireless device if it has no netdev 3761d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 37629e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 37639e0e2961SMichal Kazior * the user-set channel definition. 3764780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3765aa430da4SJohannes Berg * track the channel to be used for AP later 3766d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3767d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3768d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 376929cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 377029cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3771d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 37729bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 37739bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 37749bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 37759bc383deSJohannes Berg * by cfg80211 on change_interface 37762e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 37772e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 37788d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 37798d61ffa5SJohannes Berg * and some API functions require it held 378056d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 378156d1893dSJohannes Berg * beacons, 0 when not valid 378298104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 378398104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 3784cb3b7d87SAyala Beker * @nan_started: true if this is a NAN interface that has been started 378504f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 378604f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 378731559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3788780b40dfSJohannes Berg * @ps: powersave mode is enabled 3789780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3790780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3791780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3792780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3793780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 379434d50519SLior David * @conn_bss_type: connecting/connected BSS type 3795780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 37965336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3797780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3798780b40dfSJohannes Berg * @event_lock: (private) lock for event list 379978f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3800d3236553SJohannes Berg */ 3801d3236553SJohannes Berg struct wireless_dev { 3802d3236553SJohannes Berg struct wiphy *wiphy; 3803d3236553SJohannes Berg enum nl80211_iftype iftype; 3804d3236553SJohannes Berg 3805667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3806d3236553SJohannes Berg struct list_head list; 3807d3236553SJohannes Berg struct net_device *netdev; 3808d3236553SJohannes Berg 380989a54e48SJohannes Berg u32 identifier; 381089a54e48SJohannes Berg 38112e161f78SJohannes Berg struct list_head mgmt_registrations; 38122e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3813026331c4SJouni Malinen 3814667503ddSJohannes Berg struct mutex mtx; 3815667503ddSJohannes Berg 3816cb3b7d87SAyala Beker bool use_4addr, p2p_started, nan_started; 381798104fdeSJohannes Berg 381898104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 38199bc383deSJohannes Berg 3820b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3821d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 382229cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 38236829c878SJohannes Berg struct cfg80211_conn *conn; 3824fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 382534d50519SLior David enum ieee80211_bss_type conn_bss_type; 3826d3236553SJohannes Berg 3827667503ddSJohannes Berg struct list_head event_list; 3828667503ddSJohannes Berg spinlock_t event_lock; 3829667503ddSJohannes Berg 383019957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3831683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 38329e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3833f4489ebeSMichal Kazior 3834c30a3d38SMichal Kazior bool ibss_fixed; 38355336fa88SSimon Wunderlich bool ibss_dfs_possible; 3836c30a3d38SMichal Kazior 3837ffb9eb3dSKalle Valo bool ps; 3838ffb9eb3dSKalle Valo int ps_timeout; 3839ffb9eb3dSKalle Valo 384056d1893dSJohannes Berg int beacon_interval; 384156d1893dSJohannes Berg 384215e47304SEric W. Biederman u32 ap_unexpected_nlportid; 384328946da7SJohannes Berg 384404f39047SSimon Wunderlich bool cac_started; 384504f39047SSimon Wunderlich unsigned long cac_start_time; 384631559f35SJanusz Dziedzic unsigned int cac_time_ms; 384704f39047SSimon Wunderlich 384878f22b6aSJohannes Berg u32 owner_nlportid; 384978f22b6aSJohannes Berg 38503d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3851d3236553SJohannes Berg /* wext data */ 3852cbe8fa9cSJohannes Berg struct { 3853cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3854f2129354SJohannes Berg struct cfg80211_connect_params connect; 3855fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3856c1e5f471SJohannes Berg const u8 *ie; 3857f2129354SJohannes Berg size_t ie_len; 3858f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3859f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 386008645126SJohannes Berg s8 default_key, default_mgmt_key; 3861ffb9eb3dSKalle Valo bool prev_bssid_valid; 3862cbe8fa9cSJohannes Berg } wext; 3863d3236553SJohannes Berg #endif 3864d3236553SJohannes Berg }; 3865d3236553SJohannes Berg 386698104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 386798104fdeSJohannes Berg { 386898104fdeSJohannes Berg if (wdev->netdev) 386998104fdeSJohannes Berg return wdev->netdev->dev_addr; 387098104fdeSJohannes Berg return wdev->address; 387198104fdeSJohannes Berg } 387298104fdeSJohannes Berg 3873d3236553SJohannes Berg /** 3874d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3875d3236553SJohannes Berg * 3876d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 38770ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3878d3236553SJohannes Berg */ 3879d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3880d3236553SJohannes Berg { 3881d3236553SJohannes Berg BUG_ON(!wdev); 3882d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3883d3236553SJohannes Berg } 3884d3236553SJohannes Berg 3885d70e9693SJohannes Berg /** 3886d70e9693SJohannes Berg * DOC: Utility functions 3887d70e9693SJohannes Berg * 3888d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3889d3236553SJohannes Berg */ 3890d3236553SJohannes Berg 3891d3236553SJohannes Berg /** 3892d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3893abe37c4bSJohannes Berg * @chan: channel number 389459eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 38950ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3896d3236553SJohannes Berg */ 389757fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); 3898d3236553SJohannes Berg 3899d3236553SJohannes Berg /** 3900d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3901abe37c4bSJohannes Berg * @freq: center frequency 39020ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3903d3236553SJohannes Berg */ 390410dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3905d3236553SJohannes Berg 3906d3236553SJohannes Berg /* 3907d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3908d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3909d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3910d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3911d3236553SJohannes Berg * clash. 3912d3236553SJohannes Berg */ 391310dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3914d3236553SJohannes Berg int freq); 3915d3236553SJohannes Berg /** 3916d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3917abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3918abe37c4bSJohannes Berg * @freq: the center frequency of the channel 39190ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3920d3236553SJohannes Berg */ 3921d3236553SJohannes Berg static inline struct ieee80211_channel * 3922d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3923d3236553SJohannes Berg { 3924d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3925d3236553SJohannes Berg } 3926d3236553SJohannes Berg 3927d3236553SJohannes Berg /** 3928d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3929d3236553SJohannes Berg * 3930d3236553SJohannes Berg * @sband: the band to look for rates in 3931d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3932d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3933d3236553SJohannes Berg * 39340ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 39350ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 39360ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 39370ae997dcSYacine Belkadi * rates in the band's bitrate table. 3938d3236553SJohannes Berg */ 3939d3236553SJohannes Berg struct ieee80211_rate * 3940d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3941d3236553SJohannes Berg u32 basic_rates, int bitrate); 3942d3236553SJohannes Berg 3943b422c6cdSAshok Nagarajan /** 3944b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3945b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 394674608acaSSimon Wunderlich * @scan_width: width of the control channel 3947b422c6cdSAshok Nagarajan * 3948b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3949b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3950b422c6cdSAshok Nagarajan */ 395174608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 395274608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3953b422c6cdSAshok Nagarajan 3954d3236553SJohannes Berg /* 3955d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3956d3236553SJohannes Berg * 3957d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3958d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3959d3236553SJohannes Berg */ 3960d3236553SJohannes Berg 396133e5a2f7SJohannes Berg struct radiotap_align_size { 396233e5a2f7SJohannes Berg uint8_t align:4, size:4; 396333e5a2f7SJohannes Berg }; 396433e5a2f7SJohannes Berg 396533e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 396633e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 396733e5a2f7SJohannes Berg int n_bits; 396833e5a2f7SJohannes Berg uint32_t oui; 396933e5a2f7SJohannes Berg uint8_t subns; 397033e5a2f7SJohannes Berg }; 397133e5a2f7SJohannes Berg 397233e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 397333e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 397433e5a2f7SJohannes Berg int n_ns; 397533e5a2f7SJohannes Berg }; 397633e5a2f7SJohannes Berg 3977d3236553SJohannes Berg /** 3978d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 397933e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 398033e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 398133e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 398233e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 398333e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 398433e5a2f7SJohannes Berg * the beginning of the actual data portion 398533e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 398633e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 398733e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 398833e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 398933e5a2f7SJohannes Berg * radiotap namespace or not 399033e5a2f7SJohannes Berg * 399133e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 399233e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 399333e5a2f7SJohannes Berg * @_arg_index: next argument index 399433e5a2f7SJohannes Berg * @_arg: next argument pointer 399533e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 399633e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 399733e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 399833e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 399933e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 400033e5a2f7SJohannes Berg * next bitmap word 400133e5a2f7SJohannes Berg * 400233e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 400333e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 4004d3236553SJohannes Berg */ 4005d3236553SJohannes Berg 4006d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 400733e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 400833e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 400933e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 4010d3236553SJohannes Berg 401133e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 401267272440SJohannes Berg __le32 *_next_bitmap; 401333e5a2f7SJohannes Berg 401433e5a2f7SJohannes Berg unsigned char *this_arg; 401533e5a2f7SJohannes Berg int this_arg_index; 401633e5a2f7SJohannes Berg int this_arg_size; 401733e5a2f7SJohannes Berg 401833e5a2f7SJohannes Berg int is_radiotap_ns; 401933e5a2f7SJohannes Berg 402033e5a2f7SJohannes Berg int _max_length; 402133e5a2f7SJohannes Berg int _arg_index; 402233e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 402333e5a2f7SJohannes Berg int _reset_on_ext; 4024d3236553SJohannes Berg }; 4025d3236553SJohannes Berg 402610dd9b7cSJoe Perches int 402710dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 4028d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 402910dd9b7cSJoe Perches int max_length, 403010dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 4031d3236553SJohannes Berg 403210dd9b7cSJoe Perches int 403310dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 4034d3236553SJohannes Berg 403533e5a2f7SJohannes Berg 4036e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 4037e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 4038e31a16d6SZhu Yi 4039e31a16d6SZhu Yi /** 4040e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 4041e31a16d6SZhu Yi * 4042e31a16d6SZhu Yi * @skb: the frame 40430ae997dcSYacine Belkadi * 40440ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 40450ae997dcSYacine Belkadi * returns the 802.11 header length. 40460ae997dcSYacine Belkadi * 40470ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 40480ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 40490ae997dcSYacine Belkadi * 802.11 header. 4050e31a16d6SZhu Yi */ 4051e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 4052e31a16d6SZhu Yi 4053e31a16d6SZhu Yi /** 4054e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 4055e31a16d6SZhu Yi * @fc: frame control field in little-endian format 40560ae997dcSYacine Belkadi * Return: The header length in bytes. 4057e31a16d6SZhu Yi */ 4058633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 4059e31a16d6SZhu Yi 4060e31a16d6SZhu Yi /** 40619b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 40629b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 40639b395bc3SJohannes Berg * (first byte) will be accessed 40640ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 40659b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 40669b395bc3SJohannes Berg */ 40679b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 40689b395bc3SJohannes Berg 40699b395bc3SJohannes Berg /** 4070d70e9693SJohannes Berg * DOC: Data path helpers 4071d70e9693SJohannes Berg * 4072d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 4073d70e9693SJohannes Berg * functions that help implement the data path for devices 4074d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 4075d70e9693SJohannes Berg */ 4076d70e9693SJohannes Berg 4077d70e9693SJohannes Berg /** 4078e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 4079e31a16d6SZhu Yi * @skb: the 802.11 data frame 4080e31a16d6SZhu Yi * @addr: the device MAC address 4081e31a16d6SZhu Yi * @iftype: the virtual interface type 40820ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 4083e31a16d6SZhu Yi */ 4084eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 4085e31a16d6SZhu Yi enum nl80211_iftype iftype); 4086e31a16d6SZhu Yi 4087e31a16d6SZhu Yi /** 4088e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 4089e31a16d6SZhu Yi * @skb: the 802.3 frame 4090e31a16d6SZhu Yi * @addr: the device MAC address 4091e31a16d6SZhu Yi * @iftype: the virtual interface type 4092e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 4093e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 40940ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 4095e31a16d6SZhu Yi */ 4096eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 4097c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 4098c1e5f471SJohannes Berg bool qos); 4099e31a16d6SZhu Yi 4100e31a16d6SZhu Yi /** 4101eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 4102eaf85ca7SZhu Yi * 4103eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 4104eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 4105eaf85ca7SZhu Yi * @skb is consumed after the function returns. 4106eaf85ca7SZhu Yi * 4107eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 4108eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 4109eaf85ca7SZhu Yi * initialized by by the caller. 4110eaf85ca7SZhu Yi * @addr: The device MAC address. 4111eaf85ca7SZhu Yi * @iftype: The device interface type. 4112eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 41138b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 4114eaf85ca7SZhu Yi */ 4115eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 4116eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 41178b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 41188b3becadSYogesh Ashok Powar bool has_80211_header); 4119eaf85ca7SZhu Yi 4120eaf85ca7SZhu Yi /** 4121e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 4122e31a16d6SZhu Yi * @skb: the data frame 4123fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 41240ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 4125e31a16d6SZhu Yi */ 4126fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 4127fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4128e31a16d6SZhu Yi 4129c21dbf92SJohannes Berg /** 4130fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 4131fbd05e4aSLuca Coelho * 4132fbd05e4aSLuca Coelho * @eid: element ID 4133fbd05e4aSLuca Coelho * @ies: data consisting of IEs 4134fbd05e4aSLuca Coelho * @len: length of data 4135fbd05e4aSLuca Coelho * @match: byte array to match 4136fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 4137fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 4138fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 4139fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 4140fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 4141fbd05e4aSLuca Coelho * the second byte is the IE length. 4142fbd05e4aSLuca Coelho * 4143fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 4144fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 4145fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 4146fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 4147fbd05e4aSLuca Coelho * element ID. 4148fbd05e4aSLuca Coelho * 4149fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 4150fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 4151fbd05e4aSLuca Coelho * byte array to match. 4152fbd05e4aSLuca Coelho */ 4153fbd05e4aSLuca Coelho const u8 *cfg80211_find_ie_match(u8 eid, const u8 *ies, int len, 4154fbd05e4aSLuca Coelho const u8 *match, int match_len, 4155fbd05e4aSLuca Coelho int match_offset); 4156fbd05e4aSLuca Coelho 4157fbd05e4aSLuca Coelho /** 4158c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 4159c21dbf92SJohannes Berg * 4160c21dbf92SJohannes Berg * @eid: element ID 4161c21dbf92SJohannes Berg * @ies: data consisting of IEs 4162c21dbf92SJohannes Berg * @len: length of data 4163c21dbf92SJohannes Berg * 41640ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 41650ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 41660ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 41670ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 41680ae997dcSYacine Belkadi * 41690ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 41700ae997dcSYacine Belkadi * having to fit into the given data. 4171c21dbf92SJohannes Berg */ 4172fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 4173fbd05e4aSLuca Coelho { 4174fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 4175fbd05e4aSLuca Coelho } 4176c21dbf92SJohannes Berg 4177d70e9693SJohannes Berg /** 41780c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 41790c28ec58SEliad Peller * 41800c28ec58SEliad Peller * @oui: vendor OUI 41819e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 41820c28ec58SEliad Peller * @ies: data consisting of IEs 41830c28ec58SEliad Peller * @len: length of data 41840c28ec58SEliad Peller * 41850ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 41860ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 41870ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 41880ae997dcSYacine Belkadi * element ID. 41890ae997dcSYacine Belkadi * 41900ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 41910ae997dcSYacine Belkadi * the given data. 41920c28ec58SEliad Peller */ 41939e9ea439SEmmanuel Grumbach const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 41940c28ec58SEliad Peller const u8 *ies, int len); 41950c28ec58SEliad Peller 41960c28ec58SEliad Peller /** 4197d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 4198d70e9693SJohannes Berg * 4199d70e9693SJohannes Berg * TODO 4200d3236553SJohannes Berg */ 4201d3236553SJohannes Berg 4202d3236553SJohannes Berg /** 4203d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 4204d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 4205d3236553SJohannes Berg * conflicts) 4206d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 4207d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 4208d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 4209d3236553SJohannes Berg * alpha2. 4210d3236553SJohannes Berg * 4211d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 4212d3236553SJohannes Berg * what it believes should be the current regulatory domain by 4213d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 4214d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 4215d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 4216d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 4217d3236553SJohannes Berg * 4218d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 4219d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 4220d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 4221d3236553SJohannes Berg * 4222d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 4223d3236553SJohannes Berg * an -ENOMEM. 42240ae997dcSYacine Belkadi * 42250ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 4226d3236553SJohannes Berg */ 422710dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 4228d3236553SJohannes Berg 4229d3236553SJohannes Berg /** 4230b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 4231b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 4232b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 4233b0d7aa59SJonathan Doron * 4234b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 4235b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 4236b0d7aa59SJonathan Doron * information. 4237b0d7aa59SJonathan Doron * 4238b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 4239b0d7aa59SJonathan Doron */ 4240b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 4241b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 4242b0d7aa59SJonathan Doron 4243b0d7aa59SJonathan Doron /** 42442c3e861cSArik Nemtsov * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 42452c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 42462c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 42472c3e861cSArik Nemtsov * 42482c3e861cSArik Nemtsov * This functions requires the RTNL to be held and applies the new regdomain 42492c3e861cSArik Nemtsov * synchronously to this wiphy. For more details see 42502c3e861cSArik Nemtsov * regulatory_set_wiphy_regd(). 42512c3e861cSArik Nemtsov * 42522c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 42532c3e861cSArik Nemtsov */ 42542c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 42552c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 42562c3e861cSArik Nemtsov 42572c3e861cSArik Nemtsov /** 4258d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 4259d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 4260d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 4261d3236553SJohannes Berg * 4262d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 4263d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 4264d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 4265d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 4266d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 4267d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 4268222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 4269ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 4270222ea581SLuis R. Rodriguez * that called this helper. 4271d3236553SJohannes Berg */ 427210dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 4273d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 4274d3236553SJohannes Berg 4275d3236553SJohannes Berg /** 4276d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 4277d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 4278d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 4279d3236553SJohannes Berg * 4280d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 4281d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 4282d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 4283d3236553SJohannes Berg * and processed already. 4284d3236553SJohannes Berg * 42850ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 42860ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 42870ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 42880ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 42890ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 42900ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 42910ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 4292d3236553SJohannes Berg */ 4293361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 4294361c9c8bSJohannes Berg u32 center_freq); 4295d3236553SJohannes Berg 4296034c6d6eSLuis R. Rodriguez /** 4297034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 4298034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 4299034c6d6eSLuis R. Rodriguez * 4300034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 4301034c6d6eSLuis R. Rodriguez * proper string representation. 4302034c6d6eSLuis R. Rodriguez */ 4303034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 4304034c6d6eSLuis R. Rodriguez 4305d3236553SJohannes Berg /* 4306d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 4307d3236553SJohannes Berg * functions and BSS handling helpers 4308d3236553SJohannes Berg */ 4309d3236553SJohannes Berg 43102a519311SJohannes Berg /** 43112a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 43122a519311SJohannes Berg * 43132a519311SJohannes Berg * @request: the corresponding scan request 43141d76250bSAvraham Stern * @info: information about the completed scan 43152a519311SJohannes Berg */ 43161d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 43171d76250bSAvraham Stern struct cfg80211_scan_info *info); 43182a519311SJohannes Berg 43192a519311SJohannes Berg /** 4320807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 4321807f8a8cSLuciano Coelho * 4322807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 4323807f8a8cSLuciano Coelho */ 4324807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 4325807f8a8cSLuciano Coelho 4326807f8a8cSLuciano Coelho /** 4327807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 4328807f8a8cSLuciano Coelho * 4329807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 4330807f8a8cSLuciano Coelho * 4331807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 4332807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 4333807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 4334807f8a8cSLuciano Coelho */ 4335807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 4336807f8a8cSLuciano Coelho 4337807f8a8cSLuciano Coelho /** 4338792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 4339792e6aa7SEliad Peller * 4340792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 4341792e6aa7SEliad Peller * 4342792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 4343792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 4344792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 4345792e6aa7SEliad Peller * This function should be called with rtnl locked. 4346792e6aa7SEliad Peller */ 4347792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 4348792e6aa7SEliad Peller 4349792e6aa7SEliad Peller /** 43506e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 43512a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 43526e19bc4bSDmitry Shmidt * @data: the BSS metadata 4353abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 4354abe37c4bSJohannes Berg * @len: length of the management frame 43552a519311SJohannes Berg * @gfp: context flags 43562a519311SJohannes Berg * 43572a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 43582a519311SJohannes Berg * the BSS should be updated/added. 4359ef100682SJohannes Berg * 43600ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 43610ae997dcSYacine Belkadi * Or %NULL on error. 43622a519311SJohannes Berg */ 4363ef100682SJohannes Berg struct cfg80211_bss * __must_check 43646e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 43656e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 43666e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 43676e19bc4bSDmitry Shmidt gfp_t gfp); 43686e19bc4bSDmitry Shmidt 43696e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4370dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 43713afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4372dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 4373dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 43746e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 43756e19bc4bSDmitry Shmidt { 43766e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 43776e19bc4bSDmitry Shmidt .chan = rx_channel, 43786e19bc4bSDmitry Shmidt .scan_width = scan_width, 43796e19bc4bSDmitry Shmidt .signal = signal, 43806e19bc4bSDmitry Shmidt }; 43816e19bc4bSDmitry Shmidt 43826e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 43836e19bc4bSDmitry Shmidt } 4384dcd6eac1SSimon Wunderlich 4385dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 43862a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 43873afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 43882a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 4389dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4390dcd6eac1SSimon Wunderlich { 43916e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 43926e19bc4bSDmitry Shmidt .chan = rx_channel, 43936e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 43946e19bc4bSDmitry Shmidt .signal = signal, 43956e19bc4bSDmitry Shmidt }; 43966e19bc4bSDmitry Shmidt 43976e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 4398dcd6eac1SSimon Wunderlich } 43992a519311SJohannes Berg 4400abe37c4bSJohannes Berg /** 44015bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 44025bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 44035bc8c1f2SJohannes Berg * from a beacon or probe response 44045bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 44055bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 44065bc8c1f2SJohannes Berg */ 44075bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 44085bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 44095bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 44105bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 44115bc8c1f2SJohannes Berg }; 44125bc8c1f2SJohannes Berg 44135bc8c1f2SJohannes Berg /** 44146e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 4415abe37c4bSJohannes Berg * 4416abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 44176e19bc4bSDmitry Shmidt * @data: the BSS metadata 44185bc8c1f2SJohannes Berg * @ftype: frame type (if known) 4419abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 44207b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 4421abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 4422abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 4423abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 4424abe37c4bSJohannes Berg * @ielen: length of the additional IEs 4425abe37c4bSJohannes Berg * @gfp: context flags 4426abe37c4bSJohannes Berg * 4427abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 4428abe37c4bSJohannes Berg * the BSS should be updated/added. 4429ef100682SJohannes Berg * 44300ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 44310ae997dcSYacine Belkadi * Or %NULL on error. 4432abe37c4bSJohannes Berg */ 4433ef100682SJohannes Berg struct cfg80211_bss * __must_check 44346e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 44356e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 44366e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 44376e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 44386e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 44396e19bc4bSDmitry Shmidt gfp_t gfp); 44406e19bc4bSDmitry Shmidt 44416e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 4442dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 44433afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 4444dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 44455bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 4446dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 4447dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 44486e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 44496e19bc4bSDmitry Shmidt { 44506e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 44516e19bc4bSDmitry Shmidt .chan = rx_channel, 44526e19bc4bSDmitry Shmidt .scan_width = scan_width, 44536e19bc4bSDmitry Shmidt .signal = signal, 44546e19bc4bSDmitry Shmidt }; 44556e19bc4bSDmitry Shmidt 44566e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 44576e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 44586e19bc4bSDmitry Shmidt gfp); 44596e19bc4bSDmitry Shmidt } 4460dcd6eac1SSimon Wunderlich 4461dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 446206aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 44633afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 44645bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 44657b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 44667b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4467dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4468dcd6eac1SSimon Wunderlich { 44696e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 44706e19bc4bSDmitry Shmidt .chan = rx_channel, 44716e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 44726e19bc4bSDmitry Shmidt .signal = signal, 44736e19bc4bSDmitry Shmidt }; 44746e19bc4bSDmitry Shmidt 44756e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 44766e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 4477dcd6eac1SSimon Wunderlich gfp); 4478dcd6eac1SSimon Wunderlich } 447906aa7afaSJussi Kivilinna 44802a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 44812a519311SJohannes Berg struct ieee80211_channel *channel, 44822a519311SJohannes Berg const u8 *bssid, 448379420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 44846eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 44856eb18137SDedy Lansky enum ieee80211_privacy); 448679420f09SJohannes Berg static inline struct cfg80211_bss * 448779420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 448879420f09SJohannes Berg struct ieee80211_channel *channel, 448979420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 449079420f09SJohannes Berg { 449179420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 44926eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 44936eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 449479420f09SJohannes Berg } 449579420f09SJohannes Berg 44964c0c0b75SJohannes Berg /** 44974c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 44985b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 44994c0c0b75SJohannes Berg * @bss: the BSS struct to reference 45004c0c0b75SJohannes Berg * 45014c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 45024c0c0b75SJohannes Berg */ 45035b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 45044c0c0b75SJohannes Berg 45054c0c0b75SJohannes Berg /** 45064c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 45075b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 45084c0c0b75SJohannes Berg * @bss: the BSS struct 45094c0c0b75SJohannes Berg * 45104c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 45114c0c0b75SJohannes Berg */ 45125b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4513d3236553SJohannes Berg 4514d491af19SJohannes Berg /** 4515d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4516d491af19SJohannes Berg * @wiphy: the wiphy 4517d491af19SJohannes Berg * @bss: the bss to remove 4518d491af19SJohannes Berg * 4519d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4520d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4521d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4522d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4523d491af19SJohannes Berg */ 4524d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4525fee52678SJohannes Berg 4526dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4527dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4528dcd6eac1SSimon Wunderlich { 4529dcd6eac1SSimon Wunderlich switch (chandef->width) { 4530dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4531dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4532dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4533dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4534dcd6eac1SSimon Wunderlich default: 4535dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4536dcd6eac1SSimon Wunderlich } 4537dcd6eac1SSimon Wunderlich } 4538dcd6eac1SSimon Wunderlich 45396039f6d2SJouni Malinen /** 45406ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 45416039f6d2SJouni Malinen * @dev: network device 45426039f6d2SJouni Malinen * @buf: authentication frame (header + body) 45436039f6d2SJouni Malinen * @len: length of the frame data 45446039f6d2SJouni Malinen * 45456ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 45466ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 45476ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 45486ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 45496ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 45506ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 45516ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 45526ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 45536ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 45546ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 45556ff57cf8SJohannes Berg * 45566ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 45576039f6d2SJouni Malinen */ 45586ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 45596039f6d2SJouni Malinen 45606039f6d2SJouni Malinen /** 45616ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 45621965c853SJouni Malinen * @dev: network device 45631965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4564cb0b4bebSJohannes Berg * 45658d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 45668d61ffa5SJohannes Berg * mutex. 45671965c853SJouni Malinen */ 45686ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 45691965c853SJouni Malinen 45701965c853SJouni Malinen /** 45716ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 45726039f6d2SJouni Malinen * @dev: network device 45736ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 45746ff57cf8SJohannes Berg * moves to cfg80211 in this call 45756ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 45766039f6d2SJouni Malinen * @len: length of the frame data 4577*f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 4578*f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 45796039f6d2SJouni Malinen * 45806ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 45816ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 45826ff57cf8SJohannes Berg * 45836ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 45846039f6d2SJouni Malinen */ 45856ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 45866ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4587b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4588b0b6aa2cSEliad Peller int uapsd_queues); 45896039f6d2SJouni Malinen 45906039f6d2SJouni Malinen /** 45916ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 45921965c853SJouni Malinen * @dev: network device 4593959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4594cb0b4bebSJohannes Berg * 45958d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 45961965c853SJouni Malinen */ 4597959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 45981965c853SJouni Malinen 45991965c853SJouni Malinen /** 46006ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 46016039f6d2SJouni Malinen * @dev: network device 46026ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 46036039f6d2SJouni Malinen * @len: length of the frame data 46046039f6d2SJouni Malinen * 46056039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 460653b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 46078d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 46088d61ffa5SJohannes Berg * corresponding wdev's mutex. 46096039f6d2SJouni Malinen */ 46106ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4611ce470613SHolger Schurig 4612ce470613SHolger Schurig /** 46136ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4614cf4e594eSJouni Malinen * @dev: network device 4615cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4616cf4e594eSJouni Malinen * @len: length of the frame data 4617cf4e594eSJouni Malinen * 46186ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 46196ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4620cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4621cf4e594eSJouni Malinen */ 46226ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 46236ff57cf8SJohannes Berg const u8 *buf, size_t len); 4624cf4e594eSJouni Malinen 4625cf4e594eSJouni Malinen /** 4626a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4627a3b8b056SJouni Malinen * @dev: network device 4628a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4629a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4630a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4631a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4632e6d6e342SJohannes Berg * @gfp: allocation flags 4633a3b8b056SJouni Malinen * 4634a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4635a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4636a3b8b056SJouni Malinen * primitive. 4637a3b8b056SJouni Malinen */ 4638a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4639a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4640e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4641a3b8b056SJouni Malinen 464204a773adSJohannes Berg /** 464304a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 464404a773adSJohannes Berg * 464504a773adSJohannes Berg * @dev: network device 464604a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4647fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 464804a773adSJohannes Berg * @gfp: allocation flags 464904a773adSJohannes Berg * 465004a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 465104a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 465204a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 465304a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 465404a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 465504a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 465604a773adSJohannes Berg */ 4657fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4658fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 465904a773adSJohannes Berg 46601f87f7d3SJohannes Berg /** 4661c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4662c93b5e71SJavier Cardona * 4663c93b5e71SJavier Cardona * @dev: network device 4664c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4665c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4666c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4667c93b5e71SJavier Cardona * @gfp: allocation flags 4668c93b5e71SJavier Cardona * 4669c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4670c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4671c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4672c93b5e71SJavier Cardona */ 4673c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4674c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4675c93b5e71SJavier Cardona 4676c93b5e71SJavier Cardona /** 4677d70e9693SJohannes Berg * DOC: RFkill integration 4678d70e9693SJohannes Berg * 4679d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4680d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4681d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4682d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4683d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4684d70e9693SJohannes Berg * 4685d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4686d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4687d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4688d70e9693SJohannes Berg */ 4689d70e9693SJohannes Berg 4690d70e9693SJohannes Berg /** 46911f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 46921f87f7d3SJohannes Berg * @wiphy: the wiphy 46931f87f7d3SJohannes Berg * @blocked: block status 46941f87f7d3SJohannes Berg */ 46951f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 46961f87f7d3SJohannes Berg 46971f87f7d3SJohannes Berg /** 46981f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 46991f87f7d3SJohannes Berg * @wiphy: the wiphy 47001f87f7d3SJohannes Berg */ 47011f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 47021f87f7d3SJohannes Berg 47031f87f7d3SJohannes Berg /** 47041f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 47051f87f7d3SJohannes Berg * @wiphy: the wiphy 47061f87f7d3SJohannes Berg */ 47071f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 47081f87f7d3SJohannes Berg 4709ad7e718cSJohannes Berg /** 4710ad7e718cSJohannes Berg * DOC: Vendor commands 4711ad7e718cSJohannes Berg * 4712ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4713ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4714ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4715ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4716ad7e718cSJohannes Berg * the configuration mechanism. 4717ad7e718cSJohannes Berg * 4718ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4719ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4720ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4721ad7e718cSJohannes Berg * 4722ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4723ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4724ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4725ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4726ad7e718cSJohannes Berg * managers etc. need. 4727ad7e718cSJohannes Berg */ 4728ad7e718cSJohannes Berg 4729ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4730ad7e718cSJohannes Berg enum nl80211_commands cmd, 4731ad7e718cSJohannes Berg enum nl80211_attrs attr, 4732ad7e718cSJohannes Berg int approxlen); 4733ad7e718cSJohannes Berg 4734567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 47356c09e791SAhmad Kholaif struct wireless_dev *wdev, 4736567ffc35SJohannes Berg enum nl80211_commands cmd, 4737567ffc35SJohannes Berg enum nl80211_attrs attr, 4738567ffc35SJohannes Berg int vendor_event_idx, 4739567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4740567ffc35SJohannes Berg 4741567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4742567ffc35SJohannes Berg 4743ad7e718cSJohannes Berg /** 4744ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4745ad7e718cSJohannes Berg * @wiphy: the wiphy 4746ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4747ad7e718cSJohannes Berg * be put into the skb 4748ad7e718cSJohannes Berg * 4749ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4750ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4751ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4752ad7e718cSJohannes Berg * 4753ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4754ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4755ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4756ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4757ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4758ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4759ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4760ad7e718cSJohannes Berg * 4761ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4762ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4763ad7e718cSJohannes Berg * 4764ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4765ad7e718cSJohannes Berg */ 4766ad7e718cSJohannes Berg static inline struct sk_buff * 4767ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4768ad7e718cSJohannes Berg { 4769ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4770ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4771ad7e718cSJohannes Berg } 4772ad7e718cSJohannes Berg 4773ad7e718cSJohannes Berg /** 4774ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4775ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4776ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4777ad7e718cSJohannes Berg * 4778ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4779ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4780ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4781ad7e718cSJohannes Berg * skb regardless of the return value. 4782ad7e718cSJohannes Berg * 4783ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4784ad7e718cSJohannes Berg */ 4785ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4786ad7e718cSJohannes Berg 4787567ffc35SJohannes Berg /** 4788567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4789567ffc35SJohannes Berg * @wiphy: the wiphy 47906c09e791SAhmad Kholaif * @wdev: the wireless device 4791567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4792567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4793567ffc35SJohannes Berg * be put into the skb 4794567ffc35SJohannes Berg * @gfp: allocation flags 4795567ffc35SJohannes Berg * 4796567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4797567ffc35SJohannes Berg * vendor-specific multicast group. 4798567ffc35SJohannes Berg * 47996c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 48006c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 48016c09e791SAhmad Kholaif * attribute. 48026c09e791SAhmad Kholaif * 4803567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4804567ffc35SJohannes Berg * skb to send the event. 4805567ffc35SJohannes Berg * 4806567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4807567ffc35SJohannes Berg */ 4808567ffc35SJohannes Berg static inline struct sk_buff * 48096c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 48106c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 4811567ffc35SJohannes Berg { 48126c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 4813567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4814567ffc35SJohannes Berg event_idx, approxlen, gfp); 4815567ffc35SJohannes Berg } 4816567ffc35SJohannes Berg 4817567ffc35SJohannes Berg /** 4818567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4819567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4820567ffc35SJohannes Berg * @gfp: allocation flags 4821567ffc35SJohannes Berg * 4822567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4823567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4824567ffc35SJohannes Berg */ 4825567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4826567ffc35SJohannes Berg { 4827567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4828567ffc35SJohannes Berg } 4829567ffc35SJohannes Berg 4830aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4831aff89a9bSJohannes Berg /** 4832d70e9693SJohannes Berg * DOC: Test mode 4833d70e9693SJohannes Berg * 4834d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4835d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4836d70e9693SJohannes Berg * factory programming. 4837d70e9693SJohannes Berg * 4838d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4839d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4840d70e9693SJohannes Berg */ 4841d70e9693SJohannes Berg 4842d70e9693SJohannes Berg /** 4843aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4844aff89a9bSJohannes Berg * @wiphy: the wiphy 4845aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4846aff89a9bSJohannes Berg * be put into the skb 4847aff89a9bSJohannes Berg * 4848aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4849aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4850aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4851aff89a9bSJohannes Berg * 48520ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 48530ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 48540ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 48550ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 48560ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 48570ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 48580ae997dcSYacine Belkadi * must not modify the skb in any other way. 4859aff89a9bSJohannes Berg * 4860aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4861aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 48620ae997dcSYacine Belkadi * 48630ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4864aff89a9bSJohannes Berg */ 4865ad7e718cSJohannes Berg static inline struct sk_buff * 4866ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4867ad7e718cSJohannes Berg { 4868ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4869ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4870ad7e718cSJohannes Berg } 4871aff89a9bSJohannes Berg 4872aff89a9bSJohannes Berg /** 4873aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4874aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4875aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4876aff89a9bSJohannes Berg * 48770ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 48780ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 48790ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 48800ae997dcSYacine Belkadi * regardless of the return value. 48810ae997dcSYacine Belkadi * 48820ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4883aff89a9bSJohannes Berg */ 4884ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4885ad7e718cSJohannes Berg { 4886ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4887ad7e718cSJohannes Berg } 4888aff89a9bSJohannes Berg 4889aff89a9bSJohannes Berg /** 4890aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4891aff89a9bSJohannes Berg * @wiphy: the wiphy 4892aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4893aff89a9bSJohannes Berg * be put into the skb 4894aff89a9bSJohannes Berg * @gfp: allocation flags 4895aff89a9bSJohannes Berg * 4896aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4897aff89a9bSJohannes Berg * testmode multicast group. 4898aff89a9bSJohannes Berg * 48990ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 49000ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 49010ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 49020ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 49030ae997dcSYacine Belkadi * in any other way. 4904aff89a9bSJohannes Berg * 4905aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4906aff89a9bSJohannes Berg * skb to send the event. 49070ae997dcSYacine Belkadi * 49080ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4909aff89a9bSJohannes Berg */ 4910567ffc35SJohannes Berg static inline struct sk_buff * 4911567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4912567ffc35SJohannes Berg { 49136c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 4914567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4915567ffc35SJohannes Berg approxlen, gfp); 4916567ffc35SJohannes Berg } 4917aff89a9bSJohannes Berg 4918aff89a9bSJohannes Berg /** 4919aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4920aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4921aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4922aff89a9bSJohannes Berg * @gfp: allocation flags 4923aff89a9bSJohannes Berg * 4924aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4925aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4926aff89a9bSJohannes Berg * consumes it. 4927aff89a9bSJohannes Berg */ 4928567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4929567ffc35SJohannes Berg { 4930567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4931567ffc35SJohannes Berg } 4932aff89a9bSJohannes Berg 4933aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 493471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4935aff89a9bSJohannes Berg #else 4936aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 493771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 4938aff89a9bSJohannes Berg #endif 4939aff89a9bSJohannes Berg 4940b23aa676SSamuel Ortiz /** 4941e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 4942e7054989SKanchanapally, Vidyullatha * 4943e7054989SKanchanapally, Vidyullatha * @dev: network device 4944e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 4945e7054989SKanchanapally, Vidyullatha * @bss: entry of bss to which STA got connected to, can be obtained 4946e7054989SKanchanapally, Vidyullatha * through cfg80211_get_bss (may be %NULL) 4947e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 4948e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 4949e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 4950e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 4951e7054989SKanchanapally, Vidyullatha * @status: status code, 0 for successful connection, use 4952e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4953e7054989SKanchanapally, Vidyullatha * the real status code for failures. 4954e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 4955e7054989SKanchanapally, Vidyullatha * 4956e7054989SKanchanapally, Vidyullatha * It should be called by the underlying driver whenever connect() has 4957e7054989SKanchanapally, Vidyullatha * succeeded. This is similar to cfg80211_connect_result(), but with the 4958e7054989SKanchanapally, Vidyullatha * option of identifying the exact bss entry for the connection. Only one of 4959e7054989SKanchanapally, Vidyullatha * these functions should be called. 4960e7054989SKanchanapally, Vidyullatha */ 4961e7054989SKanchanapally, Vidyullatha void cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 4962e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 4963e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 4964bf1ecd21SJouni Malinen size_t resp_ie_len, int status, gfp_t gfp); 4965e7054989SKanchanapally, Vidyullatha 4966e7054989SKanchanapally, Vidyullatha /** 4967b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 4968b23aa676SSamuel Ortiz * 4969b23aa676SSamuel Ortiz * @dev: network device 4970b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 4971b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4972b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4973b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4974b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4975b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 4976b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4977b23aa676SSamuel Ortiz * the real status code for failures. 4978b23aa676SSamuel Ortiz * @gfp: allocation flags 4979b23aa676SSamuel Ortiz * 4980b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 4981b23aa676SSamuel Ortiz * succeeded. 4982b23aa676SSamuel Ortiz */ 4983e7054989SKanchanapally, Vidyullatha static inline void 4984e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 4985b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4986b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 4987e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 4988e7054989SKanchanapally, Vidyullatha { 4989e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 4990e7054989SKanchanapally, Vidyullatha resp_ie_len, status, gfp); 4991e7054989SKanchanapally, Vidyullatha } 4992b23aa676SSamuel Ortiz 4993b23aa676SSamuel Ortiz /** 4994bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 4995bf1ecd21SJouni Malinen * 4996bf1ecd21SJouni Malinen * @dev: network device 4997bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 4998bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 4999bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 5000bf1ecd21SJouni Malinen * @gfp: allocation flags 5001bf1ecd21SJouni Malinen * 5002bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 5003bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 5004bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 5005bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 5006bf1ecd21SJouni Malinen * waiting for the response. 5007bf1ecd21SJouni Malinen */ 5008bf1ecd21SJouni Malinen static inline void 5009bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 5010bf1ecd21SJouni Malinen const u8 *req_ie, size_t req_ie_len, gfp_t gfp) 5011bf1ecd21SJouni Malinen { 5012bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 5013bf1ecd21SJouni Malinen gfp); 5014bf1ecd21SJouni Malinen } 5015bf1ecd21SJouni Malinen 5016bf1ecd21SJouni Malinen /** 5017b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 5018b23aa676SSamuel Ortiz * 5019b23aa676SSamuel Ortiz * @dev: network device 5020ed9d0102SJouni Malinen * @channel: the channel of the new AP 5021b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 5022b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 5023b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 5024b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 5025b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 5026b23aa676SSamuel Ortiz * @gfp: allocation flags 5027b23aa676SSamuel Ortiz * 5028b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 5029b23aa676SSamuel Ortiz * from one AP to another while connected. 5030b23aa676SSamuel Ortiz */ 5031ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 5032ed9d0102SJouni Malinen struct ieee80211_channel *channel, 5033ed9d0102SJouni Malinen const u8 *bssid, 5034b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 5035b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 5036b23aa676SSamuel Ortiz 5037b23aa676SSamuel Ortiz /** 5038adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 5039adbde344SVasanthakumar Thiagarajan * 5040adbde344SVasanthakumar Thiagarajan * @dev: network device 5041adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 5042adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 5043adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 5044adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 5045adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 5046adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 5047adbde344SVasanthakumar Thiagarajan * 5048adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 5049adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 5050adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 5051adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 5052adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 5053adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 5054adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 5055adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 5056adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 5057adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 5058adbde344SVasanthakumar Thiagarajan */ 5059adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 5060adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 5061adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 5062adbde344SVasanthakumar Thiagarajan 5063adbde344SVasanthakumar Thiagarajan /** 5064b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 5065b23aa676SSamuel Ortiz * 5066b23aa676SSamuel Ortiz * @dev: network device 5067b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 5068b23aa676SSamuel Ortiz * @ie_len: length of IEs 5069b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 507080279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 5071b23aa676SSamuel Ortiz * @gfp: allocation flags 5072b23aa676SSamuel Ortiz * 5073b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 5074b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 5075b23aa676SSamuel Ortiz */ 5076b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 507780279fb7SJohannes Berg const u8 *ie, size_t ie_len, 507880279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 5079b23aa676SSamuel Ortiz 50809588bbd5SJouni Malinen /** 50819588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 508271bbc994SJohannes Berg * @wdev: wireless device 50839588bbd5SJouni Malinen * @cookie: the request cookie 50849588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 50859588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 50869588bbd5SJouni Malinen * channel 50879588bbd5SJouni Malinen * @gfp: allocation flags 50889588bbd5SJouni Malinen */ 508971bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 50909588bbd5SJouni Malinen struct ieee80211_channel *chan, 50919588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 50929588bbd5SJouni Malinen 50939588bbd5SJouni Malinen /** 50949588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 509571bbc994SJohannes Berg * @wdev: wireless device 50969588bbd5SJouni Malinen * @cookie: the request cookie 50979588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 50989588bbd5SJouni Malinen * @gfp: allocation flags 50999588bbd5SJouni Malinen */ 510071bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 51019588bbd5SJouni Malinen struct ieee80211_channel *chan, 51029588bbd5SJouni Malinen gfp_t gfp); 5103b23aa676SSamuel Ortiz 510498b62183SJohannes Berg 510598b62183SJohannes Berg /** 510698b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 510798b62183SJohannes Berg * 510898b62183SJohannes Berg * @dev: the netdev 510998b62183SJohannes Berg * @mac_addr: the station's address 511098b62183SJohannes Berg * @sinfo: the station information 511198b62183SJohannes Berg * @gfp: allocation flags 511298b62183SJohannes Berg */ 511398b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 511498b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 511598b62183SJohannes Berg 5116026331c4SJouni Malinen /** 5117cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 5118cf5ead82SJohannes Berg * @dev: the netdev 5119cf5ead82SJohannes Berg * @mac_addr: the station's address 5120cf5ead82SJohannes Berg * @sinfo: the station information/statistics 5121cf5ead82SJohannes Berg * @gfp: allocation flags 5122cf5ead82SJohannes Berg */ 5123cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 5124cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 5125cf5ead82SJohannes Berg 5126cf5ead82SJohannes Berg /** 5127ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 5128ec15e68bSJouni Malinen * 5129ec15e68bSJouni Malinen * @dev: the netdev 5130ec15e68bSJouni Malinen * @mac_addr: the station's address 5131ec15e68bSJouni Malinen * @gfp: allocation flags 5132ec15e68bSJouni Malinen */ 5133cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 5134cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 5135cf5ead82SJohannes Berg { 5136cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 5137cf5ead82SJohannes Berg } 5138ec15e68bSJouni Malinen 5139ec15e68bSJouni Malinen /** 5140ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 5141ed44a951SPandiyarajan Pitchaimuthu * 5142ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 5143ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 5144ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 5145ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 5146ed44a951SPandiyarajan Pitchaimuthu * 5147ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 5148ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 5149ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 5150ed44a951SPandiyarajan Pitchaimuthu * 5151ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 5152ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 5153ed44a951SPandiyarajan Pitchaimuthu */ 5154ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 5155ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 5156ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 5157ed44a951SPandiyarajan Pitchaimuthu 5158ed44a951SPandiyarajan Pitchaimuthu /** 51592e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 516071bbc994SJohannes Berg * @wdev: wireless device receiving the frame 5161026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 5162804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 51632e161f78SJohannes Berg * @buf: Management frame (header + body) 5164026331c4SJouni Malinen * @len: length of the frame data 516519504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 51662e161f78SJohannes Berg * 51670ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 51680ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 51690ae997dcSYacine Belkadi * 51700ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 51712e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 51722e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 51732e161f78SJohannes Berg * driver is responsible for rejecting the frame. 5174026331c4SJouni Malinen */ 517571bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 5176970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 5177026331c4SJouni Malinen 5178026331c4SJouni Malinen /** 51792e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 518071bbc994SJohannes Berg * @wdev: wireless device receiving the frame 51812e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 51822e161f78SJohannes Berg * @buf: Management frame (header + body) 5183026331c4SJouni Malinen * @len: length of the frame data 5184026331c4SJouni Malinen * @ack: Whether frame was acknowledged 5185026331c4SJouni Malinen * @gfp: context flags 5186026331c4SJouni Malinen * 51872e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 51882e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 5189026331c4SJouni Malinen * transmission attempt. 5190026331c4SJouni Malinen */ 519171bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 5192026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 5193026331c4SJouni Malinen 5194d6dc1a38SJuuso Oikarinen 5195d6dc1a38SJuuso Oikarinen /** 5196d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 5197d6dc1a38SJuuso Oikarinen * @dev: network device 5198d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 5199d6dc1a38SJuuso Oikarinen * @gfp: context flags 5200d6dc1a38SJuuso Oikarinen * 5201d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 5202d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 5203d6dc1a38SJuuso Oikarinen */ 5204d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 5205d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 5206d6dc1a38SJuuso Oikarinen gfp_t gfp); 5207d6dc1a38SJuuso Oikarinen 5208c063dbf5SJohannes Berg /** 5209c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 5210c063dbf5SJohannes Berg * @dev: network device 5211c063dbf5SJohannes Berg * @peer: peer's MAC address 5212c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 5213c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 5214c063dbf5SJohannes Berg * threshold (to account for temporary interference) 5215c063dbf5SJohannes Berg * @gfp: context flags 5216c063dbf5SJohannes Berg */ 5217c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 5218c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 5219c063dbf5SJohannes Berg 5220e5497d76SJohannes Berg /** 522184f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 522284f10708SThomas Pedersen * @dev: network device 522384f10708SThomas Pedersen * @peer: peer's MAC address 522484f10708SThomas Pedersen * @num_packets: how many packets were lost 522584f10708SThomas Pedersen * @rate: % of packets which failed transmission 522684f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 522784f10708SThomas Pedersen * @gfp: context flags 522884f10708SThomas Pedersen * 522984f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 523084f10708SThomas Pedersen * given interval is exceeded. 523184f10708SThomas Pedersen */ 523284f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 523384f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 523484f10708SThomas Pedersen 523584f10708SThomas Pedersen /** 523698f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 523798f03342SJohannes Berg * @dev: network device 523898f03342SJohannes Berg * @gfp: context flags 523998f03342SJohannes Berg * 524098f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 524198f03342SJohannes Berg */ 524298f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 524398f03342SJohannes Berg 524498f03342SJohannes Berg /** 52455b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 52465b97f49dSJohannes Berg * @wiphy: the wiphy 52475b97f49dSJohannes Berg * @chandef: chandef for the current channel 52485b97f49dSJohannes Berg * @gfp: context flags 52495b97f49dSJohannes Berg * 52505b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 52515b97f49dSJohannes Berg */ 52525b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 52535b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 52545b97f49dSJohannes Berg 52555b97f49dSJohannes Berg /** 52565b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 52575b97f49dSJohannes Berg * @netdev: network device 52585b97f49dSJohannes Berg * @chandef: chandef for the current channel 52595b97f49dSJohannes Berg * @event: type of event 52605b97f49dSJohannes Berg * @gfp: context flags 52615b97f49dSJohannes Berg * 52625b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 52635b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 52645b97f49dSJohannes Berg * also by full-MAC drivers. 52655b97f49dSJohannes Berg */ 52665b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 52675b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 52685b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 52695b97f49dSJohannes Berg 52705b97f49dSJohannes Berg 52715b97f49dSJohannes Berg /** 5272e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 5273e5497d76SJohannes Berg * @dev: network device 5274e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 5275e5497d76SJohannes Berg * @replay_ctr: new replay counter 5276af71ff85SJohannes Berg * @gfp: allocation flags 5277e5497d76SJohannes Berg */ 5278e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 5279e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 5280e5497d76SJohannes Berg 5281c9df56b4SJouni Malinen /** 5282c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 5283c9df56b4SJouni Malinen * @dev: network device 5284c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 5285c9df56b4SJouni Malinen * @bssid: BSSID of AP 5286c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 5287c9df56b4SJouni Malinen * @gfp: allocation flags 5288c9df56b4SJouni Malinen */ 5289c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 5290c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 5291c9df56b4SJouni Malinen 529228946da7SJohannes Berg /** 529328946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 529428946da7SJohannes Berg * @dev: The device the frame matched to 529528946da7SJohannes Berg * @addr: the transmitter address 529628946da7SJohannes Berg * @gfp: context flags 529728946da7SJohannes Berg * 529828946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 529928946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 530028946da7SJohannes Berg * sender. 53010ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 530228946da7SJohannes Berg * for a reason other than not having a subscription.) 530328946da7SJohannes Berg */ 530428946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 530528946da7SJohannes Berg const u8 *addr, gfp_t gfp); 530628946da7SJohannes Berg 53077f6cf311SJohannes Berg /** 5308b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 5309b92ab5d8SJohannes Berg * @dev: The device the frame matched to 5310b92ab5d8SJohannes Berg * @addr: the transmitter address 5311b92ab5d8SJohannes Berg * @gfp: context flags 5312b92ab5d8SJohannes Berg * 5313b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 5314b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 5315b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 5316b92ab5d8SJohannes Berg * station to avoid event flooding. 53170ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 5318b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 5319b92ab5d8SJohannes Berg */ 5320b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 5321b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 5322b92ab5d8SJohannes Berg 5323b92ab5d8SJohannes Berg /** 53247f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 53257f6cf311SJohannes Berg * @dev: the device the probe was sent on 53267f6cf311SJohannes Berg * @addr: the address of the peer 53277f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 53287f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 53297f6cf311SJohannes Berg * @gfp: allocation flags 53307f6cf311SJohannes Berg */ 53317f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 53327f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 53337f6cf311SJohannes Berg 53345e760230SJohannes Berg /** 53355e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 53365e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 53375e760230SJohannes Berg * @frame: the frame 53385e760230SJohannes Berg * @len: length of the frame 53395e760230SJohannes Berg * @freq: frequency the frame was received on 5340804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 53415e760230SJohannes Berg * 53425e760230SJohannes Berg * Use this function to report to userspace when a beacon was 53435e760230SJohannes Berg * received. It is not useful to call this when there is no 53445e760230SJohannes Berg * netdev that is in AP/GO mode. 53455e760230SJohannes Berg */ 53465e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 53475e760230SJohannes Berg const u8 *frame, size_t len, 534837c73b5fSBen Greear int freq, int sig_dbm); 53495e760230SJohannes Berg 5350d58e7e37SJohannes Berg /** 5351683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 535254858ee5SAlexander Simon * @wiphy: the wiphy 5353683b6d3bSJohannes Berg * @chandef: the channel definition 5354174e0cd2SIlan Peer * @iftype: interface type 5355d58e7e37SJohannes Berg * 53560ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 53570ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 535854858ee5SAlexander Simon */ 5359683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 5360174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 5361174e0cd2SIlan Peer enum nl80211_iftype iftype); 536254858ee5SAlexander Simon 5363923b352fSArik Nemtsov /** 5364923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 5365923b352fSArik Nemtsov * @wiphy: the wiphy 5366923b352fSArik Nemtsov * @chandef: the channel definition 5367923b352fSArik Nemtsov * @iftype: interface type 5368923b352fSArik Nemtsov * 5369923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 5370923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 5371923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 5372923b352fSArik Nemtsov * more permissive conditions. 5373923b352fSArik Nemtsov * 5374923b352fSArik Nemtsov * Requires the RTNL to be held. 5375923b352fSArik Nemtsov */ 5376923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 5377923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 5378923b352fSArik Nemtsov enum nl80211_iftype iftype); 5379923b352fSArik Nemtsov 53808097e149SThomas Pedersen /* 53815314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 53825314526bSThomas Pedersen * @dev: the device which switched channels 5383683b6d3bSJohannes Berg * @chandef: the new channel definition 53845314526bSThomas Pedersen * 5385e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 5386e487eaebSSimon Wunderlich * driver context! 53875314526bSThomas Pedersen */ 5388683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 5389683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 53905314526bSThomas Pedersen 5391f8d7552eSLuciano Coelho /* 5392f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 5393f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 5394f8d7552eSLuciano Coelho * @chandef: the future channel definition 5395f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 5396f8d7552eSLuciano Coelho * 5397f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 5398f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 5399f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 5400f8d7552eSLuciano Coelho */ 5401f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 5402f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 5403f8d7552eSLuciano Coelho u8 count); 5404f8d7552eSLuciano Coelho 54051ce3e82bSJohannes Berg /** 54061ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 54071ce3e82bSJohannes Berg * 54081ce3e82bSJohannes Berg * @operating_class: the operating class to convert 54091ce3e82bSJohannes Berg * @band: band pointer to fill 54101ce3e82bSJohannes Berg * 54111ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 54121ce3e82bSJohannes Berg */ 54131ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 541457fbcce3SJohannes Berg enum nl80211_band *band); 54151ce3e82bSJohannes Berg 5416a38700ddSArik Nemtsov /** 5417a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 5418a38700ddSArik Nemtsov * 5419a38700ddSArik Nemtsov * @chandef: the chandef to convert 5420a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 5421a38700ddSArik Nemtsov * 5422a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 5423a38700ddSArik Nemtsov */ 5424a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 5425a38700ddSArik Nemtsov u8 *op_class); 5426a38700ddSArik Nemtsov 54275314526bSThomas Pedersen /* 54283475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 54293475b094SJouni Malinen * @dev: the device on which the operation is requested 54303475b094SJouni Malinen * @peer: the MAC address of the peer device 54313475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 54323475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 54333475b094SJouni Malinen * @reason_code: the reason code for teardown request 54343475b094SJouni Malinen * @gfp: allocation flags 54353475b094SJouni Malinen * 54363475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 54373475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 54383475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 54393475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 54403475b094SJouni Malinen * based on traffic and signal strength for a peer). 54413475b094SJouni Malinen */ 54423475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 54433475b094SJouni Malinen enum nl80211_tdls_operation oper, 54443475b094SJouni Malinen u16 reason_code, gfp_t gfp); 54453475b094SJouni Malinen 54463475b094SJouni Malinen /* 54478097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 54488097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 54498097e149SThomas Pedersen * 54508097e149SThomas Pedersen * return 0 if MCS index >= 32 54518097e149SThomas Pedersen */ 54528eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 54538097e149SThomas Pedersen 545498104fdeSJohannes Berg /** 545598104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 545698104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 545798104fdeSJohannes Berg * 545898104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 545998104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 546098104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 546198104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 546298104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 546398104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 546498104fdeSJohannes Berg * when the device is unbound from the driver. 546598104fdeSJohannes Berg * 546698104fdeSJohannes Berg * Requires the RTNL to be held. 546798104fdeSJohannes Berg */ 546898104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 546998104fdeSJohannes Berg 54700ee45355SJohannes Berg /** 5471355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 5472355199e0SJouni Malinen * @ies: FT IEs 5473355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 5474355199e0SJouni Malinen * @target_ap: target AP's MAC address 5475355199e0SJouni Malinen * @ric_ies: RIC IE 5476355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 5477355199e0SJouni Malinen */ 5478355199e0SJouni Malinen struct cfg80211_ft_event_params { 5479355199e0SJouni Malinen const u8 *ies; 5480355199e0SJouni Malinen size_t ies_len; 5481355199e0SJouni Malinen const u8 *target_ap; 5482355199e0SJouni Malinen const u8 *ric_ies; 5483355199e0SJouni Malinen size_t ric_ies_len; 5484355199e0SJouni Malinen }; 5485355199e0SJouni Malinen 5486355199e0SJouni Malinen /** 5487355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 5488355199e0SJouni Malinen * @netdev: network device 5489355199e0SJouni Malinen * @ft_event: IE information 5490355199e0SJouni Malinen */ 5491355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 5492355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 5493355199e0SJouni Malinen 5494355199e0SJouni Malinen /** 54950ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 54960ee45355SJohannes Berg * @ies: the input IE buffer 54970ee45355SJohannes Berg * @len: the input length 54980ee45355SJohannes Berg * @attr: the attribute ID to find 54990ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 55000ee45355SJohannes Berg * if the function is only called to get the needed buffer size 55010ee45355SJohannes Berg * @bufsize: size of the output buffer 55020ee45355SJohannes Berg * 55030ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 55040ee45355SJohannes Berg * copies its contents to the given buffer. 55050ee45355SJohannes Berg * 55060ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 55070ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 55080ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 55090ee45355SJohannes Berg */ 5510c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 5511c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 5512c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 55130ee45355SJohannes Berg 5514cd8f7cb4SJohannes Berg /** 551529464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 551629464cccSJohannes Berg * @ies: the IE buffer 551729464cccSJohannes Berg * @ielen: the length of the IE buffer 551829464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 551929464cccSJohannes Berg * the split 552029464cccSJohannes Berg * @n_ids: the size of the element ID array 552129464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 552229464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 552329464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 552429464cccSJohannes Berg * 552529464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 552629464cccSJohannes Berg * variable to point to the location where the buffer should be 552729464cccSJohannes Berg * split. 552829464cccSJohannes Berg * 552929464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 553029464cccSJohannes Berg * has to be guaranteed by the caller! 553129464cccSJohannes Berg * 553229464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 553329464cccSJohannes Berg * correctly, if not the result of using this function will not 553429464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 553529464cccSJohannes Berg * 553629464cccSJohannes Berg * The function returns the offset where the next part of the 553729464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 553829464cccSJohannes Berg * of the buffer should be used. 553929464cccSJohannes Berg */ 554029464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 554129464cccSJohannes Berg const u8 *ids, int n_ids, 554229464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 554329464cccSJohannes Berg size_t offset); 554429464cccSJohannes Berg 554529464cccSJohannes Berg /** 554629464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 554729464cccSJohannes Berg * @ies: the IE buffer 554829464cccSJohannes Berg * @ielen: the length of the IE buffer 554929464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 555029464cccSJohannes Berg * the split 555129464cccSJohannes Berg * @n_ids: the size of the element ID array 555229464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 555329464cccSJohannes Berg * 555429464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 555529464cccSJohannes Berg * variable to point to the location where the buffer should be 555629464cccSJohannes Berg * split. 555729464cccSJohannes Berg * 555829464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 555929464cccSJohannes Berg * has to be guaranteed by the caller! 556029464cccSJohannes Berg * 556129464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 556229464cccSJohannes Berg * correctly, if not the result of using this function will not 556329464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 556429464cccSJohannes Berg * 556529464cccSJohannes Berg * The function returns the offset where the next part of the 556629464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 556729464cccSJohannes Berg * of the buffer should be used. 556829464cccSJohannes Berg */ 55690483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 55700483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 55710483eeacSJohannes Berg { 55720483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 55730483eeacSJohannes Berg } 557429464cccSJohannes Berg 557529464cccSJohannes Berg /** 5576cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 5577cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 5578cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 5579cd8f7cb4SJohannes Berg * @gfp: allocation flags 5580cd8f7cb4SJohannes Berg * 5581cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 5582cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 5583cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 5584cd8f7cb4SJohannes Berg * else caused the wakeup. 5585cd8f7cb4SJohannes Berg */ 5586cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 5587cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 5588cd8f7cb4SJohannes Berg gfp_t gfp); 5589cd8f7cb4SJohannes Berg 55905de17984SArend van Spriel /** 55915de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 55925de17984SArend van Spriel * 55935de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 559403f831a6SRobert P. J. Day * @gfp: allocation flags 55955de17984SArend van Spriel * 55965de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 55975de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 55985de17984SArend van Spriel * by .crit_proto_start() has expired. 55995de17984SArend van Spriel */ 56005de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 56015de17984SArend van Spriel 5602bdfbec2dSIlan Peer /** 5603bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 5604bdfbec2dSIlan Peer * @wiphy: the wiphy 5605bdfbec2dSIlan Peer * 5606bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 5607bdfbec2dSIlan Peer */ 5608bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 5609bdfbec2dSIlan Peer 5610cb2d956dSLuciano Coelho /** 5611cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 5612cb2d956dSLuciano Coelho * 5613cb2d956dSLuciano Coelho * @wiphy: the wiphy 5614e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 5615cb2d956dSLuciano Coelho * 5616cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 5617cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 5618cb2d956dSLuciano Coelho * the interface combinations. 5619cb2d956dSLuciano Coelho */ 5620cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 5621e227300cSPurushottam Kushwaha struct iface_combination_params *params); 5622cb2d956dSLuciano Coelho 562365a124ddSMichal Kazior /** 562465a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 562565a124ddSMichal Kazior * 562665a124ddSMichal Kazior * @wiphy: the wiphy 5627e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 562865a124ddSMichal Kazior * @iter: function to call for each matching combination 562965a124ddSMichal Kazior * @data: pointer to pass to iter function 563065a124ddSMichal Kazior * 563165a124ddSMichal Kazior * This function can be called by the driver to check what possible 563265a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 563365a124ddSMichal Kazior * purposes. 563465a124ddSMichal Kazior */ 563565a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 5636e227300cSPurushottam Kushwaha struct iface_combination_params *params, 563765a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 563865a124ddSMichal Kazior void *data), 563965a124ddSMichal Kazior void *data); 564065a124ddSMichal Kazior 5641f04c2203SMichal Kazior /* 5642f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 5643f04c2203SMichal Kazior * 5644f04c2203SMichal Kazior * @wiphy: the wiphy 5645f04c2203SMichal Kazior * @wdev: wireless device 5646f04c2203SMichal Kazior * @gfp: context flags 5647f04c2203SMichal Kazior * 5648f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 5649f04c2203SMichal Kazior * disconnected. 5650f04c2203SMichal Kazior * 5651f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 5652f04c2203SMichal Kazior */ 5653f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 5654f04c2203SMichal Kazior gfp_t gfp); 5655f04c2203SMichal Kazior 5656f6837ba8SJohannes Berg /** 5657f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 5658f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 5659f6837ba8SJohannes Berg * 5660f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 5661f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 5662f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 5663f6837ba8SJohannes Berg * that really can't be recovered in any other way. 5664f6837ba8SJohannes Berg * 5665f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 5666f6837ba8SJohannes Berg * the driver while the function is running. 5667f6837ba8SJohannes Berg */ 5668f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5669f6837ba8SJohannes Berg 5670d75bb06bSGautam Kumar Shukla /** 5671d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 5672d75bb06bSGautam Kumar Shukla * 5673d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5674d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5675d75bb06bSGautam Kumar Shukla * 5676d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5677d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5678d75bb06bSGautam Kumar Shukla */ 5679d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 5680d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5681d75bb06bSGautam Kumar Shukla { 5682d75bb06bSGautam Kumar Shukla u8 *ft_byte; 5683d75bb06bSGautam Kumar Shukla 5684d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 5685d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 5686d75bb06bSGautam Kumar Shukla } 5687d75bb06bSGautam Kumar Shukla 5688d75bb06bSGautam Kumar Shukla /** 5689d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 5690d75bb06bSGautam Kumar Shukla * 5691d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 5692d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 5693d75bb06bSGautam Kumar Shukla * 5694d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 5695d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 5696d75bb06bSGautam Kumar Shukla */ 5697d75bb06bSGautam Kumar Shukla static inline bool 5698d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 5699d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 5700d75bb06bSGautam Kumar Shukla { 5701d75bb06bSGautam Kumar Shukla u8 ft_byte; 5702d75bb06bSGautam Kumar Shukla 5703d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 5704d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 5705d75bb06bSGautam Kumar Shukla } 5706b7ffbd7eSJohannes Berg 5707a442b761SAyala Beker /** 5708a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 5709a442b761SAyala Beker * @f: NAN function that should be freed 5710a442b761SAyala Beker * 5711a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 5712a442b761SAyala Beker */ 5713a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 5714a442b761SAyala Beker 571550bcd31dSAyala Beker /** 571650bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 571750bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 571850bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 571950bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 572050bcd31dSAyala Beker * result. 572150bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 572250bcd31dSAyala Beker * @inst_id: the local instance id 572350bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 572450bcd31dSAyala Beker * @addr: the MAC address of the peer 572550bcd31dSAyala Beker * @info_len: the length of the &info 572650bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 572750bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 572850bcd31dSAyala Beker */ 572950bcd31dSAyala Beker struct cfg80211_nan_match_params { 573050bcd31dSAyala Beker enum nl80211_nan_function_type type; 573150bcd31dSAyala Beker u8 inst_id; 573250bcd31dSAyala Beker u8 peer_inst_id; 573350bcd31dSAyala Beker const u8 *addr; 573450bcd31dSAyala Beker u8 info_len; 573550bcd31dSAyala Beker const u8 *info; 573650bcd31dSAyala Beker u64 cookie; 573750bcd31dSAyala Beker }; 573850bcd31dSAyala Beker 573950bcd31dSAyala Beker /** 574050bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 574150bcd31dSAyala Beker * @wdev: the wireless device reporting the match 574250bcd31dSAyala Beker * @match: match notification parameters 574350bcd31dSAyala Beker * @gfp: allocation flags 574450bcd31dSAyala Beker * 574550bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 574650bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 574750bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 574850bcd31dSAyala Beker */ 574950bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 575050bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 575150bcd31dSAyala Beker 5752368e5a7bSAyala Beker /** 5753368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 5754368e5a7bSAyala Beker * 5755368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 5756368e5a7bSAyala Beker * @inst_id: the local instance id 5757368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 5758368e5a7bSAyala Beker * @cookie: unique NAN function identifier 5759368e5a7bSAyala Beker * @gfp: allocation flags 5760368e5a7bSAyala Beker * 5761368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 5762368e5a7bSAyala Beker */ 5763368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 5764368e5a7bSAyala Beker u8 inst_id, 5765368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 5766368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 5767368e5a7bSAyala Beker 5768b7ffbd7eSJohannes Berg /* ethtool helper */ 5769b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 5770b7ffbd7eSJohannes Berg 5771e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 5772e1db74fcSJoe Perches 5773e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 5774e1db74fcSJoe Perches 5775e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 57769c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 5777e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 57789c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 5779e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 57809c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 5781e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 57829c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 5783e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 57849c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 5785e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 57869c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 5787e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 57889c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 5789e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 57909c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 5791073730d7SJoe Perches 57929c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 5793e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 57949c376639SJoe Perches 5795e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 57969c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 5797e1db74fcSJoe Perches 5798e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 5799e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 5800e1db74fcSJoe Perches #else 5801e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 5802e1db74fcSJoe Perches ({ \ 5803e1db74fcSJoe Perches if (0) \ 5804e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 5805e1db74fcSJoe Perches 0; \ 5806e1db74fcSJoe Perches }) 5807e1db74fcSJoe Perches #endif 5808e1db74fcSJoe Perches 5809e1db74fcSJoe Perches /* 5810e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5811e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5812e1db74fcSJoe Perches * file/line information and a backtrace. 5813e1db74fcSJoe Perches */ 5814e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5815e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5816e1db74fcSJoe Perches 5817704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5818