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> 7d3236553SJohannes Berg * 8d3236553SJohannes Berg * This program is free software; you can redistribute it and/or modify 9d3236553SJohannes Berg * it under the terms of the GNU General Public License version 2 as 10d3236553SJohannes Berg * published by the Free Software Foundation. 11d3236553SJohannes Berg */ 12704232c2SJohannes Berg 13d3236553SJohannes Berg #include <linux/netdevice.h> 14d3236553SJohannes Berg #include <linux/debugfs.h> 15d3236553SJohannes Berg #include <linux/list.h> 16187f1882SPaul Gortmaker #include <linux/bug.h> 17704232c2SJohannes Berg #include <linux/netlink.h> 18704232c2SJohannes Berg #include <linux/skbuff.h> 1955682965SJohannes Berg #include <linux/nl80211.h> 202a519311SJohannes Berg #include <linux/if_ether.h> 212a519311SJohannes Berg #include <linux/ieee80211.h> 222a0e047eSJohannes Berg #include <linux/net.h> 23d3236553SJohannes Berg #include <net/regulatory.h> 24d3236553SJohannes Berg 25d70e9693SJohannes Berg /** 26d70e9693SJohannes Berg * DOC: Introduction 27d70e9693SJohannes Berg * 28d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 29d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 30d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 31d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 32d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 33d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 34d70e9693SJohannes Berg * 35d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 36d70e9693SJohannes Berg * use restrictions. 37d70e9693SJohannes Berg */ 38d70e9693SJohannes Berg 39d70e9693SJohannes Berg 40d70e9693SJohannes Berg /** 41d70e9693SJohannes Berg * DOC: Device registration 42d70e9693SJohannes Berg * 43d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 44d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 45d70e9693SJohannes Berg * described below. 46d70e9693SJohannes Berg * 47d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 48d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 49d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 50d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 51d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 52d70e9693SJohannes Berg * the wireless part of the interface, normally this struct is embedded in the 53d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 54d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 55d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 56d70e9693SJohannes Berg * 57d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 58d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 59d70e9693SJohannes Berg * structures here describe these capabilities in detail. 60d70e9693SJohannes Berg */ 61d70e9693SJohannes Berg 629f5e8f6eSJohannes Berg struct wiphy; 639f5e8f6eSJohannes Berg 64704232c2SJohannes Berg /* 65d3236553SJohannes Berg * wireless hardware capability structures 66d3236553SJohannes Berg */ 67d3236553SJohannes Berg 68d3236553SJohannes Berg /** 69d3236553SJohannes Berg * enum ieee80211_band - supported frequency bands 70704232c2SJohannes Berg * 71d3236553SJohannes Berg * The bands are assigned this way because the supported 72d3236553SJohannes Berg * bitrates differ in these bands. 73d3236553SJohannes Berg * 74d3236553SJohannes Berg * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 75d3236553SJohannes Berg * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 763a0c52a6SVladimir Kondratiev * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) 77abe37c4bSJohannes Berg * @IEEE80211_NUM_BANDS: number of defined bands 78d3236553SJohannes Berg */ 79d3236553SJohannes Berg enum ieee80211_band { 8013ae75b1SJouni Malinen IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 8113ae75b1SJouni Malinen IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 823a0c52a6SVladimir Kondratiev IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ, 83d3236553SJohannes Berg 84d3236553SJohannes Berg /* keep last */ 85d3236553SJohannes Berg IEEE80211_NUM_BANDS 86d3236553SJohannes Berg }; 87d3236553SJohannes Berg 88d3236553SJohannes Berg /** 89d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 90d3236553SJohannes Berg * 91d3236553SJohannes Berg * Channel flags set by the regulatory control code. 92d3236553SJohannes Berg * 93d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 94d3236553SJohannes Berg * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted 95d3236553SJohannes Berg * on this channel. 96d3236553SJohannes Berg * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. 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. 113d3236553SJohannes Berg */ 114d3236553SJohannes Berg enum ieee80211_channel_flags { 115d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 116d3236553SJohannes Berg IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, 117d3236553SJohannes Berg IEEE80211_CHAN_NO_IBSS = 1<<2, 118d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 119689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 120689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 12103f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 122c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 123c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 124d3236553SJohannes Berg }; 125d3236553SJohannes Berg 126038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 127689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 128038659e7SLuis R. Rodriguez 12904f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 13004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 13104f39047SSimon Wunderlich 132d3236553SJohannes Berg /** 133d3236553SJohannes Berg * struct ieee80211_channel - channel definition 134d3236553SJohannes Berg * 135d3236553SJohannes Berg * This structure describes a single channel for use 136d3236553SJohannes Berg * with cfg80211. 137d3236553SJohannes Berg * 138d3236553SJohannes Berg * @center_freq: center frequency in MHz 139d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 140d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 141d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 142d3236553SJohannes Berg * code to support devices with additional restrictions 143d3236553SJohannes Berg * @band: band this channel belongs to. 144d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 145d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 146eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 147d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 148d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 14977c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 150d3236553SJohannes Berg * @orig_mag: internal use 151d3236553SJohannes Berg * @orig_mpwr: internal use 15204f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 15304f39047SSimon Wunderlich * on this channel. 15404f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 155d3236553SJohannes Berg */ 156d3236553SJohannes Berg struct ieee80211_channel { 157d3236553SJohannes Berg enum ieee80211_band band; 158d3236553SJohannes Berg u16 center_freq; 159d3236553SJohannes Berg u16 hw_value; 160d3236553SJohannes Berg u32 flags; 161d3236553SJohannes Berg int max_antenna_gain; 162d3236553SJohannes Berg int max_power; 163eccc068eSHong Wu int max_reg_power; 164d3236553SJohannes Berg bool beacon_found; 165d3236553SJohannes Berg u32 orig_flags; 166d3236553SJohannes Berg int orig_mag, orig_mpwr; 16704f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 16804f39047SSimon Wunderlich unsigned long dfs_state_entered; 169d3236553SJohannes Berg }; 170d3236553SJohannes Berg 171d3236553SJohannes Berg /** 172d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 173d3236553SJohannes Berg * 174d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 175d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 176d3236553SJohannes Berg * different bands/PHY modes. 177d3236553SJohannes Berg * 178d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 179d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 180d3236553SJohannes Berg * with CCK rates. 181d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 182d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 183d3236553SJohannes Berg * core code when registering the wiphy. 184d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 185d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 186d3236553SJohannes Berg * core code when registering the wiphy. 187d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 188d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 189d3236553SJohannes Berg * core code when registering the wiphy. 190d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 191d3236553SJohannes Berg */ 192d3236553SJohannes Berg enum ieee80211_rate_flags { 193d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 194d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 195d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 196d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 197d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 198d3236553SJohannes Berg }; 199d3236553SJohannes Berg 200d3236553SJohannes Berg /** 201d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 202d3236553SJohannes Berg * 203d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 204d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 205d3236553SJohannes Berg * are only for driver use when pointers to this structure are 206d3236553SJohannes Berg * passed around. 207d3236553SJohannes Berg * 208d3236553SJohannes Berg * @flags: rate-specific flags 209d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 210d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 211d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 212d3236553SJohannes Berg * short preamble is used 213d3236553SJohannes Berg */ 214d3236553SJohannes Berg struct ieee80211_rate { 215d3236553SJohannes Berg u32 flags; 216d3236553SJohannes Berg u16 bitrate; 217d3236553SJohannes Berg u16 hw_value, hw_value_short; 218d3236553SJohannes Berg }; 219d3236553SJohannes Berg 220d3236553SJohannes Berg /** 221d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 222d3236553SJohannes Berg * 223d3236553SJohannes Berg * This structure describes most essential parameters needed 224d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 225d3236553SJohannes Berg * 226d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 227d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 228d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 229d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 230d3236553SJohannes Berg * @mcs: Supported MCS rates 231d3236553SJohannes Berg */ 232d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 233d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 234d3236553SJohannes Berg bool ht_supported; 235d3236553SJohannes Berg u8 ampdu_factor; 236d3236553SJohannes Berg u8 ampdu_density; 237d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 238d3236553SJohannes Berg }; 239d3236553SJohannes Berg 240d3236553SJohannes Berg /** 241bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 242bf0c111eSMahesh Palivela * 243bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 244bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 245bf0c111eSMahesh Palivela * 246bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 247bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 248bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 249bf0c111eSMahesh Palivela */ 250bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 251bf0c111eSMahesh Palivela bool vht_supported; 252bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 253bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 254bf0c111eSMahesh Palivela }; 255bf0c111eSMahesh Palivela 256bf0c111eSMahesh Palivela /** 257d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 258d3236553SJohannes Berg * 259d3236553SJohannes Berg * This structure describes a frequency band a wiphy 260d3236553SJohannes Berg * is able to operate in. 261d3236553SJohannes Berg * 262d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 263d3236553SJohannes Berg * in this band. 264d3236553SJohannes Berg * @band: the band this structure represents 265d3236553SJohannes Berg * @n_channels: Number of channels in @channels 266d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 267d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 268d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 269d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 270abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 271c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 272d3236553SJohannes Berg */ 273d3236553SJohannes Berg struct ieee80211_supported_band { 274d3236553SJohannes Berg struct ieee80211_channel *channels; 275d3236553SJohannes Berg struct ieee80211_rate *bitrates; 276d3236553SJohannes Berg enum ieee80211_band band; 277d3236553SJohannes Berg int n_channels; 278d3236553SJohannes Berg int n_bitrates; 279d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 280bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 281d3236553SJohannes Berg }; 282d3236553SJohannes Berg 283d3236553SJohannes Berg /* 284d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 285704232c2SJohannes Berg */ 286704232c2SJohannes Berg 2872ec600d6SLuis Carlos Cobo /** 288d70e9693SJohannes Berg * DOC: Actions and configuration 289d70e9693SJohannes Berg * 290d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 291d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 292d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 293d70e9693SJohannes Berg * operations use are described separately. 294d70e9693SJohannes Berg * 295d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 296d70e9693SJohannes Berg * information via some functions that drivers need to call. 297d70e9693SJohannes Berg * 298d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 299d70e9693SJohannes Berg * in a separate chapter. 300d70e9693SJohannes Berg */ 301d70e9693SJohannes Berg 302d70e9693SJohannes Berg /** 3032ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 3048b787643SFelix Fietkau * @use_4addr: use 4-address frames 3051c18f145SArend van Spriel * @macaddr: address to use for this virtual interface. This will only 3061c18f145SArend van Spriel * be used for non-netdevice interfaces. If this parameter is set 3071c18f145SArend van Spriel * to zero address the driver may determine the address as needed. 3082ec600d6SLuis Carlos Cobo */ 3092ec600d6SLuis Carlos Cobo struct vif_params { 3108b787643SFelix Fietkau int use_4addr; 3111c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 3122ec600d6SLuis Carlos Cobo }; 3132ec600d6SLuis Carlos Cobo 31441ade00fSJohannes Berg /** 31541ade00fSJohannes Berg * struct key_params - key information 31641ade00fSJohannes Berg * 31741ade00fSJohannes Berg * Information about a key 31841ade00fSJohannes Berg * 31941ade00fSJohannes Berg * @key: key material 32041ade00fSJohannes Berg * @key_len: length of key material 32141ade00fSJohannes Berg * @cipher: cipher suite selector 32241ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 32341ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 32441ade00fSJohannes Berg * length given by @seq_len. 325abe37c4bSJohannes Berg * @seq_len: length of @seq. 32641ade00fSJohannes Berg */ 32741ade00fSJohannes Berg struct key_params { 32841ade00fSJohannes Berg u8 *key; 32941ade00fSJohannes Berg u8 *seq; 33041ade00fSJohannes Berg int key_len; 33141ade00fSJohannes Berg int seq_len; 33241ade00fSJohannes Berg u32 cipher; 33341ade00fSJohannes Berg }; 33441ade00fSJohannes Berg 335ed1b6cc7SJohannes Berg /** 336683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 337683b6d3bSJohannes Berg * @chan: the (control) channel 3383d9d1d66SJohannes Berg * @width: channel width 3393d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 3403d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 3413d9d1d66SJohannes Berg * (only with 80+80 MHz) 342683b6d3bSJohannes Berg */ 343683b6d3bSJohannes Berg struct cfg80211_chan_def { 344683b6d3bSJohannes Berg struct ieee80211_channel *chan; 3453d9d1d66SJohannes Berg enum nl80211_chan_width width; 3463d9d1d66SJohannes Berg u32 center_freq1; 3473d9d1d66SJohannes Berg u32 center_freq2; 348683b6d3bSJohannes Berg }; 349683b6d3bSJohannes Berg 3503d9d1d66SJohannes Berg /** 3513d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 3523d9d1d66SJohannes Berg * @chandef: the channel definition 3533d9d1d66SJohannes Berg * 3540ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 3553d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 3563d9d1d66SJohannes Berg */ 357683b6d3bSJohannes Berg static inline enum nl80211_channel_type 358683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 359683b6d3bSJohannes Berg { 3603d9d1d66SJohannes Berg switch (chandef->width) { 3613d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 3623d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 3633d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 3643d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 3653d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 3663d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 3673d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 3683d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 3693d9d1d66SJohannes Berg default: 3703d9d1d66SJohannes Berg WARN_ON(1); 3713d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 372683b6d3bSJohannes Berg } 3733d9d1d66SJohannes Berg } 3743d9d1d66SJohannes Berg 3753d9d1d66SJohannes Berg /** 3763d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 3773d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 3783d9d1d66SJohannes Berg * @channel: the control channel 3793d9d1d66SJohannes Berg * @chantype: the channel type 3803d9d1d66SJohannes Berg * 3813d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 3823d9d1d66SJohannes Berg */ 3833d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 3843d9d1d66SJohannes Berg struct ieee80211_channel *channel, 3853d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 3863d9d1d66SJohannes Berg 3873d9d1d66SJohannes Berg /** 3883d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 3893d9d1d66SJohannes Berg * @chandef1: first channel definition 3903d9d1d66SJohannes Berg * @chandef2: second channel definition 3913d9d1d66SJohannes Berg * 3920ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 3933d9d1d66SJohannes Berg * identical, %false otherwise. 3943d9d1d66SJohannes Berg */ 3953d9d1d66SJohannes Berg static inline bool 3963d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 3973d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 3983d9d1d66SJohannes Berg { 3993d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 4003d9d1d66SJohannes Berg chandef1->width == chandef2->width && 4013d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 4023d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 4033d9d1d66SJohannes Berg } 4043d9d1d66SJohannes Berg 4053d9d1d66SJohannes Berg /** 4063d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 4073d9d1d66SJohannes Berg * @chandef1: first channel definition 4083d9d1d66SJohannes Berg * @chandef2: second channel definition 4093d9d1d66SJohannes Berg * 4100ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 4113d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 4123d9d1d66SJohannes Berg */ 4133d9d1d66SJohannes Berg const struct cfg80211_chan_def * 4143d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 4153d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 416683b6d3bSJohannes Berg 417683b6d3bSJohannes Berg /** 4189f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 4199f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4200ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 4219f5e8f6eSJohannes Berg */ 4229f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 4239f5e8f6eSJohannes Berg 4249f5e8f6eSJohannes Berg /** 4259f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 4269f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 4279f5e8f6eSJohannes Berg * @chandef: the channel definition to check 4280ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 4290ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 4309f5e8f6eSJohannes Berg */ 4319f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 4329f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 4339f5e8f6eSJohannes Berg u32 prohibited_flags); 4349f5e8f6eSJohannes Berg 4359f5e8f6eSJohannes Berg /** 43661fa713cSHolger Schurig * enum survey_info_flags - survey information flags 43761fa713cSHolger Schurig * 438abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 43917e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 4408610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in 4418610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in 4428610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in 4438610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in 4448610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in 445abe37c4bSJohannes Berg * 44661fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 44761fa713cSHolger Schurig * it has filled in during the get_survey(). 44861fa713cSHolger Schurig */ 44961fa713cSHolger Schurig enum survey_info_flags { 45061fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 45117e5a808SFelix Fietkau SURVEY_INFO_IN_USE = 1<<1, 4528610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME = 1<<2, 4538610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, 4548610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, 4558610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, 4568610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, 45761fa713cSHolger Schurig }; 45861fa713cSHolger Schurig 45961fa713cSHolger Schurig /** 46061fa713cSHolger Schurig * struct survey_info - channel survey response 46161fa713cSHolger Schurig * 46261fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 46361fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 46461fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 46561fa713cSHolger Schurig * optional 4668610c29aSFelix Fietkau * @channel_time: amount of time in ms the radio spent on the channel 4678610c29aSFelix Fietkau * @channel_time_busy: amount of time the primary channel was sensed busy 4688610c29aSFelix Fietkau * @channel_time_ext_busy: amount of time the extension channel was sensed busy 4698610c29aSFelix Fietkau * @channel_time_rx: amount of time the radio spent receiving data 4708610c29aSFelix Fietkau * @channel_time_tx: amount of time the radio spent transmitting data 47161fa713cSHolger Schurig * 472abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 473abe37c4bSJohannes Berg * 47461fa713cSHolger Schurig * This structure can later be expanded with things like 47561fa713cSHolger Schurig * channel duty cycle etc. 47661fa713cSHolger Schurig */ 47761fa713cSHolger Schurig struct survey_info { 47861fa713cSHolger Schurig struct ieee80211_channel *channel; 4798610c29aSFelix Fietkau u64 channel_time; 4808610c29aSFelix Fietkau u64 channel_time_busy; 4818610c29aSFelix Fietkau u64 channel_time_ext_busy; 4828610c29aSFelix Fietkau u64 channel_time_rx; 4838610c29aSFelix Fietkau u64 channel_time_tx; 48461fa713cSHolger Schurig u32 filled; 48561fa713cSHolger Schurig s8 noise; 48661fa713cSHolger Schurig }; 48761fa713cSHolger Schurig 48861fa713cSHolger Schurig /** 4895fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 4905fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 4915fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 4925fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 4935fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 4945fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 4955fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 4965fb628e9SJouni Malinen * @akm_suites: AKM suites 4975fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 4985fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 4995fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 5005fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 5015fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 5025fb628e9SJouni Malinen * allowed through even on unauthorized ports 5035fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 5045fb628e9SJouni Malinen * protocol frames. 5055fb628e9SJouni Malinen */ 5065fb628e9SJouni Malinen struct cfg80211_crypto_settings { 5075fb628e9SJouni Malinen u32 wpa_versions; 5085fb628e9SJouni Malinen u32 cipher_group; 5095fb628e9SJouni Malinen int n_ciphers_pairwise; 5105fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 5115fb628e9SJouni Malinen int n_akm_suites; 5125fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 5135fb628e9SJouni Malinen bool control_port; 5145fb628e9SJouni Malinen __be16 control_port_ethertype; 5155fb628e9SJouni Malinen bool control_port_no_encrypt; 5165fb628e9SJouni Malinen }; 5175fb628e9SJouni Malinen 5185fb628e9SJouni Malinen /** 5198860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 520ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 521ed1b6cc7SJohannes Berg * or %NULL if not changed 522ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 523ed1b6cc7SJohannes Berg * or %NULL if not changed 524ed1b6cc7SJohannes Berg * @head_len: length of @head 525ed1b6cc7SJohannes Berg * @tail_len: length of @tail 5269946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 5279946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 5289946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 5299946ecfbSJouni Malinen * frames or %NULL 5309946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 5319946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 5329946ecfbSJouni Malinen * Response frames or %NULL 5339946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 53400f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 53500f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 536ed1b6cc7SJohannes Berg */ 5378860020eSJohannes Berg struct cfg80211_beacon_data { 5388860020eSJohannes Berg const u8 *head, *tail; 5398860020eSJohannes Berg const u8 *beacon_ies; 5408860020eSJohannes Berg const u8 *proberesp_ies; 5418860020eSJohannes Berg const u8 *assocresp_ies; 5428860020eSJohannes Berg const u8 *probe_resp; 5438860020eSJohannes Berg 5448860020eSJohannes Berg size_t head_len, tail_len; 5458860020eSJohannes Berg size_t beacon_ies_len; 5468860020eSJohannes Berg size_t proberesp_ies_len; 5478860020eSJohannes Berg size_t assocresp_ies_len; 5488860020eSJohannes Berg size_t probe_resp_len; 5498860020eSJohannes Berg }; 5508860020eSJohannes Berg 5516d45a74bSVasanthakumar Thiagarajan struct mac_address { 5526d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 5536d45a74bSVasanthakumar Thiagarajan }; 5546d45a74bSVasanthakumar Thiagarajan 5558860020eSJohannes Berg /** 55677765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 55777765eafSVasanthakumar Thiagarajan * 55877765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 559077f897aSJohannes Berg * entry specified by mac_addr 56077765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 56177765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 56277765eafSVasanthakumar Thiagarajan */ 56377765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 56477765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 56577765eafSVasanthakumar Thiagarajan int n_acl_entries; 56677765eafSVasanthakumar Thiagarajan 56777765eafSVasanthakumar Thiagarajan /* Keep it last */ 56877765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 56977765eafSVasanthakumar Thiagarajan }; 57077765eafSVasanthakumar Thiagarajan 5718860020eSJohannes Berg /** 5728860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 5738860020eSJohannes Berg * 5748860020eSJohannes Berg * Used to configure an AP interface. 5758860020eSJohannes Berg * 576683b6d3bSJohannes Berg * @chandef: defines the channel to use 5778860020eSJohannes Berg * @beacon: beacon data 5788860020eSJohannes Berg * @beacon_interval: beacon interval 5798860020eSJohannes Berg * @dtim_period: DTIM period 5808860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 5818860020eSJohannes Berg * user space) 5828860020eSJohannes Berg * @ssid_len: length of @ssid 5838860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 5848860020eSJohannes Berg * @crypto: crypto settings 5858860020eSJohannes Berg * @privacy: the BSS uses privacy 5868860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 5871b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 58853cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 58953cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 59077765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 59177765eafSVasanthakumar Thiagarajan * MAC address based access control 59204f39047SSimon Wunderlich * @radar_required: set if radar detection is required 5938860020eSJohannes Berg */ 5948860020eSJohannes Berg struct cfg80211_ap_settings { 595683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 596aa430da4SJohannes Berg 5978860020eSJohannes Berg struct cfg80211_beacon_data beacon; 5988860020eSJohannes Berg 5998860020eSJohannes Berg int beacon_interval, dtim_period; 60032e9de84SJouni Malinen const u8 *ssid; 60132e9de84SJouni Malinen size_t ssid_len; 60232e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 6035fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 6045fb628e9SJouni Malinen bool privacy; 6055fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 6061b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 60753cabad7SJohannes Berg u8 p2p_ctwindow; 60853cabad7SJohannes Berg bool p2p_opp_ps; 60977765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 61004f39047SSimon Wunderlich bool radar_required; 611ed1b6cc7SJohannes Berg }; 612ed1b6cc7SJohannes Berg 6135727ef1bSJohannes Berg /** 6143b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 6153b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 6169d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 617f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 6183b9ce80cSJohannes Berg * 6193b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 6203b9ce80cSJohannes Berg * for those that don't these flags will are used. 6213b9ce80cSJohannes Berg */ 6223b9ce80cSJohannes Berg enum station_parameters_apply_mask { 6233b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 6249d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 625f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 6263b9ce80cSJohannes Berg }; 6273b9ce80cSJohannes Berg 6283b9ce80cSJohannes Berg /** 6295727ef1bSJohannes Berg * struct station_parameters - station parameters 6305727ef1bSJohannes Berg * 6315727ef1bSJohannes Berg * Used to change and create a new station. 6325727ef1bSJohannes Berg * 6335727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 6345727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 6355727ef1bSJohannes Berg * (or NULL for no change) 6365727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 637eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 638eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 639eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 640eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 6415727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 6425727ef1bSJohannes Berg * @aid: AID or zero for no change 643abe37c4bSJohannes Berg * @plink_action: plink action to take 6449c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 645abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 646f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 647910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 648910868dbSEliad Peller * as the AC bitmap in the QoS info field 649910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 650910868dbSEliad Peller * QoS info field (but already shifted down) 651c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 652c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 653c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 6543b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 6553b1c5a53SMarco Porsch * to unknown) 6569d62a986SJouni Malinen * @capability: station capability 6579d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 6589d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 6595727ef1bSJohannes Berg */ 6605727ef1bSJohannes Berg struct station_parameters { 6612c1aabf3SJohannes Berg const u8 *supported_rates; 6625727ef1bSJohannes Berg struct net_device *vlan; 663eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 6643b9ce80cSJohannes Berg u32 sta_modify_mask; 6655727ef1bSJohannes Berg int listen_interval; 6665727ef1bSJohannes Berg u16 aid; 6675727ef1bSJohannes Berg u8 supported_rates_len; 6682ec600d6SLuis Carlos Cobo u8 plink_action; 6699c3990aaSJavier Cardona u8 plink_state; 6702c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 6712c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 672c75786c9SEliad Peller u8 uapsd_queues; 673c75786c9SEliad Peller u8 max_sp; 6743b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 6759d62a986SJouni Malinen u16 capability; 6762c1aabf3SJohannes Berg const u8 *ext_capab; 6779d62a986SJouni Malinen u8 ext_capab_len; 6785727ef1bSJohannes Berg }; 6795727ef1bSJohannes Berg 680fd5b74dcSJohannes Berg /** 68177ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 68277ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 68377ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 68477ee7c89SJohannes Berg * the AP MLME in the device 68577ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 68677ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 68777ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 68877ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 68977ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 69077ee7c89SJohannes Berg * supported/used) 69177ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 69277ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 693eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 694eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 69577ee7c89SJohannes Berg */ 69677ee7c89SJohannes Berg enum cfg80211_station_type { 69777ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 69877ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 69977ee7c89SJohannes Berg CFG80211_STA_AP_STA, 70077ee7c89SJohannes Berg CFG80211_STA_IBSS, 70177ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 70277ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 703eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 704eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 70577ee7c89SJohannes Berg }; 70677ee7c89SJohannes Berg 70777ee7c89SJohannes Berg /** 70877ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 70977ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 71077ee7c89SJohannes Berg * @params: the new parameters for a station 71177ee7c89SJohannes Berg * @statype: the type of station being modified 71277ee7c89SJohannes Berg * 71377ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 71477ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 71577ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 71677ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 71777ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 71877ee7c89SJohannes Berg */ 71977ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 72077ee7c89SJohannes Berg struct station_parameters *params, 72177ee7c89SJohannes Berg enum cfg80211_station_type statype); 72277ee7c89SJohannes Berg 72377ee7c89SJohannes Berg /** 7242ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 725fd5b74dcSJohannes Berg * 7262ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 7272ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 728fd5b74dcSJohannes Berg * 7292ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 7302ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 7312ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 732077f897aSJohannes Berg * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value 733077f897aSJohannes Berg * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value 7342ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 7352ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 7362ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 737420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 738c8dcfd8aSFelix Fietkau * @STATION_INFO_TX_BITRATE: @txrate fields are filled 739420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 74042745e03SVladimir Kondratiev * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value 74142745e03SVladimir Kondratiev * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value 742b206b4efSBruno Randolf * @STATION_INFO_TX_RETRIES: @tx_retries filled 743b206b4efSBruno Randolf * @STATION_INFO_TX_FAILED: @tx_failed filled 7445a5c731aSBen Greear * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 745541a45a1SBruno Randolf * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 746c8dcfd8aSFelix Fietkau * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 747f4263c98SPaul Stewart * @STATION_INFO_BSS_PARAM: @bss_param filled 748ebe27c91SMohammed Shafi Shajakhan * @STATION_INFO_CONNECTED_TIME: @connected_time filled 749040bdf71SFelix Fietkau * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 750bb6e753eSHelmut Schaa * @STATION_INFO_STA_FLAGS: @sta_flags filled 751a85e1d55SPaul Stewart * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 752d299a1f2SJavier Cardona * @STATION_INFO_T_OFFSET: @t_offset filled 7533b1c5a53SMarco Porsch * @STATION_INFO_LOCAL_PM: @local_pm filled 7543b1c5a53SMarco Porsch * @STATION_INFO_PEER_PM: @peer_pm filled 7553b1c5a53SMarco Porsch * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 756119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 757119363c7SFelix Fietkau * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 758fd5b74dcSJohannes Berg */ 7592ec600d6SLuis Carlos Cobo enum station_info_flags { 7602ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 7612ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 7622ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 7632ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 7642ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 7652ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 766420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 767420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 76898c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 76998c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 770b206b4efSBruno Randolf STATION_INFO_TX_RETRIES = 1<<10, 771b206b4efSBruno Randolf STATION_INFO_TX_FAILED = 1<<11, 7725a5c731aSBen Greear STATION_INFO_RX_DROP_MISC = 1<<12, 773541a45a1SBruno Randolf STATION_INFO_SIGNAL_AVG = 1<<13, 774c8dcfd8aSFelix Fietkau STATION_INFO_RX_BITRATE = 1<<14, 775f4263c98SPaul Stewart STATION_INFO_BSS_PARAM = 1<<15, 776040bdf71SFelix Fietkau STATION_INFO_CONNECTED_TIME = 1<<16, 777bb6e753eSHelmut Schaa STATION_INFO_ASSOC_REQ_IES = 1<<17, 778a85e1d55SPaul Stewart STATION_INFO_STA_FLAGS = 1<<18, 779d299a1f2SJavier Cardona STATION_INFO_BEACON_LOSS_COUNT = 1<<19, 780d299a1f2SJavier Cardona STATION_INFO_T_OFFSET = 1<<20, 7813b1c5a53SMarco Porsch STATION_INFO_LOCAL_PM = 1<<21, 7823b1c5a53SMarco Porsch STATION_INFO_PEER_PM = 1<<22, 7833b1c5a53SMarco Porsch STATION_INFO_NONPEER_PM = 1<<23, 78442745e03SVladimir Kondratiev STATION_INFO_RX_BYTES64 = 1<<24, 78542745e03SVladimir Kondratiev STATION_INFO_TX_BYTES64 = 1<<25, 786119363c7SFelix Fietkau STATION_INFO_CHAIN_SIGNAL = 1<<26, 787119363c7SFelix Fietkau STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27, 788420e7fabSHenning Rogge }; 789420e7fabSHenning Rogge 790420e7fabSHenning Rogge /** 791420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 792420e7fabSHenning Rogge * 793420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 794420e7fabSHenning Rogge * type for 802.11n transmissions. 795420e7fabSHenning Rogge * 796db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 797db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 798db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission 799db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission 800db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission 801db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission 802420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 803db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_60G: 60GHz MCS 804420e7fabSHenning Rogge */ 805420e7fabSHenning Rogge enum rate_info_flags { 806db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 807db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 808db9c64cfSJohannes Berg RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2), 809db9c64cfSJohannes Berg RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3), 810db9c64cfSJohannes Berg RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4), 811db9c64cfSJohannes Berg RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5), 812db9c64cfSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(6), 813db9c64cfSJohannes Berg RATE_INFO_FLAGS_60G = BIT(7), 814420e7fabSHenning Rogge }; 815420e7fabSHenning Rogge 816420e7fabSHenning Rogge /** 817420e7fabSHenning Rogge * struct rate_info - bitrate information 818420e7fabSHenning Rogge * 819420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 820420e7fabSHenning Rogge * 821420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 822420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 823420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 824db9c64cfSJohannes Berg * @nss: number of streams (VHT only) 825420e7fabSHenning Rogge */ 826420e7fabSHenning Rogge struct rate_info { 827420e7fabSHenning Rogge u8 flags; 828420e7fabSHenning Rogge u8 mcs; 829420e7fabSHenning Rogge u16 legacy; 830db9c64cfSJohannes Berg u8 nss; 831fd5b74dcSJohannes Berg }; 832fd5b74dcSJohannes Berg 833fd5b74dcSJohannes Berg /** 834f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 835f4263c98SPaul Stewart * 836f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 837f4263c98SPaul Stewart * type for 802.11n transmissions. 838f4263c98SPaul Stewart * 839f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 840f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 841f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 842f4263c98SPaul Stewart */ 843f4263c98SPaul Stewart enum bss_param_flags { 844f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 845f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 846f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 847f4263c98SPaul Stewart }; 848f4263c98SPaul Stewart 849f4263c98SPaul Stewart /** 850f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 851f4263c98SPaul Stewart * 852f4263c98SPaul Stewart * Information about the currently associated BSS 853f4263c98SPaul Stewart * 854f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 855f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 856f4263c98SPaul Stewart * @beacon_interval: beacon interval 857f4263c98SPaul Stewart */ 858f4263c98SPaul Stewart struct sta_bss_parameters { 859f4263c98SPaul Stewart u8 flags; 860f4263c98SPaul Stewart u8 dtim_period; 861f4263c98SPaul Stewart u16 beacon_interval; 862f4263c98SPaul Stewart }; 863f4263c98SPaul Stewart 864119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 865119363c7SFelix Fietkau 866f4263c98SPaul Stewart /** 8672ec600d6SLuis Carlos Cobo * struct station_info - station information 868fd5b74dcSJohannes Berg * 8692ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 870fd5b74dcSJohannes Berg * 8712ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 872ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 873fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 874fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 875fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 8762ec600d6SLuis Carlos Cobo * @llid: mesh local link id 8772ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 8782ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 87973c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 88073c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 88173c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 88273c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 883119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 884119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 885119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 886858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 887858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 88898c8a60aSJouni Malinen * @rx_packets: packets received from this station 88998c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 890b206b4efSBruno Randolf * @tx_retries: cumulative retry counts 891b206b4efSBruno Randolf * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 8925a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 8931ba01458SRandy Dunlap * @bss_param: current BSS parameters 894f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 895f5ea9120SJohannes Berg * This number should increase every time the list of stations 896f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 897f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 89850d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 89950d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 90050d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 90150d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 90250d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 903c26887d2SJohannes Berg * @sta_flags: station flags mask & values 904a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 905d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 9063b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 9073b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 9083b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 909fd5b74dcSJohannes Berg */ 9102ec600d6SLuis Carlos Cobo struct station_info { 911fd5b74dcSJohannes Berg u32 filled; 912ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 913fd5b74dcSJohannes Berg u32 inactive_time; 91442745e03SVladimir Kondratiev u64 rx_bytes; 91542745e03SVladimir Kondratiev u64 tx_bytes; 9162ec600d6SLuis Carlos Cobo u16 llid; 9172ec600d6SLuis Carlos Cobo u16 plid; 9182ec600d6SLuis Carlos Cobo u8 plink_state; 919420e7fabSHenning Rogge s8 signal; 920541a45a1SBruno Randolf s8 signal_avg; 921119363c7SFelix Fietkau 922119363c7SFelix Fietkau u8 chains; 923119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 924119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 925119363c7SFelix Fietkau 926420e7fabSHenning Rogge struct rate_info txrate; 927c8dcfd8aSFelix Fietkau struct rate_info rxrate; 92898c8a60aSJouni Malinen u32 rx_packets; 92998c8a60aSJouni Malinen u32 tx_packets; 930b206b4efSBruno Randolf u32 tx_retries; 931b206b4efSBruno Randolf u32 tx_failed; 9325a5c731aSBen Greear u32 rx_dropped_misc; 933f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 934bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 935f5ea9120SJohannes Berg 936f5ea9120SJohannes Berg int generation; 93750d3dfb7SJouni Malinen 93850d3dfb7SJouni Malinen const u8 *assoc_req_ies; 93950d3dfb7SJouni Malinen size_t assoc_req_ies_len; 940f612cedfSJouni Malinen 941a85e1d55SPaul Stewart u32 beacon_loss_count; 942d299a1f2SJavier Cardona s64 t_offset; 9433b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 9443b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 9453b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 946a85e1d55SPaul Stewart 947f612cedfSJouni Malinen /* 948f612cedfSJouni Malinen * Note: Add a new enum station_info_flags value for each new field and 949f612cedfSJouni Malinen * use it to check which fields are initialized. 950f612cedfSJouni Malinen */ 951fd5b74dcSJohannes Berg }; 952fd5b74dcSJohannes Berg 95366f7ac50SMichael Wu /** 95466f7ac50SMichael Wu * enum monitor_flags - monitor flags 95566f7ac50SMichael Wu * 95666f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 95766f7ac50SMichael Wu * according to the nl80211 flags. 95866f7ac50SMichael Wu * 95966f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 96066f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 96166f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 96266f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 96366f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 96466f7ac50SMichael Wu */ 96566f7ac50SMichael Wu enum monitor_flags { 96666f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 96766f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 96866f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 96966f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 97066f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 97166f7ac50SMichael Wu }; 97266f7ac50SMichael Wu 9732ec600d6SLuis Carlos Cobo /** 9742ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 9752ec600d6SLuis Carlos Cobo * 9762ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 9772ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 9782ec600d6SLuis Carlos Cobo * 979abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 980abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 981abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 982abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 983abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 984abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 985abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 9862ec600d6SLuis Carlos Cobo */ 9872ec600d6SLuis Carlos Cobo enum mpath_info_flags { 9882ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 989d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 9902ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 9912ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 9922ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 9932ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 9942ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 9952ec600d6SLuis Carlos Cobo }; 9962ec600d6SLuis Carlos Cobo 9972ec600d6SLuis Carlos Cobo /** 9982ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 9992ec600d6SLuis Carlos Cobo * 10002ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 10012ec600d6SLuis Carlos Cobo * 10022ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 10032ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1004d19b3bf6SRui Paulo * @sn: target sequence number 10052ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 10062ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 10072ec600d6SLuis Carlos Cobo * @flags: mesh path flags 10082ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 10092ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1010f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1011f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1012f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1013f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 10142ec600d6SLuis Carlos Cobo */ 10152ec600d6SLuis Carlos Cobo struct mpath_info { 10162ec600d6SLuis Carlos Cobo u32 filled; 10172ec600d6SLuis Carlos Cobo u32 frame_qlen; 1018d19b3bf6SRui Paulo u32 sn; 10192ec600d6SLuis Carlos Cobo u32 metric; 10202ec600d6SLuis Carlos Cobo u32 exptime; 10212ec600d6SLuis Carlos Cobo u32 discovery_timeout; 10222ec600d6SLuis Carlos Cobo u8 discovery_retries; 10232ec600d6SLuis Carlos Cobo u8 flags; 1024f5ea9120SJohannes Berg 1025f5ea9120SJohannes Berg int generation; 10262ec600d6SLuis Carlos Cobo }; 10272ec600d6SLuis Carlos Cobo 10289f1ba906SJouni Malinen /** 10299f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 10309f1ba906SJouni Malinen * 10319f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 10329f1ba906SJouni Malinen * 10339f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 10349f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 10359f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 10369f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 10379f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 10389f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 103990c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 104090c97a04SJouni Malinen * (or NULL for no change) 104190c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1042fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 104350b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 104450b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 104553cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 104653cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 10479f1ba906SJouni Malinen */ 10489f1ba906SJouni Malinen struct bss_parameters { 10499f1ba906SJouni Malinen int use_cts_prot; 10509f1ba906SJouni Malinen int use_short_preamble; 10519f1ba906SJouni Malinen int use_short_slot_time; 105290c97a04SJouni Malinen u8 *basic_rates; 105390c97a04SJouni Malinen u8 basic_rates_len; 1054fd8aaaf3SFelix Fietkau int ap_isolate; 105550b12f59SHelmut Schaa int ht_opmode; 105653cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 10579f1ba906SJouni Malinen }; 10582ec600d6SLuis Carlos Cobo 10593ddd53f3SChun-Yeow Yeoh /** 106029cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 106129cbe68cSJohannes Berg * 106229cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 10633ddd53f3SChun-Yeow Yeoh * 10643ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 10653ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 10663ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 10673ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 10683ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 10693ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 10703ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 10713ddd53f3SChun-Yeow Yeoh * mesh interface 10723ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 10733ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 10743ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 10753ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 10763ddd53f3SChun-Yeow Yeoh * elements 10773ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 10783ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 10793ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 10803ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 10813ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 10823ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 10833ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 10843ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 10853ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 10863ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 10873ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 10883ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 10893ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 10903ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 10913ddd53f3SChun-Yeow Yeoh * element 10923ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 10933ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 10943ddd53f3SChun-Yeow Yeoh * element 10953ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 10963ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 10973ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 10983ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 10993ddd53f3SChun-Yeow Yeoh * announcements are transmitted 11003ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 11013ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 11023ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 11033ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 11043ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 11053ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 11063ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 11073ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 11083ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 11093ddd53f3SChun-Yeow Yeoh * station to establish a peer link 11103ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1111ac1073a6SChun-Yeow Yeoh * 1112ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1113ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1114ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1115ac1073a6SChun-Yeow Yeoh * 1116ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1117ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1118728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1119728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1120728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 11213b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 11223b1c5a53SMarco Porsch * setting for new peer links. 11233b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 11243b1c5a53SMarco Porsch * after transmitting its beacon. 112529cbe68cSJohannes Berg */ 112693da9cc1Scolin@cozybit.com struct mesh_config { 112793da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 112893da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 112993da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 113093da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 113193da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 113293da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 113345904f21SJavier Cardona u8 element_ttl; 113493da9cc1Scolin@cozybit.com bool auto_open_plinks; 1135d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 113693da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 113793da9cc1Scolin@cozybit.com u32 path_refresh_time; 113893da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 113993da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 114093da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1141dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 114293da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 114363c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 11440507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 114516dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 114694f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 114755335137SAshok Nagarajan s32 rssi_threshold; 114870c33eaaSAshok Nagarajan u16 ht_opmode; 1149ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1150ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1151728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 11523b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 11533b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 115493da9cc1Scolin@cozybit.com }; 115593da9cc1Scolin@cozybit.com 115631888487SJouni Malinen /** 115729cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1158683b6d3bSJohannes Berg * @chandef: defines the channel to use 115929cbe68cSJohannes Berg * @mesh_id: the mesh ID 116029cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1161d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1162c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1163c80d545dSJavier Cardona * @path_metric: which metric to use 1164*6e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1165581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1166581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1167b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1168b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1169bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 11709bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 11719bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 11724bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 117329cbe68cSJohannes Berg * 117429cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 117529cbe68cSJohannes Berg */ 117629cbe68cSJohannes Berg struct mesh_setup { 1177683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 117829cbe68cSJohannes Berg const u8 *mesh_id; 117929cbe68cSJohannes Berg u8 mesh_id_len; 1180d299a1f2SJavier Cardona u8 sync_method; 1181c80d545dSJavier Cardona u8 path_sel_proto; 1182c80d545dSJavier Cardona u8 path_metric; 1183*6e16d90bSColleen Twitty u8 auth_id; 1184581a8b0fSJavier Cardona const u8 *ie; 1185581a8b0fSJavier Cardona u8 ie_len; 1186b130e5ceSJavier Cardona bool is_authenticated; 118715d5dda6SJavier Cardona bool is_secure; 1188bb2798d4SThomas Pedersen bool user_mpm; 11899bdbf04dSMarco Porsch u8 dtim_period; 11909bdbf04dSMarco Porsch u16 beacon_interval; 11914bb62344SChun-Yeow Yeoh int mcast_rate[IEEE80211_NUM_BANDS]; 119229cbe68cSJohannes Berg }; 119329cbe68cSJohannes Berg 119429cbe68cSJohannes Berg /** 119531888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 1196a3304b0aSJohannes Berg * @ac: AC identifier 119731888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 119831888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 119931888487SJouni Malinen * 1..32767] 120031888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 120131888487SJouni Malinen * 1..32767] 120231888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 120331888487SJouni Malinen */ 120431888487SJouni Malinen struct ieee80211_txq_params { 1205a3304b0aSJohannes Berg enum nl80211_ac ac; 120631888487SJouni Malinen u16 txop; 120731888487SJouni Malinen u16 cwmin; 120831888487SJouni Malinen u16 cwmax; 120931888487SJouni Malinen u8 aifs; 121031888487SJouni Malinen }; 121131888487SJouni Malinen 1212d70e9693SJohannes Berg /** 1213d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 1214d70e9693SJohannes Berg * 1215d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 1216d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 1217d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 1218d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 1219d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 1220d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 1221d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 1222d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 1223d70e9693SJohannes Berg * in the wiphy structure. 1224d70e9693SJohannes Berg * 1225d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 1226d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 1227d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 1228d70e9693SJohannes Berg * 1229d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 1230d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 1231d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 1232d70e9693SJohannes Berg * to userspace. 1233d70e9693SJohannes Berg */ 123472bdcf34SJouni Malinen 1235704232c2SJohannes Berg /** 12362a519311SJohannes Berg * struct cfg80211_ssid - SSID description 12372a519311SJohannes Berg * @ssid: the SSID 12382a519311SJohannes Berg * @ssid_len: length of the ssid 12392a519311SJohannes Berg */ 12402a519311SJohannes Berg struct cfg80211_ssid { 12412a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 12422a519311SJohannes Berg u8 ssid_len; 12432a519311SJohannes Berg }; 12442a519311SJohannes Berg 12452a519311SJohannes Berg /** 12462a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 12472a519311SJohannes Berg * 12482a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 12492a519311SJohannes Berg * @n_ssids: number of SSIDs 12502a519311SJohannes Berg * @channels: channels to scan on. 1251ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 125270692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 125370692ad2SJouni Malinen * @ie_len: length of ie in octets 1254ed473771SSam Leffler * @flags: bit field of flags controlling operation 125534850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 12562a519311SJohannes Berg * @wiphy: the wiphy this was for 125715d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 1258fd014284SJohannes Berg * @wdev: the wireless device to scan for 1259abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 1260e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 12612a519311SJohannes Berg */ 12622a519311SJohannes Berg struct cfg80211_scan_request { 12632a519311SJohannes Berg struct cfg80211_ssid *ssids; 12642a519311SJohannes Berg int n_ssids; 12652a519311SJohannes Berg u32 n_channels; 1266de95a54bSJohannes Berg const u8 *ie; 126770692ad2SJouni Malinen size_t ie_len; 1268ed473771SSam Leffler u32 flags; 12692a519311SJohannes Berg 127034850ab2SJohannes Berg u32 rates[IEEE80211_NUM_BANDS]; 127134850ab2SJohannes Berg 1272fd014284SJohannes Berg struct wireless_dev *wdev; 1273fd014284SJohannes Berg 12742a519311SJohannes Berg /* internal */ 12752a519311SJohannes Berg struct wiphy *wiphy; 127615d6030bSSam Leffler unsigned long scan_start; 1277667503ddSJohannes Berg bool aborted; 1278e9f935e3SRajkumar Manoharan bool no_cck; 12795ba63533SJohannes Berg 12805ba63533SJohannes Berg /* keep last */ 12815ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 12822a519311SJohannes Berg }; 12832a519311SJohannes Berg 12842a519311SJohannes Berg /** 1285a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 1286a1f1c21cSLuciano Coelho * 1287a1f1c21cSLuciano Coelho * @ssid: SSID to be matched 1288a1f1c21cSLuciano Coelho */ 1289a1f1c21cSLuciano Coelho struct cfg80211_match_set { 1290a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 1291a1f1c21cSLuciano Coelho }; 1292a1f1c21cSLuciano Coelho 1293a1f1c21cSLuciano Coelho /** 1294807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 1295807f8a8cSLuciano Coelho * 1296807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 1297807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 1298807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 1299bbe6ad6dSLuciano Coelho * @interval: interval between each scheduled scan cycle 1300807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 1301807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 1302ed473771SSam Leffler * @flags: bit field of flags controlling operation 1303a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 1304a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 1305a1f1c21cSLuciano Coelho * (others are filtered out). 1306a1f1c21cSLuciano Coelho * If ommited, all results are passed. 1307a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 1308807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 1309807f8a8cSLuciano Coelho * @dev: the interface 1310077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 1311807f8a8cSLuciano Coelho * @channels: channels to scan 131288e920b4SThomas Pedersen * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1313807f8a8cSLuciano Coelho */ 1314807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 1315807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 1316807f8a8cSLuciano Coelho int n_ssids; 1317807f8a8cSLuciano Coelho u32 n_channels; 1318bbe6ad6dSLuciano Coelho u32 interval; 1319807f8a8cSLuciano Coelho const u8 *ie; 1320807f8a8cSLuciano Coelho size_t ie_len; 1321ed473771SSam Leffler u32 flags; 1322a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 1323a1f1c21cSLuciano Coelho int n_match_sets; 132488e920b4SThomas Pedersen s32 rssi_thold; 1325807f8a8cSLuciano Coelho 1326807f8a8cSLuciano Coelho /* internal */ 1327807f8a8cSLuciano Coelho struct wiphy *wiphy; 1328807f8a8cSLuciano Coelho struct net_device *dev; 132915d6030bSSam Leffler unsigned long scan_start; 1330807f8a8cSLuciano Coelho 1331807f8a8cSLuciano Coelho /* keep last */ 1332807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 1333807f8a8cSLuciano Coelho }; 1334807f8a8cSLuciano Coelho 1335807f8a8cSLuciano Coelho /** 13362a519311SJohannes Berg * enum cfg80211_signal_type - signal type 13372a519311SJohannes Berg * 13382a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 13392a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 13402a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 13412a519311SJohannes Berg */ 13422a519311SJohannes Berg enum cfg80211_signal_type { 13432a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 13442a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 13452a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 13462a519311SJohannes Berg }; 13472a519311SJohannes Berg 13482a519311SJohannes Berg /** 13499caf0364SJohannes Berg * struct cfg80211_bss_ie_data - BSS entry IE data 13508cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 13519caf0364SJohannes Berg * @rcu_head: internal use, for freeing 13529caf0364SJohannes Berg * @len: length of the IEs 13539caf0364SJohannes Berg * @data: IE data 13549caf0364SJohannes Berg */ 13559caf0364SJohannes Berg struct cfg80211_bss_ies { 13568cef2c9dSJohannes Berg u64 tsf; 13579caf0364SJohannes Berg struct rcu_head rcu_head; 13589caf0364SJohannes Berg int len; 13599caf0364SJohannes Berg u8 data[]; 13609caf0364SJohannes Berg }; 13619caf0364SJohannes Berg 13629caf0364SJohannes Berg /** 13632a519311SJohannes Berg * struct cfg80211_bss - BSS description 13642a519311SJohannes Berg * 13652a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 13662a519311SJohannes Berg * for use in scan results and similar. 13672a519311SJohannes Berg * 1368abe37c4bSJohannes Berg * @channel: channel this BSS is on 13692a519311SJohannes Berg * @bssid: BSSID of the BSS 13702a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 13712a519311SJohannes Berg * @capability: the capability field in host byte order 137283c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 137383c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 137483c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 137583c7aa1aSJohannes Berg * received. It is always non-%NULL. 137634a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 1377776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 1378776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 1379776b3580SJohannes Berg * @hidden_beacon_bss struct) 138034a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 1381776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 1382776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 1383776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 1384776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 138577965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 13862a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 13872a519311SJohannes Berg */ 13882a519311SJohannes Berg struct cfg80211_bss { 13892a519311SJohannes Berg struct ieee80211_channel *channel; 13902a519311SJohannes Berg 13919caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 13929caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 13939caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 13949caf0364SJohannes Berg 1395776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 13962a519311SJohannes Berg 13972a519311SJohannes Berg s32 signal; 13982a519311SJohannes Berg 13999caf0364SJohannes Berg u16 beacon_interval; 14009caf0364SJohannes Berg u16 capability; 14019caf0364SJohannes Berg 14029caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 14039caf0364SJohannes Berg 14041c06ef98SJohannes Berg u8 priv[0] __aligned(sizeof(void *)); 14052a519311SJohannes Berg }; 14062a519311SJohannes Berg 14072a519311SJohannes Berg /** 1408517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1409517357c6SJohannes Berg * @bss: the bss to search 1410517357c6SJohannes Berg * @ie: the IE ID 14119caf0364SJohannes Berg * 14129caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 14139caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 14140ae997dcSYacine Belkadi * Return: %NULL if not found. 1415517357c6SJohannes Berg */ 1416517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1417517357c6SJohannes Berg 1418517357c6SJohannes Berg 1419517357c6SJohannes Berg /** 1420636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1421636a5d36SJouni Malinen * 1422636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1423636a5d36SJouni Malinen * authentication. 1424636a5d36SJouni Malinen * 142519957bb3SJohannes Berg * @bss: The BSS to authenticate with. 1426636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1427636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1428636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1429fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1430fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1431fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1432e39e5b5eSJouni Malinen * @sae_data: Non-IE data to use with SAE or %NULL. This starts with 1433e39e5b5eSJouni Malinen * Authentication transaction sequence number field. 1434e39e5b5eSJouni Malinen * @sae_data_len: Length of sae_data buffer in octets 1435636a5d36SJouni Malinen */ 1436636a5d36SJouni Malinen struct cfg80211_auth_request { 143719957bb3SJohannes Berg struct cfg80211_bss *bss; 1438636a5d36SJouni Malinen const u8 *ie; 1439636a5d36SJouni Malinen size_t ie_len; 144019957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1441fffd0934SJohannes Berg const u8 *key; 1442fffd0934SJohannes Berg u8 key_len, key_idx; 1443e39e5b5eSJouni Malinen const u8 *sae_data; 1444e39e5b5eSJouni Malinen size_t sae_data_len; 1445636a5d36SJouni Malinen }; 1446636a5d36SJouni Malinen 1447636a5d36SJouni Malinen /** 14487e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 14497e7c8926SBen Greear * 14507e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1451ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 14527e7c8926SBen Greear */ 14537e7c8926SBen Greear enum cfg80211_assoc_req_flags { 14547e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 1455ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 14567e7c8926SBen Greear }; 14577e7c8926SBen Greear 14587e7c8926SBen Greear /** 1459636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1460636a5d36SJouni Malinen * 1461636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1462636a5d36SJouni Malinen * (re)association. 146395de817bSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver 146495de817bSJohannes Berg * is given a reference that it must release, normally via a call to 146595de817bSJohannes Berg * cfg80211_send_rx_assoc(), or, if association timed out, with a 146695de817bSJohannes Berg * call to cfg80211_put_bss() (in addition to calling 146795de817bSJohannes Berg * cfg80211_send_assoc_timeout()) 1468636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1469636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1470dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1471b23aa676SSamuel Ortiz * @crypto: crypto settings 14723e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 14737e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 14747e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 14757e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 14767e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1477ee2aca34SJohannes Berg * @vht_capa: VHT capability override 1478ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 1479636a5d36SJouni Malinen */ 1480636a5d36SJouni Malinen struct cfg80211_assoc_request { 148119957bb3SJohannes Berg struct cfg80211_bss *bss; 14823e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1483636a5d36SJouni Malinen size_t ie_len; 1484b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 148519957bb3SJohannes Berg bool use_mfp; 14867e7c8926SBen Greear u32 flags; 14877e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 14887e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1489ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 1490636a5d36SJouni Malinen }; 1491636a5d36SJouni Malinen 1492636a5d36SJouni Malinen /** 1493636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1494636a5d36SJouni Malinen * 1495636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1496636a5d36SJouni Malinen * deauthentication. 1497636a5d36SJouni Malinen * 149895de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1499636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1500636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 150119957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1502077f897aSJohannes Berg * @local_state_change: if set, change local state only and 1503077f897aSJohannes Berg * do not set a deauth frame 1504636a5d36SJouni Malinen */ 1505636a5d36SJouni Malinen struct cfg80211_deauth_request { 150695de817bSJohannes Berg const u8 *bssid; 1507636a5d36SJouni Malinen const u8 *ie; 1508636a5d36SJouni Malinen size_t ie_len; 150919957bb3SJohannes Berg u16 reason_code; 15106863255bSStanislaw Gruszka bool local_state_change; 1511636a5d36SJouni Malinen }; 1512636a5d36SJouni Malinen 1513636a5d36SJouni Malinen /** 1514636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1515636a5d36SJouni Malinen * 1516636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1517636a5d36SJouni Malinen * disassocation. 1518636a5d36SJouni Malinen * 151919957bb3SJohannes Berg * @bss: the BSS to disassociate from 1520636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1521636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 152219957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1523d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1524d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1525636a5d36SJouni Malinen */ 1526636a5d36SJouni Malinen struct cfg80211_disassoc_request { 152719957bb3SJohannes Berg struct cfg80211_bss *bss; 1528636a5d36SJouni Malinen const u8 *ie; 1529636a5d36SJouni Malinen size_t ie_len; 153019957bb3SJohannes Berg u16 reason_code; 1531d5cdfacbSJouni Malinen bool local_state_change; 1532636a5d36SJouni Malinen }; 1533636a5d36SJouni Malinen 1534636a5d36SJouni Malinen /** 153504a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 153604a773adSJohannes Berg * 153704a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 153804a773adSJohannes Berg * method. 153904a773adSJohannes Berg * 154004a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 154104a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 154204a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 154304a773adSJohannes Berg * search for IBSSs with a different BSSID. 1544683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 154504a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 154604a773adSJohannes Berg * IBSSs to join on other channels. 154704a773adSJohannes Berg * @ie: information element(s) to include in the beacon 154804a773adSJohannes Berg * @ie_len: length of that 15498e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1550fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1551fffd0934SJohannes Berg * after joining 1552267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1553267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1554267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1555267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 1556fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1557dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 155804a773adSJohannes Berg */ 155904a773adSJohannes Berg struct cfg80211_ibss_params { 156004a773adSJohannes Berg u8 *ssid; 156104a773adSJohannes Berg u8 *bssid; 1562683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 156304a773adSJohannes Berg u8 *ie; 156404a773adSJohannes Berg u8 ssid_len, ie_len; 15658e30bc55SJohannes Berg u16 beacon_interval; 1566fbd2c8dcSTeemu Paasikivi u32 basic_rates; 156704a773adSJohannes Berg bool channel_fixed; 1568fffd0934SJohannes Berg bool privacy; 1569267335d6SAntonio Quartulli bool control_port; 1570dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 157104a773adSJohannes Berg }; 157204a773adSJohannes Berg 157304a773adSJohannes Berg /** 1574b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1575b23aa676SSamuel Ortiz * 1576b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1577b23aa676SSamuel Ortiz * authentication and association. 1578b23aa676SSamuel Ortiz * 1579b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1580b23aa676SSamuel Ortiz * on scan results) 1581b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1582b23aa676SSamuel Ortiz * results) 1583b23aa676SSamuel Ortiz * @ssid: SSID 1584b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1585b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1586abe37c4bSJohannes Berg * @ie: IEs for association request 1587abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1588b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1589cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 1590b23aa676SSamuel Ortiz * @crypto: crypto settings 1591fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1592fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1593fffd0934SJohannes Berg * @key: WEP key for shared key authentication 15947e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 15954486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 15964486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 15977e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 15987e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 15997e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1600ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 1601ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 1602b23aa676SSamuel Ortiz */ 1603b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1604b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 1605b23aa676SSamuel Ortiz u8 *bssid; 1606b23aa676SSamuel Ortiz u8 *ssid; 1607b23aa676SSamuel Ortiz size_t ssid_len; 1608b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 1609b23aa676SSamuel Ortiz u8 *ie; 1610b23aa676SSamuel Ortiz size_t ie_len; 1611b23aa676SSamuel Ortiz bool privacy; 1612cee00a95SJouni Malinen enum nl80211_mfp mfp; 1613b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1614fffd0934SJohannes Berg const u8 *key; 1615fffd0934SJohannes Berg u8 key_len, key_idx; 16167e7c8926SBen Greear u32 flags; 16174486ea98SBala Shanmugam int bg_scan_period; 16187e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 16197e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1620ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 1621ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 1622b23aa676SSamuel Ortiz }; 1623b23aa676SSamuel Ortiz 1624b23aa676SSamuel Ortiz /** 1625b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1626abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1627abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1628abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1629abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1630abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 1631b9a5f8caSJouni Malinen */ 1632b9a5f8caSJouni Malinen enum wiphy_params_flags { 1633b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1634b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1635b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1636b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 163781077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 1638b9a5f8caSJouni Malinen }; 1639b9a5f8caSJouni Malinen 16409930380fSJohannes Berg /* 16419930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 16429930380fSJohannes Berg */ 16439930380fSJohannes Berg struct cfg80211_bitrate_mask { 16449930380fSJohannes Berg struct { 16459930380fSJohannes Berg u32 legacy; 164624db78c0SSimon Wunderlich u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 16479930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 16489930380fSJohannes Berg }; 164967fbb16bSSamuel Ortiz /** 165067fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 165167fbb16bSSamuel Ortiz * 165267fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 165367fbb16bSSamuel Ortiz * caching. 165467fbb16bSSamuel Ortiz * 165567fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 165667fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 165767fbb16bSSamuel Ortiz */ 165867fbb16bSSamuel Ortiz struct cfg80211_pmksa { 165967fbb16bSSamuel Ortiz u8 *bssid; 166067fbb16bSSamuel Ortiz u8 *pmkid; 166167fbb16bSSamuel Ortiz }; 16629930380fSJohannes Berg 16637643a2c3SJohannes Berg /** 1664ff1b6e69SJohannes Berg * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern 1665ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 1666ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 1667ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 1668ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 1669bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 1670ff1b6e69SJohannes Berg * 1671ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 1672ff1b6e69SJohannes Berg * memory, free @mask only! 1673ff1b6e69SJohannes Berg */ 1674ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern { 1675ff1b6e69SJohannes Berg u8 *mask, *pattern; 1676ff1b6e69SJohannes Berg int pattern_len; 1677bb92d199SAmitkumar Karwar int pkt_offset; 1678ff1b6e69SJohannes Berg }; 1679ff1b6e69SJohannes Berg 1680ff1b6e69SJohannes Berg /** 16812a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 16822a0e047eSJohannes Berg * 16832a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 16842a0e047eSJohannes Berg * @src: source IP address 16852a0e047eSJohannes Berg * @dst: destination IP address 16862a0e047eSJohannes Berg * @dst_mac: destination MAC address 16872a0e047eSJohannes Berg * @src_port: source port 16882a0e047eSJohannes Berg * @dst_port: destination port 16892a0e047eSJohannes Berg * @payload_len: data payload length 16902a0e047eSJohannes Berg * @payload: data payload buffer 16912a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 16922a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 16932a0e047eSJohannes Berg * @wake_len: wakeup payload match length 16942a0e047eSJohannes Berg * @wake_data: wakeup payload match data 16952a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 16962a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 16972a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 16982a0e047eSJohannes Berg */ 16992a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 17002a0e047eSJohannes Berg struct socket *sock; 17012a0e047eSJohannes Berg __be32 src, dst; 17022a0e047eSJohannes Berg u16 src_port, dst_port; 17032a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 17042a0e047eSJohannes Berg int payload_len; 17052a0e047eSJohannes Berg const u8 *payload; 17062a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 17072a0e047eSJohannes Berg u32 data_interval; 17082a0e047eSJohannes Berg u32 wake_len; 17092a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 17102a0e047eSJohannes Berg u32 tokens_size; 17112a0e047eSJohannes Berg /* must be last, variable member */ 17122a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 1713ff1b6e69SJohannes Berg }; 1714ff1b6e69SJohannes Berg 1715ff1b6e69SJohannes Berg /** 1716ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 1717ff1b6e69SJohannes Berg * 1718ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 1719ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 1720ff1b6e69SJohannes Berg * operating as normal during suspend 1721ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 1722ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 1723ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 1724ff1b6e69SJohannes Berg * @n_patterns: number of patterns 172577dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 172677dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 172777dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 172877dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 17292a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 17302a0e047eSJohannes Berg * NULL if not configured. 1731ff1b6e69SJohannes Berg */ 1732ff1b6e69SJohannes Berg struct cfg80211_wowlan { 173377dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 173477dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 173577dbbb13SJohannes Berg rfkill_release; 1736ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern *patterns; 17372a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 1738ff1b6e69SJohannes Berg int n_patterns; 1739ff1b6e69SJohannes Berg }; 1740ff1b6e69SJohannes Berg 1741ff1b6e69SJohannes Berg /** 1742cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 1743cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 1744cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 1745cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 1746cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 1747cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 1748cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 1749cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 1750cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 1751cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 1752cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 1753cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 1754cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 1755cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 1756cd8f7cb4SJohannes Berg * it is. 17572a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 17582a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 17592a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 1760cd8f7cb4SJohannes Berg */ 1761cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 1762cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 1763cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 17642a0e047eSJohannes Berg rfkill_release, packet_80211, 17652a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 1766cd8f7cb4SJohannes Berg s32 pattern_idx; 1767cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 1768cd8f7cb4SJohannes Berg const void *packet; 1769cd8f7cb4SJohannes Berg }; 1770cd8f7cb4SJohannes Berg 1771cd8f7cb4SJohannes Berg /** 1772e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 1773e5497d76SJohannes Berg * @kek: key encryption key 1774e5497d76SJohannes Berg * @kck: key confirmation key 1775e5497d76SJohannes Berg * @replay_ctr: replay counter 1776e5497d76SJohannes Berg */ 1777e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 1778e5497d76SJohannes Berg u8 kek[NL80211_KEK_LEN]; 1779e5497d76SJohannes Berg u8 kck[NL80211_KCK_LEN]; 1780e5497d76SJohannes Berg u8 replay_ctr[NL80211_REPLAY_CTR_LEN]; 1781e5497d76SJohannes Berg }; 1782e5497d76SJohannes Berg 1783e5497d76SJohannes Berg /** 1784355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 1785355199e0SJouni Malinen * 1786355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 1787355199e0SJouni Malinen * 1788355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 1789355199e0SJouni Malinen * @ie: Fast Transition IEs 1790355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 1791355199e0SJouni Malinen */ 1792355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 1793355199e0SJouni Malinen u16 md; 1794355199e0SJouni Malinen const u8 *ie; 1795355199e0SJouni Malinen size_t ie_len; 1796355199e0SJouni Malinen }; 1797355199e0SJouni Malinen 1798355199e0SJouni Malinen /** 1799704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 1800704232c2SJohannes Berg * 1801704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 1802704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 1803704232c2SJohannes Berg * 1804704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 1805704232c2SJohannes Berg * on success or a negative error code. 1806704232c2SJohannes Berg * 180743fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 180843fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 180943fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 181043fb45cbSJohannes Berg * 1811ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 1812ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 1813ff1b6e69SJohannes Berg * configured for the device. 18140378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 18156d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 18166d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 18176d52563fSJohannes Berg * the device. 18180378b3f1SJohannes Berg * 181960719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 1820463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 182184efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 182298104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 182398104fdeSJohannes Berg * also set the address member in the wdev. 1824704232c2SJohannes Berg * 182584efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 182655682965SJohannes Berg * 182760719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 182860719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 182955682965SJohannes Berg * 183041ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 183141ade00fSJohannes Berg * when adding a group key. 183241ade00fSJohannes Berg * 183341ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 183441ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 183541ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 1836e3da574aSJohannes Berg * after it returns. This function should return an error if it is 1837e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 183841ade00fSJohannes Berg * 183941ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 1840e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 184141ade00fSJohannes Berg * 184241ade00fSJohannes Berg * @set_default_key: set the default key on an interface 1843ed1b6cc7SJohannes Berg * 18443cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 18453cfcf6acSJouni Malinen * 1846e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 1847e5497d76SJohannes Berg * 1848c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 1849c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 1850c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 1851c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 18525727ef1bSJohannes Berg * 18535727ef1bSJohannes Berg * @add_station: Add a new station. 18545727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 1855bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 1856bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 1857bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 185877ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 185977ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 1860abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 1861abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 1862abe37c4bSJohannes Berg * 1863abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 1864abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 1865abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 1866abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 1867abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 1868f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 1869f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 18702ec600d6SLuis Carlos Cobo * 187124bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 187293da9cc1Scolin@cozybit.com * 187324bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 187493da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 187593da9cc1Scolin@cozybit.com * set, and which to leave alone. 187693da9cc1Scolin@cozybit.com * 18779f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 187831888487SJouni Malinen * 187931888487SJouni Malinen * @set_txq_params: Set TX queue parameters 188072bdcf34SJouni Malinen * 1881e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 1882e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 1883e8c9bd5bSJohannes Berg * join the mesh instead. 1884e8c9bd5bSJohannes Berg * 1885e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 1886e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 1887e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 1888e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 18899aed3cc1SJouni Malinen * 18902a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 18912a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 18922a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 18932a519311SJohannes Berg * the scan/scan_done bracket too. 1894636a5d36SJouni Malinen * 1895636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 1896636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 1897636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 1898636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 189904a773adSJohannes Berg * 1900b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 1901b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 1902b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 1903b23aa676SSamuel Ortiz * with the status from the AP. 1904b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 1905b23aa676SSamuel Ortiz * 190604a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 190704a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 190804a773adSJohannes Berg * to a merge. 190904a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 1910b9a5f8caSJouni Malinen * 1911f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 1912f4e583c8SAntonio Quartulli * MESH mode) 1913f4e583c8SAntonio Quartulli * 1914b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 1915b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 1916b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 1917b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 19187643a2c3SJohannes Berg * 19191432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 1920c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 1921c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 1922c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 1923c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 19247643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 19251f87f7d3SJohannes Berg * return 0 if successful 19261f87f7d3SJohannes Berg * 1927abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 1928abe37c4bSJohannes Berg * 19291f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 19301f87f7d3SJohannes Berg * functions to adjust rfkill hw state 1931aff89a9bSJohannes Berg * 193261fa713cSHolger Schurig * @dump_survey: get site survey information. 193361fa713cSHolger Schurig * 19349588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 19359588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 19369588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 19379588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 19389588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 19399588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 19409588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 19419588bbd5SJouni Malinen * the duration value. 1942f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 1943f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 1944f7ca38dfSJohannes Berg * frame on another channel 19459588bbd5SJouni Malinen * 1946aff89a9bSJohannes Berg * @testmode_cmd: run a test mode command 194771063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 194871063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 194971063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 195071063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 195171063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 195271063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 195367fbb16bSSamuel Ortiz * 1954abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 1955abe37c4bSJohannes Berg * 195667fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 195767fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 195867fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 195967fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 196067fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 19619043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 19629043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 1963d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 196484f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 196584f10708SThomas Pedersen * thresholds. 1966807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 196730d08a46SArend van Spriel * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. 196867fbb16bSSamuel Ortiz * 1969271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 1970271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 1971271733cfSJohannes Berg * concurrently with itself. 1972547025d5SBruno Randolf * 1973547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 1974547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 1975547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 1976547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 1977547025d5SBruno Randolf * 1978547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 19793677713bSJohn W. Linville * 19803677713bSJohn W. Linville * @set_ringparam: Set tx and rx ring sizes. 19813677713bSJohn W. Linville * 19823677713bSJohn W. Linville * @get_ringparam: Get tx and rx ring current and maximum sizes. 1983109086ceSArik Nemtsov * 1984109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 1985109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 19867f6cf311SJohannes Berg * 19877f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 19887f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 19891d9d9213SSimon Wunderlich * 19901d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 1991d6199218SBen Greear * 1992d6199218SBen Greear * @get_et_sset_count: Ethtool API to get string-set count. 1993d6199218SBen Greear * See @ethtool_ops.get_sset_count 1994d6199218SBen Greear * 1995d6199218SBen Greear * @get_et_stats: Ethtool API to get a set of u64 stats. 1996d6199218SBen Greear * See @ethtool_ops.get_ethtool_stats 1997d6199218SBen Greear * 1998d6199218SBen Greear * @get_et_strings: Ethtool API to get a set of strings to describe stats 1999d6199218SBen Greear * and perhaps other supported types of ethtool data-sets. 2000d6199218SBen Greear * See @ethtool_ops.get_strings 20015b7ccaf3SJohannes Berg * 20025b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 20035b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 20045b7ccaf3SJohannes Berg * current monitoring channel. 200598104fdeSJohannes Berg * 200698104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 200798104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 200877765eafSVasanthakumar Thiagarajan * 200977765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 201077765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 201177765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 201277765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 201377765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 201477765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 201504f39047SSimon Wunderlich * 201604f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 20178bf24293SJouni Malinen * 20188bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 20198bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 20208bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 20215de17984SArend van Spriel * 20225de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 20235de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 20245de17984SArend van Spriel * driver can take the most appropriate actions. 20255de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 20265de17984SArend van Spriel * reliability. This operation can not fail. 2027704232c2SJohannes Berg */ 2028704232c2SJohannes Berg struct cfg80211_ops { 2029ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 20300378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 20316d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 20320378b3f1SJohannes Berg 203384efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2034552bff0cSJohannes Berg const char *name, 2035f9e10ce4SJohannes Berg enum nl80211_iftype type, 2036f9e10ce4SJohannes Berg u32 *flags, 20372ec600d6SLuis Carlos Cobo struct vif_params *params); 203884efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 203984efbb84SJohannes Berg struct wireless_dev *wdev); 2040e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 2041e36d56b6SJohannes Berg struct net_device *dev, 20422ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 20432ec600d6SLuis Carlos Cobo struct vif_params *params); 204441ade00fSJohannes Berg 204541ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 2046e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 204741ade00fSJohannes Berg struct key_params *params); 204841ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 2049e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 2050e31b8213SJohannes Berg void *cookie, 205141ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 205241ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 2053e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 205441ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 205541ade00fSJohannes Berg struct net_device *netdev, 2056dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 20573cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 20583cfcf6acSJouni Malinen struct net_device *netdev, 20593cfcf6acSJouni Malinen u8 key_index); 2060ed1b6cc7SJohannes Berg 20618860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 20628860020eSJohannes Berg struct cfg80211_ap_settings *settings); 20638860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 20648860020eSJohannes Berg struct cfg80211_beacon_data *info); 20658860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 20665727ef1bSJohannes Berg 20675727ef1bSJohannes Berg 20685727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 20695727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 20705727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 20715727ef1bSJohannes Berg u8 *mac); 20725727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 20735727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 2074fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 20752ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 20762ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 20772ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 20782ec600d6SLuis Carlos Cobo 20792ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 20802ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 20812ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 20822ec600d6SLuis Carlos Cobo u8 *dst); 20832ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 20842ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 20852ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 20862ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 20872ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 20882ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 20892ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 20902ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 209124bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 209293da9cc1Scolin@cozybit.com struct net_device *dev, 209393da9cc1Scolin@cozybit.com struct mesh_config *conf); 209424bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 209529cbe68cSJohannes Berg struct net_device *dev, u32 mask, 209629cbe68cSJohannes Berg const struct mesh_config *nconf); 209729cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 209829cbe68cSJohannes Berg const struct mesh_config *conf, 209929cbe68cSJohannes Berg const struct mesh_setup *setup); 210029cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 210129cbe68cSJohannes Berg 21029f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 21039f1ba906SJouni Malinen struct bss_parameters *params); 210431888487SJouni Malinen 2105f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 210631888487SJouni Malinen struct ieee80211_txq_params *params); 210772bdcf34SJouni Malinen 2108e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 2109e8c9bd5bSJohannes Berg struct net_device *dev, 2110e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 2111e8c9bd5bSJohannes Berg 2112e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 2113683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 21149aed3cc1SJouni Malinen 2115fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 21162a519311SJohannes Berg struct cfg80211_scan_request *request); 2117636a5d36SJouni Malinen 2118636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 2119636a5d36SJouni Malinen struct cfg80211_auth_request *req); 2120636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 2121636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 2122636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 212363c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 2124636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 212563c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 212604a773adSJohannes Berg 2127b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 2128b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 2129b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 2130b23aa676SSamuel Ortiz u16 reason_code); 2131b23aa676SSamuel Ortiz 213204a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 213304a773adSJohannes Berg struct cfg80211_ibss_params *params); 213404a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 2135b9a5f8caSJouni Malinen 2136f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 2137f4e583c8SAntonio Quartulli int rate[IEEE80211_NUM_BANDS]); 2138f4e583c8SAntonio Quartulli 2139b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 21407643a2c3SJohannes Berg 2141c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2142fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 2143c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 2144c8442118SJohannes Berg int *dbm); 21451f87f7d3SJohannes Berg 2146ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 2147388ac775SJohannes Berg const u8 *addr); 2148ab737a4fSJohannes Berg 21491f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 2150aff89a9bSJohannes Berg 2151aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2152aff89a9bSJohannes Berg int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 215371063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 215471063f0eSWey-Yi Guy struct netlink_callback *cb, 215571063f0eSWey-Yi Guy void *data, int len); 2156aff89a9bSJohannes Berg #endif 2157bc92afd9SJohannes Berg 21589930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 21599930380fSJohannes Berg struct net_device *dev, 21609930380fSJohannes Berg const u8 *peer, 21619930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 21629930380fSJohannes Berg 216361fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 216461fa713cSHolger Schurig int idx, struct survey_info *info); 216561fa713cSHolger Schurig 216667fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 216767fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 216867fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 216967fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 217067fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 217167fbb16bSSamuel Ortiz 21729588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 217371bbc994SJohannes Berg struct wireless_dev *wdev, 21749588bbd5SJouni Malinen struct ieee80211_channel *chan, 21759588bbd5SJouni Malinen unsigned int duration, 21769588bbd5SJouni Malinen u64 *cookie); 21779588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 217871bbc994SJohannes Berg struct wireless_dev *wdev, 21799588bbd5SJouni Malinen u64 cookie); 21809588bbd5SJouni Malinen 218171bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 2182f7ca38dfSJohannes Berg struct ieee80211_channel *chan, bool offchan, 218342d97a59SJohannes Berg unsigned int wait, const u8 *buf, size_t len, 218442d97a59SJohannes Berg bool no_cck, bool dont_wait_for_ack, u64 *cookie); 2185f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 218671bbc994SJohannes Berg struct wireless_dev *wdev, 2187f7ca38dfSJohannes Berg u64 cookie); 2188026331c4SJouni Malinen 2189bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2190bc92afd9SJohannes Berg bool enabled, int timeout); 2191d6dc1a38SJuuso Oikarinen 2192d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 2193d6dc1a38SJuuso Oikarinen struct net_device *dev, 2194d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 2195271733cfSJohannes Berg 219684f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 219784f10708SThomas Pedersen struct net_device *dev, 219884f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 219984f10708SThomas Pedersen 2200271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 220171bbc994SJohannes Berg struct wireless_dev *wdev, 2202271733cfSJohannes Berg u16 frame_type, bool reg); 2203afe0cbf8SBruno Randolf 2204afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2205afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 22063677713bSJohn W. Linville 22073677713bSJohn W. Linville int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); 22083677713bSJohn W. Linville void (*get_ringparam)(struct wiphy *wiphy, 22093677713bSJohn W. Linville u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); 2210807f8a8cSLuciano Coelho 2211807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 2212807f8a8cSLuciano Coelho struct net_device *dev, 2213807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 221485a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 2215e5497d76SJohannes Berg 2216e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 2217e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 2218109086ceSArik Nemtsov 2219109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2220109086ceSArik Nemtsov u8 *peer, u8 action_code, u8 dialog_token, 2221109086ceSArik Nemtsov u16 status_code, const u8 *buf, size_t len); 2222109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2223109086ceSArik Nemtsov u8 *peer, enum nl80211_tdls_operation oper); 22247f6cf311SJohannes Berg 22257f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 22267f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 2227e999882aSJohannes Berg 22281d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 22291d9d9213SSimon Wunderlich struct net_device *dev, 22301d9d9213SSimon Wunderlich u16 noack_map); 22311d9d9213SSimon Wunderlich 2232d6199218SBen Greear int (*get_et_sset_count)(struct wiphy *wiphy, 2233d6199218SBen Greear struct net_device *dev, int sset); 2234d6199218SBen Greear void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev, 2235d6199218SBen Greear struct ethtool_stats *stats, u64 *data); 2236d6199218SBen Greear void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev, 2237d6199218SBen Greear u32 sset, u8 *data); 2238dbbae26aSMichal Kazior 2239683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 22405b7ccaf3SJohannes Berg struct wireless_dev *wdev, 2241683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 224298104fdeSJohannes Berg 224398104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 224498104fdeSJohannes Berg struct wireless_dev *wdev); 224598104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 224698104fdeSJohannes Berg struct wireless_dev *wdev); 224777765eafSVasanthakumar Thiagarajan 224877765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 224977765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 225004f39047SSimon Wunderlich 225104f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 225204f39047SSimon Wunderlich struct net_device *dev, 225304f39047SSimon Wunderlich struct cfg80211_chan_def *chandef); 2254355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2255355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 22565de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 22575de17984SArend van Spriel struct wireless_dev *wdev, 22585de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 22595de17984SArend van Spriel u16 duration); 22605de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 22615de17984SArend van Spriel struct wireless_dev *wdev); 2262704232c2SJohannes Berg }; 2263704232c2SJohannes Berg 2264d3236553SJohannes Berg /* 2265d3236553SJohannes Berg * wireless hardware and networking interfaces structures 2266d3236553SJohannes Berg * and registration/helper functions 2267d3236553SJohannes Berg */ 2268d3236553SJohannes Berg 2269d3236553SJohannes Berg /** 22705be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 22715be83de5SJohannes Berg * 22725be83de5SJohannes Berg * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device 2273d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 2274d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 2275d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 2276d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 22775be83de5SJohannes Berg * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will 22785be83de5SJohannes Berg * ignore regulatory domain settings until it gets its own regulatory 2279749b527bSLuis R. Rodriguez * domain via its regulatory_hint() unless the regulatory hint is 2280749b527bSLuis R. Rodriguez * from a country IE. After its gets its own regulatory domain it will 2281749b527bSLuis R. Rodriguez * only allow further regulatory domain settings to further enhance 2282749b527bSLuis R. Rodriguez * compliance. For example if channel 13 and 14 are disabled by this 2283749b527bSLuis R. Rodriguez * regulatory domain no user regulatory domain can enable these channels 2284749b527bSLuis R. Rodriguez * at a later time. This can be used for devices which do not have 2285749b527bSLuis R. Rodriguez * calibration information guaranteed for frequencies or settings 2286061acaaeSLuis R. Rodriguez * outside of its regulatory domain. If used in combination with 2287061acaaeSLuis R. Rodriguez * WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings 2288061acaaeSLuis R. Rodriguez * will be followed. 22895be83de5SJohannes Berg * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure 22905be83de5SJohannes Berg * that passive scan flags and beaconing flags may not be lifted by 22915be83de5SJohannes Berg * cfg80211 due to regulatory beacon hints. For more information on beacon 229237184244SLuis R. Rodriguez * hints read the documenation for regulatory_hint_found_beacon() 22935be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 22945be83de5SJohannes Berg * wiphy at all 22955be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 22965be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 22975be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 22985be83de5SJohannes Berg * reason to override the default 22999bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 23009bc383deSJohannes Berg * on a VLAN interface) 23019bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 2302c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 2303c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 2304c0692b8fSJohannes Berg * control_port_no_encrypt flag. 2305e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 230615d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 230715d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 23081ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 2309f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 2310f4b34b55SVivek Natarajan * firmware. 2311cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 2312109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 2313109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 2314109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 2315109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 2316109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 2317109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 2318562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 23195e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 23205e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 23215e760230SJohannes Berg * cfg80211_report_obss_beacon(). 232287bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 232387bbbe22SArik Nemtsov * responds to probe-requests in hardware. 23247c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 23257c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 23265be83de5SJohannes Berg */ 23275be83de5SJohannes Berg enum wiphy_flags { 23285be83de5SJohannes Berg WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 23295be83de5SJohannes Berg WIPHY_FLAG_STRICT_REGULATORY = BIT(1), 23305be83de5SJohannes Berg WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), 23315be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 23325be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 23339bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 23349bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 2335c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 2336309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 233715d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 2338807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 23398e8b41f9SJohannes Berg /* use hole at 12 */ 2340f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 2341cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 2342109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 2343109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 2344562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 23455e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 234687bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 23477c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 23487c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 23497527a782SJohannes Berg }; 23507527a782SJohannes Berg 23517527a782SJohannes Berg /** 23527527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 23537527a782SJohannes Berg * @max: maximum number of interfaces of these types 23547527a782SJohannes Berg * @types: interface types (bits) 23557527a782SJohannes Berg */ 23567527a782SJohannes Berg struct ieee80211_iface_limit { 23577527a782SJohannes Berg u16 max; 23587527a782SJohannes Berg u16 types; 23597527a782SJohannes Berg }; 23607527a782SJohannes Berg 23617527a782SJohannes Berg /** 23627527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 23637527a782SJohannes Berg * @limits: limits for the given interface types 23647527a782SJohannes Berg * @n_limits: number of limitations 23657527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 23667527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 23677527a782SJohannes Berg * group 23687527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 23697527a782SJohannes Berg * between infrastructure and AP types must match. This is required 23707527a782SJohannes Berg * only in special cases. 237111c4a075SSimon Wunderlich * @radar_detect_widths: bitmap of channel widths supported for radar detection 23727527a782SJohannes Berg * 23737527a782SJohannes Berg * These examples can be expressed as follows: 23747527a782SJohannes Berg * 23757527a782SJohannes Berg * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 23767527a782SJohannes Berg * 23777527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 23787527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 23797527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 23807527a782SJohannes Berg * }; 23817527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 23827527a782SJohannes Berg * .limits = limits1, 23837527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 23847527a782SJohannes Berg * .max_interfaces = 2, 23857527a782SJohannes Berg * .beacon_int_infra_match = true, 23867527a782SJohannes Berg * }; 23877527a782SJohannes Berg * 23887527a782SJohannes Berg * 23897527a782SJohannes Berg * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 23907527a782SJohannes Berg * 23917527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 23927527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 23937527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 23947527a782SJohannes Berg * }; 23957527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 23967527a782SJohannes Berg * .limits = limits2, 23977527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 23987527a782SJohannes Berg * .max_interfaces = 8, 23997527a782SJohannes Berg * .num_different_channels = 1, 24007527a782SJohannes Berg * }; 24017527a782SJohannes Berg * 24027527a782SJohannes Berg * 24037527a782SJohannes Berg * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 24047527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 24057527a782SJohannes Berg * 24067527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 24077527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 24087527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 24097527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 24107527a782SJohannes Berg * }; 24117527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 24127527a782SJohannes Berg * .limits = limits3, 24137527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 24147527a782SJohannes Berg * .max_interfaces = 4, 24157527a782SJohannes Berg * .num_different_channels = 2, 24167527a782SJohannes Berg * }; 24177527a782SJohannes Berg */ 24187527a782SJohannes Berg struct ieee80211_iface_combination { 24197527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 24207527a782SJohannes Berg u32 num_different_channels; 24217527a782SJohannes Berg u16 max_interfaces; 24227527a782SJohannes Berg u8 n_limits; 24237527a782SJohannes Berg bool beacon_int_infra_match; 242411c4a075SSimon Wunderlich u8 radar_detect_widths; 24255be83de5SJohannes Berg }; 24265be83de5SJohannes Berg 24272e161f78SJohannes Berg struct ieee80211_txrx_stypes { 24282e161f78SJohannes Berg u16 tx, rx; 24292e161f78SJohannes Berg }; 24302e161f78SJohannes Berg 24315be83de5SJohannes Berg /** 2432ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 2433ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 2434ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 2435ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 2436ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 2437ff1b6e69SJohannes Berg * packet should be preserved in that case 2438ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 2439ff1b6e69SJohannes Berg * (see nl80211.h) 2440ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 244177dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 244277dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 244377dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 244477dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 244577dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 2446ff1b6e69SJohannes Berg */ 2447ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 2448ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 2449ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 2450ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 245177dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 245277dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 245377dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 245477dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 245577dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 2456ff1b6e69SJohannes Berg }; 2457ff1b6e69SJohannes Berg 24582a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 24592a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 24602a0e047eSJohannes Berg u32 data_payload_max; 24612a0e047eSJohannes Berg u32 data_interval_max; 24622a0e047eSJohannes Berg u32 wake_payload_max; 24632a0e047eSJohannes Berg bool seq; 24642a0e047eSJohannes Berg }; 24652a0e047eSJohannes Berg 2466ff1b6e69SJohannes Berg /** 2467ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 2468ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 2469ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 2470ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 2471ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 2472ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 2473bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 24742a0e047eSJohannes Berg * @tcp: TCP wakeup support information 2475ff1b6e69SJohannes Berg */ 2476ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 2477ff1b6e69SJohannes Berg u32 flags; 2478ff1b6e69SJohannes Berg int n_patterns; 2479ff1b6e69SJohannes Berg int pattern_max_len; 2480ff1b6e69SJohannes Berg int pattern_min_len; 2481bb92d199SAmitkumar Karwar int max_pkt_offset; 24822a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 2483ff1b6e69SJohannes Berg }; 2484ff1b6e69SJohannes Berg 2485ff1b6e69SJohannes Berg /** 24865be83de5SJohannes Berg * struct wiphy - wireless hardware description 24872784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 24882784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 24892784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 2490d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 2491d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 2492d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 2493d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 2494d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 2495d3236553SJohannes Berg * @cipher_suites: supported cipher suites 2496d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 2497b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 2498b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 2499b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 2500b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 2501b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 2502abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 2503ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 2504ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 2505ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 2506ef15aac6SJohannes Berg * four bits are variable then set it to 00:...:00:0f. The actual 2507ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 2508ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 2509ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 2510ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 2511ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 2512ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 2513ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 2514ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 2515fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 2516fd235913SRandy Dunlap * unregister hardware 2517abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 2518abe37c4bSJohannes Berg * automatically on wiphy renames 2519abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 25204a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 2521abe37c4bSJohannes Berg * @wext: wireless extension handlers 2522abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 2523abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 2524abe37c4bSJohannes Berg * must be set by driver 25257527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 25267527a782SJohannes Berg * list single interface types. 25277527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 25287527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 25297527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 2530abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 25311f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 2532abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 2533abe37c4bSJohannes Berg * this variable determines its size 2534abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 2535abe37c4bSJohannes Berg * any given scan 253693b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 253793b6aa69SLuciano Coelho * for in any given scheduled scan 2538a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 2539a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 2540a1f1c21cSLuciano Coelho * supported. 2541abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 2542abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 2543abe37c4bSJohannes Berg * include fixed IEs like supported rates 25445a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 25455a865badSLuciano Coelho * scans 2546abe37c4bSJohannes Berg * @coverage_class: current coverage class 2547abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 2548abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 2549abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 2550abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 2551abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 2552abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 25532e161f78SJohannes Berg * 25542e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 25552e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 25562e161f78SJohannes Berg * type 2557a7ffac95SBruno Randolf * 25587f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 25597f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 25607f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 25617f531e03SBruno Randolf * 25627f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 25637f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 25647f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 2565a293911dSJohannes Berg * 256615f0ebc2SRandy Dunlap * @probe_resp_offload: 256715f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 256815f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 256915f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 257015f0ebc2SRandy Dunlap * 2571a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 2572a293911dSJohannes Berg * may request, if implemented. 2573ff1b6e69SJohannes Berg * 2574ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 2575562a7480SJohannes Berg * 2576562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 25777e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 25787e7c8926SBen Greear * If null, then none can be over-ridden. 2579ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 2580ee2aca34SJohannes Berg * If null, then none can be over-ridden. 258177765eafSVasanthakumar Thiagarajan * 258277765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 258377765eafSVasanthakumar Thiagarajan * supports for ACL. 2584a50df0c4SJohannes Berg * 2585a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 2586a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 2587a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 2588a50df0c4SJohannes Berg * and are in the same format as in the information element. See 2589a50df0c4SJohannes Berg * 802.11-2012 8.4.2.29 for the defined fields. 2590a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 2591a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 2592d3236553SJohannes Berg */ 2593d3236553SJohannes Berg struct wiphy { 2594d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 2595d3236553SJohannes Berg 2596ef15aac6SJohannes Berg /* permanent MAC address(es) */ 2597d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 2598ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 2599ef15aac6SJohannes Berg 2600ef15aac6SJohannes Berg struct mac_address *addresses; 2601d3236553SJohannes Berg 26022e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 26032e161f78SJohannes Berg 26047527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 26057527a782SJohannes Berg int n_iface_combinations; 26067527a782SJohannes Berg u16 software_iftypes; 26077527a782SJohannes Berg 26082e161f78SJohannes Berg u16 n_addresses; 26092e161f78SJohannes Berg 2610d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 2611d3236553SJohannes Berg u16 interface_modes; 2612d3236553SJohannes Berg 261377765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 261477765eafSVasanthakumar Thiagarajan 26151f074bd8SJohannes Berg u32 flags, features; 2616463d0183SJohannes Berg 2617562a7480SJohannes Berg u32 ap_sme_capa; 2618562a7480SJohannes Berg 2619d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 2620d3236553SJohannes Berg 2621d3236553SJohannes Berg int bss_priv_size; 2622d3236553SJohannes Berg u8 max_scan_ssids; 262393b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 2624a1f1c21cSLuciano Coelho u8 max_match_sets; 2625d3236553SJohannes Berg u16 max_scan_ie_len; 26265a865badSLuciano Coelho u16 max_sched_scan_ie_len; 2627d3236553SJohannes Berg 2628d3236553SJohannes Berg int n_cipher_suites; 2629d3236553SJohannes Berg const u32 *cipher_suites; 2630d3236553SJohannes Berg 2631b9a5f8caSJouni Malinen u8 retry_short; 2632b9a5f8caSJouni Malinen u8 retry_long; 2633b9a5f8caSJouni Malinen u32 frag_threshold; 2634b9a5f8caSJouni Malinen u32 rts_threshold; 263581077e82SLukáš Turek u8 coverage_class; 2636b9a5f8caSJouni Malinen 263781135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 2638dfce95f5SKalle Valo u32 hw_version; 2639dfce95f5SKalle Valo 2640dfb89c56SJohannes Berg #ifdef CONFIG_PM 2641ff1b6e69SJohannes Berg struct wiphy_wowlan_support wowlan; 2642dfb89c56SJohannes Berg #endif 2643ff1b6e69SJohannes Berg 2644a293911dSJohannes Berg u16 max_remain_on_channel_duration; 2645a293911dSJohannes Berg 264667fbb16bSSamuel Ortiz u8 max_num_pmkids; 264767fbb16bSSamuel Ortiz 26487f531e03SBruno Randolf u32 available_antennas_tx; 26497f531e03SBruno Randolf u32 available_antennas_rx; 2650a7ffac95SBruno Randolf 265187bbbe22SArik Nemtsov /* 265287bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 265387bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 265487bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 265587bbbe22SArik Nemtsov */ 265687bbbe22SArik Nemtsov u32 probe_resp_offload; 265787bbbe22SArik Nemtsov 2658a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 2659a50df0c4SJohannes Berg u8 extended_capabilities_len; 2660a50df0c4SJohannes Berg 2661d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 2662d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 2663d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 2664d3236553SJohannes Berg * or not. Assign this to something global to your driver to 2665d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 2666cf5aa2f1SDavid Kilroy const void *privid; 2667d3236553SJohannes Berg 2668d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 2669d3236553SJohannes Berg 2670d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 26710c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 2672d3236553SJohannes Berg struct regulatory_request *request); 2673d3236553SJohannes Berg 2674d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 2675d3236553SJohannes Berg 2676458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 2677d3236553SJohannes Berg 2678d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 2679d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 2680d3236553SJohannes Berg struct device dev; 2681d3236553SJohannes Berg 2682ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 2683ecb44335SStanislaw Gruszka bool registered; 2684ecb44335SStanislaw Gruszka 2685d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 2686d3236553SJohannes Berg struct dentry *debugfsdir; 2687d3236553SJohannes Berg 26887e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 2689ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 26907e7c8926SBen Greear 2691463d0183SJohannes Berg #ifdef CONFIG_NET_NS 2692463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 2693463d0183SJohannes Berg struct net *_net; 2694463d0183SJohannes Berg #endif 2695463d0183SJohannes Berg 26963d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 26973d23e349SJohannes Berg const struct iw_handler_def *wext; 26983d23e349SJohannes Berg #endif 26993d23e349SJohannes Berg 27001c06ef98SJohannes Berg char priv[0] __aligned(NETDEV_ALIGN); 2701d3236553SJohannes Berg }; 2702d3236553SJohannes Berg 2703463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 2704463d0183SJohannes Berg { 2705c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 2706463d0183SJohannes Berg } 2707463d0183SJohannes Berg 2708463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 2709463d0183SJohannes Berg { 2710c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 2711463d0183SJohannes Berg } 2712463d0183SJohannes Berg 2713d3236553SJohannes Berg /** 2714d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 2715d3236553SJohannes Berg * 2716d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 27170ae997dcSYacine Belkadi * Return: The priv of @wiphy. 2718d3236553SJohannes Berg */ 2719d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 2720d3236553SJohannes Berg { 2721d3236553SJohannes Berg BUG_ON(!wiphy); 2722d3236553SJohannes Berg return &wiphy->priv; 2723d3236553SJohannes Berg } 2724d3236553SJohannes Berg 2725d3236553SJohannes Berg /** 2726f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 2727f1f74825SDavid Kilroy * 2728f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 27290ae997dcSYacine Belkadi * Return: The wiphy of @priv. 2730f1f74825SDavid Kilroy */ 2731f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 2732f1f74825SDavid Kilroy { 2733f1f74825SDavid Kilroy BUG_ON(!priv); 2734f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 2735f1f74825SDavid Kilroy } 2736f1f74825SDavid Kilroy 2737f1f74825SDavid Kilroy /** 2738d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 2739d3236553SJohannes Berg * 2740d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 2741d3236553SJohannes Berg * @dev: The device to parent it to 2742d3236553SJohannes Berg */ 2743d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 2744d3236553SJohannes Berg { 2745d3236553SJohannes Berg wiphy->dev.parent = dev; 2746d3236553SJohannes Berg } 2747d3236553SJohannes Berg 2748d3236553SJohannes Berg /** 2749d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 2750d3236553SJohannes Berg * 2751d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 27520ae997dcSYacine Belkadi * Return: The dev of @wiphy. 2753d3236553SJohannes Berg */ 2754d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 2755d3236553SJohannes Berg { 2756d3236553SJohannes Berg return wiphy->dev.parent; 2757d3236553SJohannes Berg } 2758d3236553SJohannes Berg 2759d3236553SJohannes Berg /** 2760d3236553SJohannes Berg * wiphy_name - get wiphy name 2761d3236553SJohannes Berg * 2762d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 27630ae997dcSYacine Belkadi * Return: The name of @wiphy. 2764d3236553SJohannes Berg */ 2765e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 2766d3236553SJohannes Berg { 2767d3236553SJohannes Berg return dev_name(&wiphy->dev); 2768d3236553SJohannes Berg } 2769d3236553SJohannes Berg 2770d3236553SJohannes Berg /** 2771d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 2772d3236553SJohannes Berg * 2773d3236553SJohannes Berg * @ops: The configuration operations for this device 2774d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 2775d3236553SJohannes Berg * 2776d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 2777d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 2778d3236553SJohannes Berg * 27790ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 27800ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 2781d3236553SJohannes Berg */ 27823dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 2783d3236553SJohannes Berg 2784d3236553SJohannes Berg /** 2785d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 2786d3236553SJohannes Berg * 2787d3236553SJohannes Berg * @wiphy: The wiphy to register. 2788d3236553SJohannes Berg * 27890ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 2790d3236553SJohannes Berg */ 2791d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 2792d3236553SJohannes Berg 2793d3236553SJohannes Berg /** 2794d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 2795d3236553SJohannes Berg * 2796d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 2797d3236553SJohannes Berg * 2798d3236553SJohannes Berg * After this call, no more requests can be made with this priv 2799d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 2800d3236553SJohannes Berg * request that is being handled. 2801d3236553SJohannes Berg */ 2802d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 2803d3236553SJohannes Berg 2804d3236553SJohannes Berg /** 2805d3236553SJohannes Berg * wiphy_free - free wiphy 2806d3236553SJohannes Berg * 2807d3236553SJohannes Berg * @wiphy: The wiphy to free 2808d3236553SJohannes Berg */ 2809d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 2810d3236553SJohannes Berg 2811fffd0934SJohannes Berg /* internal structs */ 28126829c878SJohannes Berg struct cfg80211_conn; 281319957bb3SJohannes Berg struct cfg80211_internal_bss; 2814fffd0934SJohannes Berg struct cfg80211_cached_keys; 281519957bb3SJohannes Berg 2816d3236553SJohannes Berg /** 281789a54e48SJohannes Berg * struct wireless_dev - wireless device state 2818d3236553SJohannes Berg * 281989a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 282089a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 282189a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 282289a54e48SJohannes Berg * It need not be registered then as netdev registration will 282389a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 282489a54e48SJohannes Berg * 282589a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 282689a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 282789a54e48SJohannes Berg * there's no netdev registration in that case it may not be 282889a54e48SJohannes Berg * allocated outside of callback operations that return it. 2829d3236553SJohannes Berg * 2830d3236553SJohannes Berg * @wiphy: pointer to hardware description 2831d3236553SJohannes Berg * @iftype: interface type 2832d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 283389a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 283489a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 283589a54e48SJohannes Berg * wireless device if it has no netdev 2836d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 2837f444de05SJohannes Berg * @channel: (private) Used by the internal configuration code to track 2838aa430da4SJohannes Berg * the user-set AP, monitor and WDS channel 2839aa430da4SJohannes Berg * @preset_chan: (private) Used by the internal configuration code to 2840aa430da4SJohannes Berg * track the channel to be used for AP later 2841d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 2842d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 2843d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 284429cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 284529cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 2846d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 28479bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 28489bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 28499bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 28509bc383deSJohannes Berg * by cfg80211 on change_interface 28512e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 28522e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 2853abe37c4bSJohannes Berg * @mtx: mutex used to lock data in this struct 2854abe37c4bSJohannes Berg * @cleanup_work: work struct used for cleanup that can't be done directly 285556d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 285656d1893dSJohannes Berg * beacons, 0 when not valid 285798104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 285898104fdeSJohannes Berg * @p2p_started: true if this is a P2P Device that has been started 285904f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 286004f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 2861d3236553SJohannes Berg */ 2862d3236553SJohannes Berg struct wireless_dev { 2863d3236553SJohannes Berg struct wiphy *wiphy; 2864d3236553SJohannes Berg enum nl80211_iftype iftype; 2865d3236553SJohannes Berg 2866667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 2867d3236553SJohannes Berg struct list_head list; 2868d3236553SJohannes Berg struct net_device *netdev; 2869d3236553SJohannes Berg 287089a54e48SJohannes Berg u32 identifier; 287189a54e48SJohannes Berg 28722e161f78SJohannes Berg struct list_head mgmt_registrations; 28732e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 2874026331c4SJouni Malinen 2875667503ddSJohannes Berg struct mutex mtx; 2876667503ddSJohannes Berg 2877ad002395SJohannes Berg struct work_struct cleanup_work; 2878ad002395SJohannes Berg 287998104fdeSJohannes Berg bool use_4addr, p2p_started; 288098104fdeSJohannes Berg 288198104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 28829bc383deSJohannes Berg 2883b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 2884d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 288529cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 2886b23aa676SSamuel Ortiz enum { 2887b23aa676SSamuel Ortiz CFG80211_SME_IDLE, 28886829c878SJohannes Berg CFG80211_SME_CONNECTING, 2889b23aa676SSamuel Ortiz CFG80211_SME_CONNECTED, 2890b23aa676SSamuel Ortiz } sme_state; 28916829c878SJohannes Berg struct cfg80211_conn *conn; 2892fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 2893d3236553SJohannes Berg 2894667503ddSJohannes Berg struct list_head event_list; 2895667503ddSJohannes Berg spinlock_t event_lock; 2896667503ddSJohannes Berg 289719957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2898683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 289919957bb3SJohannes Berg 2900f4489ebeSMichal Kazior /* for AP and mesh channel tracking */ 2901f4489ebeSMichal Kazior struct ieee80211_channel *channel; 2902f4489ebeSMichal Kazior 2903c30a3d38SMichal Kazior bool ibss_fixed; 2904c30a3d38SMichal Kazior 2905ffb9eb3dSKalle Valo bool ps; 2906ffb9eb3dSKalle Valo int ps_timeout; 2907ffb9eb3dSKalle Valo 290856d1893dSJohannes Berg int beacon_interval; 290956d1893dSJohannes Berg 291015e47304SEric W. Biederman u32 ap_unexpected_nlportid; 291128946da7SJohannes Berg 291204f39047SSimon Wunderlich bool cac_started; 291304f39047SSimon Wunderlich unsigned long cac_start_time; 291404f39047SSimon Wunderlich 29153d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 2916d3236553SJohannes Berg /* wext data */ 2917cbe8fa9cSJohannes Berg struct { 2918cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 2919f2129354SJohannes Berg struct cfg80211_connect_params connect; 2920fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 2921f2129354SJohannes Berg u8 *ie; 2922f2129354SJohannes Berg size_t ie_len; 2923f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 2924f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 292508645126SJohannes Berg s8 default_key, default_mgmt_key; 2926ffb9eb3dSKalle Valo bool prev_bssid_valid; 2927cbe8fa9cSJohannes Berg } wext; 2928d3236553SJohannes Berg #endif 2929d3236553SJohannes Berg }; 2930d3236553SJohannes Berg 293198104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 293298104fdeSJohannes Berg { 293398104fdeSJohannes Berg if (wdev->netdev) 293498104fdeSJohannes Berg return wdev->netdev->dev_addr; 293598104fdeSJohannes Berg return wdev->address; 293698104fdeSJohannes Berg } 293798104fdeSJohannes Berg 2938d3236553SJohannes Berg /** 2939d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 2940d3236553SJohannes Berg * 2941d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 29420ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 2943d3236553SJohannes Berg */ 2944d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 2945d3236553SJohannes Berg { 2946d3236553SJohannes Berg BUG_ON(!wdev); 2947d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 2948d3236553SJohannes Berg } 2949d3236553SJohannes Berg 2950d70e9693SJohannes Berg /** 2951d70e9693SJohannes Berg * DOC: Utility functions 2952d70e9693SJohannes Berg * 2953d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 2954d3236553SJohannes Berg */ 2955d3236553SJohannes Berg 2956d3236553SJohannes Berg /** 2957d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 2958abe37c4bSJohannes Berg * @chan: channel number 295959eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 29600ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 2961d3236553SJohannes Berg */ 296259eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 2963d3236553SJohannes Berg 2964d3236553SJohannes Berg /** 2965d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 2966abe37c4bSJohannes Berg * @freq: center frequency 29670ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 2968d3236553SJohannes Berg */ 2969d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 2970d3236553SJohannes Berg 2971d3236553SJohannes Berg /* 2972d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 2973d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 2974d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 2975d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 2976d3236553SJohannes Berg * clash. 2977d3236553SJohannes Berg */ 2978d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 2979d3236553SJohannes Berg int freq); 2980d3236553SJohannes Berg /** 2981d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 2982abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 2983abe37c4bSJohannes Berg * @freq: the center frequency of the channel 29840ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 2985d3236553SJohannes Berg */ 2986d3236553SJohannes Berg static inline struct ieee80211_channel * 2987d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 2988d3236553SJohannes Berg { 2989d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 2990d3236553SJohannes Berg } 2991d3236553SJohannes Berg 2992d3236553SJohannes Berg /** 2993d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 2994d3236553SJohannes Berg * 2995d3236553SJohannes Berg * @sband: the band to look for rates in 2996d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 2997d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 2998d3236553SJohannes Berg * 29990ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 30000ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 30010ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 30020ae997dcSYacine Belkadi * rates in the band's bitrate table. 3003d3236553SJohannes Berg */ 3004d3236553SJohannes Berg struct ieee80211_rate * 3005d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3006d3236553SJohannes Berg u32 basic_rates, int bitrate); 3007d3236553SJohannes Berg 3008d3236553SJohannes Berg /* 3009d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 3010d3236553SJohannes Berg * 3011d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 3012d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 3013d3236553SJohannes Berg */ 3014d3236553SJohannes Berg 301533e5a2f7SJohannes Berg struct radiotap_align_size { 301633e5a2f7SJohannes Berg uint8_t align:4, size:4; 301733e5a2f7SJohannes Berg }; 301833e5a2f7SJohannes Berg 301933e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 302033e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 302133e5a2f7SJohannes Berg int n_bits; 302233e5a2f7SJohannes Berg uint32_t oui; 302333e5a2f7SJohannes Berg uint8_t subns; 302433e5a2f7SJohannes Berg }; 302533e5a2f7SJohannes Berg 302633e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 302733e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 302833e5a2f7SJohannes Berg int n_ns; 302933e5a2f7SJohannes Berg }; 303033e5a2f7SJohannes Berg 3031d3236553SJohannes Berg /** 3032d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 303333e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 303433e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 303533e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 303633e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 303733e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 303833e5a2f7SJohannes Berg * the beginning of the actual data portion 303933e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 304033e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 304133e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 304233e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 304333e5a2f7SJohannes Berg * radiotap namespace or not 304433e5a2f7SJohannes Berg * 304533e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 304633e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 304733e5a2f7SJohannes Berg * @_arg_index: next argument index 304833e5a2f7SJohannes Berg * @_arg: next argument pointer 304933e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 305033e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 305133e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 305233e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 305333e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 305433e5a2f7SJohannes Berg * next bitmap word 305533e5a2f7SJohannes Berg * 305633e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 305733e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 3058d3236553SJohannes Berg */ 3059d3236553SJohannes Berg 3060d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 306133e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 306233e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 306333e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 3064d3236553SJohannes Berg 306533e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 306667272440SJohannes Berg __le32 *_next_bitmap; 306733e5a2f7SJohannes Berg 306833e5a2f7SJohannes Berg unsigned char *this_arg; 306933e5a2f7SJohannes Berg int this_arg_index; 307033e5a2f7SJohannes Berg int this_arg_size; 307133e5a2f7SJohannes Berg 307233e5a2f7SJohannes Berg int is_radiotap_ns; 307333e5a2f7SJohannes Berg 307433e5a2f7SJohannes Berg int _max_length; 307533e5a2f7SJohannes Berg int _arg_index; 307633e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 307733e5a2f7SJohannes Berg int _reset_on_ext; 3078d3236553SJohannes Berg }; 3079d3236553SJohannes Berg 3080d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 3081d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 3082d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 308333e5a2f7SJohannes Berg int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); 3084d3236553SJohannes Berg 3085d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 3086d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 3087d3236553SJohannes Berg 308833e5a2f7SJohannes Berg 3089e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 3090e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 3091e31a16d6SZhu Yi 3092e31a16d6SZhu Yi /** 3093e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 3094e31a16d6SZhu Yi * 3095e31a16d6SZhu Yi * @skb: the frame 30960ae997dcSYacine Belkadi * 30970ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 30980ae997dcSYacine Belkadi * returns the 802.11 header length. 30990ae997dcSYacine Belkadi * 31000ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 31010ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 31020ae997dcSYacine Belkadi * 802.11 header. 3103e31a16d6SZhu Yi */ 3104e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 3105e31a16d6SZhu Yi 3106e31a16d6SZhu Yi /** 3107e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 3108e31a16d6SZhu Yi * @fc: frame control field in little-endian format 31090ae997dcSYacine Belkadi * Return: The header length in bytes. 3110e31a16d6SZhu Yi */ 3111633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 3112e31a16d6SZhu Yi 3113e31a16d6SZhu Yi /** 31149b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 31159b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 31169b395bc3SJohannes Berg * (first byte) will be accessed 31170ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 31189b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 31199b395bc3SJohannes Berg */ 31209b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 31219b395bc3SJohannes Berg 31229b395bc3SJohannes Berg /** 3123d70e9693SJohannes Berg * DOC: Data path helpers 3124d70e9693SJohannes Berg * 3125d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 3126d70e9693SJohannes Berg * functions that help implement the data path for devices 3127d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 3128d70e9693SJohannes Berg */ 3129d70e9693SJohannes Berg 3130d70e9693SJohannes Berg /** 3131e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 3132e31a16d6SZhu Yi * @skb: the 802.11 data frame 3133e31a16d6SZhu Yi * @addr: the device MAC address 3134e31a16d6SZhu Yi * @iftype: the virtual interface type 31350ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 3136e31a16d6SZhu Yi */ 3137eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 3138e31a16d6SZhu Yi enum nl80211_iftype iftype); 3139e31a16d6SZhu Yi 3140e31a16d6SZhu Yi /** 3141e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 3142e31a16d6SZhu Yi * @skb: the 802.3 frame 3143e31a16d6SZhu Yi * @addr: the device MAC address 3144e31a16d6SZhu Yi * @iftype: the virtual interface type 3145e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 3146e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 31470ae997dcSYacine Belkadi * Return: 0 on success, or a negative error code. 3148e31a16d6SZhu Yi */ 3149eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3150e31a16d6SZhu Yi enum nl80211_iftype iftype, u8 *bssid, bool qos); 3151e31a16d6SZhu Yi 3152e31a16d6SZhu Yi /** 3153eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3154eaf85ca7SZhu Yi * 3155eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 3156eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 3157eaf85ca7SZhu Yi * @skb is consumed after the function returns. 3158eaf85ca7SZhu Yi * 3159eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 3160eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 3161eaf85ca7SZhu Yi * initialized by by the caller. 3162eaf85ca7SZhu Yi * @addr: The device MAC address. 3163eaf85ca7SZhu Yi * @iftype: The device interface type. 3164eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 31658b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 3166eaf85ca7SZhu Yi */ 3167eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 3168eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 31698b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 31708b3becadSYogesh Ashok Powar bool has_80211_header); 3171eaf85ca7SZhu Yi 3172eaf85ca7SZhu Yi /** 3173e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 3174e31a16d6SZhu Yi * @skb: the data frame 31750ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 3176e31a16d6SZhu Yi */ 3177e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb); 3178e31a16d6SZhu Yi 3179c21dbf92SJohannes Berg /** 3180c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 3181c21dbf92SJohannes Berg * 3182c21dbf92SJohannes Berg * @eid: element ID 3183c21dbf92SJohannes Berg * @ies: data consisting of IEs 3184c21dbf92SJohannes Berg * @len: length of data 3185c21dbf92SJohannes Berg * 31860ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 31870ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 31880ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 31890ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 31900ae997dcSYacine Belkadi * 31910ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 31920ae997dcSYacine Belkadi * having to fit into the given data. 3193c21dbf92SJohannes Berg */ 3194c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 3195c21dbf92SJohannes Berg 3196d70e9693SJohannes Berg /** 31970c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 31980c28ec58SEliad Peller * 31990c28ec58SEliad Peller * @oui: vendor OUI 32000c28ec58SEliad Peller * @oui_type: vendor-specific OUI type 32010c28ec58SEliad Peller * @ies: data consisting of IEs 32020c28ec58SEliad Peller * @len: length of data 32030c28ec58SEliad Peller * 32040ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 32050ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 32060ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 32070ae997dcSYacine Belkadi * element ID. 32080ae997dcSYacine Belkadi * 32090ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 32100ae997dcSYacine Belkadi * the given data. 32110c28ec58SEliad Peller */ 32120c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 32130c28ec58SEliad Peller const u8 *ies, int len); 32140c28ec58SEliad Peller 32150c28ec58SEliad Peller /** 3216d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 3217d70e9693SJohannes Berg * 3218d70e9693SJohannes Berg * TODO 3219d3236553SJohannes Berg */ 3220d3236553SJohannes Berg 3221d3236553SJohannes Berg /** 3222d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 3223d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 3224d3236553SJohannes Berg * conflicts) 3225d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 3226d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 3227d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 3228d3236553SJohannes Berg * alpha2. 3229d3236553SJohannes Berg * 3230d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 3231d3236553SJohannes Berg * what it believes should be the current regulatory domain by 3232d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 3233d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 3234d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 3235d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 3236d3236553SJohannes Berg * 3237d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 3238d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 3239d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 3240d3236553SJohannes Berg * 3241d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 3242d3236553SJohannes Berg * an -ENOMEM. 32430ae997dcSYacine Belkadi * 32440ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 3245d3236553SJohannes Berg */ 3246d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 3247d3236553SJohannes Berg 3248d3236553SJohannes Berg /** 3249d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 3250d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 3251d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 3252d3236553SJohannes Berg * 3253d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 3254d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 3255d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 3256d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 3257d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 3258d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 3259d3236553SJohannes Berg */ 3260d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 3261d3236553SJohannes Berg struct wiphy *wiphy, 3262d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 3263d3236553SJohannes Berg 3264d3236553SJohannes Berg /** 3265d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 3266d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 3267d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 3268d3236553SJohannes Berg * 3269d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 3270d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 3271d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 3272d3236553SJohannes Berg * and processed already. 3273d3236553SJohannes Berg * 32740ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 32750ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 32760ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 32770ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 32780ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 32790ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 32800ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 3281d3236553SJohannes Berg */ 3282361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3283361c9c8bSJohannes Berg u32 center_freq); 3284d3236553SJohannes Berg 3285d3236553SJohannes Berg /* 3286d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 3287d3236553SJohannes Berg * functions and BSS handling helpers 3288d3236553SJohannes Berg */ 3289d3236553SJohannes Berg 32902a519311SJohannes Berg /** 32912a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 32922a519311SJohannes Berg * 32932a519311SJohannes Berg * @request: the corresponding scan request 32942a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 32952a519311SJohannes Berg * userspace will be notified of that 32962a519311SJohannes Berg */ 32972a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 32982a519311SJohannes Berg 32992a519311SJohannes Berg /** 3300807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 3301807f8a8cSLuciano Coelho * 3302807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 3303807f8a8cSLuciano Coelho */ 3304807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 3305807f8a8cSLuciano Coelho 3306807f8a8cSLuciano Coelho /** 3307807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 3308807f8a8cSLuciano Coelho * 3309807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 3310807f8a8cSLuciano Coelho * 3311807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 3312807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 3313807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 3314807f8a8cSLuciano Coelho */ 3315807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3316807f8a8cSLuciano Coelho 3317807f8a8cSLuciano Coelho /** 3318abe37c4bSJohannes Berg * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame 33192a519311SJohannes Berg * 33202a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 3321abe37c4bSJohannes Berg * @channel: The channel the frame was received on 3322abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 3323abe37c4bSJohannes Berg * @len: length of the management frame 332477965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 33252a519311SJohannes Berg * @gfp: context flags 33262a519311SJohannes Berg * 33272a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 33282a519311SJohannes Berg * the BSS should be updated/added. 3329ef100682SJohannes Berg * 33300ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 33310ae997dcSYacine Belkadi * Or %NULL on error. 33322a519311SJohannes Berg */ 3333ef100682SJohannes Berg struct cfg80211_bss * __must_check 33342a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 33352a519311SJohannes Berg struct ieee80211_channel *channel, 33362a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 333777965c97SJohannes Berg s32 signal, gfp_t gfp); 33382a519311SJohannes Berg 3339abe37c4bSJohannes Berg /** 3340abe37c4bSJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 3341abe37c4bSJohannes Berg * 3342abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 3343abe37c4bSJohannes Berg * @channel: The channel the frame was received on 3344abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 33457b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3346abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 3347abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 3348abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 3349abe37c4bSJohannes Berg * @ielen: length of the additional IEs 3350abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 3351abe37c4bSJohannes Berg * @gfp: context flags 3352abe37c4bSJohannes Berg * 3353abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 3354abe37c4bSJohannes Berg * the BSS should be updated/added. 3355ef100682SJohannes Berg * 33560ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 33570ae997dcSYacine Belkadi * Or %NULL on error. 3358abe37c4bSJohannes Berg */ 3359ef100682SJohannes Berg struct cfg80211_bss * __must_check 336006aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 336106aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 33627b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 33637b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 336406aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 336506aa7afaSJussi Kivilinna 33662a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 33672a519311SJohannes Berg struct ieee80211_channel *channel, 33682a519311SJohannes Berg const u8 *bssid, 336979420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 337079420f09SJohannes Berg u16 capa_mask, u16 capa_val); 337179420f09SJohannes Berg static inline struct cfg80211_bss * 337279420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 337379420f09SJohannes Berg struct ieee80211_channel *channel, 337479420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 337579420f09SJohannes Berg { 337679420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 337779420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 337879420f09SJohannes Berg } 337979420f09SJohannes Berg 33804c0c0b75SJohannes Berg /** 33814c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 33825b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 33834c0c0b75SJohannes Berg * @bss: the BSS struct to reference 33844c0c0b75SJohannes Berg * 33854c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 33864c0c0b75SJohannes Berg */ 33875b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 33884c0c0b75SJohannes Berg 33894c0c0b75SJohannes Berg /** 33904c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 33915b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 33924c0c0b75SJohannes Berg * @bss: the BSS struct 33934c0c0b75SJohannes Berg * 33944c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 33954c0c0b75SJohannes Berg */ 33965b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 3397d3236553SJohannes Berg 3398d491af19SJohannes Berg /** 3399d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 3400d491af19SJohannes Berg * @wiphy: the wiphy 3401d491af19SJohannes Berg * @bss: the bss to remove 3402d491af19SJohannes Berg * 3403d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 3404d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 3405d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 3406d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 3407d491af19SJohannes Berg */ 3408d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 3409fee52678SJohannes Berg 34106039f6d2SJouni Malinen /** 34116039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 34126039f6d2SJouni Malinen * @dev: network device 34136039f6d2SJouni Malinen * @buf: authentication frame (header + body) 34146039f6d2SJouni Malinen * @len: length of the frame data 34156039f6d2SJouni Malinen * 34166039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 34171965c853SJouni Malinen * station mode. The driver is required to call either this function or 34181965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 3419cb0b4bebSJohannes Berg * call. This function may sleep. 34206039f6d2SJouni Malinen */ 3421cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 34226039f6d2SJouni Malinen 34236039f6d2SJouni Malinen /** 34241965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 34251965c853SJouni Malinen * @dev: network device 34261965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 3427cb0b4bebSJohannes Berg * 3428cb0b4bebSJohannes Berg * This function may sleep. 34291965c853SJouni Malinen */ 3430cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 34311965c853SJouni Malinen 34321965c853SJouni Malinen /** 34336039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 34346039f6d2SJouni Malinen * @dev: network device 343595de817bSJohannes Berg * @bss: the BSS struct association was requested for, the struct reference 343695de817bSJohannes Berg * is owned by cfg80211 after this call 34376039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 34386039f6d2SJouni Malinen * @len: length of the frame data 34396039f6d2SJouni Malinen * 34406039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 34411965c853SJouni Malinen * processed in station mode. The driver is required to call either this 34421965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 3443cb0b4bebSJohannes Berg * cfg80211_ops::assoc() call. This function may sleep. 34446039f6d2SJouni Malinen */ 344595de817bSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, 344695de817bSJohannes Berg const u8 *buf, size_t len); 34476039f6d2SJouni Malinen 34486039f6d2SJouni Malinen /** 34491965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 34501965c853SJouni Malinen * @dev: network device 34511965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 3452cb0b4bebSJohannes Berg * 3453cb0b4bebSJohannes Berg * This function may sleep. 34541965c853SJouni Malinen */ 3455cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 34561965c853SJouni Malinen 34571965c853SJouni Malinen /** 345853b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 34596039f6d2SJouni Malinen * @dev: network device 34606039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 34616039f6d2SJouni Malinen * @len: length of the frame data 34626039f6d2SJouni Malinen * 34636039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 346453b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 3465cb0b4bebSJohannes Berg * locally generated ones. This function may sleep. 34666039f6d2SJouni Malinen */ 3467ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 3468ce470613SHolger Schurig 3469ce470613SHolger Schurig /** 3470ce470613SHolger Schurig * __cfg80211_send_deauth - notification of processed deauthentication 3471ce470613SHolger Schurig * @dev: network device 3472ce470613SHolger Schurig * @buf: deauthentication frame (header + body) 3473ce470613SHolger Schurig * @len: length of the frame data 3474ce470613SHolger Schurig * 3475ce470613SHolger Schurig * Like cfg80211_send_deauth(), but doesn't take the wdev lock. 3476ce470613SHolger Schurig */ 3477ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 34786039f6d2SJouni Malinen 34796039f6d2SJouni Malinen /** 348053b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 34816039f6d2SJouni Malinen * @dev: network device 34826039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 34836039f6d2SJouni Malinen * @len: length of the frame data 34846039f6d2SJouni Malinen * 34856039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 348653b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 3487cb0b4bebSJohannes Berg * generated ones. This function may sleep. 34886039f6d2SJouni Malinen */ 3489ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); 3490ce470613SHolger Schurig 3491ce470613SHolger Schurig /** 3492ce470613SHolger Schurig * __cfg80211_send_disassoc - notification of processed disassociation 3493ce470613SHolger Schurig * @dev: network device 3494ce470613SHolger Schurig * @buf: disassociation response frame (header + body) 3495ce470613SHolger Schurig * @len: length of the frame data 3496ce470613SHolger Schurig * 3497ce470613SHolger Schurig * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. 3498ce470613SHolger Schurig */ 3499ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 3500ce470613SHolger Schurig size_t len); 35016039f6d2SJouni Malinen 3502a08c1c1aSKalle Valo /** 3503cf4e594eSJouni Malinen * cfg80211_send_unprot_deauth - notification of unprotected deauthentication 3504cf4e594eSJouni Malinen * @dev: network device 3505cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 3506cf4e594eSJouni Malinen * @len: length of the frame data 3507cf4e594eSJouni Malinen * 3508cf4e594eSJouni Malinen * This function is called whenever a received Deauthentication frame has been 3509cf4e594eSJouni Malinen * dropped in station mode because of MFP being used but the Deauthentication 3510cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 3511cf4e594eSJouni Malinen */ 3512cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, 3513cf4e594eSJouni Malinen size_t len); 3514cf4e594eSJouni Malinen 3515cf4e594eSJouni Malinen /** 3516cf4e594eSJouni Malinen * cfg80211_send_unprot_disassoc - notification of unprotected disassociation 3517cf4e594eSJouni Malinen * @dev: network device 3518cf4e594eSJouni Malinen * @buf: disassociation frame (header + body) 3519cf4e594eSJouni Malinen * @len: length of the frame data 3520cf4e594eSJouni Malinen * 3521cf4e594eSJouni Malinen * This function is called whenever a received Disassociation frame has been 3522cf4e594eSJouni Malinen * dropped in station mode because of MFP being used but the Disassociation 3523cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 3524cf4e594eSJouni Malinen */ 3525cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, 3526cf4e594eSJouni Malinen size_t len); 3527cf4e594eSJouni Malinen 3528cf4e594eSJouni Malinen /** 3529a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 3530a3b8b056SJouni Malinen * @dev: network device 3531a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 3532a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 3533a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 3534a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 3535e6d6e342SJohannes Berg * @gfp: allocation flags 3536a3b8b056SJouni Malinen * 3537a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 3538a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 3539a3b8b056SJouni Malinen * primitive. 3540a3b8b056SJouni Malinen */ 3541a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 3542a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 3543e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 3544a3b8b056SJouni Malinen 354504a773adSJohannes Berg /** 354604a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 354704a773adSJohannes Berg * 354804a773adSJohannes Berg * @dev: network device 354904a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 355004a773adSJohannes Berg * @gfp: allocation flags 355104a773adSJohannes Berg * 355204a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 355304a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 355404a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 355504a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 355604a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 355704a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 355804a773adSJohannes Berg */ 355904a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 356004a773adSJohannes Berg 35611f87f7d3SJohannes Berg /** 3562c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 3563c93b5e71SJavier Cardona * 3564c93b5e71SJavier Cardona * @dev: network device 3565c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 3566c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 3567c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 3568c93b5e71SJavier Cardona * @gfp: allocation flags 3569c93b5e71SJavier Cardona * 3570c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 3571c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 3572c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 3573c93b5e71SJavier Cardona */ 3574c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 3575c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 3576c93b5e71SJavier Cardona 3577c93b5e71SJavier Cardona /** 3578d70e9693SJohannes Berg * DOC: RFkill integration 3579d70e9693SJohannes Berg * 3580d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 3581d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 3582d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 3583d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 3584d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 3585d70e9693SJohannes Berg * 3586d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 3587d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 3588d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 3589d70e9693SJohannes Berg */ 3590d70e9693SJohannes Berg 3591d70e9693SJohannes Berg /** 35921f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 35931f87f7d3SJohannes Berg * @wiphy: the wiphy 35941f87f7d3SJohannes Berg * @blocked: block status 35951f87f7d3SJohannes Berg */ 35961f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 35971f87f7d3SJohannes Berg 35981f87f7d3SJohannes Berg /** 35991f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 36001f87f7d3SJohannes Berg * @wiphy: the wiphy 36011f87f7d3SJohannes Berg */ 36021f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 36031f87f7d3SJohannes Berg 36041f87f7d3SJohannes Berg /** 36051f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 36061f87f7d3SJohannes Berg * @wiphy: the wiphy 36071f87f7d3SJohannes Berg */ 36081f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 36091f87f7d3SJohannes Berg 3610aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 3611aff89a9bSJohannes Berg /** 3612d70e9693SJohannes Berg * DOC: Test mode 3613d70e9693SJohannes Berg * 3614d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 3615d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 3616d70e9693SJohannes Berg * factory programming. 3617d70e9693SJohannes Berg * 3618d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 3619d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 3620d70e9693SJohannes Berg */ 3621d70e9693SJohannes Berg 3622d70e9693SJohannes Berg /** 3623aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 3624aff89a9bSJohannes Berg * @wiphy: the wiphy 3625aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 3626aff89a9bSJohannes Berg * be put into the skb 3627aff89a9bSJohannes Berg * 3628aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 3629aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 3630aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 3631aff89a9bSJohannes Berg * 36320ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 36330ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 36340ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 36350ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 36360ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 36370ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 36380ae997dcSYacine Belkadi * must not modify the skb in any other way. 3639aff89a9bSJohannes Berg * 3640aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 3641aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 36420ae997dcSYacine Belkadi * 36430ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 3644aff89a9bSJohannes Berg */ 3645aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 3646aff89a9bSJohannes Berg int approxlen); 3647aff89a9bSJohannes Berg 3648aff89a9bSJohannes Berg /** 3649aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 3650aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 3651aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 3652aff89a9bSJohannes Berg * 36530ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 36540ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 36550ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 36560ae997dcSYacine Belkadi * regardless of the return value. 36570ae997dcSYacine Belkadi * 36580ae997dcSYacine Belkadi * Return: An error code or 0 on success. 3659aff89a9bSJohannes Berg */ 3660aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb); 3661aff89a9bSJohannes Berg 3662aff89a9bSJohannes Berg /** 3663aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 3664aff89a9bSJohannes Berg * @wiphy: the wiphy 3665aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 3666aff89a9bSJohannes Berg * be put into the skb 3667aff89a9bSJohannes Berg * @gfp: allocation flags 3668aff89a9bSJohannes Berg * 3669aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 3670aff89a9bSJohannes Berg * testmode multicast group. 3671aff89a9bSJohannes Berg * 36720ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 36730ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 36740ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 36750ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 36760ae997dcSYacine Belkadi * in any other way. 3677aff89a9bSJohannes Berg * 3678aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 3679aff89a9bSJohannes Berg * skb to send the event. 36800ae997dcSYacine Belkadi * 36810ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 3682aff89a9bSJohannes Berg */ 3683aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 3684aff89a9bSJohannes Berg int approxlen, gfp_t gfp); 3685aff89a9bSJohannes Berg 3686aff89a9bSJohannes Berg /** 3687aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 3688aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 3689aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 3690aff89a9bSJohannes Berg * @gfp: allocation flags 3691aff89a9bSJohannes Berg * 3692aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 3693aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 3694aff89a9bSJohannes Berg * consumes it. 3695aff89a9bSJohannes Berg */ 3696aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 3697aff89a9bSJohannes Berg 3698aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 369971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 3700aff89a9bSJohannes Berg #else 3701aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 370271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 3703aff89a9bSJohannes Berg #endif 3704aff89a9bSJohannes Berg 3705b23aa676SSamuel Ortiz /** 3706b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 3707b23aa676SSamuel Ortiz * 3708b23aa676SSamuel Ortiz * @dev: network device 3709b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 3710b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 3711b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 3712b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 3713b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 3714b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 3715b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 3716b23aa676SSamuel Ortiz * the real status code for failures. 3717b23aa676SSamuel Ortiz * @gfp: allocation flags 3718b23aa676SSamuel Ortiz * 3719b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 3720b23aa676SSamuel Ortiz * succeeded. 3721b23aa676SSamuel Ortiz */ 3722b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 3723b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 3724b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 3725b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 3726b23aa676SSamuel Ortiz 3727b23aa676SSamuel Ortiz /** 3728b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 3729b23aa676SSamuel Ortiz * 3730b23aa676SSamuel Ortiz * @dev: network device 3731ed9d0102SJouni Malinen * @channel: the channel of the new AP 3732b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 3733b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 3734b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 3735b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 3736b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 3737b23aa676SSamuel Ortiz * @gfp: allocation flags 3738b23aa676SSamuel Ortiz * 3739b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 3740b23aa676SSamuel Ortiz * from one AP to another while connected. 3741b23aa676SSamuel Ortiz */ 3742ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 3743ed9d0102SJouni Malinen struct ieee80211_channel *channel, 3744ed9d0102SJouni Malinen const u8 *bssid, 3745b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 3746b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 3747b23aa676SSamuel Ortiz 3748b23aa676SSamuel Ortiz /** 3749adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 3750adbde344SVasanthakumar Thiagarajan * 3751adbde344SVasanthakumar Thiagarajan * @dev: network device 3752adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 3753adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 3754adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 3755adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 3756adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 3757adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 3758adbde344SVasanthakumar Thiagarajan * 3759adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 3760adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 3761adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 3762adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 3763adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 3764adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 3765adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 3766adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 3767adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 3768adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 3769adbde344SVasanthakumar Thiagarajan */ 3770adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 3771adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 3772adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 3773adbde344SVasanthakumar Thiagarajan 3774adbde344SVasanthakumar Thiagarajan /** 3775b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 3776b23aa676SSamuel Ortiz * 3777b23aa676SSamuel Ortiz * @dev: network device 3778b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 3779b23aa676SSamuel Ortiz * @ie_len: length of IEs 3780b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 3781b23aa676SSamuel Ortiz * @gfp: allocation flags 3782b23aa676SSamuel Ortiz * 3783b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 3784b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 3785b23aa676SSamuel Ortiz */ 3786b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 3787b23aa676SSamuel Ortiz u8 *ie, size_t ie_len, gfp_t gfp); 3788b23aa676SSamuel Ortiz 37899588bbd5SJouni Malinen /** 37909588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 379171bbc994SJohannes Berg * @wdev: wireless device 37929588bbd5SJouni Malinen * @cookie: the request cookie 37939588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 37949588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 37959588bbd5SJouni Malinen * channel 37969588bbd5SJouni Malinen * @gfp: allocation flags 37979588bbd5SJouni Malinen */ 379871bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 37999588bbd5SJouni Malinen struct ieee80211_channel *chan, 38009588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 38019588bbd5SJouni Malinen 38029588bbd5SJouni Malinen /** 38039588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 380471bbc994SJohannes Berg * @wdev: wireless device 38059588bbd5SJouni Malinen * @cookie: the request cookie 38069588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 38079588bbd5SJouni Malinen * @gfp: allocation flags 38089588bbd5SJouni Malinen */ 380971bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 38109588bbd5SJouni Malinen struct ieee80211_channel *chan, 38119588bbd5SJouni Malinen gfp_t gfp); 3812b23aa676SSamuel Ortiz 381398b62183SJohannes Berg 381498b62183SJohannes Berg /** 381598b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 381698b62183SJohannes Berg * 381798b62183SJohannes Berg * @dev: the netdev 381898b62183SJohannes Berg * @mac_addr: the station's address 381998b62183SJohannes Berg * @sinfo: the station information 382098b62183SJohannes Berg * @gfp: allocation flags 382198b62183SJohannes Berg */ 382298b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 382398b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 382498b62183SJohannes Berg 3825026331c4SJouni Malinen /** 3826ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 3827ec15e68bSJouni Malinen * 3828ec15e68bSJouni Malinen * @dev: the netdev 3829ec15e68bSJouni Malinen * @mac_addr: the station's address 3830ec15e68bSJouni Malinen * @gfp: allocation flags 3831ec15e68bSJouni Malinen */ 3832ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 3833ec15e68bSJouni Malinen 3834ec15e68bSJouni Malinen /** 3835ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 3836ed44a951SPandiyarajan Pitchaimuthu * 3837ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 3838ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 3839ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 3840ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 3841ed44a951SPandiyarajan Pitchaimuthu * 3842ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 3843ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 3844ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 3845ed44a951SPandiyarajan Pitchaimuthu * 3846ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 3847ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 3848ed44a951SPandiyarajan Pitchaimuthu */ 3849ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 3850ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 3851ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 3852ed44a951SPandiyarajan Pitchaimuthu 3853ed44a951SPandiyarajan Pitchaimuthu /** 38542e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 385571bbc994SJohannes Berg * @wdev: wireless device receiving the frame 3856026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 3857804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 38582e161f78SJohannes Berg * @buf: Management frame (header + body) 3859026331c4SJouni Malinen * @len: length of the frame data 3860026331c4SJouni Malinen * @gfp: context flags 38612e161f78SJohannes Berg * 38620ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 38630ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 38640ae997dcSYacine Belkadi * 38650ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 38662e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 38672e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 38682e161f78SJohannes Berg * driver is responsible for rejecting the frame. 3869026331c4SJouni Malinen */ 387071bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 3871804483e9SJohannes Berg const u8 *buf, size_t len, gfp_t gfp); 3872026331c4SJouni Malinen 3873026331c4SJouni Malinen /** 38742e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 387571bbc994SJohannes Berg * @wdev: wireless device receiving the frame 38762e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 38772e161f78SJohannes Berg * @buf: Management frame (header + body) 3878026331c4SJouni Malinen * @len: length of the frame data 3879026331c4SJouni Malinen * @ack: Whether frame was acknowledged 3880026331c4SJouni Malinen * @gfp: context flags 3881026331c4SJouni Malinen * 38822e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 38832e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 3884026331c4SJouni Malinen * transmission attempt. 3885026331c4SJouni Malinen */ 388671bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 3887026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 3888026331c4SJouni Malinen 3889d6dc1a38SJuuso Oikarinen 3890d6dc1a38SJuuso Oikarinen /** 3891d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 3892d6dc1a38SJuuso Oikarinen * @dev: network device 3893d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 3894d6dc1a38SJuuso Oikarinen * @gfp: context flags 3895d6dc1a38SJuuso Oikarinen * 3896d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 3897d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 3898d6dc1a38SJuuso Oikarinen */ 3899d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 3900d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 3901d6dc1a38SJuuso Oikarinen gfp_t gfp); 3902d6dc1a38SJuuso Oikarinen 3903c063dbf5SJohannes Berg /** 390404f39047SSimon Wunderlich * cfg80211_radar_event - radar detection event 390504f39047SSimon Wunderlich * @wiphy: the wiphy 390604f39047SSimon Wunderlich * @chandef: chandef for the current channel 390704f39047SSimon Wunderlich * @gfp: context flags 390804f39047SSimon Wunderlich * 390904f39047SSimon Wunderlich * This function is called when a radar is detected on the current chanenl. 391004f39047SSimon Wunderlich */ 391104f39047SSimon Wunderlich void cfg80211_radar_event(struct wiphy *wiphy, 391204f39047SSimon Wunderlich struct cfg80211_chan_def *chandef, gfp_t gfp); 391304f39047SSimon Wunderlich 391404f39047SSimon Wunderlich /** 391504f39047SSimon Wunderlich * cfg80211_cac_event - Channel availability check (CAC) event 391604f39047SSimon Wunderlich * @netdev: network device 391704f39047SSimon Wunderlich * @event: type of event 391804f39047SSimon Wunderlich * @gfp: context flags 391904f39047SSimon Wunderlich * 392004f39047SSimon Wunderlich * This function is called when a Channel availability check (CAC) is finished 392104f39047SSimon Wunderlich * or aborted. This must be called to notify the completion of a CAC process, 392204f39047SSimon Wunderlich * also by full-MAC drivers. 392304f39047SSimon Wunderlich */ 392404f39047SSimon Wunderlich void cfg80211_cac_event(struct net_device *netdev, 392504f39047SSimon Wunderlich enum nl80211_radar_event event, gfp_t gfp); 392604f39047SSimon Wunderlich 392704f39047SSimon Wunderlich 392804f39047SSimon Wunderlich /** 3929c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 3930c063dbf5SJohannes Berg * @dev: network device 3931c063dbf5SJohannes Berg * @peer: peer's MAC address 3932c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 3933c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 3934c063dbf5SJohannes Berg * threshold (to account for temporary interference) 3935c063dbf5SJohannes Berg * @gfp: context flags 3936c063dbf5SJohannes Berg */ 3937c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 3938c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 3939c063dbf5SJohannes Berg 3940e5497d76SJohannes Berg /** 394184f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 394284f10708SThomas Pedersen * @dev: network device 394384f10708SThomas Pedersen * @peer: peer's MAC address 394484f10708SThomas Pedersen * @num_packets: how many packets were lost 394584f10708SThomas Pedersen * @rate: % of packets which failed transmission 394684f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 394784f10708SThomas Pedersen * @gfp: context flags 394884f10708SThomas Pedersen * 394984f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 395084f10708SThomas Pedersen * given interval is exceeded. 395184f10708SThomas Pedersen */ 395284f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 395384f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 395484f10708SThomas Pedersen 395584f10708SThomas Pedersen /** 3956e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 3957e5497d76SJohannes Berg * @dev: network device 3958e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 3959e5497d76SJohannes Berg * @replay_ctr: new replay counter 3960af71ff85SJohannes Berg * @gfp: allocation flags 3961e5497d76SJohannes Berg */ 3962e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 3963e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 3964e5497d76SJohannes Berg 3965c9df56b4SJouni Malinen /** 3966c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 3967c9df56b4SJouni Malinen * @dev: network device 3968c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 3969c9df56b4SJouni Malinen * @bssid: BSSID of AP 3970c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 3971c9df56b4SJouni Malinen * @gfp: allocation flags 3972c9df56b4SJouni Malinen */ 3973c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 3974c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 3975c9df56b4SJouni Malinen 397628946da7SJohannes Berg /** 397728946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 397828946da7SJohannes Berg * @dev: The device the frame matched to 397928946da7SJohannes Berg * @addr: the transmitter address 398028946da7SJohannes Berg * @gfp: context flags 398128946da7SJohannes Berg * 398228946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 398328946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 398428946da7SJohannes Berg * sender. 39850ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 398628946da7SJohannes Berg * for a reason other than not having a subscription.) 398728946da7SJohannes Berg */ 398828946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 398928946da7SJohannes Berg const u8 *addr, gfp_t gfp); 399028946da7SJohannes Berg 39917f6cf311SJohannes Berg /** 3992b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 3993b92ab5d8SJohannes Berg * @dev: The device the frame matched to 3994b92ab5d8SJohannes Berg * @addr: the transmitter address 3995b92ab5d8SJohannes Berg * @gfp: context flags 3996b92ab5d8SJohannes Berg * 3997b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 3998b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 3999b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 4000b92ab5d8SJohannes Berg * station to avoid event flooding. 40010ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 4002b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 4003b92ab5d8SJohannes Berg */ 4004b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 4005b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 4006b92ab5d8SJohannes Berg 4007b92ab5d8SJohannes Berg /** 40087f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 40097f6cf311SJohannes Berg * @dev: the device the probe was sent on 40107f6cf311SJohannes Berg * @addr: the address of the peer 40117f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 40127f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 40137f6cf311SJohannes Berg * @gfp: allocation flags 40147f6cf311SJohannes Berg */ 40157f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 40167f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 40177f6cf311SJohannes Berg 40185e760230SJohannes Berg /** 40195e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 40205e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 40215e760230SJohannes Berg * @frame: the frame 40225e760230SJohannes Berg * @len: length of the frame 40235e760230SJohannes Berg * @freq: frequency the frame was received on 4024804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 40255e760230SJohannes Berg * 40265e760230SJohannes Berg * Use this function to report to userspace when a beacon was 40275e760230SJohannes Berg * received. It is not useful to call this when there is no 40285e760230SJohannes Berg * netdev that is in AP/GO mode. 40295e760230SJohannes Berg */ 40305e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 40315e760230SJohannes Berg const u8 *frame, size_t len, 403237c73b5fSBen Greear int freq, int sig_dbm); 40335e760230SJohannes Berg 4034d58e7e37SJohannes Berg /** 4035683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 403654858ee5SAlexander Simon * @wiphy: the wiphy 4037683b6d3bSJohannes Berg * @chandef: the channel definition 4038d58e7e37SJohannes Berg * 40390ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 40400ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 404154858ee5SAlexander Simon */ 4042683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4043683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 404454858ee5SAlexander Simon 40458097e149SThomas Pedersen /* 40465314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 40475314526bSThomas Pedersen * @dev: the device which switched channels 4048683b6d3bSJohannes Berg * @chandef: the new channel definition 40495314526bSThomas Pedersen * 40505314526bSThomas Pedersen * Acquires wdev_lock, so must only be called from sleepable driver context! 40515314526bSThomas Pedersen */ 4052683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 4053683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 40545314526bSThomas Pedersen 40551ce3e82bSJohannes Berg /** 40561ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 40571ce3e82bSJohannes Berg * 40581ce3e82bSJohannes Berg * @operating_class: the operating class to convert 40591ce3e82bSJohannes Berg * @band: band pointer to fill 40601ce3e82bSJohannes Berg * 40611ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 40621ce3e82bSJohannes Berg */ 40631ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 40641ce3e82bSJohannes Berg enum ieee80211_band *band); 40651ce3e82bSJohannes Berg 40665314526bSThomas Pedersen /* 40673475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 40683475b094SJouni Malinen * @dev: the device on which the operation is requested 40693475b094SJouni Malinen * @peer: the MAC address of the peer device 40703475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 40713475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 40723475b094SJouni Malinen * @reason_code: the reason code for teardown request 40733475b094SJouni Malinen * @gfp: allocation flags 40743475b094SJouni Malinen * 40753475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 40763475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 40773475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 40783475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 40793475b094SJouni Malinen * based on traffic and signal strength for a peer). 40803475b094SJouni Malinen */ 40813475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 40823475b094SJouni Malinen enum nl80211_tdls_operation oper, 40833475b094SJouni Malinen u16 reason_code, gfp_t gfp); 40843475b094SJouni Malinen 40853475b094SJouni Malinen /* 40868097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 40878097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 40888097e149SThomas Pedersen * 40898097e149SThomas Pedersen * return 0 if MCS index >= 32 40908097e149SThomas Pedersen */ 40918eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 40928097e149SThomas Pedersen 409398104fdeSJohannes Berg /** 409498104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 409598104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 409698104fdeSJohannes Berg * 409798104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 409898104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 409998104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 410098104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 410198104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 410298104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 410398104fdeSJohannes Berg * when the device is unbound from the driver. 410498104fdeSJohannes Berg * 410598104fdeSJohannes Berg * Requires the RTNL to be held. 410698104fdeSJohannes Berg */ 410798104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 410898104fdeSJohannes Berg 41090ee45355SJohannes Berg /** 4110355199e0SJouni Malinen * struct cfg80211_ft_event - FT Information Elements 4111355199e0SJouni Malinen * @ies: FT IEs 4112355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 4113355199e0SJouni Malinen * @target_ap: target AP's MAC address 4114355199e0SJouni Malinen * @ric_ies: RIC IE 4115355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 4116355199e0SJouni Malinen */ 4117355199e0SJouni Malinen struct cfg80211_ft_event_params { 4118355199e0SJouni Malinen const u8 *ies; 4119355199e0SJouni Malinen size_t ies_len; 4120355199e0SJouni Malinen const u8 *target_ap; 4121355199e0SJouni Malinen const u8 *ric_ies; 4122355199e0SJouni Malinen size_t ric_ies_len; 4123355199e0SJouni Malinen }; 4124355199e0SJouni Malinen 4125355199e0SJouni Malinen /** 4126355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 4127355199e0SJouni Malinen * @netdev: network device 4128355199e0SJouni Malinen * @ft_event: IE information 4129355199e0SJouni Malinen */ 4130355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 4131355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 4132355199e0SJouni Malinen 4133355199e0SJouni Malinen /** 41340ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 41350ee45355SJohannes Berg * @ies: the input IE buffer 41360ee45355SJohannes Berg * @len: the input length 41370ee45355SJohannes Berg * @attr: the attribute ID to find 41380ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 41390ee45355SJohannes Berg * if the function is only called to get the needed buffer size 41400ee45355SJohannes Berg * @bufsize: size of the output buffer 41410ee45355SJohannes Berg * 41420ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 41430ee45355SJohannes Berg * copies its contents to the given buffer. 41440ee45355SJohannes Berg * 41450ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 41460ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 41470ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 41480ee45355SJohannes Berg */ 4149c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 4150c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 4151c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 41520ee45355SJohannes Berg 4153cd8f7cb4SJohannes Berg /** 4154cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 4155cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 4156cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 4157cd8f7cb4SJohannes Berg * @gfp: allocation flags 4158cd8f7cb4SJohannes Berg * 4159cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 4160cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 4161cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 4162cd8f7cb4SJohannes Berg * else caused the wakeup. 4163cd8f7cb4SJohannes Berg */ 4164cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 4165cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 4166cd8f7cb4SJohannes Berg gfp_t gfp); 4167cd8f7cb4SJohannes Berg 41685de17984SArend van Spriel /** 41695de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 41705de17984SArend van Spriel * 41715de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 417203f831a6SRobert P. J. Day * @gfp: allocation flags 41735de17984SArend van Spriel * 41745de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 41755de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 41765de17984SArend van Spriel * by .crit_proto_start() has expired. 41775de17984SArend van Spriel */ 41785de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 41795de17984SArend van Spriel 4180e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 4181e1db74fcSJoe Perches 4182e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 4183e1db74fcSJoe Perches 4184e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 41859c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 4186e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 41879c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 4188e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 41899c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 4190e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 41919c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 4192e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 41939c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 4194e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 41959c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 4196e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 41979c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 4198e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 41999c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 4200073730d7SJoe Perches 42019c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 4202e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 42039c376639SJoe Perches 4204e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 42059c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 4206e1db74fcSJoe Perches 4207e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 4208e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 4209e1db74fcSJoe Perches #else 4210e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 4211e1db74fcSJoe Perches ({ \ 4212e1db74fcSJoe Perches if (0) \ 4213e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 4214e1db74fcSJoe Perches 0; \ 4215e1db74fcSJoe Perches }) 4216e1db74fcSJoe Perches #endif 4217e1db74fcSJoe Perches 4218e1db74fcSJoe Perches /* 4219e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 4220e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 4221e1db74fcSJoe Perches * file/line information and a backtrace. 4222e1db74fcSJoe Perches */ 4223e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 4224e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 4225e1db74fcSJoe Perches 4226704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 4227