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 8d3236553SJohannes Berg * 9d3236553SJohannes Berg * This program is free software; you can redistribute it and/or modify 10d3236553SJohannes Berg * it under the terms of the GNU General Public License version 2 as 11d3236553SJohannes Berg * published by the Free Software Foundation. 12d3236553SJohannes Berg */ 13704232c2SJohannes Berg 14d3236553SJohannes Berg #include <linux/netdevice.h> 15d3236553SJohannes Berg #include <linux/debugfs.h> 16d3236553SJohannes Berg #include <linux/list.h> 17187f1882SPaul Gortmaker #include <linux/bug.h> 18704232c2SJohannes Berg #include <linux/netlink.h> 19704232c2SJohannes Berg #include <linux/skbuff.h> 2055682965SJohannes Berg #include <linux/nl80211.h> 212a519311SJohannes Berg #include <linux/if_ether.h> 222a519311SJohannes Berg #include <linux/ieee80211.h> 232a0e047eSJohannes Berg #include <linux/net.h> 24d3236553SJohannes Berg #include <net/regulatory.h> 25d3236553SJohannes Berg 26d70e9693SJohannes Berg /** 27d70e9693SJohannes Berg * DOC: Introduction 28d70e9693SJohannes Berg * 29d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 30d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 31d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 32d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 33d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 34d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 35d70e9693SJohannes Berg * 36d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 37d70e9693SJohannes Berg * use restrictions. 38d70e9693SJohannes Berg */ 39d70e9693SJohannes Berg 40d70e9693SJohannes Berg 41d70e9693SJohannes Berg /** 42d70e9693SJohannes Berg * DOC: Device registration 43d70e9693SJohannes Berg * 44d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 45d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 46d70e9693SJohannes Berg * described below. 47d70e9693SJohannes Berg * 48d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 49d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 50d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 51d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 52d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 53d70e9693SJohannes Berg * the wireless part of the interface, normally this struct is embedded in the 54d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 55d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 56d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 57d70e9693SJohannes Berg * 58d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 59d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 60d70e9693SJohannes Berg * structures here describe these capabilities in detail. 61d70e9693SJohannes Berg */ 62d70e9693SJohannes Berg 639f5e8f6eSJohannes Berg struct wiphy; 649f5e8f6eSJohannes Berg 65704232c2SJohannes Berg /* 66d3236553SJohannes Berg * wireless hardware capability structures 67d3236553SJohannes Berg */ 68d3236553SJohannes Berg 69d3236553SJohannes Berg /** 70d3236553SJohannes Berg * enum ieee80211_band - supported frequency bands 71704232c2SJohannes Berg * 72d3236553SJohannes Berg * The bands are assigned this way because the supported 73d3236553SJohannes Berg * bitrates differ in these bands. 74d3236553SJohannes Berg * 75d3236553SJohannes Berg * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 76d3236553SJohannes Berg * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 773a0c52a6SVladimir Kondratiev * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) 78abe37c4bSJohannes Berg * @IEEE80211_NUM_BANDS: number of defined bands 79d3236553SJohannes Berg */ 80d3236553SJohannes Berg enum ieee80211_band { 8113ae75b1SJouni Malinen IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 8213ae75b1SJouni Malinen IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 833a0c52a6SVladimir Kondratiev IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ, 84d3236553SJohannes Berg 85d3236553SJohannes Berg /* keep last */ 86d3236553SJohannes Berg IEEE80211_NUM_BANDS 87d3236553SJohannes Berg }; 88d3236553SJohannes Berg 89d3236553SJohannes Berg /** 90d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 91d3236553SJohannes Berg * 92d3236553SJohannes Berg * Channel flags set by the regulatory control code. 93d3236553SJohannes Berg * 94d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 958fe02e16SLuis R. Rodriguez * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 968fe02e16SLuis R. Rodriguez * sending probe requests or beaconing. 97d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 98689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 99d3236553SJohannes Berg * is not permitted. 100689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 101d3236553SJohannes Berg * is not permitted. 10203f6b084SSeth Forshee * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 103c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 104c7a6ee27SJohannes Berg * this flag indicates that an 80 MHz channel cannot use this 105c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 106c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 107c7a6ee27SJohannes Berg * restrictions. 108c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 109c7a6ee27SJohannes Berg * this flag indicates that an 160 MHz channel cannot use this 110c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 111c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 112c7a6ee27SJohannes Berg * restrictions. 113570dbde1SDavid Spinadel * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 114570dbde1SDavid Spinadel * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT 115ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 116ea077c1cSRostislav Lisovy * on this channel. 117ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 118ea077c1cSRostislav Lisovy * on this channel. 119570dbde1SDavid Spinadel * 120d3236553SJohannes Berg */ 121d3236553SJohannes Berg enum ieee80211_channel_flags { 122d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 1238fe02e16SLuis R. Rodriguez IEEE80211_CHAN_NO_IR = 1<<1, 1248fe02e16SLuis R. Rodriguez /* hole at 1<<2 */ 125d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 126689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 127689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 12803f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 129c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 130c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 131570dbde1SDavid Spinadel IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 132570dbde1SDavid Spinadel IEEE80211_CHAN_GO_CONCURRENT = 1<<10, 133ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_20MHZ = 1<<11, 134ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_10MHZ = 1<<12, 135d3236553SJohannes Berg }; 136d3236553SJohannes Berg 137038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 138689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 139038659e7SLuis R. Rodriguez 14004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 14104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 14204f39047SSimon Wunderlich 143d3236553SJohannes Berg /** 144d3236553SJohannes Berg * struct ieee80211_channel - channel definition 145d3236553SJohannes Berg * 146d3236553SJohannes Berg * This structure describes a single channel for use 147d3236553SJohannes Berg * with cfg80211. 148d3236553SJohannes Berg * 149d3236553SJohannes Berg * @center_freq: center frequency in MHz 150d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 151d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 152d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 153d3236553SJohannes Berg * code to support devices with additional restrictions 154d3236553SJohannes Berg * @band: band this channel belongs to. 155d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 156d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 157eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 158d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 159d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 16077c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 161d3236553SJohannes Berg * @orig_mag: internal use 162d3236553SJohannes Berg * @orig_mpwr: internal use 16304f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 16404f39047SSimon Wunderlich * on this channel. 16504f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 166089027e5SJanusz Dziedzic * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 167d3236553SJohannes Berg */ 168d3236553SJohannes Berg struct ieee80211_channel { 169d3236553SJohannes Berg enum ieee80211_band band; 170d3236553SJohannes Berg u16 center_freq; 171d3236553SJohannes Berg u16 hw_value; 172d3236553SJohannes Berg u32 flags; 173d3236553SJohannes Berg int max_antenna_gain; 174d3236553SJohannes Berg int max_power; 175eccc068eSHong Wu int max_reg_power; 176d3236553SJohannes Berg bool beacon_found; 177d3236553SJohannes Berg u32 orig_flags; 178d3236553SJohannes Berg int orig_mag, orig_mpwr; 17904f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 18004f39047SSimon Wunderlich unsigned long dfs_state_entered; 181089027e5SJanusz Dziedzic unsigned int dfs_cac_ms; 182d3236553SJohannes Berg }; 183d3236553SJohannes Berg 184d3236553SJohannes Berg /** 185d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 186d3236553SJohannes Berg * 187d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 188d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 189d3236553SJohannes Berg * different bands/PHY modes. 190d3236553SJohannes Berg * 191d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 192d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 193d3236553SJohannes Berg * with CCK rates. 194d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 195d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 196d3236553SJohannes Berg * core code when registering the wiphy. 197d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 198d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 199d3236553SJohannes Berg * core code when registering the wiphy. 200d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 201d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 202d3236553SJohannes Berg * core code when registering the wiphy. 203d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 20430e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 20530e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 206d3236553SJohannes Berg */ 207d3236553SJohannes Berg enum ieee80211_rate_flags { 208d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 209d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 210d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 211d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 212d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 21330e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 21430e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 215d3236553SJohannes Berg }; 216d3236553SJohannes Berg 217d3236553SJohannes Berg /** 218d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 219d3236553SJohannes Berg * 220d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 221d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 222d3236553SJohannes Berg * are only for driver use when pointers to this structure are 223d3236553SJohannes Berg * passed around. 224d3236553SJohannes Berg * 225d3236553SJohannes Berg * @flags: rate-specific flags 226d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 227d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 228d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 229d3236553SJohannes Berg * short preamble is used 230d3236553SJohannes Berg */ 231d3236553SJohannes Berg struct ieee80211_rate { 232d3236553SJohannes Berg u32 flags; 233d3236553SJohannes Berg u16 bitrate; 234d3236553SJohannes Berg u16 hw_value, hw_value_short; 235d3236553SJohannes Berg }; 236d3236553SJohannes Berg 237d3236553SJohannes Berg /** 238d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 239d3236553SJohannes Berg * 240d3236553SJohannes Berg * This structure describes most essential parameters needed 241d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 242d3236553SJohannes Berg * 243d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 244d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 245d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 246d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 247d3236553SJohannes Berg * @mcs: Supported MCS rates 248d3236553SJohannes Berg */ 249d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 250d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 251d3236553SJohannes Berg bool ht_supported; 252d3236553SJohannes Berg u8 ampdu_factor; 253d3236553SJohannes Berg u8 ampdu_density; 254d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 255d3236553SJohannes Berg }; 256d3236553SJohannes Berg 257d3236553SJohannes Berg /** 258bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 259bf0c111eSMahesh Palivela * 260bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 261bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 262bf0c111eSMahesh Palivela * 263bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 264bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 265bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 266bf0c111eSMahesh Palivela */ 267bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 268bf0c111eSMahesh Palivela bool vht_supported; 269bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 270bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 271bf0c111eSMahesh Palivela }; 272bf0c111eSMahesh Palivela 273bf0c111eSMahesh Palivela /** 274d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 275d3236553SJohannes Berg * 276d3236553SJohannes Berg * This structure describes a frequency band a wiphy 277d3236553SJohannes Berg * is able to operate in. 278d3236553SJohannes Berg * 279d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 280d3236553SJohannes Berg * in this band. 281d3236553SJohannes Berg * @band: the band this structure represents 282d3236553SJohannes Berg * @n_channels: Number of channels in @channels 283d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 284d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 285d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 286d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 287abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 288c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 289d3236553SJohannes Berg */ 290d3236553SJohannes Berg struct ieee80211_supported_band { 291d3236553SJohannes Berg struct ieee80211_channel *channels; 292d3236553SJohannes Berg struct ieee80211_rate *bitrates; 293d3236553SJohannes Berg enum ieee80211_band band; 294d3236553SJohannes Berg int n_channels; 295d3236553SJohannes Berg int n_bitrates; 296d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 297bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 298d3236553SJohannes Berg }; 299d3236553SJohannes Berg 300d3236553SJohannes Berg /* 301d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 302704232c2SJohannes Berg */ 303704232c2SJohannes Berg 3042ec600d6SLuis Carlos Cobo /** 305d70e9693SJohannes Berg * DOC: Actions and configuration 306d70e9693SJohannes Berg * 307d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 308d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 309d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 310d70e9693SJohannes Berg * operations use are described separately. 311d70e9693SJohannes Berg * 312d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 313d70e9693SJohannes Berg * information via some functions that drivers need to call. 314d70e9693SJohannes Berg * 315d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 316d70e9693SJohannes Berg * in a separate chapter. 317d70e9693SJohannes Berg */ 318d70e9693SJohannes Berg 319d70e9693SJohannes Berg /** 3202ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 3218b787643SFelix Fietkau * @use_4addr: use 4-address frames 322e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 323e8f479b1SBen Greear * If this parameter is set to zero address the driver may 324e8f479b1SBen Greear * determine the address as needed. 325e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 326e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 327e8f479b1SBen Greear ** only p2p devices with specified MAC. 3282ec600d6SLuis Carlos Cobo */ 3292ec600d6SLuis Carlos Cobo struct vif_params { 3308b787643SFelix Fietkau int use_4addr; 3311c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 3322ec600d6SLuis Carlos Cobo }; 3332ec600d6SLuis Carlos Cobo 33441ade00fSJohannes Berg /** 33541ade00fSJohannes Berg * struct key_params - key information 33641ade00fSJohannes Berg * 33741ade00fSJohannes Berg * Information about a key 33841ade00fSJohannes Berg * 33941ade00fSJohannes Berg * @key: key material 34041ade00fSJohannes Berg * @key_len: length of key material 34141ade00fSJohannes Berg * @cipher: cipher suite selector 34241ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 34341ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 34441ade00fSJohannes Berg * length given by @seq_len. 345abe37c4bSJohannes Berg * @seq_len: length of @seq. 34641ade00fSJohannes Berg */ 34741ade00fSJohannes Berg struct key_params { 348c1e5f471SJohannes Berg const u8 *key; 349c1e5f471SJohannes Berg const u8 *seq; 35041ade00fSJohannes Berg int key_len; 35141ade00fSJohannes Berg int seq_len; 35241ade00fSJohannes Berg u32 cipher; 35341ade00fSJohannes Berg }; 35441ade00fSJohannes Berg 355ed1b6cc7SJohannes Berg /** 356683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 357683b6d3bSJohannes Berg * @chan: the (control) channel 3583d9d1d66SJohannes Berg * @width: channel width 3593d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 3603d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 3613d9d1d66SJohannes Berg * (only with 80+80 MHz) 362683b6d3bSJohannes Berg */ 363683b6d3bSJohannes Berg struct cfg80211_chan_def { 364683b6d3bSJohannes Berg struct ieee80211_channel *chan; 3653d9d1d66SJohannes Berg enum nl80211_chan_width width; 3663d9d1d66SJohannes Berg u32 center_freq1; 3673d9d1d66SJohannes Berg u32 center_freq2; 368683b6d3bSJohannes Berg }; 369683b6d3bSJohannes Berg 3703d9d1d66SJohannes Berg /** 3713d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 3723d9d1d66SJohannes Berg * @chandef: the channel definition 3733d9d1d66SJohannes Berg * 3740ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 3753d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 3763d9d1d66SJohannes Berg */ 377683b6d3bSJohannes Berg static inline enum nl80211_channel_type 378683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 379683b6d3bSJohannes Berg { 3803d9d1d66SJohannes Berg switch (chandef->width) { 3813d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 3823d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 3833d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 3843d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 3853d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 3863d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 3873d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 3883d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 3893d9d1d66SJohannes Berg default: 3903d9d1d66SJohannes Berg WARN_ON(1); 3913d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 392683b6d3bSJohannes Berg } 3933d9d1d66SJohannes Berg } 3943d9d1d66SJohannes Berg 3953d9d1d66SJohannes Berg /** 3963d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 3973d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 3983d9d1d66SJohannes Berg * @channel: the control channel 3993d9d1d66SJohannes Berg * @chantype: the channel type 4003d9d1d66SJohannes Berg * 4013d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 4023d9d1d66SJohannes Berg */ 4033d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 4043d9d1d66SJohannes Berg struct ieee80211_channel *channel, 4053d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 4063d9d1d66SJohannes Berg 4073d9d1d66SJohannes Berg /** 4083d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 4093d9d1d66SJohannes Berg * @chandef1: first channel definition 4103d9d1d66SJohannes Berg * @chandef2: second channel definition 4113d9d1d66SJohannes Berg * 4120ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 4133d9d1d66SJohannes Berg * identical, %false otherwise. 4143d9d1d66SJohannes Berg */ 4153d9d1d66SJohannes Berg static inline bool 4163d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 4173d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 4183d9d1d66SJohannes Berg { 4193d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 4203d9d1d66SJohannes Berg chandef1->width == chandef2->width && 4213d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 4223d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 4233d9d1d66SJohannes Berg } 4243d9d1d66SJohannes Berg 4253d9d1d66SJohannes Berg /** 4263d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 4273d9d1d66SJohannes Berg * @chandef1: first channel definition 4283d9d1d66SJohannes Berg * @chandef2: second channel definition 4293d9d1d66SJohannes Berg * 4300ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 4313d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 4323d9d1d66SJohannes Berg */ 4333d9d1d66SJohannes Berg const struct cfg80211_chan_def * 4343d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 4353d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 436683b6d3bSJohannes Berg 437683b6d3bSJohannes Berg /** 4389f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 4399f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4400ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 4419f5e8f6eSJohannes Berg */ 4429f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 4439f5e8f6eSJohannes Berg 4449f5e8f6eSJohannes Berg /** 4459f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 4469f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 4479f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4480ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 4490ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 4509f5e8f6eSJohannes Berg */ 4519f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 4529f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 4539f5e8f6eSJohannes Berg u32 prohibited_flags); 4549f5e8f6eSJohannes Berg 4559f5e8f6eSJohannes Berg /** 456774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 457774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 458774f0734SSimon Wunderlich * @chandef: the channel definition to check 4592beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 4602beb6dabSLuciano Coelho * Returns: 4612beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 462774f0734SSimon Wunderlich */ 463774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 4642beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 465c3d62036SLuciano Coelho enum nl80211_iftype iftype); 466774f0734SSimon Wunderlich 467774f0734SSimon Wunderlich /** 46830e74732SSimon Wunderlich * ieee80211_chandef_rate_flags - returns rate flags for a channel 46930e74732SSimon Wunderlich * 47030e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 47130e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 47230e74732SSimon Wunderlich * 47330e74732SSimon Wunderlich * @chandef: channel definition for the channel 47430e74732SSimon Wunderlich * 47530e74732SSimon Wunderlich * Returns: rate flags which apply for this channel 47630e74732SSimon Wunderlich */ 47730e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 47830e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 47930e74732SSimon Wunderlich { 48030e74732SSimon Wunderlich switch (chandef->width) { 48130e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 48230e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 48330e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 48430e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 48530e74732SSimon Wunderlich default: 48630e74732SSimon Wunderlich break; 48730e74732SSimon Wunderlich } 48830e74732SSimon Wunderlich return 0; 48930e74732SSimon Wunderlich } 49030e74732SSimon Wunderlich 49130e74732SSimon Wunderlich /** 4920430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 4930430c883SSimon Wunderlich * 4940430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 4950430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 4960430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 4970430c883SSimon Wunderlich * 4980430c883SSimon Wunderlich * @chandef: channel definition for the channel 4990430c883SSimon Wunderlich * 5000430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 5010430c883SSimon Wunderlich */ 5020430c883SSimon Wunderlich static inline int 5030430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 5040430c883SSimon Wunderlich { 5050430c883SSimon Wunderlich switch (chandef->width) { 5060430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 5070430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 5080430c883SSimon Wunderlich chandef->chan->max_power); 5090430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 5100430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 5110430c883SSimon Wunderlich chandef->chan->max_power); 5120430c883SSimon Wunderlich default: 5130430c883SSimon Wunderlich break; 5140430c883SSimon Wunderlich } 5150430c883SSimon Wunderlich return chandef->chan->max_power; 5160430c883SSimon Wunderlich } 5170430c883SSimon Wunderlich 5180430c883SSimon Wunderlich /** 51961fa713cSHolger Schurig * enum survey_info_flags - survey information flags 52061fa713cSHolger Schurig * 521abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 52217e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 5238610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in 5248610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in 5258610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in 5268610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in 5278610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in 528abe37c4bSJohannes Berg * 52961fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 53061fa713cSHolger Schurig * it has filled in during the get_survey(). 53161fa713cSHolger Schurig */ 53261fa713cSHolger Schurig enum survey_info_flags { 53361fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 53417e5a808SFelix Fietkau SURVEY_INFO_IN_USE = 1<<1, 5358610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME = 1<<2, 5368610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, 5378610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, 5388610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, 5398610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, 54061fa713cSHolger Schurig }; 54161fa713cSHolger Schurig 54261fa713cSHolger Schurig /** 54361fa713cSHolger Schurig * struct survey_info - channel survey response 54461fa713cSHolger Schurig * 54561fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 54661fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 54761fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 54861fa713cSHolger Schurig * optional 5498610c29aSFelix Fietkau * @channel_time: amount of time in ms the radio spent on the channel 5508610c29aSFelix Fietkau * @channel_time_busy: amount of time the primary channel was sensed busy 5518610c29aSFelix Fietkau * @channel_time_ext_busy: amount of time the extension channel was sensed busy 5528610c29aSFelix Fietkau * @channel_time_rx: amount of time the radio spent receiving data 5538610c29aSFelix Fietkau * @channel_time_tx: amount of time the radio spent transmitting data 55461fa713cSHolger Schurig * 555abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 556abe37c4bSJohannes Berg * 55761fa713cSHolger Schurig * This structure can later be expanded with things like 55861fa713cSHolger Schurig * channel duty cycle etc. 55961fa713cSHolger Schurig */ 56061fa713cSHolger Schurig struct survey_info { 56161fa713cSHolger Schurig struct ieee80211_channel *channel; 5628610c29aSFelix Fietkau u64 channel_time; 5638610c29aSFelix Fietkau u64 channel_time_busy; 5648610c29aSFelix Fietkau u64 channel_time_ext_busy; 5658610c29aSFelix Fietkau u64 channel_time_rx; 5668610c29aSFelix Fietkau u64 channel_time_tx; 56761fa713cSHolger Schurig u32 filled; 56861fa713cSHolger Schurig s8 noise; 56961fa713cSHolger Schurig }; 57061fa713cSHolger Schurig 57161fa713cSHolger Schurig /** 5725fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 5735fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 5745fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 5755fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 5765fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 5775fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 5785fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 5795fb628e9SJouni Malinen * @akm_suites: AKM suites 5805fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 5815fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 5825fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 5835fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 5845fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 5855fb628e9SJouni Malinen * allowed through even on unauthorized ports 5865fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 5875fb628e9SJouni Malinen * protocol frames. 5885fb628e9SJouni Malinen */ 5895fb628e9SJouni Malinen struct cfg80211_crypto_settings { 5905fb628e9SJouni Malinen u32 wpa_versions; 5915fb628e9SJouni Malinen u32 cipher_group; 5925fb628e9SJouni Malinen int n_ciphers_pairwise; 5935fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 5945fb628e9SJouni Malinen int n_akm_suites; 5955fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 5965fb628e9SJouni Malinen bool control_port; 5975fb628e9SJouni Malinen __be16 control_port_ethertype; 5985fb628e9SJouni Malinen bool control_port_no_encrypt; 5995fb628e9SJouni Malinen }; 6005fb628e9SJouni Malinen 6015fb628e9SJouni Malinen /** 6028860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 603ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 604ed1b6cc7SJohannes Berg * or %NULL if not changed 605ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 606ed1b6cc7SJohannes Berg * or %NULL if not changed 607ed1b6cc7SJohannes Berg * @head_len: length of @head 608ed1b6cc7SJohannes Berg * @tail_len: length of @tail 6099946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 6109946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 6119946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 6129946ecfbSJouni Malinen * frames or %NULL 6139946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 6149946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 6159946ecfbSJouni Malinen * Response frames or %NULL 6169946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 61700f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 61800f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 619ed1b6cc7SJohannes Berg */ 6208860020eSJohannes Berg struct cfg80211_beacon_data { 6218860020eSJohannes Berg const u8 *head, *tail; 6228860020eSJohannes Berg const u8 *beacon_ies; 6238860020eSJohannes Berg const u8 *proberesp_ies; 6248860020eSJohannes Berg const u8 *assocresp_ies; 6258860020eSJohannes Berg const u8 *probe_resp; 6268860020eSJohannes Berg 6278860020eSJohannes Berg size_t head_len, tail_len; 6288860020eSJohannes Berg size_t beacon_ies_len; 6298860020eSJohannes Berg size_t proberesp_ies_len; 6308860020eSJohannes Berg size_t assocresp_ies_len; 6318860020eSJohannes Berg size_t probe_resp_len; 6328860020eSJohannes Berg }; 6338860020eSJohannes Berg 6346d45a74bSVasanthakumar Thiagarajan struct mac_address { 6356d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 6366d45a74bSVasanthakumar Thiagarajan }; 6376d45a74bSVasanthakumar Thiagarajan 6388860020eSJohannes Berg /** 63977765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 64077765eafSVasanthakumar Thiagarajan * 64177765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 642077f897aSJohannes Berg * entry specified by mac_addr 64377765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 64477765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 64577765eafSVasanthakumar Thiagarajan */ 64677765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 64777765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 64877765eafSVasanthakumar Thiagarajan int n_acl_entries; 64977765eafSVasanthakumar Thiagarajan 65077765eafSVasanthakumar Thiagarajan /* Keep it last */ 65177765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 65277765eafSVasanthakumar Thiagarajan }; 65377765eafSVasanthakumar Thiagarajan 6548860020eSJohannes Berg /** 6558860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 6568860020eSJohannes Berg * 6578860020eSJohannes Berg * Used to configure an AP interface. 6588860020eSJohannes Berg * 659683b6d3bSJohannes Berg * @chandef: defines the channel to use 6608860020eSJohannes Berg * @beacon: beacon data 6618860020eSJohannes Berg * @beacon_interval: beacon interval 6628860020eSJohannes Berg * @dtim_period: DTIM period 6638860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 6648860020eSJohannes Berg * user space) 6658860020eSJohannes Berg * @ssid_len: length of @ssid 6668860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 6678860020eSJohannes Berg * @crypto: crypto settings 6688860020eSJohannes Berg * @privacy: the BSS uses privacy 6698860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 67018998c38SEliad Peller * @smps_mode: SMPS mode 6711b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 67253cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 67353cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 67477765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 67577765eafSVasanthakumar Thiagarajan * MAC address based access control 6768860020eSJohannes Berg */ 6778860020eSJohannes Berg struct cfg80211_ap_settings { 678683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 679aa430da4SJohannes Berg 6808860020eSJohannes Berg struct cfg80211_beacon_data beacon; 6818860020eSJohannes Berg 6828860020eSJohannes Berg int beacon_interval, dtim_period; 68332e9de84SJouni Malinen const u8 *ssid; 68432e9de84SJouni Malinen size_t ssid_len; 68532e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 6865fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 6875fb628e9SJouni Malinen bool privacy; 6885fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 68918998c38SEliad Peller enum nl80211_smps_mode smps_mode; 6901b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 69153cabad7SJohannes Berg u8 p2p_ctwindow; 69253cabad7SJohannes Berg bool p2p_opp_ps; 69377765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 694ed1b6cc7SJohannes Berg }; 695ed1b6cc7SJohannes Berg 6965727ef1bSJohannes Berg /** 69716ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 69816ef1fe2SSimon Wunderlich * 69916ef1fe2SSimon Wunderlich * Used for channel switch 70016ef1fe2SSimon Wunderlich * 70116ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 70216ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 7039a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 7049a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 7059a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 7069a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 70716ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 70816ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 70916ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 71016ef1fe2SSimon Wunderlich * @count: number of beacons until switch 71116ef1fe2SSimon Wunderlich */ 71216ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 71316ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 71416ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 7159a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 7169a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 7179a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 7189a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 71916ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 72016ef1fe2SSimon Wunderlich bool radar_required; 72116ef1fe2SSimon Wunderlich bool block_tx; 72216ef1fe2SSimon Wunderlich u8 count; 72316ef1fe2SSimon Wunderlich }; 72416ef1fe2SSimon Wunderlich 72516ef1fe2SSimon Wunderlich /** 7263b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 7273b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 7289d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 729f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 7303b9ce80cSJohannes Berg * 7313b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 7323b9ce80cSJohannes Berg * for those that don't these flags will are used. 7333b9ce80cSJohannes Berg */ 7343b9ce80cSJohannes Berg enum station_parameters_apply_mask { 7353b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 7369d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 737f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 7383b9ce80cSJohannes Berg }; 7393b9ce80cSJohannes Berg 7403b9ce80cSJohannes Berg /** 7415727ef1bSJohannes Berg * struct station_parameters - station parameters 7425727ef1bSJohannes Berg * 7435727ef1bSJohannes Berg * Used to change and create a new station. 7445727ef1bSJohannes Berg * 7455727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 7465727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 7475727ef1bSJohannes Berg * (or NULL for no change) 7485727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 749eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 750eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 751eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 752eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 7535727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 7545727ef1bSJohannes Berg * @aid: AID or zero for no change 755abe37c4bSJohannes Berg * @plink_action: plink action to take 7569c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 757abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 758f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 759910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 760910868dbSEliad Peller * as the AC bitmap in the QoS info field 761910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 762910868dbSEliad Peller * QoS info field (but already shifted down) 763c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 764c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 765c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 7663b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 7673b1c5a53SMarco Porsch * to unknown) 7689d62a986SJouni Malinen * @capability: station capability 7699d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 7709d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 771c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 772c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 773c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 774c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 77560f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 77660f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 7775727ef1bSJohannes Berg */ 7785727ef1bSJohannes Berg struct station_parameters { 7792c1aabf3SJohannes Berg const u8 *supported_rates; 7805727ef1bSJohannes Berg struct net_device *vlan; 781eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 7823b9ce80cSJohannes Berg u32 sta_modify_mask; 7835727ef1bSJohannes Berg int listen_interval; 7845727ef1bSJohannes Berg u16 aid; 7855727ef1bSJohannes Berg u8 supported_rates_len; 7862ec600d6SLuis Carlos Cobo u8 plink_action; 7879c3990aaSJavier Cardona u8 plink_state; 7882c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 7892c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 790c75786c9SEliad Peller u8 uapsd_queues; 791c75786c9SEliad Peller u8 max_sp; 7923b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 7939d62a986SJouni Malinen u16 capability; 7942c1aabf3SJohannes Berg const u8 *ext_capab; 7959d62a986SJouni Malinen u8 ext_capab_len; 796c01fc9adSSunil Dutt const u8 *supported_channels; 797c01fc9adSSunil Dutt u8 supported_channels_len; 798c01fc9adSSunil Dutt const u8 *supported_oper_classes; 799c01fc9adSSunil Dutt u8 supported_oper_classes_len; 80060f4a7b1SMarek Kwaczynski u8 opmode_notif; 80160f4a7b1SMarek Kwaczynski bool opmode_notif_used; 8025727ef1bSJohannes Berg }; 8035727ef1bSJohannes Berg 804fd5b74dcSJohannes Berg /** 80589c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 80689c771e5SJouni Malinen * 80789c771e5SJouni Malinen * Used to delete a station entry (or all stations). 80889c771e5SJouni Malinen * 80989c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 81098856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 81198856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 81298856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 81389c771e5SJouni Malinen */ 81489c771e5SJouni Malinen struct station_del_parameters { 81589c771e5SJouni Malinen const u8 *mac; 81698856866SJouni Malinen u8 subtype; 81798856866SJouni Malinen u16 reason_code; 81889c771e5SJouni Malinen }; 81989c771e5SJouni Malinen 82089c771e5SJouni Malinen /** 82177ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 82277ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 82377ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 82477ee7c89SJohannes Berg * the AP MLME in the device 82577ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 82677ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 82777ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 82877ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 82977ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 83077ee7c89SJohannes Berg * supported/used) 83177ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 83277ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 833eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 834eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 83577ee7c89SJohannes Berg */ 83677ee7c89SJohannes Berg enum cfg80211_station_type { 83777ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 83877ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 83977ee7c89SJohannes Berg CFG80211_STA_AP_STA, 84077ee7c89SJohannes Berg CFG80211_STA_IBSS, 84177ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 84277ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 843eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 844eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 84577ee7c89SJohannes Berg }; 84677ee7c89SJohannes Berg 84777ee7c89SJohannes Berg /** 84877ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 84977ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 85077ee7c89SJohannes Berg * @params: the new parameters for a station 85177ee7c89SJohannes Berg * @statype: the type of station being modified 85277ee7c89SJohannes Berg * 85377ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 85477ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 85577ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 85677ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 85777ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 85877ee7c89SJohannes Berg */ 85977ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 86077ee7c89SJohannes Berg struct station_parameters *params, 86177ee7c89SJohannes Berg enum cfg80211_station_type statype); 86277ee7c89SJohannes Berg 86377ee7c89SJohannes Berg /** 8642ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 865fd5b74dcSJohannes Berg * 8662ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 8672ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 868fd5b74dcSJohannes Berg * 8692ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 8702ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 8712ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 872077f897aSJohannes Berg * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value 873077f897aSJohannes Berg * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value 8742ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 8752ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 8762ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 877420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 878c8dcfd8aSFelix Fietkau * @STATION_INFO_TX_BITRATE: @txrate fields are filled 879420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 88042745e03SVladimir Kondratiev * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value 88142745e03SVladimir Kondratiev * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value 882b206b4efSBruno Randolf * @STATION_INFO_TX_RETRIES: @tx_retries filled 883b206b4efSBruno Randolf * @STATION_INFO_TX_FAILED: @tx_failed filled 8845a5c731aSBen Greear * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 885541a45a1SBruno Randolf * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 886c8dcfd8aSFelix Fietkau * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 887f4263c98SPaul Stewart * @STATION_INFO_BSS_PARAM: @bss_param filled 888ebe27c91SMohammed Shafi Shajakhan * @STATION_INFO_CONNECTED_TIME: @connected_time filled 889040bdf71SFelix Fietkau * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 890bb6e753eSHelmut Schaa * @STATION_INFO_STA_FLAGS: @sta_flags filled 891a85e1d55SPaul Stewart * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 892d299a1f2SJavier Cardona * @STATION_INFO_T_OFFSET: @t_offset filled 8933b1c5a53SMarco Porsch * @STATION_INFO_LOCAL_PM: @local_pm filled 8943b1c5a53SMarco Porsch * @STATION_INFO_PEER_PM: @peer_pm filled 8953b1c5a53SMarco Porsch * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 896119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 897119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 898867d849fSAntonio Quartulli * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled 899fd5b74dcSJohannes Berg */ 9002ec600d6SLuis Carlos Cobo enum station_info_flags { 901867d849fSAntonio Quartulli STATION_INFO_INACTIVE_TIME = BIT(0), 902867d849fSAntonio Quartulli STATION_INFO_RX_BYTES = BIT(1), 903867d849fSAntonio Quartulli STATION_INFO_TX_BYTES = BIT(2), 904867d849fSAntonio Quartulli STATION_INFO_LLID = BIT(3), 905867d849fSAntonio Quartulli STATION_INFO_PLID = BIT(4), 906867d849fSAntonio Quartulli STATION_INFO_PLINK_STATE = BIT(5), 907867d849fSAntonio Quartulli STATION_INFO_SIGNAL = BIT(6), 908867d849fSAntonio Quartulli STATION_INFO_TX_BITRATE = BIT(7), 909867d849fSAntonio Quartulli STATION_INFO_RX_PACKETS = BIT(8), 910867d849fSAntonio Quartulli STATION_INFO_TX_PACKETS = BIT(9), 911867d849fSAntonio Quartulli STATION_INFO_TX_RETRIES = BIT(10), 912867d849fSAntonio Quartulli STATION_INFO_TX_FAILED = BIT(11), 913867d849fSAntonio Quartulli STATION_INFO_RX_DROP_MISC = BIT(12), 914867d849fSAntonio Quartulli STATION_INFO_SIGNAL_AVG = BIT(13), 915867d849fSAntonio Quartulli STATION_INFO_RX_BITRATE = BIT(14), 916867d849fSAntonio Quartulli STATION_INFO_BSS_PARAM = BIT(15), 917867d849fSAntonio Quartulli STATION_INFO_CONNECTED_TIME = BIT(16), 918867d849fSAntonio Quartulli STATION_INFO_ASSOC_REQ_IES = BIT(17), 919867d849fSAntonio Quartulli STATION_INFO_STA_FLAGS = BIT(18), 920867d849fSAntonio Quartulli STATION_INFO_BEACON_LOSS_COUNT = BIT(19), 921867d849fSAntonio Quartulli STATION_INFO_T_OFFSET = BIT(20), 922867d849fSAntonio Quartulli STATION_INFO_LOCAL_PM = BIT(21), 923867d849fSAntonio Quartulli STATION_INFO_PEER_PM = BIT(22), 924867d849fSAntonio Quartulli STATION_INFO_NONPEER_PM = BIT(23), 925867d849fSAntonio Quartulli STATION_INFO_RX_BYTES64 = BIT(24), 926867d849fSAntonio Quartulli STATION_INFO_TX_BYTES64 = BIT(25), 927867d849fSAntonio Quartulli STATION_INFO_CHAIN_SIGNAL = BIT(26), 928867d849fSAntonio Quartulli STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), 929867d849fSAntonio Quartulli STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), 930420e7fabSHenning Rogge }; 931420e7fabSHenning Rogge 932420e7fabSHenning Rogge /** 933420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 934420e7fabSHenning Rogge * 935420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 936420e7fabSHenning Rogge * type for 802.11n transmissions. 937420e7fabSHenning Rogge * 938db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 939db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 940db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission 941db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission 942db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission 943db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission 944420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 945db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 946420e7fabSHenning Rogge */ 947420e7fabSHenning Rogge enum rate_info_flags { 948db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 949db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 950db9c64cfSJohannes Berg RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2), 951db9c64cfSJohannes Berg RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3), 952db9c64cfSJohannes Berg RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4), 953db9c64cfSJohannes Berg RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5), 954db9c64cfSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(6), 955db9c64cfSJohannes Berg RATE_INFO_FLAGS_60G = BIT(7), 956420e7fabSHenning Rogge }; 957420e7fabSHenning Rogge 958420e7fabSHenning Rogge /** 959420e7fabSHenning Rogge * struct rate_info - bitrate information 960420e7fabSHenning Rogge * 961420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 962420e7fabSHenning Rogge * 963420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 964420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 965420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 966db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 967420e7fabSHenning Rogge */ 968420e7fabSHenning Rogge struct rate_info { 969420e7fabSHenning Rogge u8 flags; 970420e7fabSHenning Rogge u8 mcs; 971420e7fabSHenning Rogge u16 legacy; 972db9c64cfSJohannes Berg u8 nss; 973fd5b74dcSJohannes Berg }; 974fd5b74dcSJohannes Berg 975fd5b74dcSJohannes Berg /** 976f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 977f4263c98SPaul Stewart * 978f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 979f4263c98SPaul Stewart * type for 802.11n transmissions. 980f4263c98SPaul Stewart * 981f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 982f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 983f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 984f4263c98SPaul Stewart */ 985f4263c98SPaul Stewart enum bss_param_flags { 986f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 987f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 988f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 989f4263c98SPaul Stewart }; 990f4263c98SPaul Stewart 991f4263c98SPaul Stewart /** 992f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 993f4263c98SPaul Stewart * 994f4263c98SPaul Stewart * Information about the currently associated BSS 995f4263c98SPaul Stewart * 996f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 997f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 998f4263c98SPaul Stewart * @beacon_interval: beacon interval 999f4263c98SPaul Stewart */ 1000f4263c98SPaul Stewart struct sta_bss_parameters { 1001f4263c98SPaul Stewart u8 flags; 1002f4263c98SPaul Stewart u8 dtim_period; 1003f4263c98SPaul Stewart u16 beacon_interval; 1004f4263c98SPaul Stewart }; 1005f4263c98SPaul Stewart 1006119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1007119363c7SFelix Fietkau 1008f4263c98SPaul Stewart /** 10092ec600d6SLuis Carlos Cobo * struct station_info - station information 1010fd5b74dcSJohannes Berg * 10112ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1012fd5b74dcSJohannes Berg * 10132ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 1014ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1015fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 1016fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 1017fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 10182ec600d6SLuis Carlos Cobo * @llid: mesh local link id 10192ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 10202ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 102173c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 102273c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 102373c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 102473c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1025119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1026119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1027119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1028858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1029858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 103098c8a60aSJouni Malinen * @rx_packets: packets received from this station 103198c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 1032b206b4efSBruno Randolf * @tx_retries: cumulative retry counts 1033b206b4efSBruno Randolf * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 10345a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 10351ba01458SRandy Dunlap * @bss_param: current BSS parameters 1036f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1037f5ea9120SJohannes Berg * This number should increase every time the list of stations 1038f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1039f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 104050d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 104150d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 104250d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 104350d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 104450d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1045c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1046a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1047d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 10483b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 10493b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 10503b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1051867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1052867d849fSAntonio Quartulli * towards this station. 1053fd5b74dcSJohannes Berg */ 10542ec600d6SLuis Carlos Cobo struct station_info { 1055fd5b74dcSJohannes Berg u32 filled; 1056ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1057fd5b74dcSJohannes Berg u32 inactive_time; 105842745e03SVladimir Kondratiev u64 rx_bytes; 105942745e03SVladimir Kondratiev u64 tx_bytes; 10602ec600d6SLuis Carlos Cobo u16 llid; 10612ec600d6SLuis Carlos Cobo u16 plid; 10622ec600d6SLuis Carlos Cobo u8 plink_state; 1063420e7fabSHenning Rogge s8 signal; 1064541a45a1SBruno Randolf s8 signal_avg; 1065119363c7SFelix Fietkau 1066119363c7SFelix Fietkau u8 chains; 1067119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1068119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1069119363c7SFelix Fietkau 1070420e7fabSHenning Rogge struct rate_info txrate; 1071c8dcfd8aSFelix Fietkau struct rate_info rxrate; 107298c8a60aSJouni Malinen u32 rx_packets; 107398c8a60aSJouni Malinen u32 tx_packets; 1074b206b4efSBruno Randolf u32 tx_retries; 1075b206b4efSBruno Randolf u32 tx_failed; 10765a5c731aSBen Greear u32 rx_dropped_misc; 1077f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1078bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1079f5ea9120SJohannes Berg 1080f5ea9120SJohannes Berg int generation; 108150d3dfb7SJouni Malinen 108250d3dfb7SJouni Malinen const u8 *assoc_req_ies; 108350d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1084f612cedfSJouni Malinen 1085a85e1d55SPaul Stewart u32 beacon_loss_count; 1086d299a1f2SJavier Cardona s64 t_offset; 10873b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 10883b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 10893b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1090a85e1d55SPaul Stewart 1091867d849fSAntonio Quartulli u32 expected_throughput; 1092867d849fSAntonio Quartulli 1093f612cedfSJouni Malinen /* 1094f612cedfSJouni Malinen * Note: Add a new enum station_info_flags value for each new field and 1095f612cedfSJouni Malinen * use it to check which fields are initialized. 1096f612cedfSJouni Malinen */ 1097fd5b74dcSJohannes Berg }; 1098fd5b74dcSJohannes Berg 109966f7ac50SMichael Wu /** 11007406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 11017406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 11027406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 11037406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 11047406353dSAntonio Quartulli * 11057406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 11067406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 11077406353dSAntonio Quartulli * considered undefined. 11087406353dSAntonio Quartulli */ 11097406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 11107406353dSAntonio Quartulli struct station_info *sinfo); 11117406353dSAntonio Quartulli 11127406353dSAntonio Quartulli /** 111366f7ac50SMichael Wu * enum monitor_flags - monitor flags 111466f7ac50SMichael Wu * 111566f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 111666f7ac50SMichael Wu * according to the nl80211 flags. 111766f7ac50SMichael Wu * 111866f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 111966f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 112066f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 112166f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 112266f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1123e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 112466f7ac50SMichael Wu */ 112566f7ac50SMichael Wu enum monitor_flags { 112666f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 112766f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 112866f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 112966f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 113066f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1131e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 113266f7ac50SMichael Wu }; 113366f7ac50SMichael Wu 11342ec600d6SLuis Carlos Cobo /** 11352ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 11362ec600d6SLuis Carlos Cobo * 11372ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 11382ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 11392ec600d6SLuis Carlos Cobo * 1140abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1141abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1142abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1143abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1144abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1145abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1146abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 11472ec600d6SLuis Carlos Cobo */ 11482ec600d6SLuis Carlos Cobo enum mpath_info_flags { 11492ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1150d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 11512ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 11522ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 11532ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 11542ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 11552ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 11562ec600d6SLuis Carlos Cobo }; 11572ec600d6SLuis Carlos Cobo 11582ec600d6SLuis Carlos Cobo /** 11592ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 11602ec600d6SLuis Carlos Cobo * 11612ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 11622ec600d6SLuis Carlos Cobo * 11632ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 11642ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1165d19b3bf6SRui Paulo * @sn: target sequence number 11662ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 11672ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 11682ec600d6SLuis Carlos Cobo * @flags: mesh path flags 11692ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 11702ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1171f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1172f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1173f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1174f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 11752ec600d6SLuis Carlos Cobo */ 11762ec600d6SLuis Carlos Cobo struct mpath_info { 11772ec600d6SLuis Carlos Cobo u32 filled; 11782ec600d6SLuis Carlos Cobo u32 frame_qlen; 1179d19b3bf6SRui Paulo u32 sn; 11802ec600d6SLuis Carlos Cobo u32 metric; 11812ec600d6SLuis Carlos Cobo u32 exptime; 11822ec600d6SLuis Carlos Cobo u32 discovery_timeout; 11832ec600d6SLuis Carlos Cobo u8 discovery_retries; 11842ec600d6SLuis Carlos Cobo u8 flags; 1185f5ea9120SJohannes Berg 1186f5ea9120SJohannes Berg int generation; 11872ec600d6SLuis Carlos Cobo }; 11882ec600d6SLuis Carlos Cobo 11899f1ba906SJouni Malinen /** 11909f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 11919f1ba906SJouni Malinen * 11929f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 11939f1ba906SJouni Malinen * 11949f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 11959f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 11969f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 11979f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 11989f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 11999f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 120090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 120190c97a04SJouni Malinen * (or NULL for no change) 120290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1203fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 120450b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 120550b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 120653cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 120753cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 12089f1ba906SJouni Malinen */ 12099f1ba906SJouni Malinen struct bss_parameters { 12109f1ba906SJouni Malinen int use_cts_prot; 12119f1ba906SJouni Malinen int use_short_preamble; 12129f1ba906SJouni Malinen int use_short_slot_time; 1213c1e5f471SJohannes Berg const u8 *basic_rates; 121490c97a04SJouni Malinen u8 basic_rates_len; 1215fd8aaaf3SFelix Fietkau int ap_isolate; 121650b12f59SHelmut Schaa int ht_opmode; 121753cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 12189f1ba906SJouni Malinen }; 12192ec600d6SLuis Carlos Cobo 12203ddd53f3SChun-Yeow Yeoh /** 122129cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 122229cbe68cSJohannes Berg * 122329cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 12243ddd53f3SChun-Yeow Yeoh * 12253ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 12263ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 12273ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 12283ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 12293ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 12303ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 12313ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 12323ddd53f3SChun-Yeow Yeoh * mesh interface 12333ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 12343ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 12353ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 12363ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 12373ddd53f3SChun-Yeow Yeoh * elements 12383ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 12393ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 12403ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 12413ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 12423ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 12433ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 12443ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 12453ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 12463ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 12473ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 12483ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 12493ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 12503ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 12513ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 12523ddd53f3SChun-Yeow Yeoh * element 12533ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 12543ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 12553ddd53f3SChun-Yeow Yeoh * element 12563ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 12573ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 12583ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 12593ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 12603ddd53f3SChun-Yeow Yeoh * announcements are transmitted 12613ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 12623ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 12633ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 12643ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 12653ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 12663ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 12673ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 12683ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 12693ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 12703ddd53f3SChun-Yeow Yeoh * station to establish a peer link 12713ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1272ac1073a6SChun-Yeow Yeoh * 1273ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1274ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1275ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1276ac1073a6SChun-Yeow Yeoh * 1277ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1278ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1279728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1280728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1281728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 12823b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 12833b1c5a53SMarco Porsch * setting for new peer links. 12843b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 12853b1c5a53SMarco Porsch * after transmitting its beacon. 12868e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 12878e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 12888e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 128929cbe68cSJohannes Berg */ 129093da9cc1Scolin@cozybit.com struct mesh_config { 129193da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 129293da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 129393da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 129493da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 129593da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 129693da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 129745904f21SJavier Cardona u8 element_ttl; 129893da9cc1Scolin@cozybit.com bool auto_open_plinks; 1299d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 130093da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 130193da9cc1Scolin@cozybit.com u32 path_refresh_time; 130293da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 130393da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 130493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1305dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 130693da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 130763c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 13080507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 130916dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 131094f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 131155335137SAshok Nagarajan s32 rssi_threshold; 131270c33eaaSAshok Nagarajan u16 ht_opmode; 1313ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1314ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1315728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 13163b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 13173b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 13188e7c0538SColleen Twitty u32 plink_timeout; 131993da9cc1Scolin@cozybit.com }; 132093da9cc1Scolin@cozybit.com 132131888487SJouni Malinen /** 132229cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1323683b6d3bSJohannes Berg * @chandef: defines the channel to use 132429cbe68cSJohannes Berg * @mesh_id: the mesh ID 132529cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1326d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1327c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1328c80d545dSJavier Cardona * @path_metric: which metric to use 13296e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1330581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1331581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1332b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1333b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1334bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 13359bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 13369bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 13374bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1338ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 133929cbe68cSJohannes Berg * 134029cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 134129cbe68cSJohannes Berg */ 134229cbe68cSJohannes Berg struct mesh_setup { 1343683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 134429cbe68cSJohannes Berg const u8 *mesh_id; 134529cbe68cSJohannes Berg u8 mesh_id_len; 1346d299a1f2SJavier Cardona u8 sync_method; 1347c80d545dSJavier Cardona u8 path_sel_proto; 1348c80d545dSJavier Cardona u8 path_metric; 13496e16d90bSColleen Twitty u8 auth_id; 1350581a8b0fSJavier Cardona const u8 *ie; 1351581a8b0fSJavier Cardona u8 ie_len; 1352b130e5ceSJavier Cardona bool is_authenticated; 135315d5dda6SJavier Cardona bool is_secure; 1354bb2798d4SThomas Pedersen bool user_mpm; 13559bdbf04dSMarco Porsch u8 dtim_period; 13569bdbf04dSMarco Porsch u16 beacon_interval; 13574bb62344SChun-Yeow Yeoh int mcast_rate[IEEE80211_NUM_BANDS]; 1358ffb3cf30SAshok Nagarajan u32 basic_rates; 135929cbe68cSJohannes Berg }; 136029cbe68cSJohannes Berg 136129cbe68cSJohannes Berg /** 13626e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 13636e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 13646e0bd6c3SRostislav Lisovy * 13656e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 13666e0bd6c3SRostislav Lisovy */ 13676e0bd6c3SRostislav Lisovy struct ocb_setup { 13686e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 13696e0bd6c3SRostislav Lisovy }; 13706e0bd6c3SRostislav Lisovy 13716e0bd6c3SRostislav Lisovy /** 137231888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1373a3304b0aSJohannes Berg * @ac: AC identifier 137431888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 137531888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 137631888487SJouni Malinen * 1..32767] 137731888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 137831888487SJouni Malinen * 1..32767] 137931888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 138031888487SJouni Malinen */ 138131888487SJouni Malinen struct ieee80211_txq_params { 1382a3304b0aSJohannes Berg enum nl80211_ac ac; 138331888487SJouni Malinen u16 txop; 138431888487SJouni Malinen u16 cwmin; 138531888487SJouni Malinen u16 cwmax; 138631888487SJouni Malinen u8 aifs; 138731888487SJouni Malinen }; 138831888487SJouni Malinen 1389d70e9693SJohannes Berg /** 1390d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1391d70e9693SJohannes Berg * 1392d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1393d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1394d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1395d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1396d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1397d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1398d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1399d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1400d70e9693SJohannes Berg * in the wiphy structure. 1401d70e9693SJohannes Berg * 1402d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1403d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1404d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1405d70e9693SJohannes Berg * 1406d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1407d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1408d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1409d70e9693SJohannes Berg * to userspace. 1410d70e9693SJohannes Berg */ 141172bdcf34SJouni Malinen 1412704232c2SJohannes Berg /** 14132a519311SJohannes Berg * struct cfg80211_ssid - SSID description 14142a519311SJohannes Berg * @ssid: the SSID 14152a519311SJohannes Berg * @ssid_len: length of the ssid 14162a519311SJohannes Berg */ 14172a519311SJohannes Berg struct cfg80211_ssid { 14182a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 14192a519311SJohannes Berg u8 ssid_len; 14202a519311SJohannes Berg }; 14212a519311SJohannes Berg 14222a519311SJohannes Berg /** 14232a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 14242a519311SJohannes Berg * 14252a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 14262a519311SJohannes Berg * @n_ssids: number of SSIDs 14272a519311SJohannes Berg * @channels: channels to scan on. 1428ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 1429dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 143070692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 143170692ad2SJouni Malinen * @ie_len: length of ie in octets 1432ed473771SSam Leffler * @flags: bit field of flags controlling operation 143334850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 14342a519311SJohannes Berg * @wiphy: the wiphy this was for 143515d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1436fd014284SJohannes Berg * @wdev: the wireless device to scan for 1437abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 14385fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 1439e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1440ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1441ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1442ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1443ad2b26abSJohannes Berg * be taken from the @mac_addr 14442a519311SJohannes Berg */ 14452a519311SJohannes Berg struct cfg80211_scan_request { 14462a519311SJohannes Berg struct cfg80211_ssid *ssids; 14472a519311SJohannes Berg int n_ssids; 14482a519311SJohannes Berg u32 n_channels; 1449dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1450de95a54bSJohannes Berg const u8 *ie; 145170692ad2SJouni Malinen size_t ie_len; 1452ed473771SSam Leffler u32 flags; 14532a519311SJohannes Berg 145434850ab2SJohannes Berg u32 rates[IEEE80211_NUM_BANDS]; 145534850ab2SJohannes Berg 1456fd014284SJohannes Berg struct wireless_dev *wdev; 1457fd014284SJohannes Berg 1458ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1459ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1460ad2b26abSJohannes Berg 14612a519311SJohannes Berg /* internal */ 14622a519311SJohannes Berg struct wiphy *wiphy; 146315d6030bSSam Leffler unsigned long scan_start; 14645fe231e8SJohannes Berg bool aborted, notified; 1465e9f935e3SRajkumar Manoharan bool no_cck; 14665ba63533SJohannes Berg 14675ba63533SJohannes Berg /* keep last */ 14685ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 14692a519311SJohannes Berg }; 14702a519311SJohannes Berg 1471ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 1472ad2b26abSJohannes Berg { 1473ad2b26abSJohannes Berg int i; 1474ad2b26abSJohannes Berg 1475ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 1476ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 1477ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 1478ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 1479ad2b26abSJohannes Berg } 1480ad2b26abSJohannes Berg } 1481ad2b26abSJohannes Berg 14822a519311SJohannes Berg /** 1483a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1484a1f1c21cSLuciano Coelho * 1485ea73cbceSJohannes Berg * @ssid: SSID to be matched; may be zero-length for no match (RSSI only) 1486ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1487a1f1c21cSLuciano Coelho */ 1488a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1489a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1490ea73cbceSJohannes Berg s32 rssi_thold; 1491a1f1c21cSLuciano Coelho }; 1492a1f1c21cSLuciano Coelho 1493a1f1c21cSLuciano Coelho /** 1494807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1495807f8a8cSLuciano Coelho * 1496807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1497807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1498807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1499dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 1500bbe6ad6dSLuciano Coelho * @interval: interval between each scheduled scan cycle 1501807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1502807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1503ed473771SSam Leffler * @flags: bit field of flags controlling operation 1504a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1505a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1506a1f1c21cSLuciano Coelho * (others are filtered out). 1507a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1508a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1509807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1510807f8a8cSLuciano Coelho * @dev: the interface 1511077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1512807f8a8cSLuciano Coelho * @channels: channels to scan 1513ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 1514ea73cbceSJohannes Berg * contains the minimum over all matchsets 1515ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 1516ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 1517ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 1518ad2b26abSJohannes Berg * be taken from the @mac_addr 151931a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 1520*93a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 1521*93a1e86cSJukka Rissanen * owned by a particular socket) 1522807f8a8cSLuciano Coelho */ 1523807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1524807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1525807f8a8cSLuciano Coelho int n_ssids; 1526807f8a8cSLuciano Coelho u32 n_channels; 1527dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 1528bbe6ad6dSLuciano Coelho u32 interval; 1529807f8a8cSLuciano Coelho const u8 *ie; 1530807f8a8cSLuciano Coelho size_t ie_len; 1531ed473771SSam Leffler u32 flags; 1532a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1533a1f1c21cSLuciano Coelho int n_match_sets; 1534ea73cbceSJohannes Berg s32 min_rssi_thold; 1535807f8a8cSLuciano Coelho 1536ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 1537ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 1538ad2b26abSJohannes Berg 1539807f8a8cSLuciano Coelho /* internal */ 1540807f8a8cSLuciano Coelho struct wiphy *wiphy; 1541807f8a8cSLuciano Coelho struct net_device *dev; 154215d6030bSSam Leffler unsigned long scan_start; 154331a60ed1SJukka Rissanen struct rcu_head rcu_head; 1544*93a1e86cSJukka Rissanen u32 owner_nlportid; 1545807f8a8cSLuciano Coelho 1546807f8a8cSLuciano Coelho /* keep last */ 1547807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1548807f8a8cSLuciano Coelho }; 1549807f8a8cSLuciano Coelho 1550807f8a8cSLuciano Coelho /** 15512a519311SJohannes Berg * enum cfg80211_signal_type - signal type 15522a519311SJohannes Berg * 15532a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 15542a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 15552a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 15562a519311SJohannes Berg */ 15572a519311SJohannes Berg enum cfg80211_signal_type { 15582a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 15592a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 15602a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 15612a519311SJohannes Berg }; 15622a519311SJohannes Berg 15632a519311SJohannes Berg /** 15649caf0364SJohannes Berg * struct cfg80211_bss_ie_data - BSS entry IE data 15658cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 15669caf0364SJohannes Berg * @rcu_head: internal use, for freeing 15679caf0364SJohannes Berg * @len: length of the IEs 15680e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 15699caf0364SJohannes Berg * @data: IE data 15709caf0364SJohannes Berg */ 15719caf0364SJohannes Berg struct cfg80211_bss_ies { 15728cef2c9dSJohannes Berg u64 tsf; 15739caf0364SJohannes Berg struct rcu_head rcu_head; 15749caf0364SJohannes Berg int len; 15750e227084SJohannes Berg bool from_beacon; 15769caf0364SJohannes Berg u8 data[]; 15779caf0364SJohannes Berg }; 15789caf0364SJohannes Berg 15799caf0364SJohannes Berg /** 15802a519311SJohannes Berg * struct cfg80211_bss - BSS description 15812a519311SJohannes Berg * 15822a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 15832a519311SJohannes Berg * for use in scan results and similar. 15842a519311SJohannes Berg * 1585abe37c4bSJohannes Berg * @channel: channel this BSS is on 1586dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 15872a519311SJohannes Berg * @bssid: BSSID of the BSS 15882a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 15892a519311SJohannes Berg * @capability: the capability field in host byte order 159083c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 159183c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 159283c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 159383c7aa1aSJohannes Berg * received. It is always non-%NULL. 159434a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1595776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1596776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1597776b3580SJohannes Berg * @hidden_beacon_bss struct) 159834a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1599776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1600776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1601776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1602776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 160377965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 16042a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 16052a519311SJohannes Berg */ 16062a519311SJohannes Berg struct cfg80211_bss { 16072a519311SJohannes Berg struct ieee80211_channel *channel; 1608dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 16092a519311SJohannes Berg 16109caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 16119caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 16129caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 16139caf0364SJohannes Berg 1614776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 16152a519311SJohannes Berg 16162a519311SJohannes Berg s32 signal; 16172a519311SJohannes Berg 16189caf0364SJohannes Berg u16 beacon_interval; 16199caf0364SJohannes Berg u16 capability; 16209caf0364SJohannes Berg 16219caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 16229caf0364SJohannes Berg 16231c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 16242a519311SJohannes Berg }; 16252a519311SJohannes Berg 16262a519311SJohannes Berg /** 1627517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1628517357c6SJohannes Berg * @bss: the bss to search 1629517357c6SJohannes Berg * @ie: the IE ID 16309caf0364SJohannes Berg * 16319caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 16329caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 16330ae997dcSYacine Belkadi * Return: %NULL if not found. 1634517357c6SJohannes Berg */ 1635517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1636517357c6SJohannes Berg 1637517357c6SJohannes Berg 1638517357c6SJohannes Berg /** 1639636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1640636a5d36SJouni Malinen * 1641636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1642636a5d36SJouni Malinen * authentication. 1643636a5d36SJouni Malinen * 1644959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 1645959867faSJohannes Berg * to it if it needs to keep it. 1646636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1647636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1648636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1649fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1650fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1651fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1652e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1653e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1654e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1655636a5d36SJouni Malinen */ 1656636a5d36SJouni Malinen struct cfg80211_auth_request { 165719957bb3SJohannes Berg struct cfg80211_bss *bss; 1658636a5d36SJouni Malinen const u8 *ie; 1659636a5d36SJouni Malinen size_t ie_len; 166019957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1661fffd0934SJohannes Berg const u8 *key; 1662fffd0934SJohannes Berg u8 key_len, key_idx; 1663e39e5b5eSJouni Malinen const u8 *sae_data; 1664e39e5b5eSJouni Malinen size_t sae_data_len; 1665636a5d36SJouni Malinen }; 1666636a5d36SJouni Malinen 1667636a5d36SJouni Malinen /** 16687e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 16697e7c8926SBen Greear * 16707e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1671ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1672bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 16737e7c8926SBen Greear */ 16747e7c8926SBen Greear enum cfg80211_assoc_req_flags { 16757e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1676ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 1677bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 16787e7c8926SBen Greear }; 16797e7c8926SBen Greear 16807e7c8926SBen Greear /** 1681636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1682636a5d36SJouni Malinen * 1683636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1684636a5d36SJouni Malinen * (re)association. 1685959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 1686959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 1687959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 1688959867faSJohannes Berg * association requests while already associating must be rejected. 1689636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1690636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1691dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1692b23aa676SSamuel Ortiz * @crypto: crypto settings 16933e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 16947e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 16957e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 16967e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 16977e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1698ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1699ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1700636a5d36SJouni Malinen */ 1701636a5d36SJouni Malinen struct cfg80211_assoc_request { 170219957bb3SJohannes Berg struct cfg80211_bss *bss; 17033e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1704636a5d36SJouni Malinen size_t ie_len; 1705b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 170619957bb3SJohannes Berg bool use_mfp; 17077e7c8926SBen Greear u32 flags; 17087e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 17097e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1710ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1711636a5d36SJouni Malinen }; 1712636a5d36SJouni Malinen 1713636a5d36SJouni Malinen /** 1714636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1715636a5d36SJouni Malinen * 1716636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1717636a5d36SJouni Malinen * deauthentication. 1718636a5d36SJouni Malinen * 171995de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1720636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1721636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 172219957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1723077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1724077f897aSJohannes Berg * do not set a deauth frame 1725636a5d36SJouni Malinen */ 1726636a5d36SJouni Malinen struct cfg80211_deauth_request { 172795de817bSJohannes Berg const u8 *bssid; 1728636a5d36SJouni Malinen const u8 *ie; 1729636a5d36SJouni Malinen size_t ie_len; 173019957bb3SJohannes Berg u16 reason_code; 17316863255bSStanislaw Gruszka bool local_state_change; 1732636a5d36SJouni Malinen }; 1733636a5d36SJouni Malinen 1734636a5d36SJouni Malinen /** 1735636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1736636a5d36SJouni Malinen * 1737636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1738636a5d36SJouni Malinen * disassocation. 1739636a5d36SJouni Malinen * 174019957bb3SJohannes Berg * @bss: the BSS to disassociate from 1741636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1742636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 174319957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1744d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1745d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1746636a5d36SJouni Malinen */ 1747636a5d36SJouni Malinen struct cfg80211_disassoc_request { 174819957bb3SJohannes Berg struct cfg80211_bss *bss; 1749636a5d36SJouni Malinen const u8 *ie; 1750636a5d36SJouni Malinen size_t ie_len; 175119957bb3SJohannes Berg u16 reason_code; 1752d5cdfacbSJouni Malinen bool local_state_change; 1753636a5d36SJouni Malinen }; 1754636a5d36SJouni Malinen 1755636a5d36SJouni Malinen /** 175604a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 175704a773adSJohannes Berg * 175804a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 175904a773adSJohannes Berg * method. 176004a773adSJohannes Berg * 176104a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 176204a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 176304a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 176404a773adSJohannes Berg * search for IBSSs with a different BSSID. 1765683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 176604a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 176704a773adSJohannes Berg * IBSSs to join on other channels. 176804a773adSJohannes Berg * @ie: information element(s) to include in the beacon 176904a773adSJohannes Berg * @ie_len: length of that 17708e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1771fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1772fffd0934SJohannes Berg * after joining 1773267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1774267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1775267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1776267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 17775336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 17785336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 17795336fa88SSimon Wunderlich * to operate on DFS channels. 1780fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1781dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1782803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1783803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 1784803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 178504a773adSJohannes Berg */ 178604a773adSJohannes Berg struct cfg80211_ibss_params { 1787c1e5f471SJohannes Berg const u8 *ssid; 1788c1e5f471SJohannes Berg const u8 *bssid; 1789683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1790c1e5f471SJohannes Berg const u8 *ie; 179104a773adSJohannes Berg u8 ssid_len, ie_len; 17928e30bc55SJohannes Berg u16 beacon_interval; 1793fbd2c8dcSTeemu Paasikivi u32 basic_rates; 179404a773adSJohannes Berg bool channel_fixed; 1795fffd0934SJohannes Berg bool privacy; 1796267335d6SAntonio Quartulli bool control_port; 17975336fa88SSimon Wunderlich bool userspace_handles_dfs; 1798dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 1799803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 1800803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 180104a773adSJohannes Berg }; 180204a773adSJohannes Berg 180304a773adSJohannes Berg /** 1804b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1805b23aa676SSamuel Ortiz * 1806b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1807b23aa676SSamuel Ortiz * authentication and association. 1808b23aa676SSamuel Ortiz * 1809b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1810b23aa676SSamuel Ortiz * on scan results) 18111df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 18121df4a510SJouni Malinen * %NULL if not specified 1813b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1814b23aa676SSamuel Ortiz * results) 18151df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 18161df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 18171df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 18181df4a510SJouni Malinen * to use. 1819b23aa676SSamuel Ortiz * @ssid: SSID 1820b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1821b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1822abe37c4bSJohannes Berg * @ie: IEs for association request 1823abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1824b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1825cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1826b23aa676SSamuel Ortiz * @crypto: crypto settings 1827fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1828fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1829fffd0934SJohannes Berg * @key: WEP key for shared key authentication 18307e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 18314486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 18324486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 18337e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 18347e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 18357e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1836ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 1837ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 1838b23aa676SSamuel Ortiz */ 1839b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1840b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 18411df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 1842664834deSJouni Malinen const u8 *bssid; 18431df4a510SJouni Malinen const u8 *bssid_hint; 1844664834deSJouni Malinen const u8 *ssid; 1845b23aa676SSamuel Ortiz size_t ssid_len; 1846b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 18474b5800feSJohannes Berg const u8 *ie; 1848b23aa676SSamuel Ortiz size_t ie_len; 1849b23aa676SSamuel Ortiz bool privacy; 1850cee00a95SJouni Malinen enum nl80211_mfp mfp; 1851b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1852fffd0934SJohannes Berg const u8 *key; 1853fffd0934SJohannes Berg u8 key_len, key_idx; 18547e7c8926SBen Greear u32 flags; 18554486ea98SBala Shanmugam int bg_scan_period; 18567e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 18577e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1858ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 1859ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 1860b23aa676SSamuel Ortiz }; 1861b23aa676SSamuel Ortiz 1862b23aa676SSamuel Ortiz /** 1863b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1864abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1865abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1866abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1867abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1868abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 18693057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 1870b9a5f8caSJouni Malinen */ 1871b9a5f8caSJouni Malinen enum wiphy_params_flags { 1872b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1873b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1874b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1875b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 187681077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 18773057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 1878b9a5f8caSJouni Malinen }; 1879b9a5f8caSJouni Malinen 18809930380fSJohannes Berg /* 18819930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 18829930380fSJohannes Berg */ 18839930380fSJohannes Berg struct cfg80211_bitrate_mask { 18849930380fSJohannes Berg struct { 18859930380fSJohannes Berg u32 legacy; 1886d1e33e65SJanusz Dziedzic u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1887204e35a9SJanusz Dziedzic u16 vht_mcs[NL80211_VHT_NSS_MAX]; 18880b9323f6SJanusz Dziedzic enum nl80211_txrate_gi gi; 18899930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 18909930380fSJohannes Berg }; 189167fbb16bSSamuel Ortiz /** 189267fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 189367fbb16bSSamuel Ortiz * 189467fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 189567fbb16bSSamuel Ortiz * caching. 189667fbb16bSSamuel Ortiz * 189767fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 189867fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 189967fbb16bSSamuel Ortiz */ 190067fbb16bSSamuel Ortiz struct cfg80211_pmksa { 1901c1e5f471SJohannes Berg const u8 *bssid; 1902c1e5f471SJohannes Berg const u8 *pmkid; 190367fbb16bSSamuel Ortiz }; 19049930380fSJohannes Berg 19057643a2c3SJohannes Berg /** 190650ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 1907ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 1908ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 1909ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 1910ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 1911bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 1912ff1b6e69SJohannes Berg * 1913ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 1914ff1b6e69SJohannes Berg * memory, free @mask only! 1915ff1b6e69SJohannes Berg */ 191650ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 1917922bd80fSJohannes Berg const u8 *mask, *pattern; 1918ff1b6e69SJohannes Berg int pattern_len; 1919bb92d199SAmitkumar Karwar int pkt_offset; 1920ff1b6e69SJohannes Berg }; 1921ff1b6e69SJohannes Berg 1922ff1b6e69SJohannes Berg /** 19232a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 19242a0e047eSJohannes Berg * 19252a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 19262a0e047eSJohannes Berg * @src: source IP address 19272a0e047eSJohannes Berg * @dst: destination IP address 19282a0e047eSJohannes Berg * @dst_mac: destination MAC address 19292a0e047eSJohannes Berg * @src_port: source port 19302a0e047eSJohannes Berg * @dst_port: destination port 19312a0e047eSJohannes Berg * @payload_len: data payload length 19322a0e047eSJohannes Berg * @payload: data payload buffer 19332a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 19342a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 19352a0e047eSJohannes Berg * @wake_len: wakeup payload match length 19362a0e047eSJohannes Berg * @wake_data: wakeup payload match data 19372a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 19382a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 19392a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 19402a0e047eSJohannes Berg */ 19412a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 19422a0e047eSJohannes Berg struct socket *sock; 19432a0e047eSJohannes Berg __be32 src, dst; 19442a0e047eSJohannes Berg u16 src_port, dst_port; 19452a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 19462a0e047eSJohannes Berg int payload_len; 19472a0e047eSJohannes Berg const u8 *payload; 19482a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 19492a0e047eSJohannes Berg u32 data_interval; 19502a0e047eSJohannes Berg u32 wake_len; 19512a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 19522a0e047eSJohannes Berg u32 tokens_size; 19532a0e047eSJohannes Berg /* must be last, variable member */ 19542a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 1955ff1b6e69SJohannes Berg }; 1956ff1b6e69SJohannes Berg 1957ff1b6e69SJohannes Berg /** 1958ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 1959ff1b6e69SJohannes Berg * 1960ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 1961ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 1962ff1b6e69SJohannes Berg * operating as normal during suspend 1963ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 1964ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 1965ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 1966ff1b6e69SJohannes Berg * @n_patterns: number of patterns 196777dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 196877dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 196977dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 197077dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 19712a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 19722a0e047eSJohannes Berg * NULL if not configured. 19738cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 1974ff1b6e69SJohannes Berg */ 1975ff1b6e69SJohannes Berg struct cfg80211_wowlan { 197677dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 197777dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 197877dbbb13SJohannes Berg rfkill_release; 197950ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 19802a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 1981ff1b6e69SJohannes Berg int n_patterns; 19828cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 1983ff1b6e69SJohannes Berg }; 1984ff1b6e69SJohannes Berg 1985ff1b6e69SJohannes Berg /** 1986be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 1987be29b99aSAmitkumar Karwar * 1988be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 1989be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 1990be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 1991be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 1992be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 1993be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 1994be29b99aSAmitkumar Karwar */ 1995be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 1996be29b99aSAmitkumar Karwar int delay; 1997be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 1998be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 1999be29b99aSAmitkumar Karwar int n_patterns; 2000be29b99aSAmitkumar Karwar }; 2001be29b99aSAmitkumar Karwar 2002be29b99aSAmitkumar Karwar /** 2003be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2004be29b99aSAmitkumar Karwar * 2005be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2006be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2007be29b99aSAmitkumar Karwar * @n_rules: number of rules 2008be29b99aSAmitkumar Karwar */ 2009be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2010be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2011be29b99aSAmitkumar Karwar int n_rules; 2012be29b99aSAmitkumar Karwar }; 2013be29b99aSAmitkumar Karwar 2014be29b99aSAmitkumar Karwar /** 20158cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 20168cd4d456SLuciano Coelho * 20178cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 20188cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 20198cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 20208cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 20218cd4d456SLuciano Coelho * occurred (in MHz) 20228cd4d456SLuciano Coelho */ 20238cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 20248cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 20258cd4d456SLuciano Coelho int n_channels; 20268cd4d456SLuciano Coelho u32 channels[]; 20278cd4d456SLuciano Coelho }; 20288cd4d456SLuciano Coelho 20298cd4d456SLuciano Coelho /** 20308cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 20318cd4d456SLuciano Coelho * 20328cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 20338cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 20348cd4d456SLuciano Coelho * match information. 20358cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 20368cd4d456SLuciano Coelho * the matches that triggered the wake up. 20378cd4d456SLuciano Coelho */ 20388cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 20398cd4d456SLuciano Coelho int n_matches; 20408cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 20418cd4d456SLuciano Coelho }; 20428cd4d456SLuciano Coelho 20438cd4d456SLuciano Coelho /** 2044cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 2045cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 2046cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 2047cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 2048cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 2049cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 2050cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 2051cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 2052cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 2053cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 2054cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 2055cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 2056cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 2057cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 2058cd8f7cb4SJohannes Berg * it is. 20592a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 20602a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 20612a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 20628cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 2063cd8f7cb4SJohannes Berg */ 2064cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 2065cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 2066cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 20672a0e047eSJohannes Berg rfkill_release, packet_80211, 20682a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 2069cd8f7cb4SJohannes Berg s32 pattern_idx; 2070cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 2071cd8f7cb4SJohannes Berg const void *packet; 20728cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 2073cd8f7cb4SJohannes Berg }; 2074cd8f7cb4SJohannes Berg 2075cd8f7cb4SJohannes Berg /** 2076e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 207778f686caSJohannes Berg * @kek: key encryption key (NL80211_KEK_LEN bytes) 207878f686caSJohannes Berg * @kck: key confirmation key (NL80211_KCK_LEN bytes) 207978f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 2080e5497d76SJohannes Berg */ 2081e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 208278f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 2083e5497d76SJohannes Berg }; 2084e5497d76SJohannes Berg 2085e5497d76SJohannes Berg /** 2086355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 2087355199e0SJouni Malinen * 2088355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 2089355199e0SJouni Malinen * 2090355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 2091355199e0SJouni Malinen * @ie: Fast Transition IEs 2092355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 2093355199e0SJouni Malinen */ 2094355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 2095355199e0SJouni Malinen u16 md; 2096355199e0SJouni Malinen const u8 *ie; 2097355199e0SJouni Malinen size_t ie_len; 2098355199e0SJouni Malinen }; 2099355199e0SJouni Malinen 2100355199e0SJouni Malinen /** 2101b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 2102b176e629SAndrei Otcheretianski * 2103b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 2104b176e629SAndrei Otcheretianski * 2105b176e629SAndrei Otcheretianski * @chan: channel to use 2106b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 2107b176e629SAndrei Otcheretianski * @wait: duration for ROC 2108b176e629SAndrei Otcheretianski * @buf: buffer to transmit 2109b176e629SAndrei Otcheretianski * @len: buffer length 2110b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 2111b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 211234d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 211334d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 2114b176e629SAndrei Otcheretianski */ 2115b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 2116b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 2117b176e629SAndrei Otcheretianski bool offchan; 2118b176e629SAndrei Otcheretianski unsigned int wait; 2119b176e629SAndrei Otcheretianski const u8 *buf; 2120b176e629SAndrei Otcheretianski size_t len; 2121b176e629SAndrei Otcheretianski bool no_cck; 2122b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 212334d22ce2SAndrei Otcheretianski int n_csa_offsets; 212434d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 2125b176e629SAndrei Otcheretianski }; 2126b176e629SAndrei Otcheretianski 2127b176e629SAndrei Otcheretianski /** 2128fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 2129fa9ffc74SKyeyoon Park * 2130fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 2131fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 2132fa9ffc74SKyeyoon Park */ 2133fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 2134fa9ffc74SKyeyoon Park u8 dscp; 2135fa9ffc74SKyeyoon Park u8 up; 2136fa9ffc74SKyeyoon Park }; 2137fa9ffc74SKyeyoon Park 2138fa9ffc74SKyeyoon Park /** 2139fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 2140fa9ffc74SKyeyoon Park * 2141fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 2142fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 2143fa9ffc74SKyeyoon Park */ 2144fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 2145fa9ffc74SKyeyoon Park u8 low; 2146fa9ffc74SKyeyoon Park u8 high; 2147fa9ffc74SKyeyoon Park }; 2148fa9ffc74SKyeyoon Park 2149fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 2150fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 2151fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 2152fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 2153fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 2154fa9ffc74SKyeyoon Park 2155fa9ffc74SKyeyoon Park /** 2156fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 2157fa9ffc74SKyeyoon Park * 2158fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 2159fa9ffc74SKyeyoon Park * 2160fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 2161fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 2162fa9ffc74SKyeyoon Park * the user priority DSCP range definition 2163fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 2164fa9ffc74SKyeyoon Park */ 2165fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 2166fa9ffc74SKyeyoon Park u8 num_des; 2167fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 2168fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 2169fa9ffc74SKyeyoon Park }; 2170fa9ffc74SKyeyoon Park 2171fa9ffc74SKyeyoon Park /** 2172704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 2173704232c2SJohannes Berg * 2174704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 2175704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 2176704232c2SJohannes Berg * 2177704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 2178704232c2SJohannes Berg * on success or a negative error code. 2179704232c2SJohannes Berg * 218043fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 218143fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 218243fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 218343fb45cbSJohannes Berg * 2184ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 2185ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 2186ff1b6e69SJohannes Berg * configured for the device. 21870378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 21886d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 21896d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 21906d52563fSJohannes Berg * the device. 21910378b3f1SJohannes Berg * 219260719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 2193463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 219484efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 219598104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 219698104fdeSJohannes Berg * also set the address member in the wdev. 2197704232c2SJohannes Berg * 219884efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 219955682965SJohannes Berg * 220060719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 220160719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 220255682965SJohannes Berg * 220341ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 220441ade00fSJohannes Berg * when adding a group key. 220541ade00fSJohannes Berg * 220641ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 220741ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 220841ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 2209e3da574aSJohannes Berg * after it returns. This function should return an error if it is 2210e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 221141ade00fSJohannes Berg * 221241ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 2213e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 221441ade00fSJohannes Berg * 221541ade00fSJohannes Berg * @set_default_key: set the default key on an interface 2216ed1b6cc7SJohannes Berg * 22173cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 22183cfcf6acSJouni Malinen * 2219e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 2220e5497d76SJohannes Berg * 2221c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 2222c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 2223c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 2224c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 22255727ef1bSJohannes Berg * 22265727ef1bSJohannes Berg * @add_station: Add a new station. 222789c771e5SJouni Malinen * @del_station: Remove a station 2228bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 2229bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 2230bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 223177ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 223277ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 2233abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 2234abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 2235abe37c4bSJohannes Berg * 2236abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 2237abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 2238abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 2239abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 2240abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 224166be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 224266be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 2243f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 22448d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2245f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 22468d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 22472ec600d6SLuis Carlos Cobo * 224824bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 224993da9cc1Scolin@cozybit.com * 225024bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 225193da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 225293da9cc1Scolin@cozybit.com * set, and which to leave alone. 225393da9cc1Scolin@cozybit.com * 22549f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 225531888487SJouni Malinen * 225631888487SJouni Malinen * @set_txq_params: Set TX queue parameters 225772bdcf34SJouni Malinen * 2258e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 2259e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 2260e8c9bd5bSJohannes Berg * join the mesh instead. 2261e8c9bd5bSJohannes Berg * 2262e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 2263e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 2264e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 2265e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 22669aed3cc1SJouni Malinen * 22672a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 22682a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 22692a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 22702a519311SJohannes Berg * the scan/scan_done bracket too. 2271636a5d36SJouni Malinen * 2272636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 22738d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2274636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 22758d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2276636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 22778d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2278636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 22798d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 228004a773adSJohannes Berg * 2281b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 2282b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 2283b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 2284b23aa676SSamuel Ortiz * with the status from the AP. 22858d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2286b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 22878d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2288b23aa676SSamuel Ortiz * 228904a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 229004a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 229104a773adSJohannes Berg * to a merge. 22928d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 229304a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 22948d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 2295b9a5f8caSJouni Malinen * 2296f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 2297f4e583c8SAntonio Quartulli * MESH mode) 2298f4e583c8SAntonio Quartulli * 2299b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 2300b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 2301b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 2302b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 23037643a2c3SJohannes Berg * 23041432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 2305c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 2306c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 2307c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 2308c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 23097643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 23101f87f7d3SJohannes Berg * return 0 if successful 23111f87f7d3SJohannes Berg * 2312abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 2313abe37c4bSJohannes Berg * 23141f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 23151f87f7d3SJohannes Berg * functions to adjust rfkill hw state 2316aff89a9bSJohannes Berg * 231761fa713cSHolger Schurig * @dump_survey: get site survey information. 231861fa713cSHolger Schurig * 23199588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 23209588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 23219588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 23229588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 23239588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 23249588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 23259588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 23269588bbd5SJouni Malinen * the duration value. 2327f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 2328f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 2329f7ca38dfSJohannes Berg * frame on another channel 23309588bbd5SJouni Malinen * 2331fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 233271063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 233371063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 233471063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 233571063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 233671063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 233771063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 233867fbb16bSSamuel Ortiz * 2339abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 2340abe37c4bSJohannes Berg * 234167fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 234267fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 234367fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 234467fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 234567fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 23469043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 23479043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 2348d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 234984f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 235084f10708SThomas Pedersen * thresholds. 2351807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 2352d9b8396aSJohannes Berg * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This 2353d9b8396aSJohannes Berg * call must stop the scheduled scan and be ready for starting a new one 2354d9b8396aSJohannes Berg * before it returns, i.e. @sched_scan_start may be called immediately 2355d9b8396aSJohannes Berg * after that again and should not fail in that case. The driver should 2356d9b8396aSJohannes Berg * not call cfg80211_sched_scan_stopped() for a requested stop (when this 2357d9b8396aSJohannes Berg * method returns 0.) 235867fbb16bSSamuel Ortiz * 2359271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 2360271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 2361271733cfSJohannes Berg * concurrently with itself. 2362547025d5SBruno Randolf * 2363547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2364547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2365547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 2366547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 2367547025d5SBruno Randolf * 2368547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 23693677713bSJohn W. Linville * 2370109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 2371109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 23727f6cf311SJohannes Berg * 23737f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 23747f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 23751d9d9213SSimon Wunderlich * 23761d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 2377d6199218SBen Greear * 23785b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 23795b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 23805b7ccaf3SJohannes Berg * current monitoring channel. 238198104fdeSJohannes Berg * 238298104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 238398104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 238477765eafSVasanthakumar Thiagarajan * 238577765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 238677765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 238777765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 238877765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 238977765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 239077765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 239104f39047SSimon Wunderlich * 239204f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 23938bf24293SJouni Malinen * 23948bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 23958bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 23968bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 23975de17984SArend van Spriel * 23985de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 23995de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 24005de17984SArend van Spriel * driver can take the most appropriate actions. 24015de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 24025de17984SArend van Spriel * reliability. This operation can not fail. 2403be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 240416ef1fe2SSimon Wunderlich * 240597dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 240697dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 240797dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 240897dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 240997dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 241097dc94f1SMichal Kazior * as soon as possible. 2411fa9ffc74SKyeyoon Park * 2412fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 2413e16821bcSJouni Malinen * 2414e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2415e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2416e16821bcSJouni Malinen * changes during the lifetime of the BSS. 2417960d01acSJohannes Berg * 2418960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 2419960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 2420960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 2421960d01acSJohannes Berg * account. 2422960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 2423960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 2424960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 2425960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 2426960d01acSJohannes Berg * rejected) 2427960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 24286e0bd6c3SRostislav Lisovy * 24296e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 24306e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 24316e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 24326e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 24331057d35eSArik Nemtsov * 24341057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 24351057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 24361057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 24371057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 24381057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 2439704232c2SJohannes Berg */ 2440704232c2SJohannes Berg struct cfg80211_ops { 2441ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 24420378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 24436d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 24440378b3f1SJohannes Berg 244584efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2446552bff0cSJohannes Berg const char *name, 2447f9e10ce4SJohannes Berg enum nl80211_iftype type, 2448f9e10ce4SJohannes Berg u32 *flags, 24492ec600d6SLuis Carlos Cobo struct vif_params *params); 245084efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 245184efbb84SJohannes Berg struct wireless_dev *wdev); 2452e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2453e36d56b6SJohannes Berg struct net_device *dev, 24542ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 24552ec600d6SLuis Carlos Cobo struct vif_params *params); 245641ade00fSJohannes Berg 245741ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2458e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 245941ade00fSJohannes Berg struct key_params *params); 246041ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2461e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2462e31b8213SJohannes Berg void *cookie, 246341ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 246441ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2465e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 246641ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 246741ade00fSJohannes Berg struct net_device *netdev, 2468dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 24693cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 24703cfcf6acSJouni Malinen struct net_device *netdev, 24713cfcf6acSJouni Malinen u8 key_index); 2472ed1b6cc7SJohannes Berg 24738860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 24748860020eSJohannes Berg struct cfg80211_ap_settings *settings); 24758860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 24768860020eSJohannes Berg struct cfg80211_beacon_data *info); 24778860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 24785727ef1bSJohannes Berg 24795727ef1bSJohannes Berg 24805727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 24813b3a0162SJohannes Berg const u8 *mac, 24823b3a0162SJohannes Berg struct station_parameters *params); 24835727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 248489c771e5SJouni Malinen struct station_del_parameters *params); 24855727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 24863b3a0162SJohannes Berg const u8 *mac, 24873b3a0162SJohannes Berg struct station_parameters *params); 2488fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 24893b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 24902ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 24912ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 24922ec600d6SLuis Carlos Cobo 24932ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 24943b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 24952ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 24963b3a0162SJohannes Berg const u8 *dst); 24972ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 24983b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 24992ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 25003b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 25012ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 25022ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 25032ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 250466be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 250566be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 250666be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 250766be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 250866be7d2bSHenning Rogge struct mpath_info *pinfo); 250924bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 251093da9cc1Scolin@cozybit.com struct net_device *dev, 251193da9cc1Scolin@cozybit.com struct mesh_config *conf); 251224bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 251329cbe68cSJohannes Berg struct net_device *dev, u32 mask, 251429cbe68cSJohannes Berg const struct mesh_config *nconf); 251529cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 251629cbe68cSJohannes Berg const struct mesh_config *conf, 251729cbe68cSJohannes Berg const struct mesh_setup *setup); 251829cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 251929cbe68cSJohannes Berg 25206e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 25216e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 25226e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 25236e0bd6c3SRostislav Lisovy 25249f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 25259f1ba906SJouni Malinen struct bss_parameters *params); 252631888487SJouni Malinen 2527f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 252831888487SJouni Malinen struct ieee80211_txq_params *params); 252972bdcf34SJouni Malinen 2530e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2531e8c9bd5bSJohannes Berg struct net_device *dev, 2532e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2533e8c9bd5bSJohannes Berg 2534e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2535683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 25369aed3cc1SJouni Malinen 2537fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 25382a519311SJohannes Berg struct cfg80211_scan_request *request); 2539636a5d36SJouni Malinen 2540636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2541636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2542636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2543636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2544636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 254563c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2546636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 254763c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 254804a773adSJohannes Berg 2549b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2550b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2551b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2552b23aa676SSamuel Ortiz u16 reason_code); 2553b23aa676SSamuel Ortiz 255404a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 255504a773adSJohannes Berg struct cfg80211_ibss_params *params); 255604a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2557b9a5f8caSJouni Malinen 2558f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 2559f4e583c8SAntonio Quartulli int rate[IEEE80211_NUM_BANDS]); 2560f4e583c8SAntonio Quartulli 2561b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 25627643a2c3SJohannes Berg 2563c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2564fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2565c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2566c8442118SJohannes Berg int *dbm); 25671f87f7d3SJohannes Berg 2568ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2569388ac775SJohannes Berg const u8 *addr); 2570ab737a4fSJohannes Berg 25711f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2572aff89a9bSJohannes Berg 2573aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2574fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 2575fc73f11fSDavid Spinadel void *data, int len); 257671063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 257771063f0eSWey-Yi Guy struct netlink_callback *cb, 257871063f0eSWey-Yi Guy void *data, int len); 2579aff89a9bSJohannes Berg #endif 2580bc92afd9SJohannes Berg 25819930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 25829930380fSJohannes Berg struct net_device *dev, 25839930380fSJohannes Berg const u8 *peer, 25849930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 25859930380fSJohannes Berg 258661fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 258761fa713cSHolger Schurig int idx, struct survey_info *info); 258861fa713cSHolger Schurig 258967fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 259067fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 259167fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 259267fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 259367fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 259467fbb16bSSamuel Ortiz 25959588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 259671bbc994SJohannes Berg struct wireless_dev *wdev, 25979588bbd5SJouni Malinen struct ieee80211_channel *chan, 25989588bbd5SJouni Malinen unsigned int duration, 25999588bbd5SJouni Malinen u64 *cookie); 26009588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 260171bbc994SJohannes Berg struct wireless_dev *wdev, 26029588bbd5SJouni Malinen u64 cookie); 26039588bbd5SJouni Malinen 260471bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2605b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 2606b176e629SAndrei Otcheretianski u64 *cookie); 2607f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 260871bbc994SJohannes Berg struct wireless_dev *wdev, 2609f7ca38dfSJohannes Berg u64 cookie); 2610026331c4SJouni Malinen 2611bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2612bc92afd9SJohannes Berg bool enabled, int timeout); 2613d6dc1a38SJuuso Oikarinen 2614d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2615d6dc1a38SJuuso Oikarinen struct net_device *dev, 2616d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2617271733cfSJohannes Berg 261884f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 261984f10708SThomas Pedersen struct net_device *dev, 262084f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 262184f10708SThomas Pedersen 2622271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 262371bbc994SJohannes Berg struct wireless_dev *wdev, 2624271733cfSJohannes Berg u16 frame_type, bool reg); 2625afe0cbf8SBruno Randolf 2626afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2627afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 26283677713bSJohn W. Linville 2629807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2630807f8a8cSLuciano Coelho struct net_device *dev, 2631807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 263285a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2633e5497d76SJohannes Berg 2634e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2635e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2636109086ceSArik Nemtsov 2637109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 26383b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 2639df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 264031fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 2641109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 26423b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 26437f6cf311SJohannes Berg 26447f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 26457f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2646e999882aSJohannes Berg 26471d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 26481d9d9213SSimon Wunderlich struct net_device *dev, 26491d9d9213SSimon Wunderlich u16 noack_map); 26501d9d9213SSimon Wunderlich 2651683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 26525b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2653683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 265498104fdeSJohannes Berg 265598104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 265698104fdeSJohannes Berg struct wireless_dev *wdev); 265798104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 265898104fdeSJohannes Berg struct wireless_dev *wdev); 265977765eafSVasanthakumar Thiagarajan 266077765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 266177765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 266204f39047SSimon Wunderlich 266304f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 266404f39047SSimon Wunderlich struct net_device *dev, 266531559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 266631559f35SJanusz Dziedzic u32 cac_time_ms); 2667355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2668355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 26695de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 26705de17984SArend van Spriel struct wireless_dev *wdev, 26715de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 26725de17984SArend van Spriel u16 duration); 26735de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 26745de17984SArend van Spriel struct wireless_dev *wdev); 2675be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 2676be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 267716ef1fe2SSimon Wunderlich 267816ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 267916ef1fe2SSimon Wunderlich struct net_device *dev, 268016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 2681e16821bcSJouni Malinen 2682fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 2683fa9ffc74SKyeyoon Park struct net_device *dev, 2684fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 2685e16821bcSJouni Malinen 2686e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2687e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 2688960d01acSJohannes Berg 2689960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2690960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 2691960d01acSJohannes Berg u16 admitted_time); 2692960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2693960d01acSJohannes Berg u8 tsid, const u8 *peer); 26941057d35eSArik Nemtsov 26951057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 26961057d35eSArik Nemtsov struct net_device *dev, 26971057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 26981057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 26991057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 27001057d35eSArik Nemtsov struct net_device *dev, 27011057d35eSArik Nemtsov const u8 *addr); 2702704232c2SJohannes Berg }; 2703704232c2SJohannes Berg 2704d3236553SJohannes Berg /* 2705d3236553SJohannes Berg * wireless hardware and networking interfaces structures 2706d3236553SJohannes Berg * and registration/helper functions 2707d3236553SJohannes Berg */ 2708d3236553SJohannes Berg 2709d3236553SJohannes Berg /** 27105be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 27115be83de5SJohannes Berg * 27125be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 27135be83de5SJohannes Berg * wiphy at all 27145be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 27155be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 27165be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 27175be83de5SJohannes Berg * reason to override the default 27189bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 27199bc383deSJohannes Berg * on a VLAN interface) 27209bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 2721c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 2722c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 2723c0692b8fSJohannes Berg * control_port_no_encrypt flag. 2724e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 272515d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 272615d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 27271ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 2728f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 2729f4b34b55SVivek Natarajan * firmware. 2730cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 2731109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 2732109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 2733109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 2734109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 2735109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 2736109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 2737562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 27385e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 27395e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 27405e760230SJohannes Berg * cfg80211_report_obss_beacon(). 274187bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 274287bbbe22SArik Nemtsov * responds to probe-requests in hardware. 27437c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 27447c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 27452f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 274616ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 274716ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 27485be83de5SJohannes Berg */ 27495be83de5SJohannes Berg enum wiphy_flags { 2750723e73acSJohannes Berg /* use hole at 0 */ 2751a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 2752a2f73b6cSLuis R. Rodriguez /* use hole at 2 */ 27535be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 27545be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 27559bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 27569bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 2757c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 2758309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 275915d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 2760807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 27618e8b41f9SJohannes Berg /* use hole at 12 */ 2762f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 2763cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 2764109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 2765109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 2766562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 27675e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 276887bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 27697c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 27707c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 27712f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 277216ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 27737527a782SJohannes Berg }; 27747527a782SJohannes Berg 27757527a782SJohannes Berg /** 27767527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 27777527a782SJohannes Berg * @max: maximum number of interfaces of these types 27787527a782SJohannes Berg * @types: interface types (bits) 27797527a782SJohannes Berg */ 27807527a782SJohannes Berg struct ieee80211_iface_limit { 27817527a782SJohannes Berg u16 max; 27827527a782SJohannes Berg u16 types; 27837527a782SJohannes Berg }; 27847527a782SJohannes Berg 27857527a782SJohannes Berg /** 27867527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 27877527a782SJohannes Berg * @limits: limits for the given interface types 27887527a782SJohannes Berg * @n_limits: number of limitations 27897527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 27907527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 27917527a782SJohannes Berg * group 27927527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 27937527a782SJohannes Berg * between infrastructure and AP types must match. This is required 27947527a782SJohannes Berg * only in special cases. 279511c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 27968c48b50aSFelix Fietkau * @radar_detect_regions: bitmap of regions supported for radar detection 27977527a782SJohannes Berg * 2798b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 2799b80edbc1SLuciano Coelho * combinations it supports concurrently. 28007527a782SJohannes Berg * 2801b80edbc1SLuciano Coelho * Examples: 2802b80edbc1SLuciano Coelho * 2803b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 28047527a782SJohannes Berg * 28057527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 28067527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 28077527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 28087527a782SJohannes Berg * }; 28097527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 28107527a782SJohannes Berg * .limits = limits1, 28117527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 28127527a782SJohannes Berg * .max_interfaces = 2, 28137527a782SJohannes Berg * .beacon_int_infra_match = true, 28147527a782SJohannes Berg * }; 28157527a782SJohannes Berg * 28167527a782SJohannes Berg * 2817b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 28187527a782SJohannes Berg * 28197527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 28207527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 28217527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 28227527a782SJohannes Berg * }; 28237527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 28247527a782SJohannes Berg * .limits = limits2, 28257527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 28267527a782SJohannes Berg * .max_interfaces = 8, 28277527a782SJohannes Berg * .num_different_channels = 1, 28287527a782SJohannes Berg * }; 28297527a782SJohannes Berg * 28307527a782SJohannes Berg * 2831b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2832b80edbc1SLuciano Coelho * 28337527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 28347527a782SJohannes Berg * 28357527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 28367527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 28377527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 28387527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 28397527a782SJohannes Berg * }; 28407527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 28417527a782SJohannes Berg * .limits = limits3, 28427527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 28437527a782SJohannes Berg * .max_interfaces = 4, 28447527a782SJohannes Berg * .num_different_channels = 2, 28457527a782SJohannes Berg * }; 28467527a782SJohannes Berg */ 28477527a782SJohannes Berg struct ieee80211_iface_combination { 28487527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 28497527a782SJohannes Berg u32 num_different_channels; 28507527a782SJohannes Berg u16 max_interfaces; 28517527a782SJohannes Berg u8 n_limits; 28527527a782SJohannes Berg bool beacon_int_infra_match; 285311c4a075SSimon Wunderlich u8 radar_detect_widths; 28548c48b50aSFelix Fietkau u8 radar_detect_regions; 28555be83de5SJohannes Berg }; 28565be83de5SJohannes Berg 28572e161f78SJohannes Berg struct ieee80211_txrx_stypes { 28582e161f78SJohannes Berg u16 tx, rx; 28592e161f78SJohannes Berg }; 28602e161f78SJohannes Berg 28615be83de5SJohannes Berg /** 2862ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 2863ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 2864ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 2865ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 2866ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 2867ff1b6e69SJohannes Berg * packet should be preserved in that case 2868ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 2869ff1b6e69SJohannes Berg * (see nl80211.h) 2870ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 287177dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 287277dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 287377dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 287477dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 287577dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 28768cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 2877ff1b6e69SJohannes Berg */ 2878ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 2879ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 2880ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 2881ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 288277dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 288377dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 288477dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 288577dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 288677dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 28878cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 2888ff1b6e69SJohannes Berg }; 2889ff1b6e69SJohannes Berg 28902a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 28912a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 28922a0e047eSJohannes Berg u32 data_payload_max; 28932a0e047eSJohannes Berg u32 data_interval_max; 28942a0e047eSJohannes Berg u32 wake_payload_max; 28952a0e047eSJohannes Berg bool seq; 28962a0e047eSJohannes Berg }; 28972a0e047eSJohannes Berg 2898ff1b6e69SJohannes Berg /** 2899ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 2900ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 2901ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 2902ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 2903ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 2904ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 2905bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 29068cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 29078cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 29088cd4d456SLuciano Coelho * scheduled scans. 29098cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 29108cd4d456SLuciano Coelho * details. 29112a0e047eSJohannes Berg * @tcp: TCP wakeup support information 2912ff1b6e69SJohannes Berg */ 2913ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 2914ff1b6e69SJohannes Berg u32 flags; 2915ff1b6e69SJohannes Berg int n_patterns; 2916ff1b6e69SJohannes Berg int pattern_max_len; 2917ff1b6e69SJohannes Berg int pattern_min_len; 2918bb92d199SAmitkumar Karwar int max_pkt_offset; 29198cd4d456SLuciano Coelho int max_nd_match_sets; 29202a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 2921ff1b6e69SJohannes Berg }; 2922ff1b6e69SJohannes Berg 2923ff1b6e69SJohannes Berg /** 2924be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 2925be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 2926be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 2927be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 2928be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 2929be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 2930be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 2931be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 2932be29b99aSAmitkumar Karwar */ 2933be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 2934be29b99aSAmitkumar Karwar int n_rules; 2935be29b99aSAmitkumar Karwar int max_delay; 2936be29b99aSAmitkumar Karwar int n_patterns; 2937be29b99aSAmitkumar Karwar int pattern_max_len; 2938be29b99aSAmitkumar Karwar int pattern_min_len; 2939be29b99aSAmitkumar Karwar int max_pkt_offset; 2940be29b99aSAmitkumar Karwar }; 2941be29b99aSAmitkumar Karwar 2942be29b99aSAmitkumar Karwar /** 2943ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 2944ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 2945ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 2946ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 2947ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 2948ad7e718cSJohannes Berg */ 2949ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 2950ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 2951ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 2952ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 2953ad7e718cSJohannes Berg }; 2954ad7e718cSJohannes Berg 2955ad7e718cSJohannes Berg /** 2956ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 2957ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 2958ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 2959ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 2960ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 2961ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 2962ad7e718cSJohannes Berg */ 2963ad7e718cSJohannes Berg struct wiphy_vendor_command { 2964ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 2965ad7e718cSJohannes Berg u32 flags; 2966ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 2967ad7e718cSJohannes Berg const void *data, int data_len); 2968ad7e718cSJohannes Berg }; 2969ad7e718cSJohannes Berg 2970ad7e718cSJohannes Berg /** 29715be83de5SJohannes Berg * struct wiphy - wireless hardware description 29722784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 29732784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 29742784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 2975d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 2976d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 2977d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 2978d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 2979d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 2980d3236553SJohannes Berg * @cipher_suites: supported cipher suites 2981d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 2982b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 2983b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 2984b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 2985b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 2986b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 2987abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 2988ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 2989ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 2990ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 29910fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 2992ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 2993ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 2994ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 2995ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 2996ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 2997ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 2998ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 2999ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 3000fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 3001fd235913SRandy Dunlap * unregister hardware 3002abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 3003abe37c4bSJohannes Berg * automatically on wiphy renames 3004abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 30054a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 3006abe37c4bSJohannes Berg * @wext: wireless extension handlers 3007abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 3008abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 3009abe37c4bSJohannes Berg * must be set by driver 30107527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 30117527a782SJohannes Berg * list single interface types. 30127527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 30137527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 30147527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 3015abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 3016a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 3017a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 30181f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 3019abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 3020abe37c4bSJohannes Berg * this variable determines its size 3021abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 3022abe37c4bSJohannes Berg * any given scan 302393b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 302493b6aa69SLuciano Coelho * for in any given scheduled scan 3025a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 3026a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 3027a1f1c21cSLuciano Coelho * supported. 3028abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 3029abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 3030abe37c4bSJohannes Berg * include fixed IEs like supported rates 30315a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 30325a865badSLuciano Coelho * scans 3033abe37c4bSJohannes Berg * @coverage_class: current coverage class 3034abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 3035abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 3036abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 3037abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 3038abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 3039abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 30402e161f78SJohannes Berg * 30412e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 30422e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 30432e161f78SJohannes Berg * type 3044a7ffac95SBruno Randolf * 30457f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 30467f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 30477f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 30487f531e03SBruno Randolf * 30497f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 30507f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 30517f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 3052a293911dSJohannes Berg * 305315f0ebc2SRandy Dunlap * @probe_resp_offload: 305415f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 305515f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 305615f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 305715f0ebc2SRandy Dunlap * 3058a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 3059a293911dSJohannes Berg * may request, if implemented. 3060ff1b6e69SJohannes Berg * 3061ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 30626abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 30636abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 30646abb9cb9SJohannes Berg * to the suspend() operation instead. 3065562a7480SJohannes Berg * 3066562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 30677e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 30687e7c8926SBen Greear * If null, then none can be over-ridden. 3069ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 3070ee2aca34SJohannes Berg * If null, then none can be over-ridden. 307177765eafSVasanthakumar Thiagarajan * 307277765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 307377765eafSVasanthakumar Thiagarajan * supports for ACL. 3074a50df0c4SJohannes Berg * 3075a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 3076a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 3077a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 3078a50df0c4SJohannes Berg * and are in the same format as in the information element. See 3079a50df0c4SJohannes Berg * 802.11-2012 8.4.2.29 for the defined fields. 3080a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 3081a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 3082be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 3083ad7e718cSJohannes Berg * 3084ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 3085ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 3086567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 3087567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 3088b43504cfSJouni Malinen * 3089b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 3090b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 3091b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 3092b43504cfSJouni Malinen * some cases, but may not always reach. 3093c2e4323bSLuciano Coelho * 3094c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 3095c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 3096c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 3097c2e4323bSLuciano Coelho * infinite. 309867af9811SEmmanuel Grumbach * @max_adj_channel_rssi_comp: max offset of between the channel on which the 309967af9811SEmmanuel Grumbach * frame was sent and the channel on which the frame was heard for which 310067af9811SEmmanuel Grumbach * the reported rssi is still valid. If a driver is able to compensate the 310167af9811SEmmanuel Grumbach * low rssi when a frame is heard on different channel, then it should set 310267af9811SEmmanuel Grumbach * this variable to the maximal offset for which it can compensate. 310367af9811SEmmanuel Grumbach * This value should be set in MHz. 3104d3236553SJohannes Berg */ 3105d3236553SJohannes Berg struct wiphy { 3106d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 3107d3236553SJohannes Berg 3108ef15aac6SJohannes Berg /* permanent MAC address(es) */ 3109d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 3110ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 3111ef15aac6SJohannes Berg 3112ef15aac6SJohannes Berg struct mac_address *addresses; 3113d3236553SJohannes Berg 31142e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 31152e161f78SJohannes Berg 31167527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 31177527a782SJohannes Berg int n_iface_combinations; 31187527a782SJohannes Berg u16 software_iftypes; 31197527a782SJohannes Berg 31202e161f78SJohannes Berg u16 n_addresses; 31212e161f78SJohannes Berg 3122d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 3123d3236553SJohannes Berg u16 interface_modes; 3124d3236553SJohannes Berg 312577765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 312677765eafSVasanthakumar Thiagarajan 3127a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 3128463d0183SJohannes Berg 3129562a7480SJohannes Berg u32 ap_sme_capa; 3130562a7480SJohannes Berg 3131d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 3132d3236553SJohannes Berg 3133d3236553SJohannes Berg int bss_priv_size; 3134d3236553SJohannes Berg u8 max_scan_ssids; 313593b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 3136a1f1c21cSLuciano Coelho u8 max_match_sets; 3137d3236553SJohannes Berg u16 max_scan_ie_len; 31385a865badSLuciano Coelho u16 max_sched_scan_ie_len; 3139d3236553SJohannes Berg 3140d3236553SJohannes Berg int n_cipher_suites; 3141d3236553SJohannes Berg const u32 *cipher_suites; 3142d3236553SJohannes Berg 3143b9a5f8caSJouni Malinen u8 retry_short; 3144b9a5f8caSJouni Malinen u8 retry_long; 3145b9a5f8caSJouni Malinen u32 frag_threshold; 3146b9a5f8caSJouni Malinen u32 rts_threshold; 314781077e82SLukáš Turek u8 coverage_class; 3148b9a5f8caSJouni Malinen 314981135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 3150dfce95f5SKalle Valo u32 hw_version; 3151dfce95f5SKalle Valo 3152dfb89c56SJohannes Berg #ifdef CONFIG_PM 3153964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 31546abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 3155dfb89c56SJohannes Berg #endif 3156ff1b6e69SJohannes Berg 3157a293911dSJohannes Berg u16 max_remain_on_channel_duration; 3158a293911dSJohannes Berg 315967fbb16bSSamuel Ortiz u8 max_num_pmkids; 316067fbb16bSSamuel Ortiz 31617f531e03SBruno Randolf u32 available_antennas_tx; 31627f531e03SBruno Randolf u32 available_antennas_rx; 3163a7ffac95SBruno Randolf 316487bbbe22SArik Nemtsov /* 316587bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 316687bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 316787bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 316887bbbe22SArik Nemtsov */ 316987bbbe22SArik Nemtsov u32 probe_resp_offload; 317087bbbe22SArik Nemtsov 3171a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 3172a50df0c4SJohannes Berg u8 extended_capabilities_len; 3173a50df0c4SJohannes Berg 3174d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 3175d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 3176d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 3177d3236553SJohannes Berg * or not. Assign this to something global to your driver to 3178d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 3179cf5aa2f1SDavid Kilroy const void *privid; 3180d3236553SJohannes Berg 3181d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 3182d3236553SJohannes Berg 3183d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 31840c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 3185d3236553SJohannes Berg struct regulatory_request *request); 3186d3236553SJohannes Berg 3187d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 3188d3236553SJohannes Berg 3189458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 3190d3236553SJohannes Berg 3191d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 3192d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 3193d3236553SJohannes Berg struct device dev; 3194d3236553SJohannes Berg 3195ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 3196ecb44335SStanislaw Gruszka bool registered; 3197ecb44335SStanislaw Gruszka 3198d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 3199d3236553SJohannes Berg struct dentry *debugfsdir; 3200d3236553SJohannes Berg 32017e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 3202ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 32037e7c8926SBen Greear 3204463d0183SJohannes Berg #ifdef CONFIG_NET_NS 3205463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 3206463d0183SJohannes Berg struct net *_net; 3207463d0183SJohannes Berg #endif 3208463d0183SJohannes Berg 32093d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 32103d23e349SJohannes Berg const struct iw_handler_def *wext; 32113d23e349SJohannes Berg #endif 32123d23e349SJohannes Berg 3213be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 3214be29b99aSAmitkumar Karwar 3215ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 3216567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 3217567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 3218ad7e718cSJohannes Berg 3219b43504cfSJouni Malinen u16 max_ap_assoc_sta; 3220b43504cfSJouni Malinen 32219a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 322267af9811SEmmanuel Grumbach u8 max_adj_channel_rssi_comp; 32239a774c78SAndrei Otcheretianski 32241c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 3225d3236553SJohannes Berg }; 3226d3236553SJohannes Berg 3227463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 3228463d0183SJohannes Berg { 3229c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 3230463d0183SJohannes Berg } 3231463d0183SJohannes Berg 3232463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 3233463d0183SJohannes Berg { 3234c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 3235463d0183SJohannes Berg } 3236463d0183SJohannes Berg 3237d3236553SJohannes Berg /** 3238d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 3239d3236553SJohannes Berg * 3240d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 32410ae997dcSYacine Belkadi * Return: The priv of @wiphy. 3242d3236553SJohannes Berg */ 3243d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 3244d3236553SJohannes Berg { 3245d3236553SJohannes Berg BUG_ON(!wiphy); 3246d3236553SJohannes Berg return &wiphy->priv; 3247d3236553SJohannes Berg } 3248d3236553SJohannes Berg 3249d3236553SJohannes Berg /** 3250f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 3251f1f74825SDavid Kilroy * 3252f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 32530ae997dcSYacine Belkadi * Return: The wiphy of @priv. 3254f1f74825SDavid Kilroy */ 3255f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 3256f1f74825SDavid Kilroy { 3257f1f74825SDavid Kilroy BUG_ON(!priv); 3258f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 3259f1f74825SDavid Kilroy } 3260f1f74825SDavid Kilroy 3261f1f74825SDavid Kilroy /** 3262d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 3263d3236553SJohannes Berg * 3264d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 3265d3236553SJohannes Berg * @dev: The device to parent it to 3266d3236553SJohannes Berg */ 3267d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 3268d3236553SJohannes Berg { 3269d3236553SJohannes Berg wiphy->dev.parent = dev; 3270d3236553SJohannes Berg } 3271d3236553SJohannes Berg 3272d3236553SJohannes Berg /** 3273d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 3274d3236553SJohannes Berg * 3275d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 32760ae997dcSYacine Belkadi * Return: The dev of @wiphy. 3277d3236553SJohannes Berg */ 3278d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 3279d3236553SJohannes Berg { 3280d3236553SJohannes Berg return wiphy->dev.parent; 3281d3236553SJohannes Berg } 3282d3236553SJohannes Berg 3283d3236553SJohannes Berg /** 3284d3236553SJohannes Berg * wiphy_name - get wiphy name 3285d3236553SJohannes Berg * 3286d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 32870ae997dcSYacine Belkadi * Return: The name of @wiphy. 3288d3236553SJohannes Berg */ 3289e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 3290d3236553SJohannes Berg { 3291d3236553SJohannes Berg return dev_name(&wiphy->dev); 3292d3236553SJohannes Berg } 3293d3236553SJohannes Berg 3294d3236553SJohannes Berg /** 32951998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 32961998d90aSBen Greear * 32971998d90aSBen Greear * @ops: The configuration operations for this device 32981998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 32991998d90aSBen Greear * @requested_name: Request a particular name. 33001998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 33011998d90aSBen Greear * 33021998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 33031998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 33041998d90aSBen Greear * 33051998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 33061998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 33071998d90aSBen Greear */ 33081998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 33091998d90aSBen Greear const char *requested_name); 33101998d90aSBen Greear 33111998d90aSBen Greear /** 3312d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 3313d3236553SJohannes Berg * 3314d3236553SJohannes Berg * @ops: The configuration operations for this device 3315d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 3316d3236553SJohannes Berg * 3317d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 3318d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 3319d3236553SJohannes Berg * 33200ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 33210ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 3322d3236553SJohannes Berg */ 33231998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 33241998d90aSBen Greear int sizeof_priv) 33251998d90aSBen Greear { 33261998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 33271998d90aSBen Greear } 3328d3236553SJohannes Berg 3329d3236553SJohannes Berg /** 3330d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 3331d3236553SJohannes Berg * 3332d3236553SJohannes Berg * @wiphy: The wiphy to register. 3333d3236553SJohannes Berg * 33340ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 3335d3236553SJohannes Berg */ 333610dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 3337d3236553SJohannes Berg 3338d3236553SJohannes Berg /** 3339d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 3340d3236553SJohannes Berg * 3341d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 3342d3236553SJohannes Berg * 3343d3236553SJohannes Berg * After this call, no more requests can be made with this priv 3344d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 3345d3236553SJohannes Berg * request that is being handled. 3346d3236553SJohannes Berg */ 334710dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 3348d3236553SJohannes Berg 3349d3236553SJohannes Berg /** 3350d3236553SJohannes Berg * wiphy_free - free wiphy 3351d3236553SJohannes Berg * 3352d3236553SJohannes Berg * @wiphy: The wiphy to free 3353d3236553SJohannes Berg */ 335410dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 3355d3236553SJohannes Berg 3356fffd0934SJohannes Berg /* internal structs */ 33576829c878SJohannes Berg struct cfg80211_conn; 335819957bb3SJohannes Berg struct cfg80211_internal_bss; 3359fffd0934SJohannes Berg struct cfg80211_cached_keys; 336019957bb3SJohannes Berg 3361d3236553SJohannes Berg /** 336289a54e48SJohannes Berg * struct wireless_dev - wireless device state 3363d3236553SJohannes Berg * 336489a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 336589a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 336689a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 336789a54e48SJohannes Berg * It need not be registered then as netdev registration will 336889a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 336989a54e48SJohannes Berg * 337089a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 337189a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 337289a54e48SJohannes Berg * there's no netdev registration in that case it may not be 337389a54e48SJohannes Berg * allocated outside of callback operations that return it. 3374d3236553SJohannes Berg * 3375d3236553SJohannes Berg * @wiphy: pointer to hardware description 3376d3236553SJohannes Berg * @iftype: interface type 3377d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 337889a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 337989a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 338089a54e48SJohannes Berg * wireless device if it has no netdev 3381d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 33829e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 33839e0e2961SMichal Kazior * the user-set channel definition. 3384780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 3385aa430da4SJohannes Berg * track the channel to be used for AP later 3386d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 3387d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 3388d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 338929cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 339029cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 3391d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 33929bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 33939bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 33949bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 33959bc383deSJohannes Berg * by cfg80211 on change_interface 33962e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 33972e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 33988d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 33998d61ffa5SJohannes Berg * and some API functions require it held 340056d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 340156d1893dSJohannes Berg * beacons, 0 when not valid 340298104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 340398104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 340404f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 340504f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 340631559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 3407780b40dfSJohannes Berg * @ps: powersave mode is enabled 3408780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 3409780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 3410780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 3411780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 3412780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 3413780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 34145336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3415780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 3416780b40dfSJohannes Berg * @event_lock: (private) lock for event list 341778f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 3418d3236553SJohannes Berg */ 3419d3236553SJohannes Berg struct wireless_dev { 3420d3236553SJohannes Berg struct wiphy *wiphy; 3421d3236553SJohannes Berg enum nl80211_iftype iftype; 3422d3236553SJohannes Berg 3423667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 3424d3236553SJohannes Berg struct list_head list; 3425d3236553SJohannes Berg struct net_device *netdev; 3426d3236553SJohannes Berg 342789a54e48SJohannes Berg u32 identifier; 342889a54e48SJohannes Berg 34292e161f78SJohannes Berg struct list_head mgmt_registrations; 34302e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 3431026331c4SJouni Malinen 3432667503ddSJohannes Berg struct mutex mtx; 3433667503ddSJohannes Berg 343498104fdeSJohannes Berg bool use_4addr, p2p_started; 343598104fdeSJohannes Berg 343698104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 34379bc383deSJohannes Berg 3438b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 3439d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 344029cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 34416829c878SJohannes Berg struct cfg80211_conn *conn; 3442fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 3443d3236553SJohannes Berg 3444667503ddSJohannes Berg struct list_head event_list; 3445667503ddSJohannes Berg spinlock_t event_lock; 3446667503ddSJohannes Berg 344719957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3448683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 34499e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 3450f4489ebeSMichal Kazior 3451c30a3d38SMichal Kazior bool ibss_fixed; 34525336fa88SSimon Wunderlich bool ibss_dfs_possible; 3453c30a3d38SMichal Kazior 3454ffb9eb3dSKalle Valo bool ps; 3455ffb9eb3dSKalle Valo int ps_timeout; 3456ffb9eb3dSKalle Valo 345756d1893dSJohannes Berg int beacon_interval; 345856d1893dSJohannes Berg 345915e47304SEric W. Biederman u32 ap_unexpected_nlportid; 346028946da7SJohannes Berg 346104f39047SSimon Wunderlich bool cac_started; 346204f39047SSimon Wunderlich unsigned long cac_start_time; 346331559f35SJanusz Dziedzic unsigned int cac_time_ms; 346404f39047SSimon Wunderlich 346578f22b6aSJohannes Berg u32 owner_nlportid; 346678f22b6aSJohannes Berg 34673d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 3468d3236553SJohannes Berg /* wext data */ 3469cbe8fa9cSJohannes Berg struct { 3470cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 3471f2129354SJohannes Berg struct cfg80211_connect_params connect; 3472fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 3473c1e5f471SJohannes Berg const u8 *ie; 3474f2129354SJohannes Berg size_t ie_len; 3475f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3476f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 347708645126SJohannes Berg s8 default_key, default_mgmt_key; 3478ffb9eb3dSKalle Valo bool prev_bssid_valid; 3479cbe8fa9cSJohannes Berg } wext; 3480d3236553SJohannes Berg #endif 3481d3236553SJohannes Berg }; 3482d3236553SJohannes Berg 348398104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 348498104fdeSJohannes Berg { 348598104fdeSJohannes Berg if (wdev->netdev) 348698104fdeSJohannes Berg return wdev->netdev->dev_addr; 348798104fdeSJohannes Berg return wdev->address; 348898104fdeSJohannes Berg } 348998104fdeSJohannes Berg 3490d3236553SJohannes Berg /** 3491d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 3492d3236553SJohannes Berg * 3493d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 34940ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 3495d3236553SJohannes Berg */ 3496d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 3497d3236553SJohannes Berg { 3498d3236553SJohannes Berg BUG_ON(!wdev); 3499d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 3500d3236553SJohannes Berg } 3501d3236553SJohannes Berg 3502d70e9693SJohannes Berg /** 3503d70e9693SJohannes Berg * DOC: Utility functions 3504d70e9693SJohannes Berg * 3505d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 3506d3236553SJohannes Berg */ 3507d3236553SJohannes Berg 3508d3236553SJohannes Berg /** 3509d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 3510abe37c4bSJohannes Berg * @chan: channel number 351159eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 35120ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 3513d3236553SJohannes Berg */ 351410dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 3515d3236553SJohannes Berg 3516d3236553SJohannes Berg /** 3517d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 3518abe37c4bSJohannes Berg * @freq: center frequency 35190ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 3520d3236553SJohannes Berg */ 352110dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq); 3522d3236553SJohannes Berg 3523d3236553SJohannes Berg /* 3524d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 3525d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 3526d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 3527d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 3528d3236553SJohannes Berg * clash. 3529d3236553SJohannes Berg */ 353010dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 3531d3236553SJohannes Berg int freq); 3532d3236553SJohannes Berg /** 3533d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 3534abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 3535abe37c4bSJohannes Berg * @freq: the center frequency of the channel 35360ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 3537d3236553SJohannes Berg */ 3538d3236553SJohannes Berg static inline struct ieee80211_channel * 3539d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 3540d3236553SJohannes Berg { 3541d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 3542d3236553SJohannes Berg } 3543d3236553SJohannes Berg 3544d3236553SJohannes Berg /** 3545d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 3546d3236553SJohannes Berg * 3547d3236553SJohannes Berg * @sband: the band to look for rates in 3548d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 3549d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 3550d3236553SJohannes Berg * 35510ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 35520ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 35530ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 35540ae997dcSYacine Belkadi * rates in the band's bitrate table. 3555d3236553SJohannes Berg */ 3556d3236553SJohannes Berg struct ieee80211_rate * 3557d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3558d3236553SJohannes Berg u32 basic_rates, int bitrate); 3559d3236553SJohannes Berg 3560b422c6cdSAshok Nagarajan /** 3561b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 3562b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 356374608acaSSimon Wunderlich * @scan_width: width of the control channel 3564b422c6cdSAshok Nagarajan * 3565b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 3566b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 3567b422c6cdSAshok Nagarajan */ 356874608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 356974608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 3570b422c6cdSAshok Nagarajan 3571d3236553SJohannes Berg /* 3572d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3573d3236553SJohannes Berg * 3574d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3575d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3576d3236553SJohannes Berg */ 3577d3236553SJohannes Berg 357833e5a2f7SJohannes Berg struct radiotap_align_size { 357933e5a2f7SJohannes Berg uint8_t align:4, size:4; 358033e5a2f7SJohannes Berg }; 358133e5a2f7SJohannes Berg 358233e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 358333e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 358433e5a2f7SJohannes Berg int n_bits; 358533e5a2f7SJohannes Berg uint32_t oui; 358633e5a2f7SJohannes Berg uint8_t subns; 358733e5a2f7SJohannes Berg }; 358833e5a2f7SJohannes Berg 358933e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 359033e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 359133e5a2f7SJohannes Berg int n_ns; 359233e5a2f7SJohannes Berg }; 359333e5a2f7SJohannes Berg 3594d3236553SJohannes Berg /** 3595d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 359633e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 359733e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 359833e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 359933e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 360033e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 360133e5a2f7SJohannes Berg * the beginning of the actual data portion 360233e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 360333e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 360433e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 360533e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 360633e5a2f7SJohannes Berg * radiotap namespace or not 360733e5a2f7SJohannes Berg * 360833e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 360933e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 361033e5a2f7SJohannes Berg * @_arg_index: next argument index 361133e5a2f7SJohannes Berg * @_arg: next argument pointer 361233e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 361333e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 361433e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 361533e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 361633e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 361733e5a2f7SJohannes Berg * next bitmap word 361833e5a2f7SJohannes Berg * 361933e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 362033e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 3621d3236553SJohannes Berg */ 3622d3236553SJohannes Berg 3623d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 362433e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 362533e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 362633e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 3627d3236553SJohannes Berg 362833e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 362967272440SJohannes Berg __le32 *_next_bitmap; 363033e5a2f7SJohannes Berg 363133e5a2f7SJohannes Berg unsigned char *this_arg; 363233e5a2f7SJohannes Berg int this_arg_index; 363333e5a2f7SJohannes Berg int this_arg_size; 363433e5a2f7SJohannes Berg 363533e5a2f7SJohannes Berg int is_radiotap_ns; 363633e5a2f7SJohannes Berg 363733e5a2f7SJohannes Berg int _max_length; 363833e5a2f7SJohannes Berg int _arg_index; 363933e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 364033e5a2f7SJohannes Berg int _reset_on_ext; 3641d3236553SJohannes Berg }; 3642d3236553SJohannes Berg 364310dd9b7cSJoe Perches int 364410dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 3645d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 364610dd9b7cSJoe Perches int max_length, 364710dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 3648d3236553SJohannes Berg 364910dd9b7cSJoe Perches int 365010dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 3651d3236553SJohannes Berg 365233e5a2f7SJohannes Berg 3653e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 3654e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 3655e31a16d6SZhu Yi 3656e31a16d6SZhu Yi /** 3657e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 3658e31a16d6SZhu Yi * 3659e31a16d6SZhu Yi * @skb: the frame 36600ae997dcSYacine Belkadi * 36610ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 36620ae997dcSYacine Belkadi * returns the 802.11 header length. 36630ae997dcSYacine Belkadi * 36640ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 36650ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 36660ae997dcSYacine Belkadi * 802.11 header. 3667e31a16d6SZhu Yi */ 3668e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3669e31a16d6SZhu Yi 3670e31a16d6SZhu Yi /** 3671e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 3672e31a16d6SZhu Yi * @fc: frame control field in little-endian format 36730ae997dcSYacine Belkadi * Return: The header length in bytes. 3674e31a16d6SZhu Yi */ 3675633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3676e31a16d6SZhu Yi 3677e31a16d6SZhu Yi /** 36789b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 36799b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 36809b395bc3SJohannes Berg * (first byte) will be accessed 36810ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 36829b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 36839b395bc3SJohannes Berg */ 36849b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 36859b395bc3SJohannes Berg 36869b395bc3SJohannes Berg /** 3687d70e9693SJohannes Berg * DOC: Data path helpers 3688d70e9693SJohannes Berg * 3689d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 3690d70e9693SJohannes Berg * functions that help implement the data path for devices 3691d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 3692d70e9693SJohannes Berg */ 3693d70e9693SJohannes Berg 3694d70e9693SJohannes Berg /** 3695e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 3696e31a16d6SZhu Yi * @skb: the 802.11 data frame 3697e31a16d6SZhu Yi * @addr: the device MAC address 3698e31a16d6SZhu Yi * @iftype: the virtual interface type 36990ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 3700e31a16d6SZhu Yi */ 3701eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3702e31a16d6SZhu Yi enum nl80211_iftype iftype); 3703e31a16d6SZhu Yi 3704e31a16d6SZhu Yi /** 3705e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 3706e31a16d6SZhu Yi * @skb: the 802.3 frame 3707e31a16d6SZhu Yi * @addr: the device MAC address 3708e31a16d6SZhu Yi * @iftype: the virtual interface type 3709e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3710e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 37110ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 3712e31a16d6SZhu Yi */ 3713eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3714c1e5f471SJohannes Berg enum nl80211_iftype iftype, const u8 *bssid, 3715c1e5f471SJohannes Berg bool qos); 3716e31a16d6SZhu Yi 3717e31a16d6SZhu Yi /** 3718eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3719eaf85ca7SZhu Yi * 3720eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 3721eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 3722eaf85ca7SZhu Yi * @skb is consumed after the function returns. 3723eaf85ca7SZhu Yi * 3724eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 3725eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 3726eaf85ca7SZhu Yi * initialized by by the caller. 3727eaf85ca7SZhu Yi * @addr: The device MAC address. 3728eaf85ca7SZhu Yi * @iftype: The device interface type. 3729eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 37308b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 3731eaf85ca7SZhu Yi */ 3732eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 3733eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 37348b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 37358b3becadSYogesh Ashok Powar bool has_80211_header); 3736eaf85ca7SZhu Yi 3737eaf85ca7SZhu Yi /** 3738e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3739e31a16d6SZhu Yi * @skb: the data frame 3740fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 37410ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 3742e31a16d6SZhu Yi */ 3743fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 3744fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 3745e31a16d6SZhu Yi 3746c21dbf92SJohannes Berg /** 3747c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 3748c21dbf92SJohannes Berg * 3749c21dbf92SJohannes Berg * @eid: element ID 3750c21dbf92SJohannes Berg * @ies: data consisting of IEs 3751c21dbf92SJohannes Berg * @len: length of data 3752c21dbf92SJohannes Berg * 37530ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 37540ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 37550ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 37560ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 37570ae997dcSYacine Belkadi * 37580ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 37590ae997dcSYacine Belkadi * having to fit into the given data. 3760c21dbf92SJohannes Berg */ 3761c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3762c21dbf92SJohannes Berg 3763d70e9693SJohannes Berg /** 37640c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 37650c28ec58SEliad Peller * 37660c28ec58SEliad Peller * @oui: vendor OUI 37670c28ec58SEliad Peller * @oui_type: vendor-specific OUI type 37680c28ec58SEliad Peller * @ies: data consisting of IEs 37690c28ec58SEliad Peller * @len: length of data 37700c28ec58SEliad Peller * 37710ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 37720ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 37730ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 37740ae997dcSYacine Belkadi * element ID. 37750ae997dcSYacine Belkadi * 37760ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 37770ae997dcSYacine Belkadi * the given data. 37780c28ec58SEliad Peller */ 37790c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 37800c28ec58SEliad Peller const u8 *ies, int len); 37810c28ec58SEliad Peller 37820c28ec58SEliad Peller /** 3783d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 3784d70e9693SJohannes Berg * 3785d70e9693SJohannes Berg * TODO 3786d3236553SJohannes Berg */ 3787d3236553SJohannes Berg 3788d3236553SJohannes Berg /** 3789d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 3790d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 3791d3236553SJohannes Berg * conflicts) 3792d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 3793d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 3794d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 3795d3236553SJohannes Berg * alpha2. 3796d3236553SJohannes Berg * 3797d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 3798d3236553SJohannes Berg * what it believes should be the current regulatory domain by 3799d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 3800d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 3801d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 3802d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 3803d3236553SJohannes Berg * 3804d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 3805d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 3806d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 3807d3236553SJohannes Berg * 3808d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 3809d3236553SJohannes Berg * an -ENOMEM. 38100ae997dcSYacine Belkadi * 38110ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 3812d3236553SJohannes Berg */ 381310dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3814d3236553SJohannes Berg 3815d3236553SJohannes Berg /** 3816b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 3817b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 3818b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 3819b0d7aa59SJonathan Doron * 3820b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 3821b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 3822b0d7aa59SJonathan Doron * information. 3823b0d7aa59SJonathan Doron * 3824b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 3825b0d7aa59SJonathan Doron */ 3826b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 3827b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 3828b0d7aa59SJonathan Doron 3829b0d7aa59SJonathan Doron /** 3830d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 3831d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 3832d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 3833d3236553SJohannes Berg * 3834d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 3835d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 3836d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 3837d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 3838d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 3839d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 3840222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 3841ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 3842222ea581SLuis R. Rodriguez * that called this helper. 3843d3236553SJohannes Berg */ 384410dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 3845d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 3846d3236553SJohannes Berg 3847d3236553SJohannes Berg /** 3848d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 3849d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 3850d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 3851d3236553SJohannes Berg * 3852d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 3853d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 3854d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 3855d3236553SJohannes Berg * and processed already. 3856d3236553SJohannes Berg * 38570ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 38580ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 38590ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 38600ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 38610ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 38620ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 38630ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 3864d3236553SJohannes Berg */ 3865361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3866361c9c8bSJohannes Berg u32 center_freq); 3867d3236553SJohannes Berg 3868034c6d6eSLuis R. Rodriguez /** 3869034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 3870034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 3871034c6d6eSLuis R. Rodriguez * 3872034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 3873034c6d6eSLuis R. Rodriguez * proper string representation. 3874034c6d6eSLuis R. Rodriguez */ 3875034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 3876034c6d6eSLuis R. Rodriguez 3877d3236553SJohannes Berg /* 3878d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 3879d3236553SJohannes Berg * functions and BSS handling helpers 3880d3236553SJohannes Berg */ 3881d3236553SJohannes Berg 38822a519311SJohannes Berg /** 38832a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 38842a519311SJohannes Berg * 38852a519311SJohannes Berg * @request: the corresponding scan request 38862a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 38872a519311SJohannes Berg * userspace will be notified of that 38882a519311SJohannes Berg */ 38892a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 38902a519311SJohannes Berg 38912a519311SJohannes Berg /** 3892807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 3893807f8a8cSLuciano Coelho * 3894807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 3895807f8a8cSLuciano Coelho */ 3896807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 3897807f8a8cSLuciano Coelho 3898807f8a8cSLuciano Coelho /** 3899807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 3900807f8a8cSLuciano Coelho * 3901807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 3902807f8a8cSLuciano Coelho * 3903807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 3904807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 3905807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 3906807f8a8cSLuciano Coelho */ 3907807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3908807f8a8cSLuciano Coelho 3909807f8a8cSLuciano Coelho /** 3910792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 3911792e6aa7SEliad Peller * 3912792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 3913792e6aa7SEliad Peller * 3914792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 3915792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 3916792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 3917792e6aa7SEliad Peller * This function should be called with rtnl locked. 3918792e6aa7SEliad Peller */ 3919792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); 3920792e6aa7SEliad Peller 3921792e6aa7SEliad Peller /** 3922dcd6eac1SSimon Wunderlich * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 39232a519311SJohannes Berg * 39242a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 39253afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3926dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 3927abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 3928abe37c4bSJohannes Berg * @len: length of the management frame 392977965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 39302a519311SJohannes Berg * @gfp: context flags 39312a519311SJohannes Berg * 39322a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 39332a519311SJohannes Berg * the BSS should be updated/added. 3934ef100682SJohannes Berg * 39350ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39360ae997dcSYacine Belkadi * Or %NULL on error. 39372a519311SJohannes Berg */ 3938ef100682SJohannes Berg struct cfg80211_bss * __must_check 3939dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 39403afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3941dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 3942dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 3943dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3944dcd6eac1SSimon Wunderlich 3945dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 39462a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 39473afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 39482a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 3949dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 3950dcd6eac1SSimon Wunderlich { 39513afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width_frame(wiphy, rx_channel, 3952dcd6eac1SSimon Wunderlich NL80211_BSS_CHAN_WIDTH_20, 3953dcd6eac1SSimon Wunderlich mgmt, len, signal, gfp); 3954dcd6eac1SSimon Wunderlich } 39552a519311SJohannes Berg 3956abe37c4bSJohannes Berg /** 39575bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 39585bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 39595bc8c1f2SJohannes Berg * from a beacon or probe response 39605bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 39615bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 39625bc8c1f2SJohannes Berg */ 39635bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 39645bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 39655bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 39665bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 39675bc8c1f2SJohannes Berg }; 39685bc8c1f2SJohannes Berg 39695bc8c1f2SJohannes Berg /** 39705bc8c1f2SJohannes Berg * cfg80211_inform_bss_width - inform cfg80211 of a new BSS 3971abe37c4bSJohannes Berg * 3972abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 39733afc2167SEmmanuel Grumbach * @rx_channel: The channel the frame was received on 3974dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 39755bc8c1f2SJohannes Berg * @ftype: frame type (if known) 3976abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 39777b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3978abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 3979abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 3980abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 3981abe37c4bSJohannes Berg * @ielen: length of the additional IEs 3982abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 3983abe37c4bSJohannes Berg * @gfp: context flags 3984abe37c4bSJohannes Berg * 3985abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 3986abe37c4bSJohannes Berg * the BSS should be updated/added. 3987ef100682SJohannes Berg * 39880ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 39890ae997dcSYacine Belkadi * Or %NULL on error. 3990abe37c4bSJohannes Berg */ 3991ef100682SJohannes Berg struct cfg80211_bss * __must_check 3992dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 39933afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 3994dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 39955bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 3996dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 3997dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 3998dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp); 3999dcd6eac1SSimon Wunderlich 4000dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 400106aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 40023afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 40035bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 40047b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 40057b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 4006dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 4007dcd6eac1SSimon Wunderlich { 40083afc2167SEmmanuel Grumbach return cfg80211_inform_bss_width(wiphy, rx_channel, 40095bc8c1f2SJohannes Berg NL80211_BSS_CHAN_WIDTH_20, ftype, 4010dcd6eac1SSimon Wunderlich bssid, tsf, capability, 4011dcd6eac1SSimon Wunderlich beacon_interval, ie, ielen, signal, 4012dcd6eac1SSimon Wunderlich gfp); 4013dcd6eac1SSimon Wunderlich } 401406aa7afaSJussi Kivilinna 40152a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 40162a519311SJohannes Berg struct ieee80211_channel *channel, 40172a519311SJohannes Berg const u8 *bssid, 401879420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 401979420f09SJohannes Berg u16 capa_mask, u16 capa_val); 402079420f09SJohannes Berg static inline struct cfg80211_bss * 402179420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 402279420f09SJohannes Berg struct ieee80211_channel *channel, 402379420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 402479420f09SJohannes Berg { 402579420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 402679420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 402779420f09SJohannes Berg } 402879420f09SJohannes Berg 40294c0c0b75SJohannes Berg /** 40304c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 40315b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 40324c0c0b75SJohannes Berg * @bss: the BSS struct to reference 40334c0c0b75SJohannes Berg * 40344c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 40354c0c0b75SJohannes Berg */ 40365b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 40374c0c0b75SJohannes Berg 40384c0c0b75SJohannes Berg /** 40394c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 40405b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 40414c0c0b75SJohannes Berg * @bss: the BSS struct 40424c0c0b75SJohannes Berg * 40434c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 40444c0c0b75SJohannes Berg */ 40455b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4046d3236553SJohannes Berg 4047d491af19SJohannes Berg /** 4048d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 4049d491af19SJohannes Berg * @wiphy: the wiphy 4050d491af19SJohannes Berg * @bss: the bss to remove 4051d491af19SJohannes Berg * 4052d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 4053d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 4054d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 4055d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 4056d491af19SJohannes Berg */ 4057d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 4058fee52678SJohannes Berg 4059dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 4060dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 4061dcd6eac1SSimon Wunderlich { 4062dcd6eac1SSimon Wunderlich switch (chandef->width) { 4063dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 4064dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 4065dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 4066dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 4067dcd6eac1SSimon Wunderlich default: 4068dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 4069dcd6eac1SSimon Wunderlich } 4070dcd6eac1SSimon Wunderlich } 4071dcd6eac1SSimon Wunderlich 40726039f6d2SJouni Malinen /** 40736ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 40746039f6d2SJouni Malinen * @dev: network device 40756039f6d2SJouni Malinen * @buf: authentication frame (header + body) 40766039f6d2SJouni Malinen * @len: length of the frame data 40776039f6d2SJouni Malinen * 40786ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 40796ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 40806ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 40816ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40826ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 40836ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 40846ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 40856ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 40866ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 40876ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 40886ff57cf8SJohannes Berg * 40896ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 40906039f6d2SJouni Malinen */ 40916ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 40926039f6d2SJouni Malinen 40936039f6d2SJouni Malinen /** 40946ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 40951965c853SJouni Malinen * @dev: network device 40961965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 4097cb0b4bebSJohannes Berg * 40988d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 40998d61ffa5SJohannes Berg * mutex. 41001965c853SJouni Malinen */ 41016ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 41021965c853SJouni Malinen 41031965c853SJouni Malinen /** 41046ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 41056039f6d2SJouni Malinen * @dev: network device 41066ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 41076ff57cf8SJohannes Berg * moves to cfg80211 in this call 41086ff57cf8SJohannes Berg * @buf: authentication frame (header + body) 41096039f6d2SJouni Malinen * @len: length of the frame data 4110b0b6aa2cSEliad Peller * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a. 41116039f6d2SJouni Malinen * 41126ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 41136ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 41146ff57cf8SJohannes Berg * 41156ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 41166039f6d2SJouni Malinen */ 41176ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 41186ff57cf8SJohannes Berg struct cfg80211_bss *bss, 4119b0b6aa2cSEliad Peller const u8 *buf, size_t len, 4120b0b6aa2cSEliad Peller int uapsd_queues); 41216039f6d2SJouni Malinen 41226039f6d2SJouni Malinen /** 41236ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 41241965c853SJouni Malinen * @dev: network device 4125959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 4126cb0b4bebSJohannes Berg * 41278d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 41281965c853SJouni Malinen */ 4129959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 41301965c853SJouni Malinen 41311965c853SJouni Malinen /** 41326ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 41336039f6d2SJouni Malinen * @dev: network device 41346ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 41356039f6d2SJouni Malinen * @len: length of the frame data 41366039f6d2SJouni Malinen * 41376039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 413853b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 41398d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 41408d61ffa5SJohannes Berg * corresponding wdev's mutex. 41416039f6d2SJouni Malinen */ 41426ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 4143ce470613SHolger Schurig 4144ce470613SHolger Schurig /** 41456ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 4146cf4e594eSJouni Malinen * @dev: network device 4147cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 4148cf4e594eSJouni Malinen * @len: length of the frame data 4149cf4e594eSJouni Malinen * 41506ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 41516ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 4152cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 4153cf4e594eSJouni Malinen */ 41546ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 41556ff57cf8SJohannes Berg const u8 *buf, size_t len); 4156cf4e594eSJouni Malinen 4157cf4e594eSJouni Malinen /** 4158a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 4159a3b8b056SJouni Malinen * @dev: network device 4160a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 4161a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 4162a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 4163a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 4164e6d6e342SJohannes Berg * @gfp: allocation flags 4165a3b8b056SJouni Malinen * 4166a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 4167a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 4168a3b8b056SJouni Malinen * primitive. 4169a3b8b056SJouni Malinen */ 4170a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 4171a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 4172e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 4173a3b8b056SJouni Malinen 417404a773adSJohannes Berg /** 417504a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 417604a773adSJohannes Berg * 417704a773adSJohannes Berg * @dev: network device 417804a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 4179fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 418004a773adSJohannes Berg * @gfp: allocation flags 418104a773adSJohannes Berg * 418204a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 418304a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 418404a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 418504a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 418604a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 418704a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 418804a773adSJohannes Berg */ 4189fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 4190fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 419104a773adSJohannes Berg 41921f87f7d3SJohannes Berg /** 4193c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 4194c93b5e71SJavier Cardona * 4195c93b5e71SJavier Cardona * @dev: network device 4196c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 4197c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 4198c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 4199c93b5e71SJavier Cardona * @gfp: allocation flags 4200c93b5e71SJavier Cardona * 4201c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 4202c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 4203c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 4204c93b5e71SJavier Cardona */ 4205c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 4206c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 4207c93b5e71SJavier Cardona 4208c93b5e71SJavier Cardona /** 4209d70e9693SJohannes Berg * DOC: RFkill integration 4210d70e9693SJohannes Berg * 4211d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 4212d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 4213d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 4214d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 4215d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 4216d70e9693SJohannes Berg * 4217d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 4218d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 4219d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 4220d70e9693SJohannes Berg */ 4221d70e9693SJohannes Berg 4222d70e9693SJohannes Berg /** 42231f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 42241f87f7d3SJohannes Berg * @wiphy: the wiphy 42251f87f7d3SJohannes Berg * @blocked: block status 42261f87f7d3SJohannes Berg */ 42271f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 42281f87f7d3SJohannes Berg 42291f87f7d3SJohannes Berg /** 42301f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 42311f87f7d3SJohannes Berg * @wiphy: the wiphy 42321f87f7d3SJohannes Berg */ 42331f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 42341f87f7d3SJohannes Berg 42351f87f7d3SJohannes Berg /** 42361f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 42371f87f7d3SJohannes Berg * @wiphy: the wiphy 42381f87f7d3SJohannes Berg */ 42391f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 42401f87f7d3SJohannes Berg 4241ad7e718cSJohannes Berg /** 4242ad7e718cSJohannes Berg * DOC: Vendor commands 4243ad7e718cSJohannes Berg * 4244ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 4245ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 4246ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 4247ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 4248ad7e718cSJohannes Berg * the configuration mechanism. 4249ad7e718cSJohannes Berg * 4250ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 4251ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 4252ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 4253ad7e718cSJohannes Berg * 4254ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 4255ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 4256ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 4257ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 4258ad7e718cSJohannes Berg * managers etc. need. 4259ad7e718cSJohannes Berg */ 4260ad7e718cSJohannes Berg 4261ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 4262ad7e718cSJohannes Berg enum nl80211_commands cmd, 4263ad7e718cSJohannes Berg enum nl80211_attrs attr, 4264ad7e718cSJohannes Berg int approxlen); 4265ad7e718cSJohannes Berg 4266567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 4267567ffc35SJohannes Berg enum nl80211_commands cmd, 4268567ffc35SJohannes Berg enum nl80211_attrs attr, 4269567ffc35SJohannes Berg int vendor_event_idx, 4270567ffc35SJohannes Berg int approxlen, gfp_t gfp); 4271567ffc35SJohannes Berg 4272567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 4273567ffc35SJohannes Berg 4274ad7e718cSJohannes Berg /** 4275ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 4276ad7e718cSJohannes Berg * @wiphy: the wiphy 4277ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4278ad7e718cSJohannes Berg * be put into the skb 4279ad7e718cSJohannes Berg * 4280ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4281ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 4282ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 4283ad7e718cSJohannes Berg * 4284ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 4285ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 4286ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 4287ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 4288ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 4289ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 4290ad7e718cSJohannes Berg * You must not modify the skb in any other way. 4291ad7e718cSJohannes Berg * 4292ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 4293ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 4294ad7e718cSJohannes Berg * 4295ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4296ad7e718cSJohannes Berg */ 4297ad7e718cSJohannes Berg static inline struct sk_buff * 4298ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4299ad7e718cSJohannes Berg { 4300ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 4301ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 4302ad7e718cSJohannes Berg } 4303ad7e718cSJohannes Berg 4304ad7e718cSJohannes Berg /** 4305ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 4306ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 4307ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 4308ad7e718cSJohannes Berg * 4309ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 4310ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 4311ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 4312ad7e718cSJohannes Berg * skb regardless of the return value. 4313ad7e718cSJohannes Berg * 4314ad7e718cSJohannes Berg * Return: An error code or 0 on success. 4315ad7e718cSJohannes Berg */ 4316ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 4317ad7e718cSJohannes Berg 4318567ffc35SJohannes Berg /** 4319567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4320567ffc35SJohannes Berg * @wiphy: the wiphy 4321567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 4322567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 4323567ffc35SJohannes Berg * be put into the skb 4324567ffc35SJohannes Berg * @gfp: allocation flags 4325567ffc35SJohannes Berg * 4326567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 4327567ffc35SJohannes Berg * vendor-specific multicast group. 4328567ffc35SJohannes Berg * 4329567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 4330567ffc35SJohannes Berg * skb to send the event. 4331567ffc35SJohannes Berg * 4332567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4333567ffc35SJohannes Berg */ 4334567ffc35SJohannes Berg static inline struct sk_buff * 4335567ffc35SJohannes Berg cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen, 4336567ffc35SJohannes Berg int event_idx, gfp_t gfp) 4337567ffc35SJohannes Berg { 4338567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR, 4339567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 4340567ffc35SJohannes Berg event_idx, approxlen, gfp); 4341567ffc35SJohannes Berg } 4342567ffc35SJohannes Berg 4343567ffc35SJohannes Berg /** 4344567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 4345567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 4346567ffc35SJohannes Berg * @gfp: allocation flags 4347567ffc35SJohannes Berg * 4348567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 4349567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 4350567ffc35SJohannes Berg */ 4351567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 4352567ffc35SJohannes Berg { 4353567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4354567ffc35SJohannes Berg } 4355567ffc35SJohannes Berg 4356aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4357aff89a9bSJohannes Berg /** 4358d70e9693SJohannes Berg * DOC: Test mode 4359d70e9693SJohannes Berg * 4360d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 4361d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 4362d70e9693SJohannes Berg * factory programming. 4363d70e9693SJohannes Berg * 4364d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 4365d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 4366d70e9693SJohannes Berg */ 4367d70e9693SJohannes Berg 4368d70e9693SJohannes Berg /** 4369aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 4370aff89a9bSJohannes Berg * @wiphy: the wiphy 4371aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4372aff89a9bSJohannes Berg * be put into the skb 4373aff89a9bSJohannes Berg * 4374aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 4375aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 4376aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 4377aff89a9bSJohannes Berg * 43780ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 43790ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 43800ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 43810ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 43820ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 43830ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 43840ae997dcSYacine Belkadi * must not modify the skb in any other way. 4385aff89a9bSJohannes Berg * 4386aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 4387aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 43880ae997dcSYacine Belkadi * 43890ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4390aff89a9bSJohannes Berg */ 4391ad7e718cSJohannes Berg static inline struct sk_buff * 4392ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 4393ad7e718cSJohannes Berg { 4394ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 4395ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 4396ad7e718cSJohannes Berg } 4397aff89a9bSJohannes Berg 4398aff89a9bSJohannes Berg /** 4399aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 4400aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4401aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 4402aff89a9bSJohannes Berg * 44030ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 44040ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 44050ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 44060ae997dcSYacine Belkadi * regardless of the return value. 44070ae997dcSYacine Belkadi * 44080ae997dcSYacine Belkadi * Return: An error code or 0 on success. 4409aff89a9bSJohannes Berg */ 4410ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 4411ad7e718cSJohannes Berg { 4412ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 4413ad7e718cSJohannes Berg } 4414aff89a9bSJohannes Berg 4415aff89a9bSJohannes Berg /** 4416aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 4417aff89a9bSJohannes Berg * @wiphy: the wiphy 4418aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 4419aff89a9bSJohannes Berg * be put into the skb 4420aff89a9bSJohannes Berg * @gfp: allocation flags 4421aff89a9bSJohannes Berg * 4422aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 4423aff89a9bSJohannes Berg * testmode multicast group. 4424aff89a9bSJohannes Berg * 44250ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 44260ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 44270ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 44280ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 44290ae997dcSYacine Belkadi * in any other way. 4430aff89a9bSJohannes Berg * 4431aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 4432aff89a9bSJohannes Berg * skb to send the event. 44330ae997dcSYacine Belkadi * 44340ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4435aff89a9bSJohannes Berg */ 4436567ffc35SJohannes Berg static inline struct sk_buff * 4437567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4438567ffc35SJohannes Berg { 4439567ffc35SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE, 4440567ffc35SJohannes Berg NL80211_ATTR_TESTDATA, -1, 4441567ffc35SJohannes Berg approxlen, gfp); 4442567ffc35SJohannes Berg } 4443aff89a9bSJohannes Berg 4444aff89a9bSJohannes Berg /** 4445aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 4446aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 4447aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 4448aff89a9bSJohannes Berg * @gfp: allocation flags 4449aff89a9bSJohannes Berg * 4450aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 4451aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4452aff89a9bSJohannes Berg * consumes it. 4453aff89a9bSJohannes Berg */ 4454567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 4455567ffc35SJohannes Berg { 4456567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 4457567ffc35SJohannes Berg } 4458aff89a9bSJohannes Berg 4459aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 446071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4461aff89a9bSJohannes Berg #else 4462aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 446371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 4464aff89a9bSJohannes Berg #endif 4465aff89a9bSJohannes Berg 4466b23aa676SSamuel Ortiz /** 4467b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 4468b23aa676SSamuel Ortiz * 4469b23aa676SSamuel Ortiz * @dev: network device 4470b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 4471b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4472b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4473b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4474b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4475b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 4476b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 4477b23aa676SSamuel Ortiz * the real status code for failures. 4478b23aa676SSamuel Ortiz * @gfp: allocation flags 4479b23aa676SSamuel Ortiz * 4480b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 4481b23aa676SSamuel Ortiz * succeeded. 4482b23aa676SSamuel Ortiz */ 4483b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 4484b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4485b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 4486b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 4487b23aa676SSamuel Ortiz 4488b23aa676SSamuel Ortiz /** 4489b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 4490b23aa676SSamuel Ortiz * 4491b23aa676SSamuel Ortiz * @dev: network device 4492ed9d0102SJouni Malinen * @channel: the channel of the new AP 4493b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 4494b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 4495b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 4496b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 4497b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 4498b23aa676SSamuel Ortiz * @gfp: allocation flags 4499b23aa676SSamuel Ortiz * 4500b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 4501b23aa676SSamuel Ortiz * from one AP to another while connected. 4502b23aa676SSamuel Ortiz */ 4503ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 4504ed9d0102SJouni Malinen struct ieee80211_channel *channel, 4505ed9d0102SJouni Malinen const u8 *bssid, 4506b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 4507b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4508b23aa676SSamuel Ortiz 4509b23aa676SSamuel Ortiz /** 4510adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 4511adbde344SVasanthakumar Thiagarajan * 4512adbde344SVasanthakumar Thiagarajan * @dev: network device 4513adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 4514adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 4515adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 4516adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 4517adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 4518adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 4519adbde344SVasanthakumar Thiagarajan * 4520adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 4521adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 4522adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 4523adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 4524adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 4525adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 4526adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 4527adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 4528adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 4529adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 4530adbde344SVasanthakumar Thiagarajan */ 4531adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 4532adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 4533adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 4534adbde344SVasanthakumar Thiagarajan 4535adbde344SVasanthakumar Thiagarajan /** 4536b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 4537b23aa676SSamuel Ortiz * 4538b23aa676SSamuel Ortiz * @dev: network device 4539b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 4540b23aa676SSamuel Ortiz * @ie_len: length of IEs 4541b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 4542b23aa676SSamuel Ortiz * @gfp: allocation flags 4543b23aa676SSamuel Ortiz * 4544b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 4545b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 4546b23aa676SSamuel Ortiz */ 4547b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 4548c1e5f471SJohannes Berg const u8 *ie, size_t ie_len, gfp_t gfp); 4549b23aa676SSamuel Ortiz 45509588bbd5SJouni Malinen /** 45519588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 455271bbc994SJohannes Berg * @wdev: wireless device 45539588bbd5SJouni Malinen * @cookie: the request cookie 45549588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 45559588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 45569588bbd5SJouni Malinen * channel 45579588bbd5SJouni Malinen * @gfp: allocation flags 45589588bbd5SJouni Malinen */ 455971bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 45609588bbd5SJouni Malinen struct ieee80211_channel *chan, 45619588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 45629588bbd5SJouni Malinen 45639588bbd5SJouni Malinen /** 45649588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 456571bbc994SJohannes Berg * @wdev: wireless device 45669588bbd5SJouni Malinen * @cookie: the request cookie 45679588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 45689588bbd5SJouni Malinen * @gfp: allocation flags 45699588bbd5SJouni Malinen */ 457071bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 45719588bbd5SJouni Malinen struct ieee80211_channel *chan, 45729588bbd5SJouni Malinen gfp_t gfp); 4573b23aa676SSamuel Ortiz 457498b62183SJohannes Berg 457598b62183SJohannes Berg /** 457698b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 457798b62183SJohannes Berg * 457898b62183SJohannes Berg * @dev: the netdev 457998b62183SJohannes Berg * @mac_addr: the station's address 458098b62183SJohannes Berg * @sinfo: the station information 458198b62183SJohannes Berg * @gfp: allocation flags 458298b62183SJohannes Berg */ 458398b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 458498b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 458598b62183SJohannes Berg 4586026331c4SJouni Malinen /** 4587ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 4588ec15e68bSJouni Malinen * 4589ec15e68bSJouni Malinen * @dev: the netdev 4590ec15e68bSJouni Malinen * @mac_addr: the station's address 4591ec15e68bSJouni Malinen * @gfp: allocation flags 4592ec15e68bSJouni Malinen */ 4593ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 4594ec15e68bSJouni Malinen 4595ec15e68bSJouni Malinen /** 4596ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 4597ed44a951SPandiyarajan Pitchaimuthu * 4598ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 4599ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 4600ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 4601ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 4602ed44a951SPandiyarajan Pitchaimuthu * 4603ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 4604ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 4605ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 4606ed44a951SPandiyarajan Pitchaimuthu * 4607ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 4608ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 4609ed44a951SPandiyarajan Pitchaimuthu */ 4610ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 4611ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 4612ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 4613ed44a951SPandiyarajan Pitchaimuthu 4614ed44a951SPandiyarajan Pitchaimuthu /** 46152e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 461671bbc994SJohannes Berg * @wdev: wireless device receiving the frame 4617026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 4618804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 46192e161f78SJohannes Berg * @buf: Management frame (header + body) 4620026331c4SJouni Malinen * @len: length of the frame data 462119504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 46222e161f78SJohannes Berg * 46230ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 46240ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 46250ae997dcSYacine Belkadi * 46260ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 46272e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 46282e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 46292e161f78SJohannes Berg * driver is responsible for rejecting the frame. 4630026331c4SJouni Malinen */ 463171bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 4632970fdfa8SVladimir Kondratiev const u8 *buf, size_t len, u32 flags); 4633026331c4SJouni Malinen 4634026331c4SJouni Malinen /** 46352e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 463671bbc994SJohannes Berg * @wdev: wireless device receiving the frame 46372e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 46382e161f78SJohannes Berg * @buf: Management frame (header + body) 4639026331c4SJouni Malinen * @len: length of the frame data 4640026331c4SJouni Malinen * @ack: Whether frame was acknowledged 4641026331c4SJouni Malinen * @gfp: context flags 4642026331c4SJouni Malinen * 46432e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 46442e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 4645026331c4SJouni Malinen * transmission attempt. 4646026331c4SJouni Malinen */ 464771bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 4648026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 4649026331c4SJouni Malinen 4650d6dc1a38SJuuso Oikarinen 4651d6dc1a38SJuuso Oikarinen /** 4652d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 4653d6dc1a38SJuuso Oikarinen * @dev: network device 4654d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 4655d6dc1a38SJuuso Oikarinen * @gfp: context flags 4656d6dc1a38SJuuso Oikarinen * 4657d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 4658d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 4659d6dc1a38SJuuso Oikarinen */ 4660d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 4661d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 4662d6dc1a38SJuuso Oikarinen gfp_t gfp); 4663d6dc1a38SJuuso Oikarinen 4664c063dbf5SJohannes Berg /** 4665c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 4666c063dbf5SJohannes Berg * @dev: network device 4667c063dbf5SJohannes Berg * @peer: peer's MAC address 4668c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 4669c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 4670c063dbf5SJohannes Berg * threshold (to account for temporary interference) 4671c063dbf5SJohannes Berg * @gfp: context flags 4672c063dbf5SJohannes Berg */ 4673c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 4674c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 4675c063dbf5SJohannes Berg 4676e5497d76SJohannes Berg /** 467784f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 467884f10708SThomas Pedersen * @dev: network device 467984f10708SThomas Pedersen * @peer: peer's MAC address 468084f10708SThomas Pedersen * @num_packets: how many packets were lost 468184f10708SThomas Pedersen * @rate: % of packets which failed transmission 468284f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 468384f10708SThomas Pedersen * @gfp: context flags 468484f10708SThomas Pedersen * 468584f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 468684f10708SThomas Pedersen * given interval is exceeded. 468784f10708SThomas Pedersen */ 468884f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 468984f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 469084f10708SThomas Pedersen 469184f10708SThomas Pedersen /** 469298f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 469398f03342SJohannes Berg * @dev: network device 469498f03342SJohannes Berg * @gfp: context flags 469598f03342SJohannes Berg * 469698f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 469798f03342SJohannes Berg */ 469898f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 469998f03342SJohannes Berg 470098f03342SJohannes Berg /** 47015b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 47025b97f49dSJohannes Berg * @wiphy: the wiphy 47035b97f49dSJohannes Berg * @chandef: chandef for the current channel 47045b97f49dSJohannes Berg * @gfp: context flags 47055b97f49dSJohannes Berg * 47065b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 47075b97f49dSJohannes Berg */ 47085b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 47095b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 47105b97f49dSJohannes Berg 47115b97f49dSJohannes Berg /** 47125b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 47135b97f49dSJohannes Berg * @netdev: network device 47145b97f49dSJohannes Berg * @chandef: chandef for the current channel 47155b97f49dSJohannes Berg * @event: type of event 47165b97f49dSJohannes Berg * @gfp: context flags 47175b97f49dSJohannes Berg * 47185b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 47195b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 47205b97f49dSJohannes Berg * also by full-MAC drivers. 47215b97f49dSJohannes Berg */ 47225b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 47235b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 47245b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 47255b97f49dSJohannes Berg 47265b97f49dSJohannes Berg 47275b97f49dSJohannes Berg /** 4728e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 4729e5497d76SJohannes Berg * @dev: network device 4730e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 4731e5497d76SJohannes Berg * @replay_ctr: new replay counter 4732af71ff85SJohannes Berg * @gfp: allocation flags 4733e5497d76SJohannes Berg */ 4734e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 4735e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 4736e5497d76SJohannes Berg 4737c9df56b4SJouni Malinen /** 4738c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 4739c9df56b4SJouni Malinen * @dev: network device 4740c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 4741c9df56b4SJouni Malinen * @bssid: BSSID of AP 4742c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 4743c9df56b4SJouni Malinen * @gfp: allocation flags 4744c9df56b4SJouni Malinen */ 4745c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 4746c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 4747c9df56b4SJouni Malinen 474828946da7SJohannes Berg /** 474928946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 475028946da7SJohannes Berg * @dev: The device the frame matched to 475128946da7SJohannes Berg * @addr: the transmitter address 475228946da7SJohannes Berg * @gfp: context flags 475328946da7SJohannes Berg * 475428946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 475528946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 475628946da7SJohannes Berg * sender. 47570ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 475828946da7SJohannes Berg * for a reason other than not having a subscription.) 475928946da7SJohannes Berg */ 476028946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 476128946da7SJohannes Berg const u8 *addr, gfp_t gfp); 476228946da7SJohannes Berg 47637f6cf311SJohannes Berg /** 4764b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 4765b92ab5d8SJohannes Berg * @dev: The device the frame matched to 4766b92ab5d8SJohannes Berg * @addr: the transmitter address 4767b92ab5d8SJohannes Berg * @gfp: context flags 4768b92ab5d8SJohannes Berg * 4769b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 4770b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 4771b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 4772b92ab5d8SJohannes Berg * station to avoid event flooding. 47730ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 4774b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 4775b92ab5d8SJohannes Berg */ 4776b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 4777b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 4778b92ab5d8SJohannes Berg 4779b92ab5d8SJohannes Berg /** 47807f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 47817f6cf311SJohannes Berg * @dev: the device the probe was sent on 47827f6cf311SJohannes Berg * @addr: the address of the peer 47837f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 47847f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 47857f6cf311SJohannes Berg * @gfp: allocation flags 47867f6cf311SJohannes Berg */ 47877f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 47887f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 47897f6cf311SJohannes Berg 47905e760230SJohannes Berg /** 47915e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 47925e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 47935e760230SJohannes Berg * @frame: the frame 47945e760230SJohannes Berg * @len: length of the frame 47955e760230SJohannes Berg * @freq: frequency the frame was received on 4796804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 47975e760230SJohannes Berg * 47985e760230SJohannes Berg * Use this function to report to userspace when a beacon was 47995e760230SJohannes Berg * received. It is not useful to call this when there is no 48005e760230SJohannes Berg * netdev that is in AP/GO mode. 48015e760230SJohannes Berg */ 48025e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 48035e760230SJohannes Berg const u8 *frame, size_t len, 480437c73b5fSBen Greear int freq, int sig_dbm); 48055e760230SJohannes Berg 4806d58e7e37SJohannes Berg /** 4807683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 480854858ee5SAlexander Simon * @wiphy: the wiphy 4809683b6d3bSJohannes Berg * @chandef: the channel definition 4810174e0cd2SIlan Peer * @iftype: interface type 4811d58e7e37SJohannes Berg * 48120ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 48130ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 481454858ee5SAlexander Simon */ 4815683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4816174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 4817174e0cd2SIlan Peer enum nl80211_iftype iftype); 481854858ee5SAlexander Simon 48198097e149SThomas Pedersen /* 48205314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 48215314526bSThomas Pedersen * @dev: the device which switched channels 4822683b6d3bSJohannes Berg * @chandef: the new channel definition 48235314526bSThomas Pedersen * 4824e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 4825e487eaebSSimon Wunderlich * driver context! 48265314526bSThomas Pedersen */ 4827683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 4828683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 48295314526bSThomas Pedersen 4830f8d7552eSLuciano Coelho /* 4831f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 4832f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 4833f8d7552eSLuciano Coelho * @chandef: the future channel definition 4834f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 4835f8d7552eSLuciano Coelho * 4836f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 4837f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 4838f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 4839f8d7552eSLuciano Coelho */ 4840f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 4841f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 4842f8d7552eSLuciano Coelho u8 count); 4843f8d7552eSLuciano Coelho 48441ce3e82bSJohannes Berg /** 48451ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 48461ce3e82bSJohannes Berg * 48471ce3e82bSJohannes Berg * @operating_class: the operating class to convert 48481ce3e82bSJohannes Berg * @band: band pointer to fill 48491ce3e82bSJohannes Berg * 48501ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 48511ce3e82bSJohannes Berg */ 48521ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 48531ce3e82bSJohannes Berg enum ieee80211_band *band); 48541ce3e82bSJohannes Berg 48555314526bSThomas Pedersen /* 48563475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 48573475b094SJouni Malinen * @dev: the device on which the operation is requested 48583475b094SJouni Malinen * @peer: the MAC address of the peer device 48593475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 48603475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 48613475b094SJouni Malinen * @reason_code: the reason code for teardown request 48623475b094SJouni Malinen * @gfp: allocation flags 48633475b094SJouni Malinen * 48643475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 48653475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 48663475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 48673475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 48683475b094SJouni Malinen * based on traffic and signal strength for a peer). 48693475b094SJouni Malinen */ 48703475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 48713475b094SJouni Malinen enum nl80211_tdls_operation oper, 48723475b094SJouni Malinen u16 reason_code, gfp_t gfp); 48733475b094SJouni Malinen 48743475b094SJouni Malinen /* 48758097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 48768097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 48778097e149SThomas Pedersen * 48788097e149SThomas Pedersen * return 0 if MCS index >= 32 48798097e149SThomas Pedersen */ 48808eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 48818097e149SThomas Pedersen 488298104fdeSJohannes Berg /** 488398104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 488498104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 488598104fdeSJohannes Berg * 488698104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 488798104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 488898104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 488998104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 489098104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 489198104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 489298104fdeSJohannes Berg * when the device is unbound from the driver. 489398104fdeSJohannes Berg * 489498104fdeSJohannes Berg * Requires the RTNL to be held. 489598104fdeSJohannes Berg */ 489698104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 489798104fdeSJohannes Berg 48980ee45355SJohannes Berg /** 4899355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 4900355199e0SJouni Malinen * @ies: FT IEs 4901355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 4902355199e0SJouni Malinen * @target_ap: target AP's MAC address 4903355199e0SJouni Malinen * @ric_ies: RIC IE 4904355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 4905355199e0SJouni Malinen */ 4906355199e0SJouni Malinen struct cfg80211_ft_event_params { 4907355199e0SJouni Malinen const u8 *ies; 4908355199e0SJouni Malinen size_t ies_len; 4909355199e0SJouni Malinen const u8 *target_ap; 4910355199e0SJouni Malinen const u8 *ric_ies; 4911355199e0SJouni Malinen size_t ric_ies_len; 4912355199e0SJouni Malinen }; 4913355199e0SJouni Malinen 4914355199e0SJouni Malinen /** 4915355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 4916355199e0SJouni Malinen * @netdev: network device 4917355199e0SJouni Malinen * @ft_event: IE information 4918355199e0SJouni Malinen */ 4919355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 4920355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 4921355199e0SJouni Malinen 4922355199e0SJouni Malinen /** 49230ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 49240ee45355SJohannes Berg * @ies: the input IE buffer 49250ee45355SJohannes Berg * @len: the input length 49260ee45355SJohannes Berg * @attr: the attribute ID to find 49270ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 49280ee45355SJohannes Berg * if the function is only called to get the needed buffer size 49290ee45355SJohannes Berg * @bufsize: size of the output buffer 49300ee45355SJohannes Berg * 49310ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 49320ee45355SJohannes Berg * copies its contents to the given buffer. 49330ee45355SJohannes Berg * 49340ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 49350ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 49360ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 49370ee45355SJohannes Berg */ 4938c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 4939c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 4940c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 49410ee45355SJohannes Berg 4942cd8f7cb4SJohannes Berg /** 4943cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 4944cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 4945cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 4946cd8f7cb4SJohannes Berg * @gfp: allocation flags 4947cd8f7cb4SJohannes Berg * 4948cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 4949cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 4950cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 4951cd8f7cb4SJohannes Berg * else caused the wakeup. 4952cd8f7cb4SJohannes Berg */ 4953cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 4954cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 4955cd8f7cb4SJohannes Berg gfp_t gfp); 4956cd8f7cb4SJohannes Berg 49575de17984SArend van Spriel /** 49585de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 49595de17984SArend van Spriel * 49605de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 496103f831a6SRobert P. J. Day * @gfp: allocation flags 49625de17984SArend van Spriel * 49635de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 49645de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 49655de17984SArend van Spriel * by .crit_proto_start() has expired. 49665de17984SArend van Spriel */ 49675de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 49685de17984SArend van Spriel 4969bdfbec2dSIlan Peer /** 4970bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 4971bdfbec2dSIlan Peer * @wiphy: the wiphy 4972bdfbec2dSIlan Peer * 4973bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 4974bdfbec2dSIlan Peer */ 4975bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 4976bdfbec2dSIlan Peer 4977cb2d956dSLuciano Coelho /** 4978cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 4979cb2d956dSLuciano Coelho * 4980cb2d956dSLuciano Coelho * @wiphy: the wiphy 4981cb2d956dSLuciano Coelho * @num_different_channels: the number of different channels we want 4982cb2d956dSLuciano Coelho * to use for verification 4983cb2d956dSLuciano Coelho * @radar_detect: a bitmap where each bit corresponds to a channel 4984cb2d956dSLuciano Coelho * width where radar detection is needed, as in the definition of 4985cb2d956dSLuciano Coelho * &struct ieee80211_iface_combination.@radar_detect_widths 4986cb2d956dSLuciano Coelho * @iftype_num: array with the numbers of interfaces of each interface 4987cb2d956dSLuciano Coelho * type. The index is the interface type as specified in &enum 4988cb2d956dSLuciano Coelho * nl80211_iftype. 4989cb2d956dSLuciano Coelho * 4990cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 4991cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 4992cb2d956dSLuciano Coelho * the interface combinations. 4993cb2d956dSLuciano Coelho */ 4994cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 4995cb2d956dSLuciano Coelho const int num_different_channels, 4996cb2d956dSLuciano Coelho const u8 radar_detect, 4997cb2d956dSLuciano Coelho const int iftype_num[NUM_NL80211_IFTYPES]); 4998cb2d956dSLuciano Coelho 499965a124ddSMichal Kazior /** 500065a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 500165a124ddSMichal Kazior * 500265a124ddSMichal Kazior * @wiphy: the wiphy 500365a124ddSMichal Kazior * @num_different_channels: the number of different channels we want 500465a124ddSMichal Kazior * to use for verification 500565a124ddSMichal Kazior * @radar_detect: a bitmap where each bit corresponds to a channel 500665a124ddSMichal Kazior * width where radar detection is needed, as in the definition of 500765a124ddSMichal Kazior * &struct ieee80211_iface_combination.@radar_detect_widths 500865a124ddSMichal Kazior * @iftype_num: array with the numbers of interfaces of each interface 500965a124ddSMichal Kazior * type. The index is the interface type as specified in &enum 501065a124ddSMichal Kazior * nl80211_iftype. 501165a124ddSMichal Kazior * @iter: function to call for each matching combination 501265a124ddSMichal Kazior * @data: pointer to pass to iter function 501365a124ddSMichal Kazior * 501465a124ddSMichal Kazior * This function can be called by the driver to check what possible 501565a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 501665a124ddSMichal Kazior * purposes. 501765a124ddSMichal Kazior */ 501865a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 501965a124ddSMichal Kazior const int num_different_channels, 502065a124ddSMichal Kazior const u8 radar_detect, 502165a124ddSMichal Kazior const int iftype_num[NUM_NL80211_IFTYPES], 502265a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 502365a124ddSMichal Kazior void *data), 502465a124ddSMichal Kazior void *data); 502565a124ddSMichal Kazior 5026f04c2203SMichal Kazior /* 5027f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 5028f04c2203SMichal Kazior * 5029f04c2203SMichal Kazior * @wiphy: the wiphy 5030f04c2203SMichal Kazior * @wdev: wireless device 5031f04c2203SMichal Kazior * @gfp: context flags 5032f04c2203SMichal Kazior * 5033f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 5034f04c2203SMichal Kazior * disconnected. 5035f04c2203SMichal Kazior * 5036f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 5037f04c2203SMichal Kazior */ 5038f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 5039f04c2203SMichal Kazior gfp_t gfp); 5040f04c2203SMichal Kazior 5041f6837ba8SJohannes Berg /** 5042f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 5043f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 5044f6837ba8SJohannes Berg * 5045f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 5046f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 5047f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 5048f6837ba8SJohannes Berg * that really can't be recovered in any other way. 5049f6837ba8SJohannes Berg * 5050f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 5051f6837ba8SJohannes Berg * the driver while the function is running. 5052f6837ba8SJohannes Berg */ 5053f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 5054f6837ba8SJohannes Berg 5055b7ffbd7eSJohannes Berg 5056b7ffbd7eSJohannes Berg /* ethtool helper */ 5057b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 5058b7ffbd7eSJohannes Berg 5059e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 5060e1db74fcSJoe Perches 5061e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 5062e1db74fcSJoe Perches 5063e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 50649c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 5065e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 50669c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 5067e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 50689c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 5069e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 50709c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 5071e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 50729c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 5073e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 50749c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 5075e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 50769c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 5077e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 50789c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 5079073730d7SJoe Perches 50809c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 5081e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 50829c376639SJoe Perches 5083e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 50849c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 5085e1db74fcSJoe Perches 5086e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 5087e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 5088e1db74fcSJoe Perches #else 5089e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 5090e1db74fcSJoe Perches ({ \ 5091e1db74fcSJoe Perches if (0) \ 5092e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 5093e1db74fcSJoe Perches 0; \ 5094e1db74fcSJoe Perches }) 5095e1db74fcSJoe Perches #endif 5096e1db74fcSJoe Perches 5097e1db74fcSJoe Perches /* 5098e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 5099e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 5100e1db74fcSJoe Perches * file/line information and a backtrace. 5101e1db74fcSJoe Perches */ 5102e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 5103e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 5104e1db74fcSJoe Perches 5105704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 5106