1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2704232c2SJohannes Berg #ifndef __NET_CFG80211_H 3704232c2SJohannes Berg #define __NET_CFG80211_H 4d3236553SJohannes Berg /* 5d3236553SJohannes Berg * 802.11 device and configuration interface 6d3236553SJohannes Berg * 7026331c4SJouni Malinen * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 82740f0cfSJohannes Berg * Copyright 2013-2014 Intel Mobile Communications GmbH 98585989dSLuca Coelho * Copyright 2015-2017 Intel Deutschland GmbH 107e8d6f12SShaul Triebitz * Copyright (C) 2018-2020 Intel Corporation 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_channel_flags - channel flags 70d3236553SJohannes Berg * 71d3236553SJohannes Berg * Channel flags set by the regulatory control code. 72d3236553SJohannes Berg * 73d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 748fe02e16SLuis R. Rodriguez * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 758fe02e16SLuis R. Rodriguez * sending probe requests or beaconing. 76d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 77689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 78d3236553SJohannes Berg * is not permitted. 79689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 80d3236553SJohannes Berg * is not permitted. 8103f6b084SSeth Forshee * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 82c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 83c7a6ee27SJohannes Berg * this flag indicates that an 80 MHz channel cannot use this 84c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 85c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 86c7a6ee27SJohannes Berg * restrictions. 87c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 88c7a6ee27SJohannes Berg * this flag indicates that an 160 MHz channel cannot use this 89c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 90c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 91c7a6ee27SJohannes Berg * restrictions. 92570dbde1SDavid Spinadel * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 9306f207fcSArik Nemtsov * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 94ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 95ea077c1cSRostislav Lisovy * on this channel. 96ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 97ea077c1cSRostislav Lisovy * on this channel. 981e61d82cSHaim Dreyfuss * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel. 99d65a9770SThomas Pedersen * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted 100d65a9770SThomas Pedersen * on this channel. 101d65a9770SThomas Pedersen * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted 102d65a9770SThomas Pedersen * on this channel. 103d65a9770SThomas Pedersen * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted 104d65a9770SThomas Pedersen * on this channel. 105d65a9770SThomas Pedersen * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted 106d65a9770SThomas Pedersen * on this channel. 107d65a9770SThomas Pedersen * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted 108d65a9770SThomas Pedersen * on this channel. 109570dbde1SDavid Spinadel * 110d3236553SJohannes Berg */ 111d3236553SJohannes Berg enum ieee80211_channel_flags { 112d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 1138fe02e16SLuis R. Rodriguez IEEE80211_CHAN_NO_IR = 1<<1, 1148fe02e16SLuis R. Rodriguez /* hole at 1<<2 */ 115d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 116689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 117689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 11803f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 119c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 120c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 121570dbde1SDavid Spinadel IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 12206f207fcSArik Nemtsov IEEE80211_CHAN_IR_CONCURRENT = 1<<10, 123ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_20MHZ = 1<<11, 124ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_10MHZ = 1<<12, 1251e61d82cSHaim Dreyfuss IEEE80211_CHAN_NO_HE = 1<<13, 126d65a9770SThomas Pedersen IEEE80211_CHAN_1MHZ = 1<<14, 127d65a9770SThomas Pedersen IEEE80211_CHAN_2MHZ = 1<<15, 128d65a9770SThomas Pedersen IEEE80211_CHAN_4MHZ = 1<<16, 129d65a9770SThomas Pedersen IEEE80211_CHAN_8MHZ = 1<<17, 130d65a9770SThomas Pedersen IEEE80211_CHAN_16MHZ = 1<<18, 131d3236553SJohannes Berg }; 132d3236553SJohannes Berg 133038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 134689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 135038659e7SLuis R. Rodriguez 13604f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 13704f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 13804f39047SSimon Wunderlich 139d3236553SJohannes Berg /** 140d3236553SJohannes Berg * struct ieee80211_channel - channel definition 141d3236553SJohannes Berg * 142d3236553SJohannes Berg * This structure describes a single channel for use 143d3236553SJohannes Berg * with cfg80211. 144d3236553SJohannes Berg * 145d3236553SJohannes Berg * @center_freq: center frequency in MHz 146934f4c7dSThomas Pedersen * @freq_offset: offset from @center_freq, in KHz 147d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 148d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 149d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 150d3236553SJohannes Berg * code to support devices with additional restrictions 151d3236553SJohannes Berg * @band: band this channel belongs to. 152d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 153d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 154eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 155d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 156d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 15777c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 158d3236553SJohannes Berg * @orig_mag: internal use 159d3236553SJohannes Berg * @orig_mpwr: internal use 16004f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 16104f39047SSimon Wunderlich * on this channel. 16204f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 163089027e5SJanusz Dziedzic * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 164d3236553SJohannes Berg */ 165d3236553SJohannes Berg struct ieee80211_channel { 16657fbcce3SJohannes Berg enum nl80211_band band; 1679cf0a0b4SAlexei Avshalom Lazar u32 center_freq; 168934f4c7dSThomas Pedersen u16 freq_offset; 169d3236553SJohannes Berg u16 hw_value; 170d3236553SJohannes Berg u32 flags; 171d3236553SJohannes Berg int max_antenna_gain; 172d3236553SJohannes Berg int max_power; 173eccc068eSHong Wu int max_reg_power; 174d3236553SJohannes Berg bool beacon_found; 175d3236553SJohannes Berg u32 orig_flags; 176d3236553SJohannes Berg int orig_mag, orig_mpwr; 17704f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 17804f39047SSimon Wunderlich unsigned long dfs_state_entered; 179089027e5SJanusz Dziedzic unsigned int dfs_cac_ms; 180d3236553SJohannes Berg }; 181d3236553SJohannes Berg 182d3236553SJohannes Berg /** 183d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 184d3236553SJohannes Berg * 185d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 186d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 187d3236553SJohannes Berg * different bands/PHY modes. 188d3236553SJohannes Berg * 189d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 190d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 191d3236553SJohannes Berg * with CCK rates. 192d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 193d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 194d3236553SJohannes Berg * core code when registering the wiphy. 195d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 196d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 197d3236553SJohannes Berg * core code when registering the wiphy. 198d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 199d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 200d3236553SJohannes Berg * core code when registering the wiphy. 201d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 20230e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 20330e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 204d3236553SJohannes Berg */ 205d3236553SJohannes Berg enum ieee80211_rate_flags { 206d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 207d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 208d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 209d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 210d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 21130e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 21230e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 213d3236553SJohannes Berg }; 214d3236553SJohannes Berg 215d3236553SJohannes Berg /** 2166eb18137SDedy Lansky * enum ieee80211_bss_type - BSS type filter 2176eb18137SDedy Lansky * 2186eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS 2196eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_PBSS: Personal BSS 2206eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_IBSS: Independent BSS 2216eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS 2226eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type 2236eb18137SDedy Lansky */ 2246eb18137SDedy Lansky enum ieee80211_bss_type { 2256eb18137SDedy Lansky IEEE80211_BSS_TYPE_ESS, 2266eb18137SDedy Lansky IEEE80211_BSS_TYPE_PBSS, 2276eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 2286eb18137SDedy Lansky IEEE80211_BSS_TYPE_MBSS, 2296eb18137SDedy Lansky IEEE80211_BSS_TYPE_ANY 2306eb18137SDedy Lansky }; 2316eb18137SDedy Lansky 2326eb18137SDedy Lansky /** 2336eb18137SDedy Lansky * enum ieee80211_privacy - BSS privacy filter 2346eb18137SDedy Lansky * 2356eb18137SDedy Lansky * @IEEE80211_PRIVACY_ON: privacy bit set 2366eb18137SDedy Lansky * @IEEE80211_PRIVACY_OFF: privacy bit clear 2376eb18137SDedy Lansky * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting 2386eb18137SDedy Lansky */ 2396eb18137SDedy Lansky enum ieee80211_privacy { 2406eb18137SDedy Lansky IEEE80211_PRIVACY_ON, 2416eb18137SDedy Lansky IEEE80211_PRIVACY_OFF, 2426eb18137SDedy Lansky IEEE80211_PRIVACY_ANY 2436eb18137SDedy Lansky }; 2446eb18137SDedy Lansky 2456eb18137SDedy Lansky #define IEEE80211_PRIVACY(x) \ 2466eb18137SDedy Lansky ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) 2476eb18137SDedy Lansky 2486eb18137SDedy Lansky /** 249d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 250d3236553SJohannes Berg * 251d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 252d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 253d3236553SJohannes Berg * are only for driver use when pointers to this structure are 254d3236553SJohannes Berg * passed around. 255d3236553SJohannes Berg * 256d3236553SJohannes Berg * @flags: rate-specific flags 257d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 258d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 259d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 260d3236553SJohannes Berg * short preamble is used 261d3236553SJohannes Berg */ 262d3236553SJohannes Berg struct ieee80211_rate { 263d3236553SJohannes Berg u32 flags; 264d3236553SJohannes Berg u16 bitrate; 265d3236553SJohannes Berg u16 hw_value, hw_value_short; 266d3236553SJohannes Berg }; 267d3236553SJohannes Berg 268d3236553SJohannes Berg /** 269796e90f4SJohn Crispin * struct ieee80211_he_obss_pd - AP settings for spatial reuse 270796e90f4SJohn Crispin * 271796e90f4SJohn Crispin * @enable: is the feature enabled. 272f5bec330SRajkumar Manoharan * @sr_ctrl: The SR Control field of SRP element. 273f5bec330SRajkumar Manoharan * @non_srg_max_offset: non-SRG maximum tx power offset 274796e90f4SJohn Crispin * @min_offset: minimal tx power offset an associated station shall use 275796e90f4SJohn Crispin * @max_offset: maximum tx power offset an associated station shall use 276f5bec330SRajkumar Manoharan * @bss_color_bitmap: bitmap that indicates the BSS color values used by 277f5bec330SRajkumar Manoharan * members of the SRG 278f5bec330SRajkumar Manoharan * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values 279f5bec330SRajkumar Manoharan * used by members of the SRG 280796e90f4SJohn Crispin */ 281796e90f4SJohn Crispin struct ieee80211_he_obss_pd { 282796e90f4SJohn Crispin bool enable; 283f5bec330SRajkumar Manoharan u8 sr_ctrl; 284f5bec330SRajkumar Manoharan u8 non_srg_max_offset; 285796e90f4SJohn Crispin u8 min_offset; 286796e90f4SJohn Crispin u8 max_offset; 287f5bec330SRajkumar Manoharan u8 bss_color_bitmap[8]; 288f5bec330SRajkumar Manoharan u8 partial_bssid_bitmap[8]; 289796e90f4SJohn Crispin }; 290796e90f4SJohn Crispin 291796e90f4SJohn Crispin /** 2925c5e52d1SJohn Crispin * struct cfg80211_he_bss_color - AP settings for BSS coloring 2935c5e52d1SJohn Crispin * 2945c5e52d1SJohn Crispin * @color: the current color. 29575e6b594SJohannes Berg * @enabled: HE BSS color is used 2965c5e52d1SJohn Crispin * @partial: define the AID equation. 2975c5e52d1SJohn Crispin */ 2985c5e52d1SJohn Crispin struct cfg80211_he_bss_color { 2995c5e52d1SJohn Crispin u8 color; 30075e6b594SJohannes Berg bool enabled; 3015c5e52d1SJohn Crispin bool partial; 3025c5e52d1SJohn Crispin }; 3035c5e52d1SJohn Crispin 3045c5e52d1SJohn Crispin /** 305dd56e902SJohn Crispin * struct ieee80211_he_bss_color - AP settings for BSS coloring 306dd56e902SJohn Crispin * 307dd56e902SJohn Crispin * @color: the current color. 308dd56e902SJohn Crispin * @disabled: is the feature disabled. 309dd56e902SJohn Crispin * @partial: define the AID equation. 310dd56e902SJohn Crispin */ 311dd56e902SJohn Crispin struct ieee80211_he_bss_color { 312dd56e902SJohn Crispin u8 color; 313dd56e902SJohn Crispin bool disabled; 314dd56e902SJohn Crispin bool partial; 315dd56e902SJohn Crispin }; 316dd56e902SJohn Crispin 317dd56e902SJohn Crispin /** 318d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 319d3236553SJohannes Berg * 320d3236553SJohannes Berg * This structure describes most essential parameters needed 321d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 322d3236553SJohannes Berg * 323d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 324d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 325d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 326d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 327d3236553SJohannes Berg * @mcs: Supported MCS rates 328d3236553SJohannes Berg */ 329d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 330d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 331d3236553SJohannes Berg bool ht_supported; 332d3236553SJohannes Berg u8 ampdu_factor; 333d3236553SJohannes Berg u8 ampdu_density; 334d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 335d3236553SJohannes Berg }; 336d3236553SJohannes Berg 337d3236553SJohannes Berg /** 338bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 339bf0c111eSMahesh Palivela * 340bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 341bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 342bf0c111eSMahesh Palivela * 343bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 344bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 345bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 346bf0c111eSMahesh Palivela */ 347bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 348bf0c111eSMahesh Palivela bool vht_supported; 349bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 350bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 351bf0c111eSMahesh Palivela }; 352bf0c111eSMahesh Palivela 353c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN 25 354c4cbaf79SLuca Coelho 355c4cbaf79SLuca Coelho /** 356c4cbaf79SLuca Coelho * struct ieee80211_sta_he_cap - STA's HE capabilities 357c4cbaf79SLuca Coelho * 358c4cbaf79SLuca Coelho * This structure describes most essential parameters needed 359c4cbaf79SLuca Coelho * to describe 802.11ax HE capabilities for a STA. 360c4cbaf79SLuca Coelho * 361c4cbaf79SLuca Coelho * @has_he: true iff HE data is valid. 362c4cbaf79SLuca Coelho * @he_cap_elem: Fixed portion of the HE capabilities element. 363c4cbaf79SLuca Coelho * @he_mcs_nss_supp: The supported NSS/MCS combinations. 364c4cbaf79SLuca Coelho * @ppe_thres: Holds the PPE Thresholds data. 365c4cbaf79SLuca Coelho */ 366c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap { 367c4cbaf79SLuca Coelho bool has_he; 368c4cbaf79SLuca Coelho struct ieee80211_he_cap_elem he_cap_elem; 369c4cbaf79SLuca Coelho struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 370c4cbaf79SLuca Coelho u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; 371c4cbaf79SLuca Coelho }; 372c4cbaf79SLuca Coelho 373c4cbaf79SLuca Coelho /** 374c4cbaf79SLuca Coelho * struct ieee80211_sband_iftype_data 375c4cbaf79SLuca Coelho * 376c4cbaf79SLuca Coelho * This structure encapsulates sband data that is relevant for the 377c4cbaf79SLuca Coelho * interface types defined in @types_mask. Each type in the 378c4cbaf79SLuca Coelho * @types_mask must be unique across all instances of iftype_data. 379c4cbaf79SLuca Coelho * 380c4cbaf79SLuca Coelho * @types_mask: interface types mask 381c4cbaf79SLuca Coelho * @he_cap: holds the HE capabilities 38222395217SJohannes Berg * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a 38322395217SJohannes Berg * 6 GHz band channel (and 0 may be valid value). 384c4cbaf79SLuca Coelho */ 385c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data { 386c4cbaf79SLuca Coelho u16 types_mask; 387c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap he_cap; 38822395217SJohannes Berg struct ieee80211_he_6ghz_capa he_6ghz_capa; 389c4cbaf79SLuca Coelho }; 390c4cbaf79SLuca Coelho 391bf0c111eSMahesh Palivela /** 3922a38075cSAlexei Avshalom Lazar * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations 3932a38075cSAlexei Avshalom Lazar * 3942a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz 3952a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz 3962a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz 3972a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz 3982a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz 3992a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz 4002a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz 4012a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and 4022a38075cSAlexei Avshalom Lazar * 2.16GHz+2.16GHz 4032a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and 4042a38075cSAlexei Avshalom Lazar * 4.32GHz + 4.32GHz 4052a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and 4062a38075cSAlexei Avshalom Lazar * 4.32GHz + 4.32GHz 4072a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz 4082a38075cSAlexei Avshalom Lazar * and 4.32GHz + 4.32GHz 4092a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz, 4102a38075cSAlexei Avshalom Lazar * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz 4112a38075cSAlexei Avshalom Lazar */ 4122a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config { 4132a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_4 = 4, 4142a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_5 = 5, 4152a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_6 = 6, 4162a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_7 = 7, 4172a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_8 = 8, 4182a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_9 = 9, 4192a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_10 = 10, 4202a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_11 = 11, 4212a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_12 = 12, 4222a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_13 = 13, 4232a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_14 = 14, 4242a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_15 = 15, 4252a38075cSAlexei Avshalom Lazar }; 4262a38075cSAlexei Avshalom Lazar 4272a38075cSAlexei Avshalom Lazar /** 4282a38075cSAlexei Avshalom Lazar * struct ieee80211_edmg - EDMG configuration 4292a38075cSAlexei Avshalom Lazar * 4302a38075cSAlexei Avshalom Lazar * This structure describes most essential parameters needed 4312a38075cSAlexei Avshalom Lazar * to describe 802.11ay EDMG configuration 4322a38075cSAlexei Avshalom Lazar * 4332a38075cSAlexei Avshalom Lazar * @channels: bitmap that indicates the 2.16 GHz channel(s) 4342a38075cSAlexei Avshalom Lazar * that are allowed to be used for transmissions. 4352a38075cSAlexei Avshalom Lazar * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc. 4362a38075cSAlexei Avshalom Lazar * Set to 0 indicate EDMG not supported. 4372a38075cSAlexei Avshalom Lazar * @bw_config: Channel BW Configuration subfield encodes 4382a38075cSAlexei Avshalom Lazar * the allowed channel bandwidth configurations 4392a38075cSAlexei Avshalom Lazar */ 4402a38075cSAlexei Avshalom Lazar struct ieee80211_edmg { 4412a38075cSAlexei Avshalom Lazar u8 channels; 4422a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config bw_config; 4432a38075cSAlexei Avshalom Lazar }; 4442a38075cSAlexei Avshalom Lazar 4452a38075cSAlexei Avshalom Lazar /** 446df78a0c0SThomas Pedersen * struct ieee80211_sta_s1g_cap - STA's S1G capabilities 447df78a0c0SThomas Pedersen * 448df78a0c0SThomas Pedersen * This structure describes most essential parameters needed 449df78a0c0SThomas Pedersen * to describe 802.11ah S1G capabilities for a STA. 450df78a0c0SThomas Pedersen * 451df78a0c0SThomas Pedersen * @s1g_supported: is STA an S1G STA 452df78a0c0SThomas Pedersen * @cap: S1G capabilities information 453df78a0c0SThomas Pedersen * @nss_mcs: Supported NSS MCS set 454df78a0c0SThomas Pedersen */ 455df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap { 456df78a0c0SThomas Pedersen bool s1g; 457df78a0c0SThomas Pedersen u8 cap[10]; /* use S1G_CAPAB_ */ 458df78a0c0SThomas Pedersen u8 nss_mcs[5]; 459df78a0c0SThomas Pedersen }; 460df78a0c0SThomas Pedersen 461df78a0c0SThomas Pedersen /** 462d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 463d3236553SJohannes Berg * 464d3236553SJohannes Berg * This structure describes a frequency band a wiphy 465d3236553SJohannes Berg * is able to operate in. 466d3236553SJohannes Berg * 467085a6c10SRandy Dunlap * @channels: Array of channels the hardware can operate with 468d3236553SJohannes Berg * in this band. 469d3236553SJohannes Berg * @band: the band this structure represents 470d3236553SJohannes Berg * @n_channels: Number of channels in @channels 471d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 472d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 473d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 474d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 475abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 476c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 4778a50c057SMauro Carvalho Chehab * @s1g_cap: S1G capabilities in this band 4782a38075cSAlexei Avshalom Lazar * @edmg_cap: EDMG capabilities in this band 4799ff167e1SJohannes Berg * @s1g_cap: S1G capabilities in this band (S1B band only, of course) 480c4cbaf79SLuca Coelho * @n_iftype_data: number of iftype data entries 481c4cbaf79SLuca Coelho * @iftype_data: interface type data entries. Note that the bits in 482c4cbaf79SLuca Coelho * @types_mask inside this structure cannot overlap (i.e. only 483c4cbaf79SLuca Coelho * one occurrence of each type is allowed across all instances of 484c4cbaf79SLuca Coelho * iftype_data). 485d3236553SJohannes Berg */ 486d3236553SJohannes Berg struct ieee80211_supported_band { 487d3236553SJohannes Berg struct ieee80211_channel *channels; 488d3236553SJohannes Berg struct ieee80211_rate *bitrates; 48957fbcce3SJohannes Berg enum nl80211_band band; 490d3236553SJohannes Berg int n_channels; 491d3236553SJohannes Berg int n_bitrates; 492d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 493bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 494df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap s1g_cap; 4952a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg_cap; 496c4cbaf79SLuca Coelho u16 n_iftype_data; 497c4cbaf79SLuca Coelho const struct ieee80211_sband_iftype_data *iftype_data; 498d3236553SJohannes Berg }; 499d3236553SJohannes Berg 500e691ac2fSRafał Miłecki /** 501c4cbaf79SLuca Coelho * ieee80211_get_sband_iftype_data - return sband data for a given iftype 502c4cbaf79SLuca Coelho * @sband: the sband to search for the STA on 503c4cbaf79SLuca Coelho * @iftype: enum nl80211_iftype 504c4cbaf79SLuca Coelho * 505c4cbaf79SLuca Coelho * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found 506c4cbaf79SLuca Coelho */ 507c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data * 508c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, 509c4cbaf79SLuca Coelho u8 iftype) 510c4cbaf79SLuca Coelho { 511c4cbaf79SLuca Coelho int i; 512c4cbaf79SLuca Coelho 513c4cbaf79SLuca Coelho if (WARN_ON(iftype >= NL80211_IFTYPE_MAX)) 514c4cbaf79SLuca Coelho return NULL; 515c4cbaf79SLuca Coelho 516c4cbaf79SLuca Coelho for (i = 0; i < sband->n_iftype_data; i++) { 517c4cbaf79SLuca Coelho const struct ieee80211_sband_iftype_data *data = 518c4cbaf79SLuca Coelho &sband->iftype_data[i]; 519c4cbaf79SLuca Coelho 520c4cbaf79SLuca Coelho if (data->types_mask & BIT(iftype)) 521c4cbaf79SLuca Coelho return data; 522c4cbaf79SLuca Coelho } 523c4cbaf79SLuca Coelho 524c4cbaf79SLuca Coelho return NULL; 525c4cbaf79SLuca Coelho } 526c4cbaf79SLuca Coelho 527c4cbaf79SLuca Coelho /** 528d7edf40cSJohn Crispin * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype 529d7edf40cSJohn Crispin * @sband: the sband to search for the iftype on 530d7edf40cSJohn Crispin * @iftype: enum nl80211_iftype 531d7edf40cSJohn Crispin * 532d7edf40cSJohn Crispin * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 533d7edf40cSJohn Crispin */ 534d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap * 535d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband, 536d7edf40cSJohn Crispin u8 iftype) 537d7edf40cSJohn Crispin { 538d7edf40cSJohn Crispin const struct ieee80211_sband_iftype_data *data = 539d7edf40cSJohn Crispin ieee80211_get_sband_iftype_data(sband, iftype); 540d7edf40cSJohn Crispin 541d7edf40cSJohn Crispin if (data && data->he_cap.has_he) 542d7edf40cSJohn Crispin return &data->he_cap; 543d7edf40cSJohn Crispin 544d7edf40cSJohn Crispin return NULL; 545d7edf40cSJohn Crispin } 546d7edf40cSJohn Crispin 547d7edf40cSJohn Crispin /** 548c4cbaf79SLuca Coelho * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA 549c4cbaf79SLuca Coelho * @sband: the sband to search for the STA on 550c4cbaf79SLuca Coelho * 551c4cbaf79SLuca Coelho * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 552c4cbaf79SLuca Coelho */ 553c4cbaf79SLuca Coelho static inline const struct ieee80211_sta_he_cap * 554c4cbaf79SLuca Coelho ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband) 555c4cbaf79SLuca Coelho { 556d7edf40cSJohn Crispin return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION); 557c4cbaf79SLuca Coelho } 558c4cbaf79SLuca Coelho 559c4cbaf79SLuca Coelho /** 5602ad2274cSIlan Peer * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities 5612ad2274cSIlan Peer * @sband: the sband to search for the STA on 5622ad2274cSIlan Peer * @iftype: the iftype to search for 5632ad2274cSIlan Peer * 5642ad2274cSIlan Peer * Return: the 6GHz capabilities 5652ad2274cSIlan Peer */ 5662ad2274cSIlan Peer static inline __le16 5672ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband, 5682ad2274cSIlan Peer enum nl80211_iftype iftype) 5692ad2274cSIlan Peer { 5702ad2274cSIlan Peer const struct ieee80211_sband_iftype_data *data = 5712ad2274cSIlan Peer ieee80211_get_sband_iftype_data(sband, iftype); 5722ad2274cSIlan Peer 5732ad2274cSIlan Peer if (WARN_ON(!data || !data->he_cap.has_he)) 5742ad2274cSIlan Peer return 0; 5752ad2274cSIlan Peer 5762ad2274cSIlan Peer return data->he_6ghz_capa.capa; 5772ad2274cSIlan Peer } 5782ad2274cSIlan Peer 5792ad2274cSIlan Peer /** 580e691ac2fSRafał Miłecki * wiphy_read_of_freq_limits - read frequency limits from device tree 581e691ac2fSRafał Miłecki * 582e691ac2fSRafał Miłecki * @wiphy: the wireless device to get extra limits for 583e691ac2fSRafał Miłecki * 584e691ac2fSRafał Miłecki * Some devices may have extra limitations specified in DT. This may be useful 585e691ac2fSRafał Miłecki * for chipsets that normally support more bands but are limited due to board 586e691ac2fSRafał Miłecki * design (e.g. by antennas or external power amplifier). 587e691ac2fSRafał Miłecki * 588e691ac2fSRafał Miłecki * This function reads info from DT and uses it to *modify* channels (disable 589e691ac2fSRafał Miłecki * unavailable ones). It's usually a *bad* idea to use it in drivers with 590e691ac2fSRafał Miłecki * shared channel data as DT limitations are device specific. You should make 591e691ac2fSRafał Miłecki * sure to call it only if channels in wiphy are copied and can be modified 592e691ac2fSRafał Miłecki * without affecting other devices. 593e691ac2fSRafał Miłecki * 594e691ac2fSRafał Miłecki * As this function access device node it has to be called after set_wiphy_dev. 595e691ac2fSRafał Miłecki * It also modifies channels so they have to be set first. 596e691ac2fSRafał Miłecki * If using this helper, call it before wiphy_register(). 597e691ac2fSRafał Miłecki */ 598e691ac2fSRafał Miłecki #ifdef CONFIG_OF 599e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy); 600e691ac2fSRafał Miłecki #else /* CONFIG_OF */ 601e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) 602e691ac2fSRafał Miłecki { 603e691ac2fSRafał Miłecki } 604e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */ 605e691ac2fSRafał Miłecki 606e691ac2fSRafał Miłecki 607d3236553SJohannes Berg /* 608d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 609704232c2SJohannes Berg */ 610704232c2SJohannes Berg 6112ec600d6SLuis Carlos Cobo /** 612d70e9693SJohannes Berg * DOC: Actions and configuration 613d70e9693SJohannes Berg * 614d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 615d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 616d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 617d70e9693SJohannes Berg * operations use are described separately. 618d70e9693SJohannes Berg * 619d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 620d70e9693SJohannes Berg * information via some functions that drivers need to call. 621d70e9693SJohannes Berg * 622d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 623d70e9693SJohannes Berg * in a separate chapter. 624d70e9693SJohannes Berg */ 625d70e9693SJohannes Berg 626c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 627c6e6a0c8SAviya Erenfeld WLAN_USER_POSITION_LEN) 628c6e6a0c8SAviya Erenfeld 629d70e9693SJohannes Berg /** 6302ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 631818a986eSJohannes Berg * @flags: monitor interface flags, unchanged if 0, otherwise 632818a986eSJohannes Berg * %MONITOR_FLAG_CHANGED will be set 6338b787643SFelix Fietkau * @use_4addr: use 4-address frames 634e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 635e8f479b1SBen Greear * If this parameter is set to zero address the driver may 636e8f479b1SBen Greear * determine the address as needed. 637e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 638e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 639e8f479b1SBen Greear ** only p2p devices with specified MAC. 640b0265024SJohannes Berg * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets 641b0265024SJohannes Berg * belonging to that MU-MIMO groupID; %NULL if not changed 642b0265024SJohannes Berg * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring 643b0265024SJohannes Berg * MU-MIMO packets going to the specified station; %NULL if not changed 6442ec600d6SLuis Carlos Cobo */ 6452ec600d6SLuis Carlos Cobo struct vif_params { 646818a986eSJohannes Berg u32 flags; 6478b787643SFelix Fietkau int use_4addr; 6481c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 649b0265024SJohannes Berg const u8 *vht_mumimo_groups; 650b0265024SJohannes Berg const u8 *vht_mumimo_follow_addr; 6512ec600d6SLuis Carlos Cobo }; 6522ec600d6SLuis Carlos Cobo 65341ade00fSJohannes Berg /** 65441ade00fSJohannes Berg * struct key_params - key information 65541ade00fSJohannes Berg * 65641ade00fSJohannes Berg * Information about a key 65741ade00fSJohannes Berg * 65841ade00fSJohannes Berg * @key: key material 65941ade00fSJohannes Berg * @key_len: length of key material 66041ade00fSJohannes Berg * @cipher: cipher suite selector 66141ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 66241ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 66341ade00fSJohannes Berg * length given by @seq_len. 664abe37c4bSJohannes Berg * @seq_len: length of @seq. 66514f34e36SGurumoorthi Gnanasambandhan * @vlan_id: vlan_id for VLAN group key (if nonzero) 6666cdd3979SAlexander Wetzel * @mode: key install mode (RX_TX, NO_TX or SET_TX) 66741ade00fSJohannes Berg */ 66841ade00fSJohannes Berg struct key_params { 669c1e5f471SJohannes Berg const u8 *key; 670c1e5f471SJohannes Berg const u8 *seq; 67141ade00fSJohannes Berg int key_len; 67241ade00fSJohannes Berg int seq_len; 67314f34e36SGurumoorthi Gnanasambandhan u16 vlan_id; 67441ade00fSJohannes Berg u32 cipher; 6756cdd3979SAlexander Wetzel enum nl80211_key_mode mode; 67641ade00fSJohannes Berg }; 67741ade00fSJohannes Berg 678ed1b6cc7SJohannes Berg /** 679683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 680683b6d3bSJohannes Berg * @chan: the (control) channel 6813d9d1d66SJohannes Berg * @width: channel width 6823d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 6833d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 6843d9d1d66SJohannes Berg * (only with 80+80 MHz) 6852a38075cSAlexei Avshalom Lazar * @edmg: define the EDMG channels configuration. 6862a38075cSAlexei Avshalom Lazar * If edmg is requested (i.e. the .channels member is non-zero), 6872a38075cSAlexei Avshalom Lazar * chan will define the primary channel and all other 6882a38075cSAlexei Avshalom Lazar * parameters are ignored. 689934f4c7dSThomas Pedersen * @freq1_offset: offset from @center_freq1, in KHz 690683b6d3bSJohannes Berg */ 691683b6d3bSJohannes Berg struct cfg80211_chan_def { 692683b6d3bSJohannes Berg struct ieee80211_channel *chan; 6933d9d1d66SJohannes Berg enum nl80211_chan_width width; 6943d9d1d66SJohannes Berg u32 center_freq1; 6953d9d1d66SJohannes Berg u32 center_freq2; 6962a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg; 697934f4c7dSThomas Pedersen u16 freq1_offset; 698683b6d3bSJohannes Berg }; 699683b6d3bSJohannes Berg 7009a5f6488STamizh Chelvam /* 7019a5f6488STamizh Chelvam * cfg80211_bitrate_mask - masks for bitrate control 7029a5f6488STamizh Chelvam */ 7039a5f6488STamizh Chelvam struct cfg80211_bitrate_mask { 7049a5f6488STamizh Chelvam struct { 7059a5f6488STamizh Chelvam u32 legacy; 7069a5f6488STamizh Chelvam u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 7079a5f6488STamizh Chelvam u16 vht_mcs[NL80211_VHT_NSS_MAX]; 708eb89a6a6SMiles Hu u16 he_mcs[NL80211_HE_NSS_MAX]; 7099a5f6488STamizh Chelvam enum nl80211_txrate_gi gi; 710eb89a6a6SMiles Hu enum nl80211_he_gi he_gi; 711eb89a6a6SMiles Hu enum nl80211_he_ltf he_ltf; 7129a5f6488STamizh Chelvam } control[NUM_NL80211_BANDS]; 7139a5f6488STamizh Chelvam }; 7149a5f6488STamizh Chelvam 7159a5f6488STamizh Chelvam 71677f576deSTamizh chelvam /** 7173710a8a6SJohannes Berg * struct cfg80211_tid_cfg - TID specific configuration 71877f576deSTamizh chelvam * @config_override: Flag to notify driver to reset TID configuration 71977f576deSTamizh chelvam * of the peer. 7203710a8a6SJohannes Berg * @tids: bitmap of TIDs to modify 7213710a8a6SJohannes Berg * @mask: bitmap of attributes indicating which parameter changed, 7223710a8a6SJohannes Berg * similar to &nl80211_tid_config_supp. 72377f576deSTamizh chelvam * @noack: noack configuration value for the TID 7246a21d16cSTamizh chelvam * @retry_long: retry count value 7256a21d16cSTamizh chelvam * @retry_short: retry count value 72633462e68SSergey Matyukevich * @ampdu: Enable/Disable MPDU aggregation 72704f7d142STamizh chelvam * @rtscts: Enable/Disable RTS/CTS 72833462e68SSergey Matyukevich * @amsdu: Enable/Disable MSDU aggregation 7299a5f6488STamizh Chelvam * @txrate_type: Tx bitrate mask type 7309a5f6488STamizh Chelvam * @txrate_mask: Tx bitrate to be applied for the TID 73177f576deSTamizh chelvam */ 7323710a8a6SJohannes Berg struct cfg80211_tid_cfg { 73377f576deSTamizh chelvam bool config_override; 7343710a8a6SJohannes Berg u8 tids; 7352d5d9b7fSSergey Matyukevich u64 mask; 73677f576deSTamizh chelvam enum nl80211_tid_config noack; 7376a21d16cSTamizh chelvam u8 retry_long, retry_short; 738ade274b2STamizh chelvam enum nl80211_tid_config ampdu; 73904f7d142STamizh chelvam enum nl80211_tid_config rtscts; 74033462e68SSergey Matyukevich enum nl80211_tid_config amsdu; 7419a5f6488STamizh Chelvam enum nl80211_tx_rate_setting txrate_type; 7429a5f6488STamizh Chelvam struct cfg80211_bitrate_mask txrate_mask; 74377f576deSTamizh chelvam }; 74477f576deSTamizh chelvam 74577f576deSTamizh chelvam /** 7463710a8a6SJohannes Berg * struct cfg80211_tid_config - TID configuration 74777f576deSTamizh chelvam * @peer: Station's MAC address 74877f576deSTamizh chelvam * @n_tid_conf: Number of TID specific configurations to be applied 74977f576deSTamizh chelvam * @tid_conf: Configuration change info 75077f576deSTamizh chelvam */ 7513710a8a6SJohannes Berg struct cfg80211_tid_config { 75277f576deSTamizh chelvam const u8 *peer; 75377f576deSTamizh chelvam u32 n_tid_conf; 7543710a8a6SJohannes Berg struct cfg80211_tid_cfg tid_conf[]; 75577f576deSTamizh chelvam }; 75677f576deSTamizh chelvam 7573d9d1d66SJohannes Berg /** 7583d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 7593d9d1d66SJohannes Berg * @chandef: the channel definition 7603d9d1d66SJohannes Berg * 7610ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 7623d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 7633d9d1d66SJohannes Berg */ 764683b6d3bSJohannes Berg static inline enum nl80211_channel_type 765683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 766683b6d3bSJohannes Berg { 7673d9d1d66SJohannes Berg switch (chandef->width) { 7683d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 7693d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 7703d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 7713d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 7723d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 7733d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 7743d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 7753d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 7763d9d1d66SJohannes Berg default: 7773d9d1d66SJohannes Berg WARN_ON(1); 7783d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 779683b6d3bSJohannes Berg } 7803d9d1d66SJohannes Berg } 7813d9d1d66SJohannes Berg 7823d9d1d66SJohannes Berg /** 7833d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 7843d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 7853d9d1d66SJohannes Berg * @channel: the control channel 7863d9d1d66SJohannes Berg * @chantype: the channel type 7873d9d1d66SJohannes Berg * 7883d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 7893d9d1d66SJohannes Berg */ 7903d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 7913d9d1d66SJohannes Berg struct ieee80211_channel *channel, 7923d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 7933d9d1d66SJohannes Berg 7943d9d1d66SJohannes Berg /** 7953d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 7963d9d1d66SJohannes Berg * @chandef1: first channel definition 7973d9d1d66SJohannes Berg * @chandef2: second channel definition 7983d9d1d66SJohannes Berg * 7990ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 8003d9d1d66SJohannes Berg * identical, %false otherwise. 8013d9d1d66SJohannes Berg */ 8023d9d1d66SJohannes Berg static inline bool 8033d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 8043d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 8053d9d1d66SJohannes Berg { 8063d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 8073d9d1d66SJohannes Berg chandef1->width == chandef2->width && 8083d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 809934f4c7dSThomas Pedersen chandef1->freq1_offset == chandef2->freq1_offset && 8103d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 8113d9d1d66SJohannes Berg } 8123d9d1d66SJohannes Berg 8133d9d1d66SJohannes Berg /** 8142a38075cSAlexei Avshalom Lazar * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel 8152a38075cSAlexei Avshalom Lazar * 8162a38075cSAlexei Avshalom Lazar * @chandef: the channel definition 8172a38075cSAlexei Avshalom Lazar * 8182a38075cSAlexei Avshalom Lazar * Return: %true if EDMG defined, %false otherwise. 8192a38075cSAlexei Avshalom Lazar */ 8202a38075cSAlexei Avshalom Lazar static inline bool 8212a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef) 8222a38075cSAlexei Avshalom Lazar { 8232a38075cSAlexei Avshalom Lazar return chandef->edmg.channels || chandef->edmg.bw_config; 8242a38075cSAlexei Avshalom Lazar } 8252a38075cSAlexei Avshalom Lazar 8262a38075cSAlexei Avshalom Lazar /** 8273d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 8283d9d1d66SJohannes Berg * @chandef1: first channel definition 8293d9d1d66SJohannes Berg * @chandef2: second channel definition 8303d9d1d66SJohannes Berg * 8310ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 8323d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 8333d9d1d66SJohannes Berg */ 8343d9d1d66SJohannes Berg const struct cfg80211_chan_def * 8353d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 8363d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 837683b6d3bSJohannes Berg 838683b6d3bSJohannes Berg /** 8399f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 8409f5e8f6eSJohannes Berg * @chandef: the channel definition to check 8410ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 8429f5e8f6eSJohannes Berg */ 8439f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 8449f5e8f6eSJohannes Berg 8459f5e8f6eSJohannes Berg /** 8469f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 8479f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 8489f5e8f6eSJohannes Berg * @chandef: the channel definition to check 8490ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 8500ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 8519f5e8f6eSJohannes Berg */ 8529f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 8539f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 8549f5e8f6eSJohannes Berg u32 prohibited_flags); 8559f5e8f6eSJohannes Berg 8569f5e8f6eSJohannes Berg /** 857774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 858774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 859774f0734SSimon Wunderlich * @chandef: the channel definition to check 8602beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 8612beb6dabSLuciano Coelho * Returns: 8622beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 863774f0734SSimon Wunderlich */ 864774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 8652beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 866c3d62036SLuciano Coelho enum nl80211_iftype iftype); 867774f0734SSimon Wunderlich 868774f0734SSimon Wunderlich /** 86930e74732SSimon Wunderlich * ieee80211_chandef_rate_flags - returns rate flags for a channel 87030e74732SSimon Wunderlich * 87130e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 87230e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 87330e74732SSimon Wunderlich * 87430e74732SSimon Wunderlich * @chandef: channel definition for the channel 87530e74732SSimon Wunderlich * 87630e74732SSimon Wunderlich * Returns: rate flags which apply for this channel 87730e74732SSimon Wunderlich */ 87830e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 87930e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 88030e74732SSimon Wunderlich { 88130e74732SSimon Wunderlich switch (chandef->width) { 88230e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 88330e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 88430e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 88530e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 88630e74732SSimon Wunderlich default: 88730e74732SSimon Wunderlich break; 88830e74732SSimon Wunderlich } 88930e74732SSimon Wunderlich return 0; 89030e74732SSimon Wunderlich } 89130e74732SSimon Wunderlich 89230e74732SSimon Wunderlich /** 8930430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 8940430c883SSimon Wunderlich * 8950430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 8960430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 8970430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 8980430c883SSimon Wunderlich * 8990430c883SSimon Wunderlich * @chandef: channel definition for the channel 9000430c883SSimon Wunderlich * 9010430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 9020430c883SSimon Wunderlich */ 9030430c883SSimon Wunderlich static inline int 9040430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 9050430c883SSimon Wunderlich { 9060430c883SSimon Wunderlich switch (chandef->width) { 9070430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 9080430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 9090430c883SSimon Wunderlich chandef->chan->max_power); 9100430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 9110430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 9120430c883SSimon Wunderlich chandef->chan->max_power); 9130430c883SSimon Wunderlich default: 9140430c883SSimon Wunderlich break; 9150430c883SSimon Wunderlich } 9160430c883SSimon Wunderlich return chandef->chan->max_power; 9170430c883SSimon Wunderlich } 9180430c883SSimon Wunderlich 9190430c883SSimon Wunderlich /** 92061fa713cSHolger Schurig * enum survey_info_flags - survey information flags 92161fa713cSHolger Schurig * 922abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 92317e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 9244ed20bebSJohannes Berg * @SURVEY_INFO_TIME: active time (in ms) was filled in 9254ed20bebSJohannes Berg * @SURVEY_INFO_TIME_BUSY: busy time was filled in 9264ed20bebSJohannes Berg * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 9274ed20bebSJohannes Berg * @SURVEY_INFO_TIME_RX: receive time was filled in 9284ed20bebSJohannes Berg * @SURVEY_INFO_TIME_TX: transmit time was filled in 929052536abSJohannes Berg * @SURVEY_INFO_TIME_SCAN: scan time was filled in 930c8cd6e7fSFelix Fietkau * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in 931abe37c4bSJohannes Berg * 93261fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 93361fa713cSHolger Schurig * it has filled in during the get_survey(). 93461fa713cSHolger Schurig */ 93561fa713cSHolger Schurig enum survey_info_flags { 9364ed20bebSJohannes Berg SURVEY_INFO_NOISE_DBM = BIT(0), 9374ed20bebSJohannes Berg SURVEY_INFO_IN_USE = BIT(1), 9384ed20bebSJohannes Berg SURVEY_INFO_TIME = BIT(2), 9394ed20bebSJohannes Berg SURVEY_INFO_TIME_BUSY = BIT(3), 9404ed20bebSJohannes Berg SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 9414ed20bebSJohannes Berg SURVEY_INFO_TIME_RX = BIT(5), 9424ed20bebSJohannes Berg SURVEY_INFO_TIME_TX = BIT(6), 943052536abSJohannes Berg SURVEY_INFO_TIME_SCAN = BIT(7), 944c8cd6e7fSFelix Fietkau SURVEY_INFO_TIME_BSS_RX = BIT(8), 94561fa713cSHolger Schurig }; 94661fa713cSHolger Schurig 94761fa713cSHolger Schurig /** 94861fa713cSHolger Schurig * struct survey_info - channel survey response 94961fa713cSHolger Schurig * 95011f78ac3SJohannes Berg * @channel: the channel this survey record reports, may be %NULL for a single 95111f78ac3SJohannes Berg * record to report global statistics 95261fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 95361fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 95461fa713cSHolger Schurig * optional 9554ed20bebSJohannes Berg * @time: amount of time in ms the radio was turn on (on the channel) 9564ed20bebSJohannes Berg * @time_busy: amount of time the primary channel was sensed busy 9574ed20bebSJohannes Berg * @time_ext_busy: amount of time the extension channel was sensed busy 9584ed20bebSJohannes Berg * @time_rx: amount of time the radio spent receiving data 9594ed20bebSJohannes Berg * @time_tx: amount of time the radio spent transmitting data 960052536abSJohannes Berg * @time_scan: amount of time the radio spent for scanning 961c8cd6e7fSFelix Fietkau * @time_bss_rx: amount of time the radio spent receiving data on a local BSS 96261fa713cSHolger Schurig * 963abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 964abe37c4bSJohannes Berg * 96561fa713cSHolger Schurig * This structure can later be expanded with things like 96661fa713cSHolger Schurig * channel duty cycle etc. 96761fa713cSHolger Schurig */ 96861fa713cSHolger Schurig struct survey_info { 96961fa713cSHolger Schurig struct ieee80211_channel *channel; 9704ed20bebSJohannes Berg u64 time; 9714ed20bebSJohannes Berg u64 time_busy; 9724ed20bebSJohannes Berg u64 time_ext_busy; 9734ed20bebSJohannes Berg u64 time_rx; 9744ed20bebSJohannes Berg u64 time_tx; 975052536abSJohannes Berg u64 time_scan; 976c8cd6e7fSFelix Fietkau u64 time_bss_rx; 97761fa713cSHolger Schurig u32 filled; 97861fa713cSHolger Schurig s8 noise; 97961fa713cSHolger Schurig }; 98061fa713cSHolger Schurig 981b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS 4 982b8676221SDavid Spinadel 98361fa713cSHolger Schurig /** 9845fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 9855fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 9865fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 9875fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 9885fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 9895fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 9905fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 9915fb628e9SJouni Malinen * @akm_suites: AKM suites 9925fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 9935fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 9945fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 9955fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 9965fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 9975fb628e9SJouni Malinen * allowed through even on unauthorized ports 9985fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 9995fb628e9SJouni Malinen * protocol frames. 100064bf3d4bSDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 100164bf3d4bSDenis Kenzior * port frames over NL80211 instead of the network interface. 1002a710d214SLothar Rubusch * @control_port_no_preauth: disables pre-auth rx over the nl80211 control 1003a710d214SLothar Rubusch * port for mac80211 1004b8676221SDavid Spinadel * @wep_keys: static WEP keys, if not NULL points to an array of 1005b8676221SDavid Spinadel * CFG80211_MAX_WEP_KEYS WEP keys 1006b8676221SDavid Spinadel * @wep_tx_key: key index (0..3) of the default TX static WEP key 100791b5ab62SEliad Peller * @psk: PSK (for devices supporting 4-way-handshake offload) 100826f7044eSChung-Hsien Hsu * @sae_pwd: password for SAE authentication (for devices supporting SAE 100926f7044eSChung-Hsien Hsu * offload) 101026f7044eSChung-Hsien Hsu * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) 10115fb628e9SJouni Malinen */ 10125fb628e9SJouni Malinen struct cfg80211_crypto_settings { 10135fb628e9SJouni Malinen u32 wpa_versions; 10145fb628e9SJouni Malinen u32 cipher_group; 10155fb628e9SJouni Malinen int n_ciphers_pairwise; 10165fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 10175fb628e9SJouni Malinen int n_akm_suites; 10185fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 10195fb628e9SJouni Malinen bool control_port; 10205fb628e9SJouni Malinen __be16 control_port_ethertype; 10215fb628e9SJouni Malinen bool control_port_no_encrypt; 102264bf3d4bSDenis Kenzior bool control_port_over_nl80211; 10237f3f96ceSMarkus Theil bool control_port_no_preauth; 1024b8676221SDavid Spinadel struct key_params *wep_keys; 1025b8676221SDavid Spinadel int wep_tx_key; 102691b5ab62SEliad Peller const u8 *psk; 102726f7044eSChung-Hsien Hsu const u8 *sae_pwd; 102826f7044eSChung-Hsien Hsu u8 sae_pwd_len; 10295fb628e9SJouni Malinen }; 10305fb628e9SJouni Malinen 10315fb628e9SJouni Malinen /** 10328860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 1033ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 1034ed1b6cc7SJohannes Berg * or %NULL if not changed 1035ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 1036ed1b6cc7SJohannes Berg * or %NULL if not changed 1037ed1b6cc7SJohannes Berg * @head_len: length of @head 1038ed1b6cc7SJohannes Berg * @tail_len: length of @tail 10399946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 10409946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 10419946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 10429946ecfbSJouni Malinen * frames or %NULL 10439946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 10449946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 10459946ecfbSJouni Malinen * Response frames or %NULL 10469946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 104700f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 104800f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 104981e54d08SPradeep Kumar Chitrapu * @ftm_responder: enable FTM responder functionality; -1 for no change 105081e54d08SPradeep Kumar Chitrapu * (which also implies no change in LCI/civic location data) 105130db641eSJohannes Berg * @lci: Measurement Report element content, starting with Measurement Token 105230db641eSJohannes Berg * (measurement type 8) 105330db641eSJohannes Berg * @civicloc: Measurement Report element content, starting with Measurement 105430db641eSJohannes Berg * Token (measurement type 11) 105581e54d08SPradeep Kumar Chitrapu * @lci_len: LCI data length 105681e54d08SPradeep Kumar Chitrapu * @civicloc_len: Civic location data length 1057ed1b6cc7SJohannes Berg */ 10588860020eSJohannes Berg struct cfg80211_beacon_data { 10598860020eSJohannes Berg const u8 *head, *tail; 10608860020eSJohannes Berg const u8 *beacon_ies; 10618860020eSJohannes Berg const u8 *proberesp_ies; 10628860020eSJohannes Berg const u8 *assocresp_ies; 10638860020eSJohannes Berg const u8 *probe_resp; 106481e54d08SPradeep Kumar Chitrapu const u8 *lci; 106581e54d08SPradeep Kumar Chitrapu const u8 *civicloc; 106681e54d08SPradeep Kumar Chitrapu s8 ftm_responder; 10678860020eSJohannes Berg 10688860020eSJohannes Berg size_t head_len, tail_len; 10698860020eSJohannes Berg size_t beacon_ies_len; 10708860020eSJohannes Berg size_t proberesp_ies_len; 10718860020eSJohannes Berg size_t assocresp_ies_len; 10728860020eSJohannes Berg size_t probe_resp_len; 107381e54d08SPradeep Kumar Chitrapu size_t lci_len; 107481e54d08SPradeep Kumar Chitrapu size_t civicloc_len; 10758860020eSJohannes Berg }; 10768860020eSJohannes Berg 10776d45a74bSVasanthakumar Thiagarajan struct mac_address { 10786d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 10796d45a74bSVasanthakumar Thiagarajan }; 10806d45a74bSVasanthakumar Thiagarajan 10818860020eSJohannes Berg /** 108277765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 108377765eafSVasanthakumar Thiagarajan * 108477765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 1085077f897aSJohannes Berg * entry specified by mac_addr 108677765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 108777765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 108877765eafSVasanthakumar Thiagarajan */ 108977765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 109077765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 109177765eafSVasanthakumar Thiagarajan int n_acl_entries; 109277765eafSVasanthakumar Thiagarajan 109377765eafSVasanthakumar Thiagarajan /* Keep it last */ 109477765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 109577765eafSVasanthakumar Thiagarajan }; 109677765eafSVasanthakumar Thiagarajan 10978860020eSJohannes Berg /** 1098291c49deSAloka Dixit * struct cfg80211_fils_discovery - FILS discovery parameters from 1099291c49deSAloka Dixit * IEEE Std 802.11ai-2016, Annex C.3 MIB detail. 1100291c49deSAloka Dixit * 1101291c49deSAloka Dixit * @min_interval: Minimum packet interval in TUs (0 - 10000) 1102291c49deSAloka Dixit * @max_interval: Maximum packet interval in TUs (0 - 10000) 1103291c49deSAloka Dixit * @tmpl_len: Template length 1104291c49deSAloka Dixit * @tmpl: Template data for FILS discovery frame including the action 1105291c49deSAloka Dixit * frame headers. 1106291c49deSAloka Dixit */ 1107291c49deSAloka Dixit struct cfg80211_fils_discovery { 1108291c49deSAloka Dixit u32 min_interval; 1109291c49deSAloka Dixit u32 max_interval; 1110291c49deSAloka Dixit size_t tmpl_len; 1111291c49deSAloka Dixit const u8 *tmpl; 1112291c49deSAloka Dixit }; 1113291c49deSAloka Dixit 1114291c49deSAloka Dixit /** 11157443dcd1SAloka Dixit * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe 11167443dcd1SAloka Dixit * response parameters in 6GHz. 11177443dcd1SAloka Dixit * 11187443dcd1SAloka Dixit * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned 11197443dcd1SAloka Dixit * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive 11207443dcd1SAloka Dixit * scanning 11217443dcd1SAloka Dixit * @tmpl_len: Template length 11227443dcd1SAloka Dixit * @tmpl: Template data for probe response 11237443dcd1SAloka Dixit */ 11247443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp { 11257443dcd1SAloka Dixit u32 interval; 11267443dcd1SAloka Dixit size_t tmpl_len; 11277443dcd1SAloka Dixit const u8 *tmpl; 11287443dcd1SAloka Dixit }; 11297443dcd1SAloka Dixit 11307443dcd1SAloka Dixit /** 1131fe494370SSrinivas Dasari * enum cfg80211_ap_settings_flags - AP settings flags 1132fe494370SSrinivas Dasari * 1133fe494370SSrinivas Dasari * Used by cfg80211_ap_settings 1134fe494370SSrinivas Dasari * 1135fe494370SSrinivas Dasari * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication 1136fe494370SSrinivas Dasari */ 1137fe494370SSrinivas Dasari enum cfg80211_ap_settings_flags { 1138fe494370SSrinivas Dasari AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0), 1139fe494370SSrinivas Dasari }; 1140fe494370SSrinivas Dasari 1141fe494370SSrinivas Dasari /** 11428860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 11438860020eSJohannes Berg * 11448860020eSJohannes Berg * Used to configure an AP interface. 11458860020eSJohannes Berg * 1146683b6d3bSJohannes Berg * @chandef: defines the channel to use 11478860020eSJohannes Berg * @beacon: beacon data 11488860020eSJohannes Berg * @beacon_interval: beacon interval 11498860020eSJohannes Berg * @dtim_period: DTIM period 11508860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 11518860020eSJohannes Berg * user space) 11528860020eSJohannes Berg * @ssid_len: length of @ssid 11538860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 11548860020eSJohannes Berg * @crypto: crypto settings 11558860020eSJohannes Berg * @privacy: the BSS uses privacy 11568860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 115718998c38SEliad Peller * @smps_mode: SMPS mode 11581b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 115953cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 116053cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 116177765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 116277765eafSVasanthakumar Thiagarajan * MAC address based access control 116334d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 116434d50519SLior David * networks. 11658564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 116666cd794eSJohannes Berg * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 116766cd794eSJohannes Berg * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 1168244eb9aeSShaul Triebitz * @he_cap: HE capabilities (or %NULL if HE isn't enabled) 116966cd794eSJohannes Berg * @ht_required: stations must support HT 117066cd794eSJohannes Berg * @vht_required: stations must support VHT 1171a0de1ca3SJohn Crispin * @twt_responder: Enable Target Wait Time 11722a392596SIlan Peer * @he_required: stations must support HE 1173fe494370SSrinivas Dasari * @flags: flags, as defined in enum cfg80211_ap_settings_flags 1174796e90f4SJohn Crispin * @he_obss_pd: OBSS Packet Detection settings 11755c5e52d1SJohn Crispin * @he_bss_color: BSS Color settings 11767e8d6f12SShaul Triebitz * @he_oper: HE operation IE (or %NULL if HE isn't enabled) 1177291c49deSAloka Dixit * @fils_discovery: FILS discovery transmission parameters 11787443dcd1SAloka Dixit * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 11798860020eSJohannes Berg */ 11808860020eSJohannes Berg struct cfg80211_ap_settings { 1181683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1182aa430da4SJohannes Berg 11838860020eSJohannes Berg struct cfg80211_beacon_data beacon; 11848860020eSJohannes Berg 11858860020eSJohannes Berg int beacon_interval, dtim_period; 118632e9de84SJouni Malinen const u8 *ssid; 118732e9de84SJouni Malinen size_t ssid_len; 118832e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 11895fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 11905fb628e9SJouni Malinen bool privacy; 11915fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 119218998c38SEliad Peller enum nl80211_smps_mode smps_mode; 11931b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 119453cabad7SJohannes Berg u8 p2p_ctwindow; 119553cabad7SJohannes Berg bool p2p_opp_ps; 119677765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 119734d50519SLior David bool pbss; 1198a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask beacon_rate; 119966cd794eSJohannes Berg 120066cd794eSJohannes Berg const struct ieee80211_ht_cap *ht_cap; 120166cd794eSJohannes Berg const struct ieee80211_vht_cap *vht_cap; 1202244eb9aeSShaul Triebitz const struct ieee80211_he_cap_elem *he_cap; 12037e8d6f12SShaul Triebitz const struct ieee80211_he_operation *he_oper; 12042a392596SIlan Peer bool ht_required, vht_required, he_required; 1205a0de1ca3SJohn Crispin bool twt_responder; 1206fe494370SSrinivas Dasari u32 flags; 1207796e90f4SJohn Crispin struct ieee80211_he_obss_pd he_obss_pd; 12085c5e52d1SJohn Crispin struct cfg80211_he_bss_color he_bss_color; 1209291c49deSAloka Dixit struct cfg80211_fils_discovery fils_discovery; 12107443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1211ed1b6cc7SJohannes Berg }; 1212ed1b6cc7SJohannes Berg 12135727ef1bSJohannes Berg /** 121416ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 121516ef1fe2SSimon Wunderlich * 121616ef1fe2SSimon Wunderlich * Used for channel switch 121716ef1fe2SSimon Wunderlich * 121816ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 121916ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 12209a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 12219a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 12229a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 12239a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 122416ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 122516ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 122616ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 122716ef1fe2SSimon Wunderlich * @count: number of beacons until switch 122816ef1fe2SSimon Wunderlich */ 122916ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 123016ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 123116ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 12329a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 12339a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 12349a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 12359a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 123616ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 123716ef1fe2SSimon Wunderlich bool radar_required; 123816ef1fe2SSimon Wunderlich bool block_tx; 123916ef1fe2SSimon Wunderlich u8 count; 124016ef1fe2SSimon Wunderlich }; 124116ef1fe2SSimon Wunderlich 124251a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 124351a1aaa6SJohannes Berg 124416ef1fe2SSimon Wunderlich /** 1245e227300cSPurushottam Kushwaha * struct iface_combination_params - input parameters for interface combinations 1246e227300cSPurushottam Kushwaha * 1247e227300cSPurushottam Kushwaha * Used to pass interface combination parameters 1248e227300cSPurushottam Kushwaha * 1249e227300cSPurushottam Kushwaha * @num_different_channels: the number of different channels we want 1250e227300cSPurushottam Kushwaha * to use for verification 1251e227300cSPurushottam Kushwaha * @radar_detect: a bitmap where each bit corresponds to a channel 1252e227300cSPurushottam Kushwaha * width where radar detection is needed, as in the definition of 1253e227300cSPurushottam Kushwaha * &struct ieee80211_iface_combination.@radar_detect_widths 1254e227300cSPurushottam Kushwaha * @iftype_num: array with the number of interfaces of each interface 1255e227300cSPurushottam Kushwaha * type. The index is the interface type as specified in &enum 1256e227300cSPurushottam Kushwaha * nl80211_iftype. 12574c8dea63SJohannes Berg * @new_beacon_int: set this to the beacon interval of a new interface 12584c8dea63SJohannes Berg * that's not operating yet, if such is to be checked as part of 12594c8dea63SJohannes Berg * the verification 1260e227300cSPurushottam Kushwaha */ 1261e227300cSPurushottam Kushwaha struct iface_combination_params { 1262e227300cSPurushottam Kushwaha int num_different_channels; 1263e227300cSPurushottam Kushwaha u8 radar_detect; 1264e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 12654c8dea63SJohannes Berg u32 new_beacon_int; 1266e227300cSPurushottam Kushwaha }; 1267e227300cSPurushottam Kushwaha 1268e227300cSPurushottam Kushwaha /** 12693b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 12703b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 12719d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 1272f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 12733b9ce80cSJohannes Berg * 12743b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 12753b9ce80cSJohannes Berg * for those that don't these flags will are used. 12763b9ce80cSJohannes Berg */ 12773b9ce80cSJohannes Berg enum station_parameters_apply_mask { 12783b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 12799d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 1280f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 1281e96d1cd2SAshok Raj Nagarajan STATION_PARAM_APPLY_STA_TXPOWER = BIT(3), 1282e96d1cd2SAshok Raj Nagarajan }; 1283e96d1cd2SAshok Raj Nagarajan 1284e96d1cd2SAshok Raj Nagarajan /** 1285e96d1cd2SAshok Raj Nagarajan * struct sta_txpwr - station txpower configuration 1286e96d1cd2SAshok Raj Nagarajan * 1287e96d1cd2SAshok Raj Nagarajan * Used to configure txpower for station. 1288e96d1cd2SAshok Raj Nagarajan * 1289e96d1cd2SAshok Raj Nagarajan * @power: tx power (in dBm) to be used for sending data traffic. If tx power 1290e96d1cd2SAshok Raj Nagarajan * is not provided, the default per-interface tx power setting will be 1291e96d1cd2SAshok Raj Nagarajan * overriding. Driver should be picking up the lowest tx power, either tx 1292e96d1cd2SAshok Raj Nagarajan * power per-interface or per-station. 1293e96d1cd2SAshok Raj Nagarajan * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power 1294e96d1cd2SAshok Raj Nagarajan * will be less than or equal to specified from userspace, whereas if TPC 1295e96d1cd2SAshok Raj Nagarajan * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power. 1296e96d1cd2SAshok Raj Nagarajan * NL80211_TX_POWER_FIXED is not a valid configuration option for 1297e96d1cd2SAshok Raj Nagarajan * per peer TPC. 1298e96d1cd2SAshok Raj Nagarajan */ 1299e96d1cd2SAshok Raj Nagarajan struct sta_txpwr { 1300e96d1cd2SAshok Raj Nagarajan s16 power; 1301e96d1cd2SAshok Raj Nagarajan enum nl80211_tx_power_setting type; 13023b9ce80cSJohannes Berg }; 13033b9ce80cSJohannes Berg 13043b9ce80cSJohannes Berg /** 13055727ef1bSJohannes Berg * struct station_parameters - station parameters 13065727ef1bSJohannes Berg * 13075727ef1bSJohannes Berg * Used to change and create a new station. 13085727ef1bSJohannes Berg * 13095727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 13105727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 13115727ef1bSJohannes Berg * (or NULL for no change) 13125727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 1313eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 1314819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1315eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 1316819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 13175727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 13185727ef1bSJohannes Berg * @aid: AID or zero for no change 131914f34e36SGurumoorthi Gnanasambandhan * @vlan_id: VLAN ID for station (if nonzero) 13207d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 1321abe37c4bSJohannes Berg * @plink_action: plink action to take 13229c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 1323abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 1324f461be3eSMahesh Palivela * @vht_capa: VHT capabilities of station 1325910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 1326910868dbSEliad Peller * as the AC bitmap in the QoS info field 1327910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 1328910868dbSEliad Peller * QoS info field (but already shifted down) 1329c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 1330c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 1331c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 13323b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 13333b1c5a53SMarco Porsch * to unknown) 13349d62a986SJouni Malinen * @capability: station capability 13359d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 13369d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 1337c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 1338c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 1339c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 1340c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 134160f4a7b1SMarek Kwaczynski * @opmode_notif: operating mode field from Operating Mode Notification 134260f4a7b1SMarek Kwaczynski * @opmode_notif_used: information if operating mode field is used 134317b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 1344c4cbaf79SLuca Coelho * @he_capa: HE capabilities of station 1345c4cbaf79SLuca Coelho * @he_capa_len: the length of the HE capabilities 134636647055SToke Høiland-Jørgensen * @airtime_weight: airtime scheduler weight for this station 1347a710d214SLothar Rubusch * @txpwr: transmit power for an associated station 134843e64bf3SRajkumar Manoharan * @he_6ghz_capa: HE 6 GHz Band capabilities of station 13495727ef1bSJohannes Berg */ 13505727ef1bSJohannes Berg struct station_parameters { 13512c1aabf3SJohannes Berg const u8 *supported_rates; 13525727ef1bSJohannes Berg struct net_device *vlan; 1353eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 13543b9ce80cSJohannes Berg u32 sta_modify_mask; 13555727ef1bSJohannes Berg int listen_interval; 13565727ef1bSJohannes Berg u16 aid; 135714f34e36SGurumoorthi Gnanasambandhan u16 vlan_id; 13587d27a0baSMasashi Honma u16 peer_aid; 13595727ef1bSJohannes Berg u8 supported_rates_len; 13602ec600d6SLuis Carlos Cobo u8 plink_action; 13619c3990aaSJavier Cardona u8 plink_state; 13622c1aabf3SJohannes Berg const struct ieee80211_ht_cap *ht_capa; 13632c1aabf3SJohannes Berg const struct ieee80211_vht_cap *vht_capa; 1364c75786c9SEliad Peller u8 uapsd_queues; 1365c75786c9SEliad Peller u8 max_sp; 13663b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 13679d62a986SJouni Malinen u16 capability; 13682c1aabf3SJohannes Berg const u8 *ext_capab; 13699d62a986SJouni Malinen u8 ext_capab_len; 1370c01fc9adSSunil Dutt const u8 *supported_channels; 1371c01fc9adSSunil Dutt u8 supported_channels_len; 1372c01fc9adSSunil Dutt const u8 *supported_oper_classes; 1373c01fc9adSSunil Dutt u8 supported_oper_classes_len; 137460f4a7b1SMarek Kwaczynski u8 opmode_notif; 137560f4a7b1SMarek Kwaczynski bool opmode_notif_used; 137617b94247SAyala Beker int support_p2p_ps; 1377c4cbaf79SLuca Coelho const struct ieee80211_he_cap_elem *he_capa; 1378c4cbaf79SLuca Coelho u8 he_capa_len; 137936647055SToke Høiland-Jørgensen u16 airtime_weight; 1380e96d1cd2SAshok Raj Nagarajan struct sta_txpwr txpwr; 138143e64bf3SRajkumar Manoharan const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 13825727ef1bSJohannes Berg }; 13835727ef1bSJohannes Berg 1384fd5b74dcSJohannes Berg /** 138589c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 138689c771e5SJouni Malinen * 138789c771e5SJouni Malinen * Used to delete a station entry (or all stations). 138889c771e5SJouni Malinen * 138989c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 139098856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 139198856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 139298856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 139389c771e5SJouni Malinen */ 139489c771e5SJouni Malinen struct station_del_parameters { 139589c771e5SJouni Malinen const u8 *mac; 139698856866SJouni Malinen u8 subtype; 139798856866SJouni Malinen u16 reason_code; 139889c771e5SJouni Malinen }; 139989c771e5SJouni Malinen 140089c771e5SJouni Malinen /** 140177ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 140277ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 140347edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 140447edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 140577ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 140677ee7c89SJohannes Berg * the AP MLME in the device 140777ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 140877ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 140977ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 141077ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 141177ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 141277ee7c89SJohannes Berg * supported/used) 141377ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 141477ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 1415eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 1416eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 141777ee7c89SJohannes Berg */ 141877ee7c89SJohannes Berg enum cfg80211_station_type { 141977ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 142047edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 142177ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 142277ee7c89SJohannes Berg CFG80211_STA_AP_STA, 142377ee7c89SJohannes Berg CFG80211_STA_IBSS, 142477ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 142577ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 1426eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 1427eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 142877ee7c89SJohannes Berg }; 142977ee7c89SJohannes Berg 143077ee7c89SJohannes Berg /** 143177ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 143277ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 143377ee7c89SJohannes Berg * @params: the new parameters for a station 143477ee7c89SJohannes Berg * @statype: the type of station being modified 143577ee7c89SJohannes Berg * 143677ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 143777ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 143877ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 143977ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 144077ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 144177ee7c89SJohannes Berg */ 144277ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 144377ee7c89SJohannes Berg struct station_parameters *params, 144477ee7c89SJohannes Berg enum cfg80211_station_type statype); 144577ee7c89SJohannes Berg 144677ee7c89SJohannes Berg /** 1447*b1e8eb11SMauro Carvalho Chehab * enum rate_info_flags - bitrate info flags 1448420e7fabSHenning Rogge * 1449420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 1450420e7fabSHenning Rogge * type for 802.11n transmissions. 1451420e7fabSHenning Rogge * 1452db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 1453db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 1454420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 14552a38075cSAlexei Avshalom Lazar * @RATE_INFO_FLAGS_DMG: 60GHz MCS 1456c4cbaf79SLuca Coelho * @RATE_INFO_FLAGS_HE_MCS: HE MCS information 14572a38075cSAlexei Avshalom Lazar * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode 1458420e7fabSHenning Rogge */ 1459420e7fabSHenning Rogge enum rate_info_flags { 1460db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 1461db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 1462b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 14632a38075cSAlexei Avshalom Lazar RATE_INFO_FLAGS_DMG = BIT(3), 1464c4cbaf79SLuca Coelho RATE_INFO_FLAGS_HE_MCS = BIT(4), 14652a38075cSAlexei Avshalom Lazar RATE_INFO_FLAGS_EDMG = BIT(5), 1466b51f3beeSJohannes Berg }; 1467b51f3beeSJohannes Berg 1468b51f3beeSJohannes Berg /** 1469b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 1470b51f3beeSJohannes Berg * 1471b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 1472b51f3beeSJohannes Berg * 1473b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 1474b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 1475b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 1476b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 1477b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 1478b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 1479c4cbaf79SLuca Coelho * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation 1480b51f3beeSJohannes Berg */ 1481b51f3beeSJohannes Berg enum rate_info_bw { 1482842be75cSJohannes Berg RATE_INFO_BW_20 = 0, 1483b51f3beeSJohannes Berg RATE_INFO_BW_5, 1484b51f3beeSJohannes Berg RATE_INFO_BW_10, 1485b51f3beeSJohannes Berg RATE_INFO_BW_40, 1486b51f3beeSJohannes Berg RATE_INFO_BW_80, 1487b51f3beeSJohannes Berg RATE_INFO_BW_160, 1488c4cbaf79SLuca Coelho RATE_INFO_BW_HE_RU, 1489420e7fabSHenning Rogge }; 1490420e7fabSHenning Rogge 1491420e7fabSHenning Rogge /** 1492420e7fabSHenning Rogge * struct rate_info - bitrate information 1493420e7fabSHenning Rogge * 1494420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 1495420e7fabSHenning Rogge * 1496420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 1497c4cbaf79SLuca Coelho * @mcs: mcs index if struct describes an HT/VHT/HE rate 1498420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 1499c4cbaf79SLuca Coelho * @nss: number of streams (VHT & HE only) 1500b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 1501c4cbaf79SLuca Coelho * @he_gi: HE guard interval (from &enum nl80211_he_gi) 1502c4cbaf79SLuca Coelho * @he_dcm: HE DCM value 1503c4cbaf79SLuca Coelho * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc, 1504c4cbaf79SLuca Coelho * only valid if bw is %RATE_INFO_BW_HE_RU) 15052a38075cSAlexei Avshalom Lazar * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4) 1506420e7fabSHenning Rogge */ 1507420e7fabSHenning Rogge struct rate_info { 1508420e7fabSHenning Rogge u8 flags; 1509420e7fabSHenning Rogge u8 mcs; 1510420e7fabSHenning Rogge u16 legacy; 1511db9c64cfSJohannes Berg u8 nss; 1512b51f3beeSJohannes Berg u8 bw; 1513c4cbaf79SLuca Coelho u8 he_gi; 1514c4cbaf79SLuca Coelho u8 he_dcm; 1515c4cbaf79SLuca Coelho u8 he_ru_alloc; 15162a38075cSAlexei Avshalom Lazar u8 n_bonded_ch; 1517fd5b74dcSJohannes Berg }; 1518fd5b74dcSJohannes Berg 1519fd5b74dcSJohannes Berg /** 1520*b1e8eb11SMauro Carvalho Chehab * enum bss_param_flags - bitrate info flags 1521f4263c98SPaul Stewart * 1522f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1523f4263c98SPaul Stewart * type for 802.11n transmissions. 1524f4263c98SPaul Stewart * 1525f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1526f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1527f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1528f4263c98SPaul Stewart */ 1529f4263c98SPaul Stewart enum bss_param_flags { 1530f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1531f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1532f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1533f4263c98SPaul Stewart }; 1534f4263c98SPaul Stewart 1535f4263c98SPaul Stewart /** 1536f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1537f4263c98SPaul Stewart * 1538f4263c98SPaul Stewart * Information about the currently associated BSS 1539f4263c98SPaul Stewart * 1540f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1541f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1542f4263c98SPaul Stewart * @beacon_interval: beacon interval 1543f4263c98SPaul Stewart */ 1544f4263c98SPaul Stewart struct sta_bss_parameters { 1545f4263c98SPaul Stewart u8 flags; 1546f4263c98SPaul Stewart u8 dtim_period; 1547f4263c98SPaul Stewart u16 beacon_interval; 1548f4263c98SPaul Stewart }; 1549f4263c98SPaul Stewart 15506de39808SJohannes Berg /** 155152539ca8SToke Høiland-Jørgensen * struct cfg80211_txq_stats - TXQ statistics for this TID 155252539ca8SToke Høiland-Jørgensen * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to 155352539ca8SToke Høiland-Jørgensen * indicate the relevant values in this struct are filled 155452539ca8SToke Høiland-Jørgensen * @backlog_bytes: total number of bytes currently backlogged 155552539ca8SToke Høiland-Jørgensen * @backlog_packets: total number of packets currently backlogged 155652539ca8SToke Høiland-Jørgensen * @flows: number of new flows seen 155752539ca8SToke Høiland-Jørgensen * @drops: total number of packets dropped 155852539ca8SToke Høiland-Jørgensen * @ecn_marks: total number of packets marked with ECN CE 155952539ca8SToke Høiland-Jørgensen * @overlimit: number of drops due to queue space overflow 156052539ca8SToke Høiland-Jørgensen * @overmemory: number of drops due to memory limit overflow 156152539ca8SToke Høiland-Jørgensen * @collisions: number of hash collisions 156252539ca8SToke Høiland-Jørgensen * @tx_bytes: total number of bytes dequeued 156352539ca8SToke Høiland-Jørgensen * @tx_packets: total number of packets dequeued 156452539ca8SToke Høiland-Jørgensen * @max_flows: maximum number of flows supported 156552539ca8SToke Høiland-Jørgensen */ 156652539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats { 156752539ca8SToke Høiland-Jørgensen u32 filled; 156852539ca8SToke Høiland-Jørgensen u32 backlog_bytes; 156952539ca8SToke Høiland-Jørgensen u32 backlog_packets; 157052539ca8SToke Høiland-Jørgensen u32 flows; 157152539ca8SToke Høiland-Jørgensen u32 drops; 157252539ca8SToke Høiland-Jørgensen u32 ecn_marks; 157352539ca8SToke Høiland-Jørgensen u32 overlimit; 157452539ca8SToke Høiland-Jørgensen u32 overmemory; 157552539ca8SToke Høiland-Jørgensen u32 collisions; 157652539ca8SToke Høiland-Jørgensen u32 tx_bytes; 157752539ca8SToke Høiland-Jørgensen u32 tx_packets; 157852539ca8SToke Høiland-Jørgensen u32 max_flows; 157952539ca8SToke Høiland-Jørgensen }; 158052539ca8SToke Høiland-Jørgensen 158152539ca8SToke Høiland-Jørgensen /** 15826de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 15836de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 15846de39808SJohannes Berg * indicate the relevant values in this struct are filled 15856de39808SJohannes Berg * @rx_msdu: number of received MSDUs 15866de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 15876de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 15886de39808SJohannes Berg * transmitted MSDUs 15896de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 159052539ca8SToke Høiland-Jørgensen * @txq_stats: TXQ statistics 15916de39808SJohannes Berg */ 15926de39808SJohannes Berg struct cfg80211_tid_stats { 15936de39808SJohannes Berg u32 filled; 15946de39808SJohannes Berg u64 rx_msdu; 15956de39808SJohannes Berg u64 tx_msdu; 15966de39808SJohannes Berg u64 tx_msdu_retries; 15976de39808SJohannes Berg u64 tx_msdu_failed; 159852539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats txq_stats; 15996de39808SJohannes Berg }; 16006de39808SJohannes Berg 1601119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1602119363c7SFelix Fietkau 1603f4263c98SPaul Stewart /** 16042ec600d6SLuis Carlos Cobo * struct station_info - station information 1605fd5b74dcSJohannes Berg * 16062ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1607fd5b74dcSJohannes Berg * 1608319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1609319090bfSJohannes Berg * indicate the relevant values in this struct for them 1610ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1611fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 16126c7a0033SBen Greear * @assoc_at: bootime (ns) of the last association 16138d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 16148d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 16152ec600d6SLuis Carlos Cobo * @llid: mesh local link id 16162ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 16172ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 161873c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 161973c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 162073c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 162173c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1622119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1623119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1624119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1625858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1626858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 16278d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 16288d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 16298d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 16308d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 16315a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 16321ba01458SRandy Dunlap * @bss_param: current BSS parameters 1633f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1634f5ea9120SJohannes Berg * This number should increase every time the list of stations 1635f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1636f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 163750d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 163850d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 163950d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 164050d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 164150d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1642c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1643a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1644d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 16453b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 16463b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 16473b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1648867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1649867d849fSAntonio Quartulli * towards this station. 1650a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1651a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1652a76b1942SJohannes Berg * from this peer 1653dbdaee7aSBob Copeland * @connected_to_gate: true if mesh STA has a path to mesh gate 1654739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 165536647055SToke Høiland-Jørgensen * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer 165636647055SToke Høiland-Jørgensen * @airtime_weight: current airtime scheduling weight 16576de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 16586de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 16598689c051SArend van Spriel * Note that this doesn't use the @filled bit, but is used if non-NULL. 1660c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the last ACK frame. 166181d5439dSBalaji Pothunoori * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 166281d5439dSBalaji Pothunoori * been sent. 16630d4e14a3SAnkita Bajaj * @rx_mpdu_count: number of MPDUs received from this station 16640d4e14a3SAnkita Bajaj * @fcs_err_count: number of packets (MPDUs) received from this station with 16650d4e14a3SAnkita Bajaj * an FCS error. This counter should be incremented only when TA of the 16660d4e14a3SAnkita Bajaj * received packet with an FCS error matches the peer MAC address. 1667ab60633cSNarayanraddi Masti * @airtime_link_metric: mesh airtime link metric. 16681303a51cSMarkus Theil * @connected_to_as: true if mesh STA has a path to authentication server 1669fd5b74dcSJohannes Berg */ 16702ec600d6SLuis Carlos Cobo struct station_info { 1671739960f1SMohammed Shafi Shajakhan u64 filled; 1672ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1673fd5b74dcSJohannes Berg u32 inactive_time; 16746c7a0033SBen Greear u64 assoc_at; 167542745e03SVladimir Kondratiev u64 rx_bytes; 167642745e03SVladimir Kondratiev u64 tx_bytes; 16772ec600d6SLuis Carlos Cobo u16 llid; 16782ec600d6SLuis Carlos Cobo u16 plid; 16792ec600d6SLuis Carlos Cobo u8 plink_state; 1680420e7fabSHenning Rogge s8 signal; 1681541a45a1SBruno Randolf s8 signal_avg; 1682119363c7SFelix Fietkau 1683119363c7SFelix Fietkau u8 chains; 1684119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1685119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1686119363c7SFelix Fietkau 1687420e7fabSHenning Rogge struct rate_info txrate; 1688c8dcfd8aSFelix Fietkau struct rate_info rxrate; 168998c8a60aSJouni Malinen u32 rx_packets; 169098c8a60aSJouni Malinen u32 tx_packets; 1691b206b4efSBruno Randolf u32 tx_retries; 1692b206b4efSBruno Randolf u32 tx_failed; 16935a5c731aSBen Greear u32 rx_dropped_misc; 1694f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1695bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1696f5ea9120SJohannes Berg 1697f5ea9120SJohannes Berg int generation; 169850d3dfb7SJouni Malinen 169950d3dfb7SJouni Malinen const u8 *assoc_req_ies; 170050d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1701f612cedfSJouni Malinen 1702a85e1d55SPaul Stewart u32 beacon_loss_count; 1703d299a1f2SJavier Cardona s64 t_offset; 17043b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 17053b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 17063b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1707a85e1d55SPaul Stewart 1708867d849fSAntonio Quartulli u32 expected_throughput; 1709a76b1942SJohannes Berg 171036647055SToke Høiland-Jørgensen u64 tx_duration; 1711739960f1SMohammed Shafi Shajakhan u64 rx_duration; 171236647055SToke Høiland-Jørgensen u64 rx_beacon; 1713a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 1714dbdaee7aSBob Copeland u8 connected_to_gate; 1715dbdaee7aSBob Copeland 17168689c051SArend van Spriel struct cfg80211_tid_stats *pertid; 1717c4b50cd3SVenkateswara Naralasetty s8 ack_signal; 171881d5439dSBalaji Pothunoori s8 avg_ack_signal; 17190d4e14a3SAnkita Bajaj 172036647055SToke Høiland-Jørgensen u16 airtime_weight; 172136647055SToke Høiland-Jørgensen 17220d4e14a3SAnkita Bajaj u32 rx_mpdu_count; 17230d4e14a3SAnkita Bajaj u32 fcs_err_count; 1724ab60633cSNarayanraddi Masti 1725ab60633cSNarayanraddi Masti u32 airtime_link_metric; 17261303a51cSMarkus Theil 17271303a51cSMarkus Theil u8 connected_to_as; 1728fd5b74dcSJohannes Berg }; 1729fd5b74dcSJohannes Berg 173061aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 173166f7ac50SMichael Wu /** 17327406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 17337406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 17347406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 17357406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 17367406353dSAntonio Quartulli * 17377406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 17387406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 17397406353dSAntonio Quartulli * considered undefined. 17407406353dSAntonio Quartulli */ 17417406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 17427406353dSAntonio Quartulli struct station_info *sinfo); 174361aaa0e8SLinus Lüssing #else 174461aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 174561aaa0e8SLinus Lüssing const u8 *mac_addr, 174661aaa0e8SLinus Lüssing struct station_info *sinfo) 174761aaa0e8SLinus Lüssing { 174861aaa0e8SLinus Lüssing return -ENOENT; 174961aaa0e8SLinus Lüssing } 175061aaa0e8SLinus Lüssing #endif 17517406353dSAntonio Quartulli 17527406353dSAntonio Quartulli /** 175366f7ac50SMichael Wu * enum monitor_flags - monitor flags 175466f7ac50SMichael Wu * 175566f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 175666f7ac50SMichael Wu * according to the nl80211 flags. 175766f7ac50SMichael Wu * 1758818a986eSJohannes Berg * @MONITOR_FLAG_CHANGED: set if the flags were changed 175966f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 176066f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 176166f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 176266f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 176366f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 1764e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 176566f7ac50SMichael Wu */ 176666f7ac50SMichael Wu enum monitor_flags { 1767818a986eSJohannes Berg MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID, 176866f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 176966f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 177066f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 177166f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 177266f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 1773e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 177466f7ac50SMichael Wu }; 177566f7ac50SMichael Wu 17762ec600d6SLuis Carlos Cobo /** 17772ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 17782ec600d6SLuis Carlos Cobo * 17792ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 17802ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 17812ec600d6SLuis Carlos Cobo * 1782abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 1783abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 1784abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 1785abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 1786abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 1787abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 1788abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 1789cc241636SJulan Hsu * @MPATH_INFO_HOP_COUNT: @hop_count filled 17909874b71fSJohannes Berg * @MPATH_INFO_PATH_CHANGE: @path_change_count filled 17912ec600d6SLuis Carlos Cobo */ 17922ec600d6SLuis Carlos Cobo enum mpath_info_flags { 17932ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 1794d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 17952ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 17962ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 17972ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 17982ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 17992ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 1800540bbcb9SJulan Hsu MPATH_INFO_HOP_COUNT = BIT(7), 1801540bbcb9SJulan Hsu MPATH_INFO_PATH_CHANGE = BIT(8), 18022ec600d6SLuis Carlos Cobo }; 18032ec600d6SLuis Carlos Cobo 18042ec600d6SLuis Carlos Cobo /** 18052ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 18062ec600d6SLuis Carlos Cobo * 18072ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 18082ec600d6SLuis Carlos Cobo * 18092ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 18102ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 1811d19b3bf6SRui Paulo * @sn: target sequence number 18122ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 18132ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 18142ec600d6SLuis Carlos Cobo * @flags: mesh path flags 18152ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 18162ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 1817f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1818f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 1819f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1820f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 1821cc241636SJulan Hsu * @hop_count: hops to destination 1822540bbcb9SJulan Hsu * @path_change_count: total number of path changes to destination 18232ec600d6SLuis Carlos Cobo */ 18242ec600d6SLuis Carlos Cobo struct mpath_info { 18252ec600d6SLuis Carlos Cobo u32 filled; 18262ec600d6SLuis Carlos Cobo u32 frame_qlen; 1827d19b3bf6SRui Paulo u32 sn; 18282ec600d6SLuis Carlos Cobo u32 metric; 18292ec600d6SLuis Carlos Cobo u32 exptime; 18302ec600d6SLuis Carlos Cobo u32 discovery_timeout; 18312ec600d6SLuis Carlos Cobo u8 discovery_retries; 18322ec600d6SLuis Carlos Cobo u8 flags; 1833cc241636SJulan Hsu u8 hop_count; 1834540bbcb9SJulan Hsu u32 path_change_count; 1835f5ea9120SJohannes Berg 1836f5ea9120SJohannes Berg int generation; 18372ec600d6SLuis Carlos Cobo }; 18382ec600d6SLuis Carlos Cobo 18399f1ba906SJouni Malinen /** 18409f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 18419f1ba906SJouni Malinen * 18429f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 18439f1ba906SJouni Malinen * 18449f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 18459f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 18469f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 18479f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 18489f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 18499f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 185090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 185190c97a04SJouni Malinen * (or NULL for no change) 185290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 1853fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 18549d6e371dSWright Feng * (0 = no, 1 = yes, -1 = do not change) 185550b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 185650b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 185753cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 185853cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 18599f1ba906SJouni Malinen */ 18609f1ba906SJouni Malinen struct bss_parameters { 18619f1ba906SJouni Malinen int use_cts_prot; 18629f1ba906SJouni Malinen int use_short_preamble; 18639f1ba906SJouni Malinen int use_short_slot_time; 1864c1e5f471SJohannes Berg const u8 *basic_rates; 186590c97a04SJouni Malinen u8 basic_rates_len; 1866fd8aaaf3SFelix Fietkau int ap_isolate; 186750b12f59SHelmut Schaa int ht_opmode; 186853cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 18699f1ba906SJouni Malinen }; 18702ec600d6SLuis Carlos Cobo 18713ddd53f3SChun-Yeow Yeoh /** 187229cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 187329cbe68cSJohannes Berg * 187429cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 18753ddd53f3SChun-Yeow Yeoh * 18763ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 18773ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 18783ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 18793ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 18803ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 18813ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 18823ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 18833ddd53f3SChun-Yeow Yeoh * mesh interface 18843ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 18853ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 18863ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 18873ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 18883ddd53f3SChun-Yeow Yeoh * elements 18893ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 18903ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 18913ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 18923ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 18933ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 18943ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 18953ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 18963ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 18973ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 18983ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 18993ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 19003ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 19013ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 19023ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 19033ddd53f3SChun-Yeow Yeoh * element 19043ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 19053ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 19063ddd53f3SChun-Yeow Yeoh * element 19073ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 19083ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 19093ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 19103ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 19113ddd53f3SChun-Yeow Yeoh * announcements are transmitted 19123ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 19133ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 19143ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 19153ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 19163ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 19173ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 19183ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 19193ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 19203ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 19213ddd53f3SChun-Yeow Yeoh * station to establish a peer link 19223ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 1923ac1073a6SChun-Yeow Yeoh * 1924ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 1925ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 1926ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 1927ac1073a6SChun-Yeow Yeoh * 1928ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 1929ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 1930728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 1931728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 1932728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 19333b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 19343b1c5a53SMarco Porsch * setting for new peer links. 19353b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 19363b1c5a53SMarco Porsch * after transmitting its beacon. 19378e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 19388e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 19398e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 194001d66fbdSBob Copeland * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is 194101d66fbdSBob Copeland * connected to a mesh gate in mesh formation info. If false, the 194201d66fbdSBob Copeland * value in mesh formation is determined by the presence of root paths 194301d66fbdSBob Copeland * in the mesh path table 1944e3718a61SLinus Lüssing * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP 1945e3718a61SLinus Lüssing * for HWMP) if the destination is a direct neighbor. Note that this might 1946e3718a61SLinus Lüssing * not be the optimal decision as a multi-hop route might be better. So 1947e3718a61SLinus Lüssing * if using this setting you will likely also want to disable 1948e3718a61SLinus Lüssing * dot11MeshForwarding and use another mesh routing protocol on top. 194929cbe68cSJohannes Berg */ 195093da9cc1Scolin@cozybit.com struct mesh_config { 195193da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 195293da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 195393da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 195493da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 195593da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 195693da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 195745904f21SJavier Cardona u8 element_ttl; 195893da9cc1Scolin@cozybit.com bool auto_open_plinks; 1959d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 196093da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 196193da9cc1Scolin@cozybit.com u32 path_refresh_time; 196293da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 196393da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 196493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 1965dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 196693da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 196763c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 196801d66fbdSBob Copeland bool dot11MeshConnectedToMeshGate; 1969184eebe6SMarkus Theil bool dot11MeshConnectedToAuthServer; 19700507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 197116dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 197294f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 197355335137SAshok Nagarajan s32 rssi_threshold; 197470c33eaaSAshok Nagarajan u16 ht_opmode; 1975ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 1976ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 1977728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 19783b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 19793b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 19808e7c0538SColleen Twitty u32 plink_timeout; 1981e3718a61SLinus Lüssing bool dot11MeshNolearn; 198293da9cc1Scolin@cozybit.com }; 198393da9cc1Scolin@cozybit.com 198431888487SJouni Malinen /** 198529cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 1986683b6d3bSJohannes Berg * @chandef: defines the channel to use 198729cbe68cSJohannes Berg * @mesh_id: the mesh ID 198829cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1989d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 1990c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 1991c80d545dSJavier Cardona * @path_metric: which metric to use 19926e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 1993581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 1994581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 1995b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 1996b130e5ceSJavier Cardona * @is_secure: this mesh uses security 1997bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 19989bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 19999bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 20004bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 2001ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 20028564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 2003d37d49c2SBenjamin Berg * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 2004d37d49c2SBenjamin Berg * changes the channel when a radar is detected. This is required 2005d37d49c2SBenjamin Berg * to operate on DFS channels. 20061224f583SDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 20071224f583SDenis Kenzior * port frames over NL80211 instead of the network interface. 200829cbe68cSJohannes Berg * 200929cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 201029cbe68cSJohannes Berg */ 201129cbe68cSJohannes Berg struct mesh_setup { 2012683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 201329cbe68cSJohannes Berg const u8 *mesh_id; 201429cbe68cSJohannes Berg u8 mesh_id_len; 2015d299a1f2SJavier Cardona u8 sync_method; 2016c80d545dSJavier Cardona u8 path_sel_proto; 2017c80d545dSJavier Cardona u8 path_metric; 20186e16d90bSColleen Twitty u8 auth_id; 2019581a8b0fSJavier Cardona const u8 *ie; 2020581a8b0fSJavier Cardona u8 ie_len; 2021b130e5ceSJavier Cardona bool is_authenticated; 202215d5dda6SJavier Cardona bool is_secure; 2023bb2798d4SThomas Pedersen bool user_mpm; 20249bdbf04dSMarco Porsch u8 dtim_period; 20259bdbf04dSMarco Porsch u16 beacon_interval; 202657fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2027ffb3cf30SAshok Nagarajan u32 basic_rates; 20288564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 2029d37d49c2SBenjamin Berg bool userspace_handles_dfs; 20301224f583SDenis Kenzior bool control_port_over_nl80211; 203129cbe68cSJohannes Berg }; 203229cbe68cSJohannes Berg 203329cbe68cSJohannes Berg /** 20346e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 20356e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 20366e0bd6c3SRostislav Lisovy * 20376e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 20386e0bd6c3SRostislav Lisovy */ 20396e0bd6c3SRostislav Lisovy struct ocb_setup { 20406e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 20416e0bd6c3SRostislav Lisovy }; 20426e0bd6c3SRostislav Lisovy 20436e0bd6c3SRostislav Lisovy /** 204431888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 2045a3304b0aSJohannes Berg * @ac: AC identifier 204631888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 204731888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 204831888487SJouni Malinen * 1..32767] 204931888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 205031888487SJouni Malinen * 1..32767] 205131888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 205231888487SJouni Malinen */ 205331888487SJouni Malinen struct ieee80211_txq_params { 2054a3304b0aSJohannes Berg enum nl80211_ac ac; 205531888487SJouni Malinen u16 txop; 205631888487SJouni Malinen u16 cwmin; 205731888487SJouni Malinen u16 cwmax; 205831888487SJouni Malinen u8 aifs; 205931888487SJouni Malinen }; 206031888487SJouni Malinen 2061d70e9693SJohannes Berg /** 2062d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 2063d70e9693SJohannes Berg * 2064d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 2065d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 2066d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 2067d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 2068d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 2069d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 2070d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 2071d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 2072d70e9693SJohannes Berg * in the wiphy structure. 2073d70e9693SJohannes Berg * 2074d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 2075d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 2076d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 2077d70e9693SJohannes Berg * 2078d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 2079d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 2080d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 2081d70e9693SJohannes Berg * to userspace. 2082d70e9693SJohannes Berg */ 208372bdcf34SJouni Malinen 2084704232c2SJohannes Berg /** 20852a519311SJohannes Berg * struct cfg80211_ssid - SSID description 20862a519311SJohannes Berg * @ssid: the SSID 20872a519311SJohannes Berg * @ssid_len: length of the ssid 20882a519311SJohannes Berg */ 20892a519311SJohannes Berg struct cfg80211_ssid { 20902a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 20912a519311SJohannes Berg u8 ssid_len; 20922a519311SJohannes Berg }; 20932a519311SJohannes Berg 20942a519311SJohannes Berg /** 20951d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 20961d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 20971d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 20981d76250bSAvraham Stern * information is not available, this field is left zero. 20991d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 21001d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 21011d76250bSAvraham Stern * userspace will be notified of that 21021d76250bSAvraham Stern */ 21031d76250bSAvraham Stern struct cfg80211_scan_info { 21041d76250bSAvraham Stern u64 scan_start_tsf; 21051d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 21061d76250bSAvraham Stern bool aborted; 21071d76250bSAvraham Stern }; 21081d76250bSAvraham Stern 21091d76250bSAvraham Stern /** 2110c8cb5b85STova Mussai * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only 2111c8cb5b85STova Mussai * 2112c8cb5b85STova Mussai * @short_bssid: short ssid to scan for 2113c8cb5b85STova Mussai * @bssid: bssid to scan for 2114c8cb5b85STova Mussai * @channel_idx: idx of the channel in the channel array in the scan request 2115c8cb5b85STova Mussai * which the above info relvant to 2116c8cb5b85STova Mussai * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU 2117c8cb5b85STova Mussai * @short_ssid_valid: short_ssid is valid and can be used 2118c8cb5b85STova Mussai * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait 2119c8cb5b85STova Mussai * 20 TUs before starting to send probe requests. 2120c8cb5b85STova Mussai */ 2121c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params { 2122c8cb5b85STova Mussai u32 short_ssid; 2123c8cb5b85STova Mussai u32 channel_idx; 2124c8cb5b85STova Mussai u8 bssid[ETH_ALEN]; 2125c8cb5b85STova Mussai bool unsolicited_probe; 2126c8cb5b85STova Mussai bool short_ssid_valid; 2127c8cb5b85STova Mussai bool psc_no_listen; 2128c8cb5b85STova Mussai }; 2129c8cb5b85STova Mussai 2130c8cb5b85STova Mussai /** 21312a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 21322a519311SJohannes Berg * 21332a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 21342a519311SJohannes Berg * @n_ssids: number of SSIDs 21352a519311SJohannes Berg * @channels: channels to scan on. 2136ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 2137dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 213870692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 213970692ad2SJouni Malinen * @ie_len: length of ie in octets 21401d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 21411d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 21421d76250bSAvraham Stern * the actual dwell time may be shorter. 21431d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 21441d76250bSAvraham Stern * %duration field. 2145ed473771SSam Leffler * @flags: bit field of flags controlling operation 214634850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 21472a519311SJohannes Berg * @wiphy: the wiphy this was for 214815d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 2149fd014284SJohannes Berg * @wdev: the wireless device to scan for 21501d76250bSAvraham Stern * @info: (internal) information about completed scan 21515fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 2152e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 2153ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 2154ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 2155ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 2156ad2b26abSJohannes Berg * be taken from the @mac_addr 2157c8cb5b85STova Mussai * @scan_6ghz: relevant for split scan request only, 2158c8cb5b85STova Mussai * true if this is the second scan request 2159c8cb5b85STova Mussai * @n_6ghz_params: number of 6 GHz params 2160c8cb5b85STova Mussai * @scan_6ghz_params: 6 GHz params 2161818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 21622a519311SJohannes Berg */ 21632a519311SJohannes Berg struct cfg80211_scan_request { 21642a519311SJohannes Berg struct cfg80211_ssid *ssids; 21652a519311SJohannes Berg int n_ssids; 21662a519311SJohannes Berg u32 n_channels; 2167dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 2168de95a54bSJohannes Berg const u8 *ie; 216970692ad2SJouni Malinen size_t ie_len; 21701d76250bSAvraham Stern u16 duration; 21711d76250bSAvraham Stern bool duration_mandatory; 2172ed473771SSam Leffler u32 flags; 21732a519311SJohannes Berg 217457fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 217534850ab2SJohannes Berg 2176fd014284SJohannes Berg struct wireless_dev *wdev; 2177fd014284SJohannes Berg 2178ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 2179ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2180818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 2181ad2b26abSJohannes Berg 21822a519311SJohannes Berg /* internal */ 21832a519311SJohannes Berg struct wiphy *wiphy; 218415d6030bSSam Leffler unsigned long scan_start; 21851d76250bSAvraham Stern struct cfg80211_scan_info info; 21861d76250bSAvraham Stern bool notified; 2187e9f935e3SRajkumar Manoharan bool no_cck; 2188c8cb5b85STova Mussai bool scan_6ghz; 2189c8cb5b85STova Mussai u32 n_6ghz_params; 2190c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params *scan_6ghz_params; 21915ba63533SJohannes Berg 21925ba63533SJohannes Berg /* keep last */ 2193396fba0aSGustavo A. R. Silva struct ieee80211_channel *channels[]; 21942a519311SJohannes Berg }; 21952a519311SJohannes Berg 2196ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 2197ad2b26abSJohannes Berg { 2198ad2b26abSJohannes Berg int i; 2199ad2b26abSJohannes Berg 2200ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 2201ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 2202ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 2203ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 2204ad2b26abSJohannes Berg } 2205ad2b26abSJohannes Berg } 2206ad2b26abSJohannes Berg 22072a519311SJohannes Berg /** 2208a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 2209a1f1c21cSLuciano Coelho * 22103007e352SArend Van Spriel * @ssid: SSID to be matched; may be zero-length in case of BSSID match 22113007e352SArend Van Spriel * or no match (RSSI only) 22123007e352SArend Van Spriel * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 22133007e352SArend Van Spriel * or no match (RSSI only) 2214ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 22151e1b11b6Svamsi krishna * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied 22161e1b11b6Svamsi krishna * for filtering out scan results received. Drivers advertize this support 22171e1b11b6Svamsi krishna * of band specific rssi based filtering through the feature capability 22181e1b11b6Svamsi krishna * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band 22191e1b11b6Svamsi krishna * specific rssi thresholds take precedence over rssi_thold, if specified. 22201e1b11b6Svamsi krishna * If not specified for any band, it will be assigned with rssi_thold of 22211e1b11b6Svamsi krishna * corresponding matchset. 2222a1f1c21cSLuciano Coelho */ 2223a1f1c21cSLuciano Coelho struct cfg80211_match_set { 2224a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 22253007e352SArend Van Spriel u8 bssid[ETH_ALEN]; 2226ea73cbceSJohannes Berg s32 rssi_thold; 22271e1b11b6Svamsi krishna s32 per_band_rssi_thold[NUM_NL80211_BANDS]; 2228a1f1c21cSLuciano Coelho }; 2229a1f1c21cSLuciano Coelho 2230a1f1c21cSLuciano Coelho /** 22313b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 22323b06d277SAvraham Stern * 22333b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 22343b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 22353b06d277SAvraham Stern * infinite loop. 22363b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 22373b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 22383b06d277SAvraham Stern */ 22393b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 22403b06d277SAvraham Stern u32 interval; 22413b06d277SAvraham Stern u32 iterations; 22423b06d277SAvraham Stern }; 22433b06d277SAvraham Stern 22443b06d277SAvraham Stern /** 2245bf95ecdbSvamsi krishna * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 2246bf95ecdbSvamsi krishna * 2247bf95ecdbSvamsi krishna * @band: band of BSS which should match for RSSI level adjustment. 2248bf95ecdbSvamsi krishna * @delta: value of RSSI level adjustment. 2249bf95ecdbSvamsi krishna */ 2250bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust { 2251bf95ecdbSvamsi krishna enum nl80211_band band; 2252bf95ecdbSvamsi krishna s8 delta; 2253bf95ecdbSvamsi krishna }; 2254bf95ecdbSvamsi krishna 2255bf95ecdbSvamsi krishna /** 2256807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 2257807f8a8cSLuciano Coelho * 225896b08fd6SArend Van Spriel * @reqid: identifies this request. 2259807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 2260807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 2261807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 2262dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 2263807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 2264807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 2265ed473771SSam Leffler * @flags: bit field of flags controlling operation 2266a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 2267a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 2268a1f1c21cSLuciano Coelho * (others are filtered out). 2269a1f1c21cSLuciano Coelho * If ommited, all results are passed. 2270a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 22716406c919SJohannes Berg * @report_results: indicates that results were reported for this request 2272807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 2273807f8a8cSLuciano Coelho * @dev: the interface 2274077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 2275807f8a8cSLuciano Coelho * @channels: channels to scan 2276ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 2277ea73cbceSJohannes Berg * contains the minimum over all matchsets 2278ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 2279ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 2280ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 2281ad2b26abSJohannes Berg * be taken from the @mac_addr 22823b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 22833b06d277SAvraham Stern * index must be executed first. 22843b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 228531a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 228693a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 228793a1e86cSJukka Rissanen * owned by a particular socket) 2288ca986ad9SArend Van Spriel * @nl_owner_dead: netlink owner socket was closed - this request be freed 2289ca986ad9SArend Van Spriel * @list: for keeping list of requests. 22909c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 22919c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 22929c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 22939c748934SLuciano Coelho * supported. 2294bf95ecdbSvamsi krishna * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 2295bf95ecdbSvamsi krishna * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 2296bf95ecdbSvamsi krishna * reporting in connected state to cases where a matching BSS is determined 2297bf95ecdbSvamsi krishna * to have better or slightly worse RSSI than the current connected BSS. 2298bf95ecdbSvamsi krishna * The relative RSSI threshold values are ignored in disconnected state. 2299bf95ecdbSvamsi krishna * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 2300bf95ecdbSvamsi krishna * to the specified band while deciding whether a better BSS is reported 2301bf95ecdbSvamsi krishna * using @relative_rssi. If delta is a negative number, the BSSs that 2302bf95ecdbSvamsi krishna * belong to the specified band will be penalized by delta dB in relative 2303bf95ecdbSvamsi krishna * comparisions. 2304807f8a8cSLuciano Coelho */ 2305807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 230696b08fd6SArend Van Spriel u64 reqid; 2307807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 2308807f8a8cSLuciano Coelho int n_ssids; 2309807f8a8cSLuciano Coelho u32 n_channels; 2310dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 2311807f8a8cSLuciano Coelho const u8 *ie; 2312807f8a8cSLuciano Coelho size_t ie_len; 2313ed473771SSam Leffler u32 flags; 2314a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 2315a1f1c21cSLuciano Coelho int n_match_sets; 2316ea73cbceSJohannes Berg s32 min_rssi_thold; 23179c748934SLuciano Coelho u32 delay; 23183b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 23193b06d277SAvraham Stern int n_scan_plans; 2320807f8a8cSLuciano Coelho 2321ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 2322ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2323ad2b26abSJohannes Berg 2324bf95ecdbSvamsi krishna bool relative_rssi_set; 2325bf95ecdbSvamsi krishna s8 relative_rssi; 2326bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust rssi_adjust; 2327bf95ecdbSvamsi krishna 2328807f8a8cSLuciano Coelho /* internal */ 2329807f8a8cSLuciano Coelho struct wiphy *wiphy; 2330807f8a8cSLuciano Coelho struct net_device *dev; 233115d6030bSSam Leffler unsigned long scan_start; 2332b34939b9SArend Van Spriel bool report_results; 233331a60ed1SJukka Rissanen struct rcu_head rcu_head; 233493a1e86cSJukka Rissanen u32 owner_nlportid; 2335ca986ad9SArend Van Spriel bool nl_owner_dead; 2336ca986ad9SArend Van Spriel struct list_head list; 2337807f8a8cSLuciano Coelho 2338807f8a8cSLuciano Coelho /* keep last */ 2339396fba0aSGustavo A. R. Silva struct ieee80211_channel *channels[]; 2340807f8a8cSLuciano Coelho }; 2341807f8a8cSLuciano Coelho 2342807f8a8cSLuciano Coelho /** 23432a519311SJohannes Berg * enum cfg80211_signal_type - signal type 23442a519311SJohannes Berg * 23452a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 23462a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 23472a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 23482a519311SJohannes Berg */ 23492a519311SJohannes Berg enum cfg80211_signal_type { 23502a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 23512a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 23522a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 23532a519311SJohannes Berg }; 23542a519311SJohannes Berg 23552a519311SJohannes Berg /** 23566e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 23576e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 23586e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 23596e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 23606e19bc4bSDmitry Shmidt * signal type 23616e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 23626e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 23636e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 23646e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 23656e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 23669285ec4cSJason A. Donenfeld * ktime_get_boottime_ns() is likely appropriate. 23671d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 23681d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 23691d76250bSAvraham Stern * by %parent_bssid. 23701d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 23711d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 2372983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 2373983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 23746e19bc4bSDmitry Shmidt */ 23756e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 23766e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 23776e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 23786e19bc4bSDmitry Shmidt s32 signal; 23796e19bc4bSDmitry Shmidt u64 boottime_ns; 23801d76250bSAvraham Stern u64 parent_tsf; 23811d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 2382983dafaaSSunil Dutt u8 chains; 2383983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 23846e19bc4bSDmitry Shmidt }; 23856e19bc4bSDmitry Shmidt 23866e19bc4bSDmitry Shmidt /** 23872aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 23888cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 23899caf0364SJohannes Berg * @rcu_head: internal use, for freeing 23909caf0364SJohannes Berg * @len: length of the IEs 23910e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 23929caf0364SJohannes Berg * @data: IE data 23939caf0364SJohannes Berg */ 23949caf0364SJohannes Berg struct cfg80211_bss_ies { 23958cef2c9dSJohannes Berg u64 tsf; 23969caf0364SJohannes Berg struct rcu_head rcu_head; 23979caf0364SJohannes Berg int len; 23980e227084SJohannes Berg bool from_beacon; 23999caf0364SJohannes Berg u8 data[]; 24009caf0364SJohannes Berg }; 24019caf0364SJohannes Berg 24029caf0364SJohannes Berg /** 24032a519311SJohannes Berg * struct cfg80211_bss - BSS description 24042a519311SJohannes Berg * 24052a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 24062a519311SJohannes Berg * for use in scan results and similar. 24072a519311SJohannes Berg * 2408abe37c4bSJohannes Berg * @channel: channel this BSS is on 2409dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 24102a519311SJohannes Berg * @bssid: BSSID of the BSS 24112a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 24122a519311SJohannes Berg * @capability: the capability field in host byte order 241383c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 241483c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 241583c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 241683c7aa1aSJohannes Berg * received. It is always non-%NULL. 241734a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 2418776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 2419776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 2420776b3580SJohannes Berg * @hidden_beacon_bss struct) 242134a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 2422776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 2423776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 2424776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 2425776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 2426851ae31dSJohannes Berg * @transmitted_bss: pointer to the transmitted BSS, if this is a 2427851ae31dSJohannes Berg * non-transmitted one (multi-BSSID support) 2428851ae31dSJohannes Berg * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one 2429851ae31dSJohannes Berg * (multi-BSSID support) 243077965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 2431983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 2432983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 24330cd01efbSSara Sharon * @bssid_index: index in the multiple BSS set 24340cd01efbSSara Sharon * @max_bssid_indicator: max number of members in the BSS set 24352a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 24362a519311SJohannes Berg */ 24372a519311SJohannes Berg struct cfg80211_bss { 24382a519311SJohannes Berg struct ieee80211_channel *channel; 2439dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 24402a519311SJohannes Berg 24419caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 24429caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 24439caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 24449caf0364SJohannes Berg 2445776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 24467011ba58SSara Sharon struct cfg80211_bss *transmitted_bss; 24477011ba58SSara Sharon struct list_head nontrans_list; 24482a519311SJohannes Berg 24492a519311SJohannes Berg s32 signal; 24502a519311SJohannes Berg 24519caf0364SJohannes Berg u16 beacon_interval; 24529caf0364SJohannes Berg u16 capability; 24539caf0364SJohannes Berg 24549caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 2455983dafaaSSunil Dutt u8 chains; 2456983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 24579caf0364SJohannes Berg 24580cd01efbSSara Sharon u8 bssid_index; 24590cd01efbSSara Sharon u8 max_bssid_indicator; 24600cd01efbSSara Sharon 2461396fba0aSGustavo A. R. Silva u8 priv[] __aligned(sizeof(void *)); 24622a519311SJohannes Berg }; 24632a519311SJohannes Berg 24642a519311SJohannes Berg /** 246549a68e0dSJohannes Berg * ieee80211_bss_get_elem - find element with given ID 2466517357c6SJohannes Berg * @bss: the bss to search 246749a68e0dSJohannes Berg * @id: the element ID 24689caf0364SJohannes Berg * 24699caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 24709caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 24710ae997dcSYacine Belkadi * Return: %NULL if not found. 2472517357c6SJohannes Berg */ 247349a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id); 247449a68e0dSJohannes Berg 247549a68e0dSJohannes Berg /** 247649a68e0dSJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 247749a68e0dSJohannes Berg * @bss: the bss to search 247849a68e0dSJohannes Berg * @id: the element ID 247949a68e0dSJohannes Berg * 248049a68e0dSJohannes Berg * Note that the return value is an RCU-protected pointer, so 248149a68e0dSJohannes Berg * rcu_read_lock() must be held when calling this function. 248249a68e0dSJohannes Berg * Return: %NULL if not found. 248349a68e0dSJohannes Berg */ 248449a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id) 248549a68e0dSJohannes Berg { 248649a68e0dSJohannes Berg return (void *)ieee80211_bss_get_elem(bss, id); 248749a68e0dSJohannes Berg } 2488517357c6SJohannes Berg 2489517357c6SJohannes Berg 2490517357c6SJohannes Berg /** 2491636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 2492636a5d36SJouni Malinen * 2493636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 2494636a5d36SJouni Malinen * authentication. 2495636a5d36SJouni Malinen * 2496959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 2497959867faSJohannes Berg * to it if it needs to keep it. 2498636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 2499636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 2500636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 2501fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2502fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2503fffd0934SJohannes Berg * @key: WEP key for shared key authentication 250411b6b5a4SJouni Malinen * @auth_data: Fields and elements in Authentication frames. This contains 250511b6b5a4SJouni Malinen * the authentication frame body (non-IE and IE data), excluding the 250611b6b5a4SJouni Malinen * Authentication algorithm number, i.e., starting at the Authentication 250711b6b5a4SJouni Malinen * transaction sequence number field. 250811b6b5a4SJouni Malinen * @auth_data_len: Length of auth_data buffer in octets 2509636a5d36SJouni Malinen */ 2510636a5d36SJouni Malinen struct cfg80211_auth_request { 251119957bb3SJohannes Berg struct cfg80211_bss *bss; 2512636a5d36SJouni Malinen const u8 *ie; 2513636a5d36SJouni Malinen size_t ie_len; 251419957bb3SJohannes Berg enum nl80211_auth_type auth_type; 2515fffd0934SJohannes Berg const u8 *key; 2516fffd0934SJohannes Berg u8 key_len, key_idx; 251711b6b5a4SJouni Malinen const u8 *auth_data; 251811b6b5a4SJouni Malinen size_t auth_data_len; 2519636a5d36SJouni Malinen }; 2520636a5d36SJouni Malinen 2521636a5d36SJouni Malinen /** 25227e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 25237e7c8926SBen Greear * 25247e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 2525ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 2526bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 252740cbfa90SSrinivas Dasari * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external 252840cbfa90SSrinivas Dasari * authentication capability. Drivers can offload authentication to 252940cbfa90SSrinivas Dasari * userspace if this flag is set. Only applicable for cfg80211_connect() 253040cbfa90SSrinivas Dasari * request (connect callback). 25317e7c8926SBen Greear */ 25327e7c8926SBen Greear enum cfg80211_assoc_req_flags { 25337e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 2534ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 2535bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 253640cbfa90SSrinivas Dasari CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), 25377e7c8926SBen Greear }; 25387e7c8926SBen Greear 25397e7c8926SBen Greear /** 2540636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 2541636a5d36SJouni Malinen * 2542636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 2543636a5d36SJouni Malinen * (re)association. 2544959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 2545959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 2546959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 2547959867faSJohannes Berg * association requests while already associating must be rejected. 2548636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 2549636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 2550dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 2551b23aa676SSamuel Ortiz * @crypto: crypto settings 255235eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 255335eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 255435eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 255535eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 255635eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 255735eb8f7bSJouni Malinen * frame. 25587e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 25597e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 25607e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 25617e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2562ee2aca34SJohannes Berg * @vht_capa: VHT capability override 2563ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 2564348bd456SJouni Malinen * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 2565348bd456SJouni Malinen * %NULL if FILS is not used. 2566348bd456SJouni Malinen * @fils_kek_len: Length of fils_kek in octets 2567348bd456SJouni Malinen * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 2568348bd456SJouni Malinen * Request/Response frame or %NULL if FILS is not used. This field starts 2569348bd456SJouni Malinen * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 2570d2b7588aSThomas Pedersen * @s1g_capa: S1G capability override 2571d2b7588aSThomas Pedersen * @s1g_capa_mask: S1G capability override mask 2572636a5d36SJouni Malinen */ 2573636a5d36SJouni Malinen struct cfg80211_assoc_request { 257419957bb3SJohannes Berg struct cfg80211_bss *bss; 25753e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 2576636a5d36SJouni Malinen size_t ie_len; 2577b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 257819957bb3SJohannes Berg bool use_mfp; 25797e7c8926SBen Greear u32 flags; 25807e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 25817e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2582ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 2583348bd456SJouni Malinen const u8 *fils_kek; 2584348bd456SJouni Malinen size_t fils_kek_len; 2585348bd456SJouni Malinen const u8 *fils_nonces; 2586d2b7588aSThomas Pedersen struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask; 2587636a5d36SJouni Malinen }; 2588636a5d36SJouni Malinen 2589636a5d36SJouni Malinen /** 2590636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 2591636a5d36SJouni Malinen * 2592636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 2593636a5d36SJouni Malinen * deauthentication. 2594636a5d36SJouni Malinen * 259595de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 2596636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 2597636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 259819957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 2599077f897aSJohannes Berg * @local_state_change: if set, change local state only and 2600077f897aSJohannes Berg * do not set a deauth frame 2601636a5d36SJouni Malinen */ 2602636a5d36SJouni Malinen struct cfg80211_deauth_request { 260395de817bSJohannes Berg const u8 *bssid; 2604636a5d36SJouni Malinen const u8 *ie; 2605636a5d36SJouni Malinen size_t ie_len; 260619957bb3SJohannes Berg u16 reason_code; 26076863255bSStanislaw Gruszka bool local_state_change; 2608636a5d36SJouni Malinen }; 2609636a5d36SJouni Malinen 2610636a5d36SJouni Malinen /** 2611636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 2612636a5d36SJouni Malinen * 2613636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 261466f00449SMasahiro Yamada * disassociation. 2615636a5d36SJouni Malinen * 261619957bb3SJohannes Berg * @bss: the BSS to disassociate from 2617636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 2618636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 261919957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 2620d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 2621d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 2622636a5d36SJouni Malinen */ 2623636a5d36SJouni Malinen struct cfg80211_disassoc_request { 262419957bb3SJohannes Berg struct cfg80211_bss *bss; 2625636a5d36SJouni Malinen const u8 *ie; 2626636a5d36SJouni Malinen size_t ie_len; 262719957bb3SJohannes Berg u16 reason_code; 2628d5cdfacbSJouni Malinen bool local_state_change; 2629636a5d36SJouni Malinen }; 2630636a5d36SJouni Malinen 2631636a5d36SJouni Malinen /** 263204a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 263304a773adSJohannes Berg * 263404a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 263504a773adSJohannes Berg * method. 263604a773adSJohannes Berg * 263704a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 263804a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 263904a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 264004a773adSJohannes Berg * search for IBSSs with a different BSSID. 2641683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 264204a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 264304a773adSJohannes Berg * IBSSs to join on other channels. 264404a773adSJohannes Berg * @ie: information element(s) to include in the beacon 264504a773adSJohannes Berg * @ie_len: length of that 26468e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 2647fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 2648fffd0934SJohannes Berg * after joining 2649267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 2650267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 2651267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 2652267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 2653c3bfe1f6SDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 2654c3bfe1f6SDenis Kenzior * port frames over NL80211 instead of the network interface. 26555336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 26565336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 26575336fa88SSimon Wunderlich * to operate on DFS channels. 2658fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 2659dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 2660803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2661803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 2662803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 26639ae3b172STova Mussai * @wep_keys: static WEP keys, if not NULL points to an array of 26649ae3b172STova Mussai * CFG80211_MAX_WEP_KEYS WEP keys 26659ae3b172STova Mussai * @wep_tx_key: key index (0..3) of the default TX static WEP key 266604a773adSJohannes Berg */ 266704a773adSJohannes Berg struct cfg80211_ibss_params { 2668c1e5f471SJohannes Berg const u8 *ssid; 2669c1e5f471SJohannes Berg const u8 *bssid; 2670683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 2671c1e5f471SJohannes Berg const u8 *ie; 267204a773adSJohannes Berg u8 ssid_len, ie_len; 26738e30bc55SJohannes Berg u16 beacon_interval; 2674fbd2c8dcSTeemu Paasikivi u32 basic_rates; 267504a773adSJohannes Berg bool channel_fixed; 2676fffd0934SJohannes Berg bool privacy; 2677267335d6SAntonio Quartulli bool control_port; 2678c3bfe1f6SDenis Kenzior bool control_port_over_nl80211; 26795336fa88SSimon Wunderlich bool userspace_handles_dfs; 268057fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2681803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 2682803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 26839ae3b172STova Mussai struct key_params *wep_keys; 26849ae3b172STova Mussai int wep_tx_key; 268504a773adSJohannes Berg }; 268604a773adSJohannes Berg 268704a773adSJohannes Berg /** 268838de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 268938de03d2SArend van Spriel * 269038de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 269138de03d2SArend van Spriel * @param: parameters for requestion behaviour. 269238de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 269338de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 269438de03d2SArend van Spriel */ 269538de03d2SArend van Spriel struct cfg80211_bss_selection { 269638de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 269738de03d2SArend van Spriel union { 269857fbcce3SJohannes Berg enum nl80211_band band_pref; 269938de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 270038de03d2SArend van Spriel } param; 270138de03d2SArend van Spriel }; 270238de03d2SArend van Spriel 270338de03d2SArend van Spriel /** 2704b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 2705b23aa676SSamuel Ortiz * 2706b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 2707b23aa676SSamuel Ortiz * authentication and association. 2708b23aa676SSamuel Ortiz * 2709b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 2710b23aa676SSamuel Ortiz * on scan results) 27111df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 27121df4a510SJouni Malinen * %NULL if not specified 2713b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 2714b23aa676SSamuel Ortiz * results) 27151df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 27161df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 27171df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 27181df4a510SJouni Malinen * to use. 2719b23aa676SSamuel Ortiz * @ssid: SSID 2720b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 2721b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 2722abe37c4bSJohannes Berg * @ie: IEs for association request 2723abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 2724b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 2725cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 2726b23aa676SSamuel Ortiz * @crypto: crypto settings 2727fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2728fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2729fffd0934SJohannes Berg * @key: WEP key for shared key authentication 27307e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 27314486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 27324486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 27337e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 27347e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 27357e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2736ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 2737ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 273834d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 273934d50519SLior David * networks. 274038de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 274135eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 274235eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 274335eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 274435eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 274535eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 274635eb8f7bSJouni Malinen * frame. 2747a3caf744SVidyullatha Kanchanapally * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 2748a3caf744SVidyullatha Kanchanapally * NAI or %NULL if not specified. This is used to construct FILS wrapped 2749a3caf744SVidyullatha Kanchanapally * data IE. 2750a3caf744SVidyullatha Kanchanapally * @fils_erp_username_len: Length of @fils_erp_username in octets. 2751a3caf744SVidyullatha Kanchanapally * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 2752a3caf744SVidyullatha Kanchanapally * %NULL if not specified. This specifies the domain name of ER server and 2753a3caf744SVidyullatha Kanchanapally * is used to construct FILS wrapped data IE. 2754a3caf744SVidyullatha Kanchanapally * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 2755a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 2756a3caf744SVidyullatha Kanchanapally * messages. This is also used to construct FILS wrapped data IE. 2757a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 2758a3caf744SVidyullatha Kanchanapally * keys in FILS or %NULL if not specified. 2759a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 27603a00df57SAvraham Stern * @want_1x: indicates user-space supports and wants to use 802.1X driver 27613a00df57SAvraham Stern * offload of 4-way handshake. 27622a38075cSAlexei Avshalom Lazar * @edmg: define the EDMG channels. 27632a38075cSAlexei Avshalom Lazar * This may specify multiple channels and bonding options for the driver 27642a38075cSAlexei Avshalom Lazar * to choose from, based on BSS configuration. 2765b23aa676SSamuel Ortiz */ 2766b23aa676SSamuel Ortiz struct cfg80211_connect_params { 2767b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 27681df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 2769664834deSJouni Malinen const u8 *bssid; 27701df4a510SJouni Malinen const u8 *bssid_hint; 2771664834deSJouni Malinen const u8 *ssid; 2772b23aa676SSamuel Ortiz size_t ssid_len; 2773b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 27744b5800feSJohannes Berg const u8 *ie; 2775b23aa676SSamuel Ortiz size_t ie_len; 2776b23aa676SSamuel Ortiz bool privacy; 2777cee00a95SJouni Malinen enum nl80211_mfp mfp; 2778b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 2779fffd0934SJohannes Berg const u8 *key; 2780fffd0934SJohannes Berg u8 key_len, key_idx; 27817e7c8926SBen Greear u32 flags; 27824486ea98SBala Shanmugam int bg_scan_period; 27837e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 27847e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2785ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 2786ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 278734d50519SLior David bool pbss; 278838de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 2789ba6fbacfSJouni Malinen const u8 *prev_bssid; 2790a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_username; 2791a3caf744SVidyullatha Kanchanapally size_t fils_erp_username_len; 2792a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_realm; 2793a3caf744SVidyullatha Kanchanapally size_t fils_erp_realm_len; 2794a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 2795a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_rrk; 2796a3caf744SVidyullatha Kanchanapally size_t fils_erp_rrk_len; 27973a00df57SAvraham Stern bool want_1x; 27982a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg; 2799b23aa676SSamuel Ortiz }; 2800b23aa676SSamuel Ortiz 2801b23aa676SSamuel Ortiz /** 2802088e8df8Svamsi krishna * enum cfg80211_connect_params_changed - Connection parameters being updated 2803088e8df8Svamsi krishna * 2804088e8df8Svamsi krishna * This enum provides information of all connect parameters that 2805088e8df8Svamsi krishna * have to be updated as part of update_connect_params() call. 2806088e8df8Svamsi krishna * 2807088e8df8Svamsi krishna * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 28087f9a3e15SVidyullatha Kanchanapally * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm, 28097f9a3e15SVidyullatha Kanchanapally * username, erp sequence number and rrk) are updated 28107f9a3e15SVidyullatha Kanchanapally * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated 2811088e8df8Svamsi krishna */ 2812088e8df8Svamsi krishna enum cfg80211_connect_params_changed { 2813088e8df8Svamsi krishna UPDATE_ASSOC_IES = BIT(0), 28147f9a3e15SVidyullatha Kanchanapally UPDATE_FILS_ERP_INFO = BIT(1), 28157f9a3e15SVidyullatha Kanchanapally UPDATE_AUTH_TYPE = BIT(2), 2816088e8df8Svamsi krishna }; 2817088e8df8Svamsi krishna 2818088e8df8Svamsi krishna /** 2819b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 2820abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 2821abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 2822abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 2823abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2824abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 28253057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 282652539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed 282752539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed 282852539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum 2829b9a5f8caSJouni Malinen */ 2830b9a5f8caSJouni Malinen enum wiphy_params_flags { 2831b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2832b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 2833b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 2834b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 283581077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 28363057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 283752539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_LIMIT = 1 << 6, 283852539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7, 283952539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, 2840b9a5f8caSJouni Malinen }; 2841b9a5f8caSJouni Malinen 284236647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 284336647055SToke Høiland-Jørgensen 28443ace10f5SKan Yan /* The per TXQ device queue limit in airtime */ 28453ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 28463ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 28473ace10f5SKan Yan 28483ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */ 28493ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD 24000 28503ace10f5SKan Yan 285167fbb16bSSamuel Ortiz /** 285267fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 285367fbb16bSSamuel Ortiz * 285467fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 285567fbb16bSSamuel Ortiz * caching. 285667fbb16bSSamuel Ortiz * 2857a3caf744SVidyullatha Kanchanapally * @bssid: The AP's BSSID (may be %NULL). 2858a3caf744SVidyullatha Kanchanapally * @pmkid: The identifier to refer a PMKSA. 2859a3caf744SVidyullatha Kanchanapally * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 2860a3caf744SVidyullatha Kanchanapally * derivation by a FILS STA. Otherwise, %NULL. 2861a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 2862a3caf744SVidyullatha Kanchanapally * the hash algorithm used to generate this. 2863a3caf744SVidyullatha Kanchanapally * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 2864a3caf744SVidyullatha Kanchanapally * cache identifier (may be %NULL). 2865a3caf744SVidyullatha Kanchanapally * @ssid_len: Length of the @ssid in octets. 2866a3caf744SVidyullatha Kanchanapally * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 2867a3caf744SVidyullatha Kanchanapally * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 2868a3caf744SVidyullatha Kanchanapally * %NULL). 28697fc82af8SVeerendranath Jakkam * @pmk_lifetime: Maximum lifetime for PMKSA in seconds 28707fc82af8SVeerendranath Jakkam * (dot11RSNAConfigPMKLifetime) or 0 if not specified. 28717fc82af8SVeerendranath Jakkam * The configured PMKSA must not be used for PMKSA caching after 28727fc82af8SVeerendranath Jakkam * expiration and any keys derived from this PMK become invalid on 28737fc82af8SVeerendranath Jakkam * expiration, i.e., the current association must be dropped if the PMK 28747fc82af8SVeerendranath Jakkam * used for it expires. 28757fc82af8SVeerendranath Jakkam * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of 28767fc82af8SVeerendranath Jakkam * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified. 28777fc82af8SVeerendranath Jakkam * Drivers are expected to trigger a full authentication instead of using 28787fc82af8SVeerendranath Jakkam * this PMKSA for caching when reassociating to a new BSS after this 28797fc82af8SVeerendranath Jakkam * threshold to generate a new PMK before the current one expires. 288067fbb16bSSamuel Ortiz */ 288167fbb16bSSamuel Ortiz struct cfg80211_pmksa { 2882c1e5f471SJohannes Berg const u8 *bssid; 2883c1e5f471SJohannes Berg const u8 *pmkid; 2884a3caf744SVidyullatha Kanchanapally const u8 *pmk; 2885a3caf744SVidyullatha Kanchanapally size_t pmk_len; 2886a3caf744SVidyullatha Kanchanapally const u8 *ssid; 2887a3caf744SVidyullatha Kanchanapally size_t ssid_len; 2888a3caf744SVidyullatha Kanchanapally const u8 *cache_id; 28897fc82af8SVeerendranath Jakkam u32 pmk_lifetime; 28907fc82af8SVeerendranath Jakkam u8 pmk_reauth_threshold; 289167fbb16bSSamuel Ortiz }; 28929930380fSJohannes Berg 28937643a2c3SJohannes Berg /** 289450ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 2895ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 2896ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 2897ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 2898ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 2899bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 2900ff1b6e69SJohannes Berg * 2901ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 2902ff1b6e69SJohannes Berg * memory, free @mask only! 2903ff1b6e69SJohannes Berg */ 290450ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 2905922bd80fSJohannes Berg const u8 *mask, *pattern; 2906ff1b6e69SJohannes Berg int pattern_len; 2907bb92d199SAmitkumar Karwar int pkt_offset; 2908ff1b6e69SJohannes Berg }; 2909ff1b6e69SJohannes Berg 2910ff1b6e69SJohannes Berg /** 29112a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 29122a0e047eSJohannes Berg * 29132a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 29142a0e047eSJohannes Berg * @src: source IP address 29152a0e047eSJohannes Berg * @dst: destination IP address 29162a0e047eSJohannes Berg * @dst_mac: destination MAC address 29172a0e047eSJohannes Berg * @src_port: source port 29182a0e047eSJohannes Berg * @dst_port: destination port 29192a0e047eSJohannes Berg * @payload_len: data payload length 29202a0e047eSJohannes Berg * @payload: data payload buffer 29212a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 29222a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 29232a0e047eSJohannes Berg * @wake_len: wakeup payload match length 29242a0e047eSJohannes Berg * @wake_data: wakeup payload match data 29252a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 29262a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 29272a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 29282a0e047eSJohannes Berg */ 29292a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 29302a0e047eSJohannes Berg struct socket *sock; 29312a0e047eSJohannes Berg __be32 src, dst; 29322a0e047eSJohannes Berg u16 src_port, dst_port; 29332a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 29342a0e047eSJohannes Berg int payload_len; 29352a0e047eSJohannes Berg const u8 *payload; 29362a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 29372a0e047eSJohannes Berg u32 data_interval; 29382a0e047eSJohannes Berg u32 wake_len; 29392a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 29402a0e047eSJohannes Berg u32 tokens_size; 29412a0e047eSJohannes Berg /* must be last, variable member */ 29422a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 2943ff1b6e69SJohannes Berg }; 2944ff1b6e69SJohannes Berg 2945ff1b6e69SJohannes Berg /** 2946ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 2947ff1b6e69SJohannes Berg * 2948ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 2949ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 2950ff1b6e69SJohannes Berg * operating as normal during suspend 2951ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 2952ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 2953ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 2954ff1b6e69SJohannes Berg * @n_patterns: number of patterns 295577dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 295677dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 295777dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 295877dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 29592a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 29602a0e047eSJohannes Berg * NULL if not configured. 29618cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 2962ff1b6e69SJohannes Berg */ 2963ff1b6e69SJohannes Berg struct cfg80211_wowlan { 296477dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 296577dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 296677dbbb13SJohannes Berg rfkill_release; 296750ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 29682a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 2969ff1b6e69SJohannes Berg int n_patterns; 29708cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 2971ff1b6e69SJohannes Berg }; 2972ff1b6e69SJohannes Berg 2973ff1b6e69SJohannes Berg /** 2974be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 2975be29b99aSAmitkumar Karwar * 2976be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 2977be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 2978be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 2979be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 2980be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 2981be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 2982be29b99aSAmitkumar Karwar */ 2983be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 2984be29b99aSAmitkumar Karwar int delay; 2985be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 2986be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 2987be29b99aSAmitkumar Karwar int n_patterns; 2988be29b99aSAmitkumar Karwar }; 2989be29b99aSAmitkumar Karwar 2990be29b99aSAmitkumar Karwar /** 2991be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 2992be29b99aSAmitkumar Karwar * 2993be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 2994be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 2995be29b99aSAmitkumar Karwar * @n_rules: number of rules 2996be29b99aSAmitkumar Karwar */ 2997be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 2998be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 2999be29b99aSAmitkumar Karwar int n_rules; 3000be29b99aSAmitkumar Karwar }; 3001be29b99aSAmitkumar Karwar 3002be29b99aSAmitkumar Karwar /** 30038cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 30048cd4d456SLuciano Coelho * 30058cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 30068cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 30078cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 30088cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 30098cd4d456SLuciano Coelho * occurred (in MHz) 30108cd4d456SLuciano Coelho */ 30118cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 30128cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 30138cd4d456SLuciano Coelho int n_channels; 30148cd4d456SLuciano Coelho u32 channels[]; 30158cd4d456SLuciano Coelho }; 30168cd4d456SLuciano Coelho 30178cd4d456SLuciano Coelho /** 30188cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 30198cd4d456SLuciano Coelho * 30208cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 30218cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 30228cd4d456SLuciano Coelho * match information. 30238cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 30248cd4d456SLuciano Coelho * the matches that triggered the wake up. 30258cd4d456SLuciano Coelho */ 30268cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 30278cd4d456SLuciano Coelho int n_matches; 30288cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 30298cd4d456SLuciano Coelho }; 30308cd4d456SLuciano Coelho 30318cd4d456SLuciano Coelho /** 3032cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 3033cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 3034cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 3035cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 3036cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 3037cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 3038cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 3039cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 3040cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 3041cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 3042cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 3043cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 3044cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 3045cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 3046cd8f7cb4SJohannes Berg * it is. 30472a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 30482a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 30492a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 30508cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 3051cd8f7cb4SJohannes Berg */ 3052cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 3053cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 3054cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 30552a0e047eSJohannes Berg rfkill_release, packet_80211, 30562a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 3057cd8f7cb4SJohannes Berg s32 pattern_idx; 3058cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 3059cd8f7cb4SJohannes Berg const void *packet; 30608cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 3061cd8f7cb4SJohannes Berg }; 3062cd8f7cb4SJohannes Berg 3063cd8f7cb4SJohannes Berg /** 3064e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 3065093a48d2SNathan Errera * @kek: key encryption key (@kek_len bytes) 3066093a48d2SNathan Errera * @kck: key confirmation key (@kck_len bytes) 306778f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 3068093a48d2SNathan Errera * @kek_len: length of kek 3069093a48d2SNathan Errera * @kck_len length of kck 3070093a48d2SNathan Errera * @akm: akm (oui, id) 3071e5497d76SJohannes Berg */ 3072e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 307378f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 3074093a48d2SNathan Errera u32 akm; 3075093a48d2SNathan Errera u8 kek_len, kck_len; 3076e5497d76SJohannes Berg }; 3077e5497d76SJohannes Berg 3078e5497d76SJohannes Berg /** 3079355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 3080355199e0SJouni Malinen * 3081355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 3082355199e0SJouni Malinen * 3083355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 3084355199e0SJouni Malinen * @ie: Fast Transition IEs 3085355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 3086355199e0SJouni Malinen */ 3087355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 3088355199e0SJouni Malinen u16 md; 3089355199e0SJouni Malinen const u8 *ie; 3090355199e0SJouni Malinen size_t ie_len; 3091355199e0SJouni Malinen }; 3092355199e0SJouni Malinen 3093355199e0SJouni Malinen /** 3094b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 3095b176e629SAndrei Otcheretianski * 3096b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 3097b176e629SAndrei Otcheretianski * 3098b176e629SAndrei Otcheretianski * @chan: channel to use 3099b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 3100b176e629SAndrei Otcheretianski * @wait: duration for ROC 3101b176e629SAndrei Otcheretianski * @buf: buffer to transmit 3102b176e629SAndrei Otcheretianski * @len: buffer length 3103b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 3104b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 310534d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 310634d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 3107b176e629SAndrei Otcheretianski */ 3108b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 3109b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 3110b176e629SAndrei Otcheretianski bool offchan; 3111b176e629SAndrei Otcheretianski unsigned int wait; 3112b176e629SAndrei Otcheretianski const u8 *buf; 3113b176e629SAndrei Otcheretianski size_t len; 3114b176e629SAndrei Otcheretianski bool no_cck; 3115b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 311634d22ce2SAndrei Otcheretianski int n_csa_offsets; 311734d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 3118b176e629SAndrei Otcheretianski }; 3119b176e629SAndrei Otcheretianski 3120b176e629SAndrei Otcheretianski /** 3121fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 3122fa9ffc74SKyeyoon Park * 3123fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 3124fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 3125fa9ffc74SKyeyoon Park */ 3126fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 3127fa9ffc74SKyeyoon Park u8 dscp; 3128fa9ffc74SKyeyoon Park u8 up; 3129fa9ffc74SKyeyoon Park }; 3130fa9ffc74SKyeyoon Park 3131fa9ffc74SKyeyoon Park /** 3132fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 3133fa9ffc74SKyeyoon Park * 3134fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 3135fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 3136fa9ffc74SKyeyoon Park */ 3137fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 3138fa9ffc74SKyeyoon Park u8 low; 3139fa9ffc74SKyeyoon Park u8 high; 3140fa9ffc74SKyeyoon Park }; 3141fa9ffc74SKyeyoon Park 3142fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 3143fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 3144fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 3145fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 3146fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 3147fa9ffc74SKyeyoon Park 3148fa9ffc74SKyeyoon Park /** 3149fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 3150fa9ffc74SKyeyoon Park * 3151fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 3152fa9ffc74SKyeyoon Park * 3153fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 3154fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 3155fa9ffc74SKyeyoon Park * the user priority DSCP range definition 3156fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 3157fa9ffc74SKyeyoon Park */ 3158fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 3159fa9ffc74SKyeyoon Park u8 num_des; 3160fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 3161fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 3162fa9ffc74SKyeyoon Park }; 3163fa9ffc74SKyeyoon Park 3164fa9ffc74SKyeyoon Park /** 3165cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 3166cb3b7d87SAyala Beker * 3167cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 3168cb3b7d87SAyala Beker * 3169cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 31708585989dSLuca Coelho * @bands: operating bands, a bitmap of &enum nl80211_band values. 31718585989dSLuca Coelho * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 31728585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 3173cb3b7d87SAyala Beker */ 3174cb3b7d87SAyala Beker struct cfg80211_nan_conf { 3175cb3b7d87SAyala Beker u8 master_pref; 31768585989dSLuca Coelho u8 bands; 3177cb3b7d87SAyala Beker }; 3178cb3b7d87SAyala Beker 3179cb3b7d87SAyala Beker /** 3180a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 3181a5a9dcf2SAyala Beker * configuration 3182a5a9dcf2SAyala Beker * 3183a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 31848585989dSLuca Coelho * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 3185a5a9dcf2SAyala Beker */ 3186a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 3187a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 31888585989dSLuca Coelho CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 3189a5a9dcf2SAyala Beker }; 3190a5a9dcf2SAyala Beker 3191a5a9dcf2SAyala Beker /** 3192a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 3193a442b761SAyala Beker * 3194a442b761SAyala Beker * @filter: the content of the filter 3195a442b761SAyala Beker * @len: the length of the filter 3196a442b761SAyala Beker */ 3197a442b761SAyala Beker struct cfg80211_nan_func_filter { 3198a442b761SAyala Beker const u8 *filter; 3199a442b761SAyala Beker u8 len; 3200a442b761SAyala Beker }; 3201a442b761SAyala Beker 3202a442b761SAyala Beker /** 3203a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 3204a442b761SAyala Beker * 3205a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 3206a442b761SAyala Beker * @service_id: the service ID of the function 3207a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 3208a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 3209a442b761SAyala Beker * implementation specific. 3210a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 3211a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 3212a442b761SAyala Beker * @followup_id: the instance ID for follow up 3213a442b761SAyala Beker * @followup_reqid: the requestor instance ID for follow up 3214a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 3215a442b761SAyala Beker * @ttl: time to live counter in DW. 3216a442b761SAyala Beker * @serv_spec_info: Service Specific Info 3217a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 3218a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 3219a442b761SAyala Beker * @srf_bf: Bloom Filter 3220a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 3221a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 3222a442b761SAyala Beker * @srf_macs: SRF MAC addresses 3223a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 3224a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 3225a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 3226a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 3227a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 3228a442b761SAyala Beker * @instance_id: driver allocated id of the function. 3229a442b761SAyala Beker * @cookie: unique NAN function identifier. 3230a442b761SAyala Beker */ 3231a442b761SAyala Beker struct cfg80211_nan_func { 3232a442b761SAyala Beker enum nl80211_nan_function_type type; 3233a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 3234a442b761SAyala Beker u8 publish_type; 3235a442b761SAyala Beker bool close_range; 3236a442b761SAyala Beker bool publish_bcast; 3237a442b761SAyala Beker bool subscribe_active; 3238a442b761SAyala Beker u8 followup_id; 3239a442b761SAyala Beker u8 followup_reqid; 3240a442b761SAyala Beker struct mac_address followup_dest; 3241a442b761SAyala Beker u32 ttl; 3242a442b761SAyala Beker const u8 *serv_spec_info; 3243a442b761SAyala Beker u8 serv_spec_info_len; 3244a442b761SAyala Beker bool srf_include; 3245a442b761SAyala Beker const u8 *srf_bf; 3246a442b761SAyala Beker u8 srf_bf_len; 3247a442b761SAyala Beker u8 srf_bf_idx; 3248a442b761SAyala Beker struct mac_address *srf_macs; 3249a442b761SAyala Beker int srf_num_macs; 3250a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 3251a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 3252a442b761SAyala Beker u8 num_tx_filters; 3253a442b761SAyala Beker u8 num_rx_filters; 3254a442b761SAyala Beker u8 instance_id; 3255a442b761SAyala Beker u64 cookie; 3256a442b761SAyala Beker }; 3257a442b761SAyala Beker 3258a442b761SAyala Beker /** 32593a00df57SAvraham Stern * struct cfg80211_pmk_conf - PMK configuration 32603a00df57SAvraham Stern * 32613a00df57SAvraham Stern * @aa: authenticator address 32623a00df57SAvraham Stern * @pmk_len: PMK length in bytes. 32633a00df57SAvraham Stern * @pmk: the PMK material 32643a00df57SAvraham Stern * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK 32653a00df57SAvraham Stern * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field 32663a00df57SAvraham Stern * holds PMK-R0. 32673a00df57SAvraham Stern */ 32683a00df57SAvraham Stern struct cfg80211_pmk_conf { 32693a00df57SAvraham Stern const u8 *aa; 32703a00df57SAvraham Stern u8 pmk_len; 32713a00df57SAvraham Stern const u8 *pmk; 32723a00df57SAvraham Stern const u8 *pmk_r0_name; 32733a00df57SAvraham Stern }; 32743a00df57SAvraham Stern 32753a00df57SAvraham Stern /** 327640cbfa90SSrinivas Dasari * struct cfg80211_external_auth_params - Trigger External authentication. 327740cbfa90SSrinivas Dasari * 327840cbfa90SSrinivas Dasari * Commonly used across the external auth request and event interfaces. 327940cbfa90SSrinivas Dasari * 328040cbfa90SSrinivas Dasari * @action: action type / trigger for external authentication. Only significant 328140cbfa90SSrinivas Dasari * for the authentication request event interface (driver to user space). 328240cbfa90SSrinivas Dasari * @bssid: BSSID of the peer with which the authentication has 328340cbfa90SSrinivas Dasari * to happen. Used by both the authentication request event and 328440cbfa90SSrinivas Dasari * authentication response command interface. 328540cbfa90SSrinivas Dasari * @ssid: SSID of the AP. Used by both the authentication request event and 328640cbfa90SSrinivas Dasari * authentication response command interface. 328740cbfa90SSrinivas Dasari * @key_mgmt_suite: AKM suite of the respective authentication. Used by the 328840cbfa90SSrinivas Dasari * authentication request event interface. 328940cbfa90SSrinivas Dasari * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication, 329040cbfa90SSrinivas Dasari * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you 329140cbfa90SSrinivas Dasari * the real status code for failures. Used only for the authentication 329240cbfa90SSrinivas Dasari * response command interface (user space to driver). 3293fe494370SSrinivas Dasari * @pmkid: The identifier to refer a PMKSA. 329440cbfa90SSrinivas Dasari */ 329540cbfa90SSrinivas Dasari struct cfg80211_external_auth_params { 329640cbfa90SSrinivas Dasari enum nl80211_external_auth_action action; 329740cbfa90SSrinivas Dasari u8 bssid[ETH_ALEN] __aligned(2); 329840cbfa90SSrinivas Dasari struct cfg80211_ssid ssid; 329940cbfa90SSrinivas Dasari unsigned int key_mgmt_suite; 330040cbfa90SSrinivas Dasari u16 status; 3301fe494370SSrinivas Dasari const u8 *pmkid; 330240cbfa90SSrinivas Dasari }; 330340cbfa90SSrinivas Dasari 330440cbfa90SSrinivas Dasari /** 33053453de98SRandy Dunlap * struct cfg80211_ftm_responder_stats - FTM responder statistics 330681e54d08SPradeep Kumar Chitrapu * 330781e54d08SPradeep Kumar Chitrapu * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to 330881e54d08SPradeep Kumar Chitrapu * indicate the relevant values in this struct for them 330981e54d08SPradeep Kumar Chitrapu * @success_num: number of FTM sessions in which all frames were successfully 331081e54d08SPradeep Kumar Chitrapu * answered 331181e54d08SPradeep Kumar Chitrapu * @partial_num: number of FTM sessions in which part of frames were 331281e54d08SPradeep Kumar Chitrapu * successfully answered 331381e54d08SPradeep Kumar Chitrapu * @failed_num: number of failed FTM sessions 331481e54d08SPradeep Kumar Chitrapu * @asap_num: number of ASAP FTM sessions 331581e54d08SPradeep Kumar Chitrapu * @non_asap_num: number of non-ASAP FTM sessions 331681e54d08SPradeep Kumar Chitrapu * @total_duration_ms: total sessions durations - gives an indication 331781e54d08SPradeep Kumar Chitrapu * of how much time the responder was busy 331881e54d08SPradeep Kumar Chitrapu * @unknown_triggers_num: number of unknown FTM triggers - triggers from 331981e54d08SPradeep Kumar Chitrapu * initiators that didn't finish successfully the negotiation phase with 332081e54d08SPradeep Kumar Chitrapu * the responder 332181e54d08SPradeep Kumar Chitrapu * @reschedule_requests_num: number of FTM reschedule requests - initiator asks 332281e54d08SPradeep Kumar Chitrapu * for a new scheduling although it already has scheduled FTM slot 332381e54d08SPradeep Kumar Chitrapu * @out_of_window_triggers_num: total FTM triggers out of scheduled window 332481e54d08SPradeep Kumar Chitrapu */ 332581e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats { 332681e54d08SPradeep Kumar Chitrapu u32 filled; 332781e54d08SPradeep Kumar Chitrapu u32 success_num; 332881e54d08SPradeep Kumar Chitrapu u32 partial_num; 332981e54d08SPradeep Kumar Chitrapu u32 failed_num; 333081e54d08SPradeep Kumar Chitrapu u32 asap_num; 333181e54d08SPradeep Kumar Chitrapu u32 non_asap_num; 333281e54d08SPradeep Kumar Chitrapu u64 total_duration_ms; 333381e54d08SPradeep Kumar Chitrapu u32 unknown_triggers_num; 333481e54d08SPradeep Kumar Chitrapu u32 reschedule_requests_num; 333581e54d08SPradeep Kumar Chitrapu u32 out_of_window_triggers_num; 333681e54d08SPradeep Kumar Chitrapu }; 333781e54d08SPradeep Kumar Chitrapu 333881e54d08SPradeep Kumar Chitrapu /** 33399bb7e0f2SJohannes Berg * struct cfg80211_pmsr_ftm_result - FTM result 33409bb7e0f2SJohannes Berg * @failure_reason: if this measurement failed (PMSR status is 33419bb7e0f2SJohannes Berg * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise 33429bb7e0f2SJohannes Berg * reason than just "failure" 33439bb7e0f2SJohannes Berg * @burst_index: if reporting partial results, this is the index 33449bb7e0f2SJohannes Berg * in [0 .. num_bursts-1] of the burst that's being reported 33459bb7e0f2SJohannes Berg * @num_ftmr_attempts: number of FTM request frames transmitted 33469bb7e0f2SJohannes Berg * @num_ftmr_successes: number of FTM request frames acked 33479bb7e0f2SJohannes Berg * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY, 33489bb7e0f2SJohannes Berg * fill this to indicate in how many seconds a retry is deemed possible 33499bb7e0f2SJohannes Berg * by the responder 33509bb7e0f2SJohannes Berg * @num_bursts_exp: actual number of bursts exponent negotiated 33519bb7e0f2SJohannes Berg * @burst_duration: actual burst duration negotiated 33529bb7e0f2SJohannes Berg * @ftms_per_burst: actual FTMs per burst negotiated 33539bb7e0f2SJohannes Berg * @lci_len: length of LCI information (if present) 33549bb7e0f2SJohannes Berg * @civicloc_len: length of civic location information (if present) 33559bb7e0f2SJohannes Berg * @lci: LCI data (may be %NULL) 33569bb7e0f2SJohannes Berg * @civicloc: civic location data (may be %NULL) 33579bb7e0f2SJohannes Berg * @rssi_avg: average RSSI over FTM action frames reported 33589bb7e0f2SJohannes Berg * @rssi_spread: spread of the RSSI over FTM action frames reported 33599bb7e0f2SJohannes Berg * @tx_rate: bitrate for transmitted FTM action frame response 33609bb7e0f2SJohannes Berg * @rx_rate: bitrate of received FTM action frame 33619bb7e0f2SJohannes Berg * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) 33629bb7e0f2SJohannes Berg * @rtt_variance: variance of RTTs measured (note that standard deviation is 33639bb7e0f2SJohannes Berg * the square root of the variance) 33649bb7e0f2SJohannes Berg * @rtt_spread: spread of the RTTs measured 33659bb7e0f2SJohannes Berg * @dist_avg: average of distances (mm) measured 33669bb7e0f2SJohannes Berg * (must have either this or @rtt_avg) 33679bb7e0f2SJohannes Berg * @dist_variance: variance of distances measured (see also @rtt_variance) 33689bb7e0f2SJohannes Berg * @dist_spread: spread of distances measured (see also @rtt_spread) 33699bb7e0f2SJohannes Berg * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid 33709bb7e0f2SJohannes Berg * @num_ftmr_successes_valid: @num_ftmr_successes is valid 33719bb7e0f2SJohannes Berg * @rssi_avg_valid: @rssi_avg is valid 33729bb7e0f2SJohannes Berg * @rssi_spread_valid: @rssi_spread is valid 33739bb7e0f2SJohannes Berg * @tx_rate_valid: @tx_rate is valid 33749bb7e0f2SJohannes Berg * @rx_rate_valid: @rx_rate is valid 33759bb7e0f2SJohannes Berg * @rtt_avg_valid: @rtt_avg is valid 33769bb7e0f2SJohannes Berg * @rtt_variance_valid: @rtt_variance is valid 33779bb7e0f2SJohannes Berg * @rtt_spread_valid: @rtt_spread is valid 33789bb7e0f2SJohannes Berg * @dist_avg_valid: @dist_avg is valid 33799bb7e0f2SJohannes Berg * @dist_variance_valid: @dist_variance is valid 33809bb7e0f2SJohannes Berg * @dist_spread_valid: @dist_spread is valid 33819bb7e0f2SJohannes Berg */ 33829bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result { 33839bb7e0f2SJohannes Berg const u8 *lci; 33849bb7e0f2SJohannes Berg const u8 *civicloc; 33859bb7e0f2SJohannes Berg unsigned int lci_len; 33869bb7e0f2SJohannes Berg unsigned int civicloc_len; 33879bb7e0f2SJohannes Berg enum nl80211_peer_measurement_ftm_failure_reasons failure_reason; 33889bb7e0f2SJohannes Berg u32 num_ftmr_attempts, num_ftmr_successes; 33899bb7e0f2SJohannes Berg s16 burst_index; 33909bb7e0f2SJohannes Berg u8 busy_retry_time; 33919bb7e0f2SJohannes Berg u8 num_bursts_exp; 33929bb7e0f2SJohannes Berg u8 burst_duration; 33939bb7e0f2SJohannes Berg u8 ftms_per_burst; 33949bb7e0f2SJohannes Berg s32 rssi_avg; 33959bb7e0f2SJohannes Berg s32 rssi_spread; 33969bb7e0f2SJohannes Berg struct rate_info tx_rate, rx_rate; 33979bb7e0f2SJohannes Berg s64 rtt_avg; 33989bb7e0f2SJohannes Berg s64 rtt_variance; 33999bb7e0f2SJohannes Berg s64 rtt_spread; 34009bb7e0f2SJohannes Berg s64 dist_avg; 34019bb7e0f2SJohannes Berg s64 dist_variance; 34029bb7e0f2SJohannes Berg s64 dist_spread; 34039bb7e0f2SJohannes Berg 34049bb7e0f2SJohannes Berg u16 num_ftmr_attempts_valid:1, 34059bb7e0f2SJohannes Berg num_ftmr_successes_valid:1, 34069bb7e0f2SJohannes Berg rssi_avg_valid:1, 34079bb7e0f2SJohannes Berg rssi_spread_valid:1, 34089bb7e0f2SJohannes Berg tx_rate_valid:1, 34099bb7e0f2SJohannes Berg rx_rate_valid:1, 34109bb7e0f2SJohannes Berg rtt_avg_valid:1, 34119bb7e0f2SJohannes Berg rtt_variance_valid:1, 34129bb7e0f2SJohannes Berg rtt_spread_valid:1, 34139bb7e0f2SJohannes Berg dist_avg_valid:1, 34149bb7e0f2SJohannes Berg dist_variance_valid:1, 34159bb7e0f2SJohannes Berg dist_spread_valid:1; 34169bb7e0f2SJohannes Berg }; 34179bb7e0f2SJohannes Berg 34189bb7e0f2SJohannes Berg /** 34199bb7e0f2SJohannes Berg * struct cfg80211_pmsr_result - peer measurement result 34209bb7e0f2SJohannes Berg * @addr: address of the peer 34219bb7e0f2SJohannes Berg * @host_time: host time (use ktime_get_boottime() adjust to the time when the 34229bb7e0f2SJohannes Berg * measurement was made) 34239bb7e0f2SJohannes Berg * @ap_tsf: AP's TSF at measurement time 34249bb7e0f2SJohannes Berg * @status: status of the measurement 34259bb7e0f2SJohannes Berg * @final: if reporting partial results, mark this as the last one; if not 34269bb7e0f2SJohannes Berg * reporting partial results always set this flag 34279bb7e0f2SJohannes Berg * @ap_tsf_valid: indicates the @ap_tsf value is valid 34289bb7e0f2SJohannes Berg * @type: type of the measurement reported, note that we only support reporting 34299bb7e0f2SJohannes Berg * one type at a time, but you can report multiple results separately and 34309bb7e0f2SJohannes Berg * they're all aggregated for userspace. 34319bb7e0f2SJohannes Berg */ 34329bb7e0f2SJohannes Berg struct cfg80211_pmsr_result { 34339bb7e0f2SJohannes Berg u64 host_time, ap_tsf; 34349bb7e0f2SJohannes Berg enum nl80211_peer_measurement_status status; 34359bb7e0f2SJohannes Berg 34369bb7e0f2SJohannes Berg u8 addr[ETH_ALEN]; 34379bb7e0f2SJohannes Berg 34389bb7e0f2SJohannes Berg u8 final:1, 34399bb7e0f2SJohannes Berg ap_tsf_valid:1; 34409bb7e0f2SJohannes Berg 34419bb7e0f2SJohannes Berg enum nl80211_peer_measurement_type type; 34429bb7e0f2SJohannes Berg 34439bb7e0f2SJohannes Berg union { 34449bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result ftm; 34459bb7e0f2SJohannes Berg }; 34469bb7e0f2SJohannes Berg }; 34479bb7e0f2SJohannes Berg 34489bb7e0f2SJohannes Berg /** 34499bb7e0f2SJohannes Berg * struct cfg80211_pmsr_ftm_request_peer - FTM request data 34509bb7e0f2SJohannes Berg * @requested: indicates FTM is requested 34519bb7e0f2SJohannes Berg * @preamble: frame preamble to use 34529bb7e0f2SJohannes Berg * @burst_period: burst period to use 34539bb7e0f2SJohannes Berg * @asap: indicates to use ASAP mode 34549bb7e0f2SJohannes Berg * @num_bursts_exp: number of bursts exponent 34559bb7e0f2SJohannes Berg * @burst_duration: burst duration 34569bb7e0f2SJohannes Berg * @ftms_per_burst: number of FTMs per burst 34579bb7e0f2SJohannes Berg * @ftmr_retries: number of retries for FTM request 34589bb7e0f2SJohannes Berg * @request_lci: request LCI information 34599bb7e0f2SJohannes Berg * @request_civicloc: request civic location information 3460efb5520dSAvraham Stern * @trigger_based: use trigger based ranging for the measurement 3461efb5520dSAvraham Stern * If neither @trigger_based nor @non_trigger_based is set, 3462efb5520dSAvraham Stern * EDCA based ranging will be used. 3463efb5520dSAvraham Stern * @non_trigger_based: use non trigger based ranging for the measurement 3464efb5520dSAvraham Stern * If neither @trigger_based nor @non_trigger_based is set, 3465efb5520dSAvraham Stern * EDCA based ranging will be used. 34669bb7e0f2SJohannes Berg * 34679bb7e0f2SJohannes Berg * See also nl80211 for the respective attribute documentation. 34689bb7e0f2SJohannes Berg */ 34699bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer { 34709bb7e0f2SJohannes Berg enum nl80211_preamble preamble; 34719bb7e0f2SJohannes Berg u16 burst_period; 34729bb7e0f2SJohannes Berg u8 requested:1, 34739bb7e0f2SJohannes Berg asap:1, 34749bb7e0f2SJohannes Berg request_lci:1, 3475efb5520dSAvraham Stern request_civicloc:1, 3476efb5520dSAvraham Stern trigger_based:1, 3477efb5520dSAvraham Stern non_trigger_based:1; 34789bb7e0f2SJohannes Berg u8 num_bursts_exp; 34799bb7e0f2SJohannes Berg u8 burst_duration; 34809bb7e0f2SJohannes Berg u8 ftms_per_burst; 34819bb7e0f2SJohannes Berg u8 ftmr_retries; 34829bb7e0f2SJohannes Berg }; 34839bb7e0f2SJohannes Berg 34849bb7e0f2SJohannes Berg /** 34859bb7e0f2SJohannes Berg * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request 34869bb7e0f2SJohannes Berg * @addr: MAC address 34879bb7e0f2SJohannes Berg * @chandef: channel to use 34889bb7e0f2SJohannes Berg * @report_ap_tsf: report the associated AP's TSF 34899bb7e0f2SJohannes Berg * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer 34909bb7e0f2SJohannes Berg */ 34919bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer { 34929bb7e0f2SJohannes Berg u8 addr[ETH_ALEN]; 34939bb7e0f2SJohannes Berg struct cfg80211_chan_def chandef; 34949bb7e0f2SJohannes Berg u8 report_ap_tsf:1; 34959bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer ftm; 34969bb7e0f2SJohannes Berg }; 34979bb7e0f2SJohannes Berg 34989bb7e0f2SJohannes Berg /** 34999bb7e0f2SJohannes Berg * struct cfg80211_pmsr_request - peer measurement request 35009bb7e0f2SJohannes Berg * @cookie: cookie, set by cfg80211 35019bb7e0f2SJohannes Berg * @nl_portid: netlink portid - used by cfg80211 35029bb7e0f2SJohannes Berg * @drv_data: driver data for this request, if required for aborting, 35039bb7e0f2SJohannes Berg * not otherwise freed or anything by cfg80211 35049bb7e0f2SJohannes Berg * @mac_addr: MAC address used for (randomised) request 35059bb7e0f2SJohannes Berg * @mac_addr_mask: MAC address mask used for randomisation, bits that 35069bb7e0f2SJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 35079bb7e0f2SJohannes Berg * be taken from the @mac_addr 35089bb7e0f2SJohannes Berg * @list: used by cfg80211 to hold on to the request 35099bb7e0f2SJohannes Berg * @timeout: timeout (in milliseconds) for the whole operation, if 35109bb7e0f2SJohannes Berg * zero it means there's no timeout 35119bb7e0f2SJohannes Berg * @n_peers: number of peers to do measurements with 35129bb7e0f2SJohannes Berg * @peers: per-peer measurement request data 35139bb7e0f2SJohannes Berg */ 35149bb7e0f2SJohannes Berg struct cfg80211_pmsr_request { 35159bb7e0f2SJohannes Berg u64 cookie; 35169bb7e0f2SJohannes Berg void *drv_data; 35179bb7e0f2SJohannes Berg u32 n_peers; 35189bb7e0f2SJohannes Berg u32 nl_portid; 35199bb7e0f2SJohannes Berg 35209bb7e0f2SJohannes Berg u32 timeout; 35219bb7e0f2SJohannes Berg 35229bb7e0f2SJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 35239bb7e0f2SJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 35249bb7e0f2SJohannes Berg 35259bb7e0f2SJohannes Berg struct list_head list; 35269bb7e0f2SJohannes Berg 35279bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer peers[]; 35289bb7e0f2SJohannes Berg }; 35299bb7e0f2SJohannes Berg 35309bb7e0f2SJohannes Berg /** 3531cb74e977SSunil Dutt * struct cfg80211_update_owe_info - OWE Information 3532cb74e977SSunil Dutt * 3533cb74e977SSunil Dutt * This structure provides information needed for the drivers to offload OWE 3534cb74e977SSunil Dutt * (Opportunistic Wireless Encryption) processing to the user space. 3535cb74e977SSunil Dutt * 3536cb74e977SSunil Dutt * Commonly used across update_owe_info request and event interfaces. 3537cb74e977SSunil Dutt * 3538cb74e977SSunil Dutt * @peer: MAC address of the peer device for which the OWE processing 3539cb74e977SSunil Dutt * has to be done. 3540cb74e977SSunil Dutt * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info 3541cb74e977SSunil Dutt * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space 3542cb74e977SSunil Dutt * cannot give you the real status code for failures. Used only for 3543cb74e977SSunil Dutt * OWE update request command interface (user space to driver). 3544cb74e977SSunil Dutt * @ie: IEs obtained from the peer or constructed by the user space. These are 3545cb74e977SSunil Dutt * the IEs of the remote peer in the event from the host driver and 3546cb74e977SSunil Dutt * the constructed IEs by the user space in the request interface. 3547cb74e977SSunil Dutt * @ie_len: Length of IEs in octets. 3548cb74e977SSunil Dutt */ 3549cb74e977SSunil Dutt struct cfg80211_update_owe_info { 3550cb74e977SSunil Dutt u8 peer[ETH_ALEN] __aligned(2); 3551cb74e977SSunil Dutt u16 status; 3552cb74e977SSunil Dutt const u8 *ie; 3553cb74e977SSunil Dutt size_t ie_len; 3554cb74e977SSunil Dutt }; 3555cb74e977SSunil Dutt 3556cb74e977SSunil Dutt /** 35576cd536feSJohannes Berg * struct mgmt_frame_regs - management frame registrations data 35586cd536feSJohannes Berg * @global_stypes: bitmap of management frame subtypes registered 35596cd536feSJohannes Berg * for the entire device 35606cd536feSJohannes Berg * @interface_stypes: bitmap of management frame subtypes registered 35616cd536feSJohannes Berg * for the given interface 35629dba48a6SJohannes Berg * @global_mcast_rx: mcast RX is needed globally for these subtypes 35639dba48a6SJohannes Berg * @interface_mcast_stypes: mcast RX is needed on this interface 35649dba48a6SJohannes Berg * for these subtypes 35656cd536feSJohannes Berg */ 35666cd536feSJohannes Berg struct mgmt_frame_regs { 35676cd536feSJohannes Berg u32 global_stypes, interface_stypes; 35689dba48a6SJohannes Berg u32 global_mcast_stypes, interface_mcast_stypes; 35696cd536feSJohannes Berg }; 35706cd536feSJohannes Berg 35716cd536feSJohannes Berg /** 3572704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 3573704232c2SJohannes Berg * 3574704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 3575704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 3576704232c2SJohannes Berg * 3577704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 3578704232c2SJohannes Berg * on success or a negative error code. 3579704232c2SJohannes Berg * 358043fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 358143fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 358243fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 358343fb45cbSJohannes Berg * 3584ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 3585ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 3586ff1b6e69SJohannes Berg * configured for the device. 35870378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 35886d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 35896d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 35906d52563fSJohannes Berg * the device. 35910378b3f1SJohannes Berg * 359260719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 3593463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 359484efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 359598104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 359698104fdeSJohannes Berg * also set the address member in the wdev. 3597704232c2SJohannes Berg * 359884efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 359955682965SJohannes Berg * 360060719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 360160719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 360255682965SJohannes Berg * 360341ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 360441ade00fSJohannes Berg * when adding a group key. 360541ade00fSJohannes Berg * 360641ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 360741ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 360841ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 3609e3da574aSJohannes Berg * after it returns. This function should return an error if it is 3610e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 361141ade00fSJohannes Berg * 361241ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 3613e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 361441ade00fSJohannes Berg * 361541ade00fSJohannes Berg * @set_default_key: set the default key on an interface 3616ed1b6cc7SJohannes Berg * 36173cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 36181f7e9f46SJohannes Berg * 361956be393fSJouni Malinen * @set_default_beacon_key: set the default Beacon frame key on an interface 36203cfcf6acSJouni Malinen * 3621e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 3622e5497d76SJohannes Berg * 3623c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 3624c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 3625c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 3626c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 36275727ef1bSJohannes Berg * 36285727ef1bSJohannes Berg * @add_station: Add a new station. 362989c771e5SJouni Malinen * @del_station: Remove a station 3630bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 3631bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 3632bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 363377ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 363477ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 3635abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 3636abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 3637abe37c4bSJohannes Berg * 3638abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 3639abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 3640abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 3641abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 3642abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 364366be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 364466be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 3645f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 36468d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3647f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 36488d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 36492ec600d6SLuis Carlos Cobo * 365024bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 365193da9cc1Scolin@cozybit.com * 365224bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 365393da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 365493da9cc1Scolin@cozybit.com * set, and which to leave alone. 365593da9cc1Scolin@cozybit.com * 36569f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 365731888487SJouni Malinen * 365831888487SJouni Malinen * @set_txq_params: Set TX queue parameters 365972bdcf34SJouni Malinen * 3660e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 3661e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 3662e8c9bd5bSJohannes Berg * join the mesh instead. 3663e8c9bd5bSJohannes Berg * 3664e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 3665e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 3666e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 3667e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 36689aed3cc1SJouni Malinen * 36692a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 36702a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 36712a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 36722a519311SJohannes Berg * the scan/scan_done bracket too. 367391d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 367491d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 3675636a5d36SJouni Malinen * 3676636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 36778d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3678636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 36798d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3680636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 36818d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3682636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 36838d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 368404a773adSJohannes Berg * 3685b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 3686bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 3687bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 3688bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 3689bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 3690bf1ecd21SJouni Malinen * was received. 3691bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 3692bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 3693bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 3694bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 3695bf1ecd21SJouni Malinen * frame instead of Association Request frame. 3696bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 3697bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 369835eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 3699bf1ecd21SJouni Malinen * indication of requesting reassociation. 3700bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 3701bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 370229ce6ecbSAvraham Stern * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 3703088e8df8Svamsi krishna * @update_connect_params: Update the connect parameters while connected to a 3704088e8df8Svamsi krishna * BSS. The updated parameters can be used by driver/firmware for 3705088e8df8Svamsi krishna * subsequent BSS selection (roaming) decisions and to form the 3706088e8df8Svamsi krishna * Authentication/(Re)Association Request frames. This call does not 3707088e8df8Svamsi krishna * request an immediate disassociation or reassociation with the current 3708088e8df8Svamsi krishna * BSS, i.e., this impacts only subsequent (re)associations. The bits in 3709088e8df8Svamsi krishna * changed are defined in &enum cfg80211_connect_params_changed. 3710088e8df8Svamsi krishna * (invoked with the wireless_dev mutex held) 37110711d638SIlan Peer * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 37120711d638SIlan Peer * connection is in progress. Once done, call cfg80211_disconnected() in 37130711d638SIlan Peer * case connection was already established (invoked with the 37140711d638SIlan Peer * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 3715b23aa676SSamuel Ortiz * 371604a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 371704a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 371804a773adSJohannes Berg * to a merge. 37198d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 372004a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 37218d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3722b9a5f8caSJouni Malinen * 3723f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 3724f4e583c8SAntonio Quartulli * MESH mode) 3725f4e583c8SAntonio Quartulli * 3726b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 3727b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 3728b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 3729b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 37307643a2c3SJohannes Berg * 37311432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 3732c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 3733c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 3734c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 3735c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 37367643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 37371f87f7d3SJohannes Berg * return 0 if successful 37381f87f7d3SJohannes Berg * 3739abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 3740abe37c4bSJohannes Berg * 37411f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 37421f87f7d3SJohannes Berg * functions to adjust rfkill hw state 3743aff89a9bSJohannes Berg * 374461fa713cSHolger Schurig * @dump_survey: get site survey information. 374561fa713cSHolger Schurig * 37469588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 37479588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 37489588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 37499588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 37509588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 37519588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 37529588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 37539588bbd5SJouni Malinen * the duration value. 3754f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 3755f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 3756f7ca38dfSJohannes Berg * frame on another channel 37579588bbd5SJouni Malinen * 3758fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 375971063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 376071063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 376171063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 376271063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 376371063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 376471063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 376567fbb16bSSamuel Ortiz * 3766abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 3767abe37c4bSJohannes Berg * 376867fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 376967fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 377067fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 377167fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 377267fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 37739043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 37749043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 3775d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 3776e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 3777e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 3778e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 3779e86abc68SJohannes Berg * disabled.) 37804a4b8169SAndrew Zaborowski * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 37814a4b8169SAndrew Zaborowski * connection quality monitor. An event is to be sent only when the 37824a4b8169SAndrew Zaborowski * signal level is found to be outside the two values. The driver should 37834a4b8169SAndrew Zaborowski * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 37844a4b8169SAndrew Zaborowski * If it is provided then there's no point providing @set_cqm_rssi_config. 378584f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 378684f10708SThomas Pedersen * thresholds. 3787807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 37883a3ecf1dSArend Van Spriel * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 37893a3ecf1dSArend Van Spriel * given request id. This call must stop the scheduled scan and be ready 37903a3ecf1dSArend Van Spriel * for starting a new one before it returns, i.e. @sched_scan_start may be 37913a3ecf1dSArend Van Spriel * called immediately after that again and should not fail in that case. 37923a3ecf1dSArend Van Spriel * The driver should not call cfg80211_sched_scan_stopped() for a requested 37933a3ecf1dSArend Van Spriel * stop (when this method returns 0). 379467fbb16bSSamuel Ortiz * 37956cd536feSJohannes Berg * @update_mgmt_frame_registrations: Notify the driver that management frame 37966cd536feSJohannes Berg * registrations were updated. The callback is allowed to sleep. 3797547025d5SBruno Randolf * 3798547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 3799547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 3800547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 3801547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 3802547025d5SBruno Randolf * 3803547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 38043677713bSJohn W. Linville * 3805109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 3806109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 38077f6cf311SJohannes Berg * 38087f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 38097f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 38101d9d9213SSimon Wunderlich * 38111d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 3812d6199218SBen Greear * 38135b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 38145b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 38155b7ccaf3SJohannes Berg * current monitoring channel. 381698104fdeSJohannes Berg * 381798104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 381898104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 381977765eafSVasanthakumar Thiagarajan * 382077765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 382177765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 382277765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 382377765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 382477765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 382577765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 382604f39047SSimon Wunderlich * 382704f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 38288bf24293SJouni Malinen * 382926ec17a1SOrr Mazor * @end_cac: End running CAC, probably because a related CAC 383026ec17a1SOrr Mazor * was finished on another phy. 383126ec17a1SOrr Mazor * 38328bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 38338bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 38348bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 38355de17984SArend van Spriel * 38365de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 38375de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 38385de17984SArend van Spriel * driver can take the most appropriate actions. 38395de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 38405de17984SArend van Spriel * reliability. This operation can not fail. 3841be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 384216ef1fe2SSimon Wunderlich * 384397dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 384497dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 384597dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 384697dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 384797dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 384897dc94f1SMichal Kazior * as soon as possible. 3849fa9ffc74SKyeyoon Park * 3850fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 3851e16821bcSJouni Malinen * 3852e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 3853e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 3854e16821bcSJouni Malinen * changes during the lifetime of the BSS. 3855960d01acSJohannes Berg * 3856960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 3857960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 3858960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 3859960d01acSJohannes Berg * account. 3860960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 3861960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 3862960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 3863960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 3864960d01acSJohannes Berg * rejected) 3865960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 38666e0bd6c3SRostislav Lisovy * 38676e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 38686e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 38696e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 38706e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 38711057d35eSArik Nemtsov * 38721057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 38731057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 38741057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 38751057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 38761057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 3877cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 3878cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 3879a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 3880a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 3881a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 3882a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 3883a442b761SAyala Beker * cfg80211_free_nan_func(). 3884a442b761SAyala Beker * On success the driver should assign an instance_id in the 3885a442b761SAyala Beker * provided @nan_func. 3886a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 3887a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 3888a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 3889a5a9dcf2SAyala Beker * All other parameters must be ignored. 3890ce0ce13aSMichael Braun * 3891ce0ce13aSMichael Braun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 38923a00df57SAvraham Stern * 389352539ca8SToke Høiland-Jørgensen * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this 389452539ca8SToke Høiland-Jørgensen * function should return phy stats, and interface stats otherwise. 389552539ca8SToke Høiland-Jørgensen * 38963a00df57SAvraham Stern * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 38973a00df57SAvraham Stern * If not deleted through @del_pmk the PMK remains valid until disconnect 38983a00df57SAvraham Stern * upon which the driver should clear it. 38993a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 39003a00df57SAvraham Stern * @del_pmk: delete the previously configured PMK for the given authenticator. 39013a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 390240cbfa90SSrinivas Dasari * 390340cbfa90SSrinivas Dasari * @external_auth: indicates result of offloaded authentication processing from 390440cbfa90SSrinivas Dasari * user space 39052576a9acSDenis Kenzior * 39062576a9acSDenis Kenzior * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter 39072576a9acSDenis Kenzior * tells the driver that the frame should not be encrypted. 390881e54d08SPradeep Kumar Chitrapu * 390981e54d08SPradeep Kumar Chitrapu * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. 391081e54d08SPradeep Kumar Chitrapu * Statistics should be cumulative, currently no way to reset is provided. 39119bb7e0f2SJohannes Berg * @start_pmsr: start peer measurement (e.g. FTM) 39129bb7e0f2SJohannes Berg * @abort_pmsr: abort peer measurement 3913cb74e977SSunil Dutt * 3914cb74e977SSunil Dutt * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME 3915cb74e977SSunil Dutt * but offloading OWE processing to the user space will get the updated 3916cb74e977SSunil Dutt * DH IE through this interface. 39175ab92e7fSRajkumar Manoharan * 39185ab92e7fSRajkumar Manoharan * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame 39195ab92e7fSRajkumar Manoharan * and overrule HWMP path selection algorithm. 392077f576deSTamizh chelvam * @set_tid_config: TID specific configuration, this can be peer or BSS specific 392177f576deSTamizh chelvam * This callback may sleep. 39223710a8a6SJohannes Berg * @reset_tid_config: Reset TID specific configuration for the peer, for the 39233710a8a6SJohannes Berg * given TIDs. This callback may sleep. 3924704232c2SJohannes Berg */ 3925704232c2SJohannes Berg struct cfg80211_ops { 3926ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 39270378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 39286d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 39290378b3f1SJohannes Berg 393084efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 3931552bff0cSJohannes Berg const char *name, 39326bab2e19STom Gundersen unsigned char name_assign_type, 3933f9e10ce4SJohannes Berg enum nl80211_iftype type, 39342ec600d6SLuis Carlos Cobo struct vif_params *params); 393584efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 393684efbb84SJohannes Berg struct wireless_dev *wdev); 3937e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 3938e36d56b6SJohannes Berg struct net_device *dev, 3939818a986eSJohannes Berg enum nl80211_iftype type, 39402ec600d6SLuis Carlos Cobo struct vif_params *params); 394141ade00fSJohannes Berg 394241ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 3943e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 394441ade00fSJohannes Berg struct key_params *params); 394541ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 3946e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 3947e31b8213SJohannes Berg void *cookie, 394841ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 394941ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 3950e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 395141ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 395241ade00fSJohannes Berg struct net_device *netdev, 3953dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 39543cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 39553cfcf6acSJouni Malinen struct net_device *netdev, 39563cfcf6acSJouni Malinen u8 key_index); 395756be393fSJouni Malinen int (*set_default_beacon_key)(struct wiphy *wiphy, 395856be393fSJouni Malinen struct net_device *netdev, 395956be393fSJouni Malinen u8 key_index); 3960ed1b6cc7SJohannes Berg 39618860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 39628860020eSJohannes Berg struct cfg80211_ap_settings *settings); 39638860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 39648860020eSJohannes Berg struct cfg80211_beacon_data *info); 39658860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 39665727ef1bSJohannes Berg 39675727ef1bSJohannes Berg 39685727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 39693b3a0162SJohannes Berg const u8 *mac, 39703b3a0162SJohannes Berg struct station_parameters *params); 39715727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 397289c771e5SJouni Malinen struct station_del_parameters *params); 39735727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 39743b3a0162SJohannes Berg const u8 *mac, 39753b3a0162SJohannes Berg struct station_parameters *params); 3976fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 39773b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 39782ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 39792ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 39802ec600d6SLuis Carlos Cobo 39812ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 39823b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 39832ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 39843b3a0162SJohannes Berg const u8 *dst); 39852ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 39863b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 39872ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 39883b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 39892ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 39902ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 39912ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 399266be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 399366be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 399466be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 399566be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 399666be7d2bSHenning Rogge struct mpath_info *pinfo); 399724bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 399893da9cc1Scolin@cozybit.com struct net_device *dev, 399993da9cc1Scolin@cozybit.com struct mesh_config *conf); 400024bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 400129cbe68cSJohannes Berg struct net_device *dev, u32 mask, 400229cbe68cSJohannes Berg const struct mesh_config *nconf); 400329cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 400429cbe68cSJohannes Berg const struct mesh_config *conf, 400529cbe68cSJohannes Berg const struct mesh_setup *setup); 400629cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 400729cbe68cSJohannes Berg 40086e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 40096e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 40106e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 40116e0bd6c3SRostislav Lisovy 40129f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 40139f1ba906SJouni Malinen struct bss_parameters *params); 401431888487SJouni Malinen 4015f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 401631888487SJouni Malinen struct ieee80211_txq_params *params); 401772bdcf34SJouni Malinen 4018e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 4019e8c9bd5bSJohannes Berg struct net_device *dev, 4020e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 4021e8c9bd5bSJohannes Berg 4022e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 4023683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 40249aed3cc1SJouni Malinen 4025fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 40262a519311SJohannes Berg struct cfg80211_scan_request *request); 402791d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4028636a5d36SJouni Malinen 4029636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 4030636a5d36SJouni Malinen struct cfg80211_auth_request *req); 4031636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 4032636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 4033636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 403463c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 4035636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 403663c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 403704a773adSJohannes Berg 4038b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 4039b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 4040088e8df8Svamsi krishna int (*update_connect_params)(struct wiphy *wiphy, 4041088e8df8Svamsi krishna struct net_device *dev, 4042088e8df8Svamsi krishna struct cfg80211_connect_params *sme, 4043088e8df8Svamsi krishna u32 changed); 4044b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 4045b23aa676SSamuel Ortiz u16 reason_code); 4046b23aa676SSamuel Ortiz 404704a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 404804a773adSJohannes Berg struct cfg80211_ibss_params *params); 404904a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 4050b9a5f8caSJouni Malinen 4051f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 405257fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 4053f4e583c8SAntonio Quartulli 4054b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 40557643a2c3SJohannes Berg 4056c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 4057fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 4058c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 4059c8442118SJohannes Berg int *dbm); 40601f87f7d3SJohannes Berg 4061ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 4062388ac775SJohannes Berg const u8 *addr); 4063ab737a4fSJohannes Berg 40641f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 4065aff89a9bSJohannes Berg 4066aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4067fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 4068fc73f11fSDavid Spinadel void *data, int len); 406971063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 407071063f0eSWey-Yi Guy struct netlink_callback *cb, 407171063f0eSWey-Yi Guy void *data, int len); 4072aff89a9bSJohannes Berg #endif 4073bc92afd9SJohannes Berg 40749930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 40759930380fSJohannes Berg struct net_device *dev, 40769930380fSJohannes Berg const u8 *peer, 40779930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 40789930380fSJohannes Berg 407961fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 408061fa713cSHolger Schurig int idx, struct survey_info *info); 408161fa713cSHolger Schurig 408267fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 408367fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 408467fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 408567fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 408667fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 408767fbb16bSSamuel Ortiz 40889588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 408971bbc994SJohannes Berg struct wireless_dev *wdev, 40909588bbd5SJouni Malinen struct ieee80211_channel *chan, 40919588bbd5SJouni Malinen unsigned int duration, 40929588bbd5SJouni Malinen u64 *cookie); 40939588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 409471bbc994SJohannes Berg struct wireless_dev *wdev, 40959588bbd5SJouni Malinen u64 cookie); 40969588bbd5SJouni Malinen 409771bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 4098b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 4099b176e629SAndrei Otcheretianski u64 *cookie); 4100f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 410171bbc994SJohannes Berg struct wireless_dev *wdev, 4102f7ca38dfSJohannes Berg u64 cookie); 4103026331c4SJouni Malinen 4104bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 4105bc92afd9SJohannes Berg bool enabled, int timeout); 4106d6dc1a38SJuuso Oikarinen 4107d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 4108d6dc1a38SJuuso Oikarinen struct net_device *dev, 4109d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 4110271733cfSJohannes Berg 41114a4b8169SAndrew Zaborowski int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 41124a4b8169SAndrew Zaborowski struct net_device *dev, 41134a4b8169SAndrew Zaborowski s32 rssi_low, s32 rssi_high); 41144a4b8169SAndrew Zaborowski 411584f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 411684f10708SThomas Pedersen struct net_device *dev, 411784f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 411884f10708SThomas Pedersen 41196cd536feSJohannes Berg void (*update_mgmt_frame_registrations)(struct wiphy *wiphy, 412071bbc994SJohannes Berg struct wireless_dev *wdev, 41216cd536feSJohannes Berg struct mgmt_frame_regs *upd); 4122afe0cbf8SBruno Randolf 4123afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 4124afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 41253677713bSJohn W. Linville 4126807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 4127807f8a8cSLuciano Coelho struct net_device *dev, 4128807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 41293a3ecf1dSArend Van Spriel int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 41303a3ecf1dSArend Van Spriel u64 reqid); 4131e5497d76SJohannes Berg 4132e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 4133e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 4134109086ceSArik Nemtsov 4135109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 41363b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 4137df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 413831fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 4139109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 41403b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 41417f6cf311SJohannes Berg 41427f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 41437f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 4144e999882aSJohannes Berg 41451d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 41461d9d9213SSimon Wunderlich struct net_device *dev, 41471d9d9213SSimon Wunderlich u16 noack_map); 41481d9d9213SSimon Wunderlich 4149683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 41505b7ccaf3SJohannes Berg struct wireless_dev *wdev, 4151683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 415298104fdeSJohannes Berg 415398104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 415498104fdeSJohannes Berg struct wireless_dev *wdev); 415598104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 415698104fdeSJohannes Berg struct wireless_dev *wdev); 415777765eafSVasanthakumar Thiagarajan 415877765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 415977765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 416004f39047SSimon Wunderlich 416104f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 416204f39047SSimon Wunderlich struct net_device *dev, 416331559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 416431559f35SJanusz Dziedzic u32 cac_time_ms); 416526ec17a1SOrr Mazor void (*end_cac)(struct wiphy *wiphy, 416626ec17a1SOrr Mazor struct net_device *dev); 4167355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 4168355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 41695de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 41705de17984SArend van Spriel struct wireless_dev *wdev, 41715de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 41725de17984SArend van Spriel u16 duration); 41735de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 41745de17984SArend van Spriel struct wireless_dev *wdev); 4175be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 4176be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 417716ef1fe2SSimon Wunderlich 417816ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 417916ef1fe2SSimon Wunderlich struct net_device *dev, 418016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 4181e16821bcSJouni Malinen 4182fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 4183fa9ffc74SKyeyoon Park struct net_device *dev, 4184fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4185e16821bcSJouni Malinen 4186e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 4187e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 4188960d01acSJohannes Berg 4189960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4190960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 4191960d01acSJohannes Berg u16 admitted_time); 4192960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4193960d01acSJohannes Berg u8 tsid, const u8 *peer); 41941057d35eSArik Nemtsov 41951057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 41961057d35eSArik Nemtsov struct net_device *dev, 41971057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 41981057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 41991057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 42001057d35eSArik Nemtsov struct net_device *dev, 42011057d35eSArik Nemtsov const u8 *addr); 4202cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 4203cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 4204cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4205a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4206a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 4207a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4208a442b761SAyala Beker u64 cookie); 4209a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 4210a5a9dcf2SAyala Beker struct wireless_dev *wdev, 4211a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 4212a5a9dcf2SAyala Beker u32 changes); 4213ce0ce13aSMichael Braun 4214ce0ce13aSMichael Braun int (*set_multicast_to_unicast)(struct wiphy *wiphy, 4215ce0ce13aSMichael Braun struct net_device *dev, 4216ce0ce13aSMichael Braun const bool enabled); 42173a00df57SAvraham Stern 421852539ca8SToke Høiland-Jørgensen int (*get_txq_stats)(struct wiphy *wiphy, 421952539ca8SToke Høiland-Jørgensen struct wireless_dev *wdev, 422052539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats *txqstats); 422152539ca8SToke Høiland-Jørgensen 42223a00df57SAvraham Stern int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 42233a00df57SAvraham Stern const struct cfg80211_pmk_conf *conf); 42243a00df57SAvraham Stern int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 42253a00df57SAvraham Stern const u8 *aa); 422640cbfa90SSrinivas Dasari int (*external_auth)(struct wiphy *wiphy, struct net_device *dev, 422740cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params); 42282576a9acSDenis Kenzior 42292576a9acSDenis Kenzior int (*tx_control_port)(struct wiphy *wiphy, 42302576a9acSDenis Kenzior struct net_device *dev, 42312576a9acSDenis Kenzior const u8 *buf, size_t len, 42328d74a623SJohannes Berg const u8 *dest, const __be16 proto, 4233dca9ca2dSMarkus Theil const bool noencrypt, 4234dca9ca2dSMarkus Theil u64 *cookie); 423581e54d08SPradeep Kumar Chitrapu 423681e54d08SPradeep Kumar Chitrapu int (*get_ftm_responder_stats)(struct wiphy *wiphy, 423781e54d08SPradeep Kumar Chitrapu struct net_device *dev, 423881e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats *ftm_stats); 42399bb7e0f2SJohannes Berg 42409bb7e0f2SJohannes Berg int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 42419bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *request); 42429bb7e0f2SJohannes Berg void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 42439bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *request); 4244cb74e977SSunil Dutt int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev, 4245cb74e977SSunil Dutt struct cfg80211_update_owe_info *owe_info); 42465ab92e7fSRajkumar Manoharan int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev, 42475ab92e7fSRajkumar Manoharan const u8 *buf, size_t len); 424877f576deSTamizh chelvam int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev, 42493710a8a6SJohannes Berg struct cfg80211_tid_config *tid_conf); 425077f576deSTamizh chelvam int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, 42513710a8a6SJohannes Berg const u8 *peer, u8 tids); 4252704232c2SJohannes Berg }; 4253704232c2SJohannes Berg 4254d3236553SJohannes Berg /* 4255d3236553SJohannes Berg * wireless hardware and networking interfaces structures 4256d3236553SJohannes Berg * and registration/helper functions 4257d3236553SJohannes Berg */ 4258d3236553SJohannes Berg 4259d3236553SJohannes Berg /** 42605be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 42615be83de5SJohannes Berg * 4262c8cb5b85STova Mussai * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split 4263c8cb5b85STova Mussai * into two, first for legacy bands and second for UHB. 42645be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 42655be83de5SJohannes Berg * wiphy at all 42665be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 42675be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 42685be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 42695be83de5SJohannes Berg * reason to override the default 42709bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 427133d915d9SManikanta Pubbisetty * on a VLAN interface). This flag also serves an extra purpose of 427233d915d9SManikanta Pubbisetty * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. 42739bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 4274c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 4275c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 4276c0692b8fSJohannes Berg * control_port_no_encrypt flag. 4277e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 427815d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 427915d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 4280f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 4281f4b34b55SVivek Natarajan * firmware. 4282cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 4283109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 4284109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 4285109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 4286109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 4287109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 4288109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 4289562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 42905e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 42915e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 42925e760230SJohannes Berg * cfg80211_report_obss_beacon(). 429387bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 429487bbbe22SArik Nemtsov * responds to probe-requests in hardware. 42957c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 42967c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 42972f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 429816ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 429916ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 4300b8676221SDavid Spinadel * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 4301b8676221SDavid Spinadel * before connection. 4302093a48d2SNathan Errera * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys 43035be83de5SJohannes Berg */ 43045be83de5SJohannes Berg enum wiphy_flags { 4305093a48d2SNathan Errera WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), 4306a2f73b6cSLuis R. Rodriguez /* use hole at 1 */ 4307c8cb5b85STova Mussai WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2), 43085be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 43095be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 43109bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 43119bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 4312c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 4313309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 431415d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 4315ca986ad9SArend Van Spriel /* use hole at 11 */ 43168e8b41f9SJohannes Berg /* use hole at 12 */ 4317f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 4318cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 4319109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 4320109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 4321562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 43225e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 432387bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 43247c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 43257c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 43262f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 432716ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 4328b8676221SDavid Spinadel WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 43297527a782SJohannes Berg }; 43307527a782SJohannes Berg 43317527a782SJohannes Berg /** 43327527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 43337527a782SJohannes Berg * @max: maximum number of interfaces of these types 43347527a782SJohannes Berg * @types: interface types (bits) 43357527a782SJohannes Berg */ 43367527a782SJohannes Berg struct ieee80211_iface_limit { 43377527a782SJohannes Berg u16 max; 43387527a782SJohannes Berg u16 types; 43397527a782SJohannes Berg }; 43407527a782SJohannes Berg 43417527a782SJohannes Berg /** 43427527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 43437527a782SJohannes Berg * 4344b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 4345b80edbc1SLuciano Coelho * combinations it supports concurrently. 43467527a782SJohannes Berg * 4347b80edbc1SLuciano Coelho * Examples: 4348b80edbc1SLuciano Coelho * 4349b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 43507527a782SJohannes Berg * 4351819bf593SJohannes Berg * .. code-block:: c 4352819bf593SJohannes Berg * 43537527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 43547527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 43557527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 43567527a782SJohannes Berg * }; 43577527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 43587527a782SJohannes Berg * .limits = limits1, 43597527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 43607527a782SJohannes Berg * .max_interfaces = 2, 43617527a782SJohannes Berg * .beacon_int_infra_match = true, 43627527a782SJohannes Berg * }; 43637527a782SJohannes Berg * 43647527a782SJohannes Berg * 4365b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 43667527a782SJohannes Berg * 4367819bf593SJohannes Berg * .. code-block:: c 4368819bf593SJohannes Berg * 43697527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 43707527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 43717527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 43727527a782SJohannes Berg * }; 43737527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 43747527a782SJohannes Berg * .limits = limits2, 43757527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 43767527a782SJohannes Berg * .max_interfaces = 8, 43777527a782SJohannes Berg * .num_different_channels = 1, 43787527a782SJohannes Berg * }; 43797527a782SJohannes Berg * 43807527a782SJohannes Berg * 4381b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 4382b80edbc1SLuciano Coelho * 43837527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 43847527a782SJohannes Berg * 4385819bf593SJohannes Berg * .. code-block:: c 4386819bf593SJohannes Berg * 43877527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 43887527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 43897527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 43907527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 43917527a782SJohannes Berg * }; 43927527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 43937527a782SJohannes Berg * .limits = limits3, 43947527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 43957527a782SJohannes Berg * .max_interfaces = 4, 43967527a782SJohannes Berg * .num_different_channels = 2, 43977527a782SJohannes Berg * }; 4398819bf593SJohannes Berg * 43997527a782SJohannes Berg */ 44007527a782SJohannes Berg struct ieee80211_iface_combination { 4401c6c94aeaSJohannes Berg /** 4402c6c94aeaSJohannes Berg * @limits: 4403c6c94aeaSJohannes Berg * limits for the given interface types 4404c6c94aeaSJohannes Berg */ 44057527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 4406c6c94aeaSJohannes Berg 4407c6c94aeaSJohannes Berg /** 4408c6c94aeaSJohannes Berg * @num_different_channels: 4409c6c94aeaSJohannes Berg * can use up to this many different channels 4410c6c94aeaSJohannes Berg */ 44117527a782SJohannes Berg u32 num_different_channels; 4412c6c94aeaSJohannes Berg 4413c6c94aeaSJohannes Berg /** 4414c6c94aeaSJohannes Berg * @max_interfaces: 4415c6c94aeaSJohannes Berg * maximum number of interfaces in total allowed in this group 4416c6c94aeaSJohannes Berg */ 44177527a782SJohannes Berg u16 max_interfaces; 4418c6c94aeaSJohannes Berg 4419c6c94aeaSJohannes Berg /** 4420c6c94aeaSJohannes Berg * @n_limits: 4421c6c94aeaSJohannes Berg * number of limitations 4422c6c94aeaSJohannes Berg */ 44237527a782SJohannes Berg u8 n_limits; 4424c6c94aeaSJohannes Berg 4425c6c94aeaSJohannes Berg /** 4426c6c94aeaSJohannes Berg * @beacon_int_infra_match: 4427c6c94aeaSJohannes Berg * In this combination, the beacon intervals between infrastructure 4428c6c94aeaSJohannes Berg * and AP types must match. This is required only in special cases. 4429c6c94aeaSJohannes Berg */ 44307527a782SJohannes Berg bool beacon_int_infra_match; 4431c6c94aeaSJohannes Berg 4432c6c94aeaSJohannes Berg /** 4433c6c94aeaSJohannes Berg * @radar_detect_widths: 4434c6c94aeaSJohannes Berg * bitmap of channel widths supported for radar detection 4435c6c94aeaSJohannes Berg */ 443611c4a075SSimon Wunderlich u8 radar_detect_widths; 4437c6c94aeaSJohannes Berg 4438c6c94aeaSJohannes Berg /** 4439c6c94aeaSJohannes Berg * @radar_detect_regions: 4440c6c94aeaSJohannes Berg * bitmap of regions supported for radar detection 4441c6c94aeaSJohannes Berg */ 44428c48b50aSFelix Fietkau u8 radar_detect_regions; 4443c6c94aeaSJohannes Berg 4444c6c94aeaSJohannes Berg /** 4445c6c94aeaSJohannes Berg * @beacon_int_min_gcd: 4446c6c94aeaSJohannes Berg * This interface combination supports different beacon intervals. 4447c6c94aeaSJohannes Berg * 4448c6c94aeaSJohannes Berg * = 0 4449c6c94aeaSJohannes Berg * all beacon intervals for different interface must be same. 4450c6c94aeaSJohannes Berg * > 0 4451c6c94aeaSJohannes Berg * any beacon interval for the interface part of this combination AND 4452c6c94aeaSJohannes Berg * GCD of all beacon intervals from beaconing interfaces of this 4453c6c94aeaSJohannes Berg * combination must be greater or equal to this value. 4454c6c94aeaSJohannes Berg */ 44550c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 44565be83de5SJohannes Berg }; 44575be83de5SJohannes Berg 44582e161f78SJohannes Berg struct ieee80211_txrx_stypes { 44592e161f78SJohannes Berg u16 tx, rx; 44602e161f78SJohannes Berg }; 44612e161f78SJohannes Berg 44625be83de5SJohannes Berg /** 4463ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 4464ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 4465ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 4466ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 4467ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 4468ff1b6e69SJohannes Berg * packet should be preserved in that case 4469ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 4470ff1b6e69SJohannes Berg * (see nl80211.h) 4471ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 447277dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 447377dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 447477dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 447577dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 447677dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 44778cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 4478ff1b6e69SJohannes Berg */ 4479ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 4480ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 4481ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 4482ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 448377dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 448477dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 448577dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 448677dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 448777dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 44888cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 4489ff1b6e69SJohannes Berg }; 4490ff1b6e69SJohannes Berg 44912a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 44922a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 44932a0e047eSJohannes Berg u32 data_payload_max; 44942a0e047eSJohannes Berg u32 data_interval_max; 44952a0e047eSJohannes Berg u32 wake_payload_max; 44962a0e047eSJohannes Berg bool seq; 44972a0e047eSJohannes Berg }; 44982a0e047eSJohannes Berg 4499ff1b6e69SJohannes Berg /** 4500ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 4501ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 4502ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 4503ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 4504ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 4505ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 4506bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 45078cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 45088cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 45098cd4d456SLuciano Coelho * scheduled scans. 45108cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 45118cd4d456SLuciano Coelho * details. 45122a0e047eSJohannes Berg * @tcp: TCP wakeup support information 4513ff1b6e69SJohannes Berg */ 4514ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 4515ff1b6e69SJohannes Berg u32 flags; 4516ff1b6e69SJohannes Berg int n_patterns; 4517ff1b6e69SJohannes Berg int pattern_max_len; 4518ff1b6e69SJohannes Berg int pattern_min_len; 4519bb92d199SAmitkumar Karwar int max_pkt_offset; 45208cd4d456SLuciano Coelho int max_nd_match_sets; 45212a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 4522ff1b6e69SJohannes Berg }; 4523ff1b6e69SJohannes Berg 4524ff1b6e69SJohannes Berg /** 4525be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 4526be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 4527be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 4528be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 4529be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 4530be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 4531be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 4532be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 4533be29b99aSAmitkumar Karwar */ 4534be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 4535be29b99aSAmitkumar Karwar int n_rules; 4536be29b99aSAmitkumar Karwar int max_delay; 4537be29b99aSAmitkumar Karwar int n_patterns; 4538be29b99aSAmitkumar Karwar int pattern_max_len; 4539be29b99aSAmitkumar Karwar int pattern_min_len; 4540be29b99aSAmitkumar Karwar int max_pkt_offset; 4541be29b99aSAmitkumar Karwar }; 4542be29b99aSAmitkumar Karwar 4543be29b99aSAmitkumar Karwar /** 4544ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 4545ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 4546ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 4547ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 4548ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 4549ad7e718cSJohannes Berg */ 4550ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 4551ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 4552ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 4553ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 4554ad7e718cSJohannes Berg }; 4555ad7e718cSJohannes Berg 4556ad7e718cSJohannes Berg /** 4557466b9936Stamizhr@codeaurora.org * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags 4558466b9936Stamizhr@codeaurora.org * 4559466b9936Stamizhr@codeaurora.org * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed 4560466b9936Stamizhr@codeaurora.org * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed 4561466b9936Stamizhr@codeaurora.org * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed 4562466b9936Stamizhr@codeaurora.org * 4563466b9936Stamizhr@codeaurora.org */ 4564466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag { 4565466b9936Stamizhr@codeaurora.org STA_OPMODE_MAX_BW_CHANGED = BIT(0), 4566466b9936Stamizhr@codeaurora.org STA_OPMODE_SMPS_MODE_CHANGED = BIT(1), 4567466b9936Stamizhr@codeaurora.org STA_OPMODE_N_SS_CHANGED = BIT(2), 4568466b9936Stamizhr@codeaurora.org }; 4569466b9936Stamizhr@codeaurora.org 4570466b9936Stamizhr@codeaurora.org /** 4571466b9936Stamizhr@codeaurora.org * struct sta_opmode_info - Station's ht/vht operation mode information 4572466b9936Stamizhr@codeaurora.org * @changed: contains value from &enum wiphy_opmode_flag 45735e78abd0Stamizhr@codeaurora.org * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station 45745e78abd0Stamizhr@codeaurora.org * @bw: new max bandwidth value from &enum nl80211_chan_width of a station 4575466b9936Stamizhr@codeaurora.org * @rx_nss: new rx_nss value of a station 4576466b9936Stamizhr@codeaurora.org */ 4577466b9936Stamizhr@codeaurora.org 4578466b9936Stamizhr@codeaurora.org struct sta_opmode_info { 4579466b9936Stamizhr@codeaurora.org u32 changed; 45805e78abd0Stamizhr@codeaurora.org enum nl80211_smps_mode smps_mode; 45815e78abd0Stamizhr@codeaurora.org enum nl80211_chan_width bw; 4582466b9936Stamizhr@codeaurora.org u8 rx_nss; 4583466b9936Stamizhr@codeaurora.org }; 4584466b9936Stamizhr@codeaurora.org 458591046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA)) 4586901bb989SJohannes Berg 4587466b9936Stamizhr@codeaurora.org /** 4588ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 4589ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 4590ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 4591ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 4592ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 4593ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 45947bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 45957bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 45967bdbe400SJohannes Berg * dumpit calls. 4597901bb989SJohannes Berg * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA. 4598901bb989SJohannes Berg * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the 4599901bb989SJohannes Berg * attribute is just raw data (e.g. a firmware command). 4600901bb989SJohannes Berg * @maxattr: highest attribute number in policy 46017bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 46027bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 46037bdbe400SJohannes Berg * are used with dump requests. 4604ad7e718cSJohannes Berg */ 4605ad7e718cSJohannes Berg struct wiphy_vendor_command { 4606ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 4607ad7e718cSJohannes Berg u32 flags; 4608ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 4609ad7e718cSJohannes Berg const void *data, int data_len); 46107bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 46117bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 46127bdbe400SJohannes Berg unsigned long *storage); 4613901bb989SJohannes Berg const struct nla_policy *policy; 4614901bb989SJohannes Berg unsigned int maxattr; 4615ad7e718cSJohannes Berg }; 4616ad7e718cSJohannes Berg 4617ad7e718cSJohannes Berg /** 4618019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 4619019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 4620019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 4621019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 4622019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 4623019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 4624019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 4625019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 4626019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 4627019ae3a9SKanchanapally, Vidyullatha */ 4628019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 4629019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 4630019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 4631019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 4632019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 4633019ae3a9SKanchanapally, Vidyullatha }; 4634019ae3a9SKanchanapally, Vidyullatha 4635019ae3a9SKanchanapally, Vidyullatha /** 46369bb7e0f2SJohannes Berg * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities 46379bb7e0f2SJohannes Berg * @max_peers: maximum number of peers in a single measurement 46389bb7e0f2SJohannes Berg * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement 46399bb7e0f2SJohannes Berg * @randomize_mac_addr: can randomize MAC address for measurement 46409bb7e0f2SJohannes Berg * @ftm.supported: FTM measurement is supported 46419bb7e0f2SJohannes Berg * @ftm.asap: ASAP-mode is supported 46429bb7e0f2SJohannes Berg * @ftm.non_asap: non-ASAP-mode is supported 46439bb7e0f2SJohannes Berg * @ftm.request_lci: can request LCI data 46449bb7e0f2SJohannes Berg * @ftm.request_civicloc: can request civic location data 46459bb7e0f2SJohannes Berg * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble) 46469bb7e0f2SJohannes Berg * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width) 46479bb7e0f2SJohannes Berg * @ftm.max_bursts_exponent: maximum burst exponent supported 46489bb7e0f2SJohannes Berg * (set to -1 if not limited; note that setting this will necessarily 46499bb7e0f2SJohannes Berg * forbid using the value 15 to let the responder pick) 46509bb7e0f2SJohannes Berg * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if 46519bb7e0f2SJohannes Berg * not limited) 4652efb5520dSAvraham Stern * @ftm.trigger_based: trigger based ranging measurement is supported 4653efb5520dSAvraham Stern * @ftm.non_trigger_based: non trigger based ranging measurement is supported 46549bb7e0f2SJohannes Berg */ 46559bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities { 46569bb7e0f2SJohannes Berg unsigned int max_peers; 46579bb7e0f2SJohannes Berg u8 report_ap_tsf:1, 46589bb7e0f2SJohannes Berg randomize_mac_addr:1; 46599bb7e0f2SJohannes Berg 46609bb7e0f2SJohannes Berg struct { 46619bb7e0f2SJohannes Berg u32 preambles; 46629bb7e0f2SJohannes Berg u32 bandwidths; 46639bb7e0f2SJohannes Berg s8 max_bursts_exponent; 46649bb7e0f2SJohannes Berg u8 max_ftms_per_burst; 46659bb7e0f2SJohannes Berg u8 supported:1, 46669bb7e0f2SJohannes Berg asap:1, 46679bb7e0f2SJohannes Berg non_asap:1, 46689bb7e0f2SJohannes Berg request_lci:1, 4669efb5520dSAvraham Stern request_civicloc:1, 4670efb5520dSAvraham Stern trigger_based:1, 4671efb5520dSAvraham Stern non_trigger_based:1; 46729bb7e0f2SJohannes Berg } ftm; 46739bb7e0f2SJohannes Berg }; 46749bb7e0f2SJohannes Berg 46759bb7e0f2SJohannes Berg /** 4676d6039a34SVeerendranath Jakkam * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm 4677d6039a34SVeerendranath Jakkam * suites for interface types defined in @iftypes_mask. Each type in the 4678d6039a34SVeerendranath Jakkam * @iftypes_mask must be unique across all instances of iftype_akm_suites. 4679d6039a34SVeerendranath Jakkam * 4680d6039a34SVeerendranath Jakkam * @iftypes_mask: bitmask of interfaces types 4681d6039a34SVeerendranath Jakkam * @akm_suites: points to an array of supported akm suites 4682d6039a34SVeerendranath Jakkam * @n_akm_suites: number of supported AKM suites 4683d6039a34SVeerendranath Jakkam */ 4684d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites { 4685d6039a34SVeerendranath Jakkam u16 iftypes_mask; 4686d6039a34SVeerendranath Jakkam const u32 *akm_suites; 4687d6039a34SVeerendranath Jakkam int n_akm_suites; 4688d6039a34SVeerendranath Jakkam }; 4689d6039a34SVeerendranath Jakkam 4690d6039a34SVeerendranath Jakkam /** 46915be83de5SJohannes Berg * struct wiphy - wireless hardware description 46922784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 46932784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 46942784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 4695d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 4696d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 4697d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 4698d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 4699d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 4700d3236553SJohannes Berg * @cipher_suites: supported cipher suites 4701d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 4702d6039a34SVeerendranath Jakkam * @akm_suites: supported AKM suites. These are the default AKMs supported if 4703d6039a34SVeerendranath Jakkam * the supported AKMs not advertized for a specific interface type in 4704d6039a34SVeerendranath Jakkam * iftype_akm_suites. 4705ab4dfa20SVeerendranath Jakkam * @n_akm_suites: number of supported AKM suites 4706d6039a34SVeerendranath Jakkam * @iftype_akm_suites: array of supported akm suites info per interface type. 4707d6039a34SVeerendranath Jakkam * Note that the bits in @iftypes_mask inside this structure cannot 4708d6039a34SVeerendranath Jakkam * overlap (i.e. only one occurrence of each type is allowed across all 4709d6039a34SVeerendranath Jakkam * instances of iftype_akm_suites). 4710d6039a34SVeerendranath Jakkam * @num_iftype_akm_suites: number of interface types for which supported akm 4711d6039a34SVeerendranath Jakkam * suites are specified separately. 4712b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 4713b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 4714b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 4715b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 4716b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 4717abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 4718ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 4719ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 4720ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 47210fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 4722ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 4723ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 4724ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 4725ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 4726ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 4727ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 4728ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 4729ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 4730fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 4731fd235913SRandy Dunlap * unregister hardware 4732edf77192SJérôme Pouiller * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>). 4733edf77192SJérôme Pouiller * It will be renamed automatically on wiphy renames 473415bc6dfbSJérôme Pouiller * @dev: (virtual) struct device for this wiphy. The item in 473515bc6dfbSJérôme Pouiller * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev() 473615bc6dfbSJérôme Pouiller * (see below). 4737abe37c4bSJohannes Berg * @wext: wireless extension handlers 4738abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 4739abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 4740abe37c4bSJohannes Berg * must be set by driver 47417527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 47427527a782SJohannes Berg * list single interface types. 47437527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 47447527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 47457527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 4746abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 4747a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 4748a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 47491f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 4750d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 4751d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 4752abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 4753abe37c4bSJohannes Berg * this variable determines its size 4754abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 4755abe37c4bSJohannes Berg * any given scan 4756ca986ad9SArend Van Spriel * @max_sched_scan_reqs: maximum number of scheduled scan requests that 4757ca986ad9SArend Van Spriel * the device can run concurrently. 475893b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 475993b6aa69SLuciano Coelho * for in any given scheduled scan 4760a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 4761a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 4762a1f1c21cSLuciano Coelho * supported. 4763abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 4764abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 4765abe37c4bSJohannes Berg * include fixed IEs like supported rates 47665a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 47675a865badSLuciano Coelho * scans 47683b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 47693b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 47703b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 47713b06d277SAvraham Stern * single scan plan supported by the device. 47723b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 47733b06d277SAvraham Stern * scan plan supported by the device. 4774abe37c4bSJohannes Berg * @coverage_class: current coverage class 4775abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 4776abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 4777abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 4778abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 4779abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 4780abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 47812e161f78SJohannes Berg * 47822e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 47832e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 47842e161f78SJohannes Berg * type 4785a7ffac95SBruno Randolf * 47867f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 47877f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 47887f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 47897f531e03SBruno Randolf * 47907f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 47917f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 47927f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 4793a293911dSJohannes Berg * 479415f0ebc2SRandy Dunlap * @probe_resp_offload: 479515f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 479615f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 479715f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 479815f0ebc2SRandy Dunlap * 4799a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 4800a293911dSJohannes Berg * may request, if implemented. 4801ff1b6e69SJohannes Berg * 4802ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 48036abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 48046abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 48056abb9cb9SJohannes Berg * to the suspend() operation instead. 4806562a7480SJohannes Berg * 4807562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 48087e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 48097e7c8926SBen Greear * If null, then none can be over-ridden. 4810ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 4811ee2aca34SJohannes Berg * If null, then none can be over-ridden. 481277765eafSVasanthakumar Thiagarajan * 481353873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 481453873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 481553873f13SJohannes Berg * 481677765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 481777765eafSVasanthakumar Thiagarajan * supports for ACL. 4818a50df0c4SJohannes Berg * 4819a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 4820a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 4821a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 4822a50df0c4SJohannes Berg * and are in the same format as in the information element. See 4823019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 4824019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 4825019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 4826a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 4827a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 4828019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 4829019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 4830019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 4831be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 4832ad7e718cSJohannes Berg * 4833ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 4834ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 4835567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 4836567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 4837b43504cfSJouni Malinen * 4838b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 4839b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 4840b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 4841b43504cfSJouni Malinen * some cases, but may not always reach. 4842c2e4323bSLuciano Coelho * 4843c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 4844c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 4845c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 4846c2e4323bSLuciano Coelho * infinite. 484738de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 484838de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 484938de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 4850a442b761SAyala Beker * 48518585989dSLuca Coelho * @nan_supported_bands: bands supported by the device in NAN mode, a 48528585989dSLuca Coelho * bitmap of &enum nl80211_band values. For instance, for 48538585989dSLuca Coelho * NL80211_BAND_2GHZ, bit 0 would be set 48548585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 4855f3a7ca64SJohannes Berg * 4856f3a7ca64SJohannes Berg * @txq_limit: configuration of internal TX queue frame limit 4857f3a7ca64SJohannes Berg * @txq_memory_limit: configuration internal TX queue memory limit 4858f3a7ca64SJohannes Berg * @txq_quantum: configuration of internal TX queue scheduler quantum 48599bb7e0f2SJohannes Berg * 4860a710d214SLothar Rubusch * @tx_queue_len: allow setting transmit queue len for drivers not using 4861a710d214SLothar Rubusch * wake_tx_queue 4862a710d214SLothar Rubusch * 4863213ed579SSara Sharon * @support_mbssid: can HW support association with nontransmitted AP 4864213ed579SSara Sharon * @support_only_he_mbssid: don't parse MBSSID elements if it is not 4865213ed579SSara Sharon * HE AP, in order to avoid compatibility issues. 4866213ed579SSara Sharon * @support_mbssid must be set for this to have any effect. 4867213ed579SSara Sharon * 48689bb7e0f2SJohannes Berg * @pmsr_capa: peer measurement capabilities 48693710a8a6SJohannes Berg * 48703710a8a6SJohannes Berg * @tid_config_support: describes the per-TID config support that the 48713710a8a6SJohannes Berg * device has 48723710a8a6SJohannes Berg * @tid_config_support.vif: bitmap of attributes (configurations) 48733710a8a6SJohannes Berg * supported by the driver for each vif 48743710a8a6SJohannes Berg * @tid_config_support.peer: bitmap of attributes (configurations) 48753710a8a6SJohannes Berg * supported by the driver for each peer 48766a21d16cSTamizh chelvam * @tid_config_support.max_retry: maximum supported retry count for 48776a21d16cSTamizh chelvam * long/short retry configuration 4878a710d214SLothar Rubusch * 4879a710d214SLothar Rubusch * @max_data_retry_count: maximum supported per TID retry count for 4880a710d214SLothar Rubusch * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and 4881a710d214SLothar Rubusch * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes 4882d3236553SJohannes Berg */ 4883d3236553SJohannes Berg struct wiphy { 4884d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 4885d3236553SJohannes Berg 4886d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 4887ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 4888ef15aac6SJohannes Berg 4889ef15aac6SJohannes Berg struct mac_address *addresses; 4890d3236553SJohannes Berg 48912e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 48922e161f78SJohannes Berg 48937527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 48947527a782SJohannes Berg int n_iface_combinations; 48957527a782SJohannes Berg u16 software_iftypes; 48967527a782SJohannes Berg 48972e161f78SJohannes Berg u16 n_addresses; 48982e161f78SJohannes Berg 4899d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 4900d3236553SJohannes Berg u16 interface_modes; 4901d3236553SJohannes Berg 490277765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 490377765eafSVasanthakumar Thiagarajan 4904a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 4905d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 4906463d0183SJohannes Berg 4907562a7480SJohannes Berg u32 ap_sme_capa; 4908562a7480SJohannes Berg 4909d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 4910d3236553SJohannes Berg 4911d3236553SJohannes Berg int bss_priv_size; 4912d3236553SJohannes Berg u8 max_scan_ssids; 4913ca986ad9SArend Van Spriel u8 max_sched_scan_reqs; 491493b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 4915a1f1c21cSLuciano Coelho u8 max_match_sets; 4916d3236553SJohannes Berg u16 max_scan_ie_len; 49175a865badSLuciano Coelho u16 max_sched_scan_ie_len; 49183b06d277SAvraham Stern u32 max_sched_scan_plans; 49193b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 49203b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 4921d3236553SJohannes Berg 4922d3236553SJohannes Berg int n_cipher_suites; 4923d3236553SJohannes Berg const u32 *cipher_suites; 4924d3236553SJohannes Berg 4925ab4dfa20SVeerendranath Jakkam int n_akm_suites; 4926ab4dfa20SVeerendranath Jakkam const u32 *akm_suites; 4927ab4dfa20SVeerendranath Jakkam 4928d6039a34SVeerendranath Jakkam const struct wiphy_iftype_akm_suites *iftype_akm_suites; 4929d6039a34SVeerendranath Jakkam unsigned int num_iftype_akm_suites; 4930d6039a34SVeerendranath Jakkam 4931b9a5f8caSJouni Malinen u8 retry_short; 4932b9a5f8caSJouni Malinen u8 retry_long; 4933b9a5f8caSJouni Malinen u32 frag_threshold; 4934b9a5f8caSJouni Malinen u32 rts_threshold; 493581077e82SLukáš Turek u8 coverage_class; 4936b9a5f8caSJouni Malinen 493781135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 4938dfce95f5SKalle Valo u32 hw_version; 4939dfce95f5SKalle Valo 4940dfb89c56SJohannes Berg #ifdef CONFIG_PM 4941964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 49426abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 4943dfb89c56SJohannes Berg #endif 4944ff1b6e69SJohannes Berg 4945a293911dSJohannes Berg u16 max_remain_on_channel_duration; 4946a293911dSJohannes Berg 494767fbb16bSSamuel Ortiz u8 max_num_pmkids; 494867fbb16bSSamuel Ortiz 49497f531e03SBruno Randolf u32 available_antennas_tx; 49507f531e03SBruno Randolf u32 available_antennas_rx; 4951a7ffac95SBruno Randolf 495287bbbe22SArik Nemtsov u32 probe_resp_offload; 495387bbbe22SArik Nemtsov 4954a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 4955a50df0c4SJohannes Berg u8 extended_capabilities_len; 4956a50df0c4SJohannes Berg 4957019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 4958019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 4959019ae3a9SKanchanapally, Vidyullatha 4960cf5aa2f1SDavid Kilroy const void *privid; 4961d3236553SJohannes Berg 496257fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 4963d3236553SJohannes Berg 49640c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 4965d3236553SJohannes Berg struct regulatory_request *request); 4966d3236553SJohannes Berg 4967d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 4968d3236553SJohannes Berg 4969458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 4970d3236553SJohannes Berg 4971d3236553SJohannes Berg struct device dev; 4972d3236553SJohannes Berg 4973ecb44335SStanislaw Gruszka bool registered; 4974ecb44335SStanislaw Gruszka 4975d3236553SJohannes Berg struct dentry *debugfsdir; 4976d3236553SJohannes Berg 49777e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 4978ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 49797e7c8926SBen Greear 498053873f13SJohannes Berg struct list_head wdev_list; 498153873f13SJohannes Berg 49820c5c9fb5SEric W. Biederman possible_net_t _net; 4983463d0183SJohannes Berg 49843d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 49853d23e349SJohannes Berg const struct iw_handler_def *wext; 49863d23e349SJohannes Berg #endif 49873d23e349SJohannes Berg 4988be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 4989be29b99aSAmitkumar Karwar 4990ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 4991567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 4992567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 4993ad7e718cSJohannes Berg 4994b43504cfSJouni Malinen u16 max_ap_assoc_sta; 4995b43504cfSJouni Malinen 49969a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 49979a774c78SAndrei Otcheretianski 499838de03d2SArend van Spriel u32 bss_select_support; 499938de03d2SArend van Spriel 50008585989dSLuca Coelho u8 nan_supported_bands; 50018585989dSLuca Coelho 500252539ca8SToke Høiland-Jørgensen u32 txq_limit; 500352539ca8SToke Høiland-Jørgensen u32 txq_memory_limit; 500452539ca8SToke Høiland-Jørgensen u32 txq_quantum; 500552539ca8SToke Høiland-Jørgensen 50061f6e0baaSJohn Crispin unsigned long tx_queue_len; 50071f6e0baaSJohn Crispin 5008213ed579SSara Sharon u8 support_mbssid:1, 5009213ed579SSara Sharon support_only_he_mbssid:1; 5010213ed579SSara Sharon 50119bb7e0f2SJohannes Berg const struct cfg80211_pmsr_capabilities *pmsr_capa; 50129bb7e0f2SJohannes Berg 50133710a8a6SJohannes Berg struct { 50143710a8a6SJohannes Berg u64 peer, vif; 50156a21d16cSTamizh chelvam u8 max_retry; 50163710a8a6SJohannes Berg } tid_config_support; 50173710a8a6SJohannes Berg 50186a21d16cSTamizh chelvam u8 max_data_retry_count; 50196a21d16cSTamizh chelvam 5020396fba0aSGustavo A. R. Silva char priv[] __aligned(NETDEV_ALIGN); 5021d3236553SJohannes Berg }; 5022d3236553SJohannes Berg 5023463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 5024463d0183SJohannes Berg { 5025c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 5026463d0183SJohannes Berg } 5027463d0183SJohannes Berg 5028463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 5029463d0183SJohannes Berg { 5030c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 5031463d0183SJohannes Berg } 5032463d0183SJohannes Berg 5033d3236553SJohannes Berg /** 5034d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 5035d3236553SJohannes Berg * 5036d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 50370ae997dcSYacine Belkadi * Return: The priv of @wiphy. 5038d3236553SJohannes Berg */ 5039d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 5040d3236553SJohannes Berg { 5041d3236553SJohannes Berg BUG_ON(!wiphy); 5042d3236553SJohannes Berg return &wiphy->priv; 5043d3236553SJohannes Berg } 5044d3236553SJohannes Berg 5045d3236553SJohannes Berg /** 5046f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 5047f1f74825SDavid Kilroy * 5048f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 50490ae997dcSYacine Belkadi * Return: The wiphy of @priv. 5050f1f74825SDavid Kilroy */ 5051f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 5052f1f74825SDavid Kilroy { 5053f1f74825SDavid Kilroy BUG_ON(!priv); 5054f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 5055f1f74825SDavid Kilroy } 5056f1f74825SDavid Kilroy 5057f1f74825SDavid Kilroy /** 5058d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 5059d3236553SJohannes Berg * 5060d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 5061d3236553SJohannes Berg * @dev: The device to parent it to 5062d3236553SJohannes Berg */ 5063d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 5064d3236553SJohannes Berg { 5065d3236553SJohannes Berg wiphy->dev.parent = dev; 5066d3236553SJohannes Berg } 5067d3236553SJohannes Berg 5068d3236553SJohannes Berg /** 5069d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 5070d3236553SJohannes Berg * 5071d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 50720ae997dcSYacine Belkadi * Return: The dev of @wiphy. 5073d3236553SJohannes Berg */ 5074d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 5075d3236553SJohannes Berg { 5076d3236553SJohannes Berg return wiphy->dev.parent; 5077d3236553SJohannes Berg } 5078d3236553SJohannes Berg 5079d3236553SJohannes Berg /** 5080d3236553SJohannes Berg * wiphy_name - get wiphy name 5081d3236553SJohannes Berg * 5082d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 50830ae997dcSYacine Belkadi * Return: The name of @wiphy. 5084d3236553SJohannes Berg */ 5085e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 5086d3236553SJohannes Berg { 5087d3236553SJohannes Berg return dev_name(&wiphy->dev); 5088d3236553SJohannes Berg } 5089d3236553SJohannes Berg 5090d3236553SJohannes Berg /** 50911998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 50921998d90aSBen Greear * 50931998d90aSBen Greear * @ops: The configuration operations for this device 50941998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 50951998d90aSBen Greear * @requested_name: Request a particular name. 50961998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 50971998d90aSBen Greear * 50981998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 50991998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 51001998d90aSBen Greear * 51011998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 51021998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 51031998d90aSBen Greear */ 51041998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 51051998d90aSBen Greear const char *requested_name); 51061998d90aSBen Greear 51071998d90aSBen Greear /** 5108d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 5109d3236553SJohannes Berg * 5110d3236553SJohannes Berg * @ops: The configuration operations for this device 5111d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 5112d3236553SJohannes Berg * 5113d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 5114d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 5115d3236553SJohannes Berg * 51160ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 51170ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 5118d3236553SJohannes Berg */ 51191998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 51201998d90aSBen Greear int sizeof_priv) 51211998d90aSBen Greear { 51221998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 51231998d90aSBen Greear } 5124d3236553SJohannes Berg 5125d3236553SJohannes Berg /** 5126d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 5127d3236553SJohannes Berg * 5128d3236553SJohannes Berg * @wiphy: The wiphy to register. 5129d3236553SJohannes Berg * 51300ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 5131d3236553SJohannes Berg */ 513210dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 5133d3236553SJohannes Berg 5134d3236553SJohannes Berg /** 5135d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 5136d3236553SJohannes Berg * 5137d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 5138d3236553SJohannes Berg * 5139d3236553SJohannes Berg * After this call, no more requests can be made with this priv 5140d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 5141d3236553SJohannes Berg * request that is being handled. 5142d3236553SJohannes Berg */ 514310dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 5144d3236553SJohannes Berg 5145d3236553SJohannes Berg /** 5146d3236553SJohannes Berg * wiphy_free - free wiphy 5147d3236553SJohannes Berg * 5148d3236553SJohannes Berg * @wiphy: The wiphy to free 5149d3236553SJohannes Berg */ 515010dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 5151d3236553SJohannes Berg 5152fffd0934SJohannes Berg /* internal structs */ 51536829c878SJohannes Berg struct cfg80211_conn; 515419957bb3SJohannes Berg struct cfg80211_internal_bss; 5155fffd0934SJohannes Berg struct cfg80211_cached_keys; 51564a4b8169SAndrew Zaborowski struct cfg80211_cqm_config; 515719957bb3SJohannes Berg 5158d3236553SJohannes Berg /** 515989a54e48SJohannes Berg * struct wireless_dev - wireless device state 5160d3236553SJohannes Berg * 516189a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 516289a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 516389a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 516489a54e48SJohannes Berg * It need not be registered then as netdev registration will 516589a54e48SJohannes Berg * be intercepted by cfg80211 to see the new wireless device. 516689a54e48SJohannes Berg * 516789a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 516889a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 516989a54e48SJohannes Berg * there's no netdev registration in that case it may not be 517089a54e48SJohannes Berg * allocated outside of callback operations that return it. 5171d3236553SJohannes Berg * 5172d3236553SJohannes Berg * @wiphy: pointer to hardware description 5173d3236553SJohannes Berg * @iftype: interface type 5174d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 517589a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 517689a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 517789a54e48SJohannes Berg * wireless device if it has no netdev 5178d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 51799e0e2961SMichal Kazior * @chandef: (private) Used by the internal configuration code to track 51809e0e2961SMichal Kazior * the user-set channel definition. 5181780b40dfSJohannes Berg * @preset_chandef: (private) Used by the internal configuration code to 5182aa430da4SJohannes Berg * track the channel to be used for AP later 5183d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 5184d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 5185d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 518629cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 518729cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 5188d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 51899874b71fSJohannes Berg * @wext.ibss: (private) IBSS data part of wext handling 51909874b71fSJohannes Berg * @wext.connect: (private) connection handling data 51919874b71fSJohannes Berg * @wext.keys: (private) (WEP) key data 51929874b71fSJohannes Berg * @wext.ie: (private) extra elements for association 51939874b71fSJohannes Berg * @wext.ie_len: (private) length of extra elements 51949874b71fSJohannes Berg * @wext.bssid: (private) selected network BSSID 51959874b71fSJohannes Berg * @wext.ssid: (private) selected network SSID 51969874b71fSJohannes Berg * @wext.default_key: (private) selected default key index 51979874b71fSJohannes Berg * @wext.default_mgmt_key: (private) selected default management key index 51989874b71fSJohannes Berg * @wext.prev_bssid: (private) previous BSSID for reassociation 51999874b71fSJohannes Berg * @wext.prev_bssid_valid: (private) previous BSSID validity 52009bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 52019bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 52029bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 52039bc383deSJohannes Berg * by cfg80211 on change_interface 52042e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 52052e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 520679ea1e12SJohannes Berg * @mgmt_registrations_need_update: mgmt registrations were updated, 520779ea1e12SJohannes Berg * need to propagate the update to the driver 52088d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 52098d61ffa5SJohannes Berg * and some API functions require it held 521056d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 521156d1893dSJohannes Berg * beacons, 0 when not valid 521298104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 521373c7da3dSArend Van Spriel * @is_running: true if this is a non-netdev device that has been started, e.g. 521473c7da3dSArend Van Spriel * the P2P Device. 521504f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 521604f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 521731559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 5218780b40dfSJohannes Berg * @ps: powersave mode is enabled 5219780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 5220780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 5221780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 5222780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 5223780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 522434d50519SLior David * @conn_bss_type: connecting/connected BSS type 5225bd2522b1SAndrzej Zaborowski * @conn_owner_nlportid: (private) connection owner socket port ID 5226bd2522b1SAndrzej Zaborowski * @disconnect_wk: (private) auto-disconnect work 5227bd2522b1SAndrzej Zaborowski * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 5228780b40dfSJohannes Berg * @ibss_fixed: (private) IBSS is using fixed BSSID 52295336fa88SSimon Wunderlich * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 5230780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 5231780b40dfSJohannes Berg * @event_lock: (private) lock for event list 523278f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 5233ab81007aSJohannes Berg * @nl_owner_dead: (private) owner socket went away 52344a4b8169SAndrew Zaborowski * @cqm_config: (private) nl80211 RSSI monitor state 52359bb7e0f2SJohannes Berg * @pmsr_list: (private) peer measurement requests 52369bb7e0f2SJohannes Berg * @pmsr_lock: (private) peer measurements requests/results lock 52379bb7e0f2SJohannes Berg * @pmsr_free_wk: (private) peer measurements cleanup work 52384d797fceSJouni Malinen * @unprot_beacon_reported: (private) timestamp of last 52394d797fceSJouni Malinen * unprotected beacon report 5240d3236553SJohannes Berg */ 5241d3236553SJohannes Berg struct wireless_dev { 5242d3236553SJohannes Berg struct wiphy *wiphy; 5243d3236553SJohannes Berg enum nl80211_iftype iftype; 5244d3236553SJohannes Berg 5245667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 5246d3236553SJohannes Berg struct list_head list; 5247d3236553SJohannes Berg struct net_device *netdev; 5248d3236553SJohannes Berg 524989a54e48SJohannes Berg u32 identifier; 525089a54e48SJohannes Berg 52512e161f78SJohannes Berg struct list_head mgmt_registrations; 52522e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 525379ea1e12SJohannes Berg u8 mgmt_registrations_need_update:1; 5254026331c4SJouni Malinen 5255667503ddSJohannes Berg struct mutex mtx; 5256667503ddSJohannes Berg 525773c7da3dSArend Van Spriel bool use_4addr, is_running; 525898104fdeSJohannes Berg 525998104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 52609bc383deSJohannes Berg 5261b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 5262d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 526329cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 52646829c878SJohannes Berg struct cfg80211_conn *conn; 5265fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 526634d50519SLior David enum ieee80211_bss_type conn_bss_type; 5267bd2522b1SAndrzej Zaborowski u32 conn_owner_nlportid; 5268bd2522b1SAndrzej Zaborowski 5269bd2522b1SAndrzej Zaborowski struct work_struct disconnect_wk; 5270bd2522b1SAndrzej Zaborowski u8 disconnect_bssid[ETH_ALEN]; 5271d3236553SJohannes Berg 5272667503ddSJohannes Berg struct list_head event_list; 5273667503ddSJohannes Berg spinlock_t event_lock; 5274667503ddSJohannes Berg 527519957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 5276683b6d3bSJohannes Berg struct cfg80211_chan_def preset_chandef; 52779e0e2961SMichal Kazior struct cfg80211_chan_def chandef; 5278f4489ebeSMichal Kazior 5279c30a3d38SMichal Kazior bool ibss_fixed; 52805336fa88SSimon Wunderlich bool ibss_dfs_possible; 5281c30a3d38SMichal Kazior 5282ffb9eb3dSKalle Valo bool ps; 5283ffb9eb3dSKalle Valo int ps_timeout; 5284ffb9eb3dSKalle Valo 528556d1893dSJohannes Berg int beacon_interval; 528656d1893dSJohannes Berg 528715e47304SEric W. Biederman u32 ap_unexpected_nlportid; 528828946da7SJohannes Berg 5289ab81007aSJohannes Berg u32 owner_nlportid; 5290ab81007aSJohannes Berg bool nl_owner_dead; 5291ab81007aSJohannes Berg 529204f39047SSimon Wunderlich bool cac_started; 529304f39047SSimon Wunderlich unsigned long cac_start_time; 529431559f35SJanusz Dziedzic unsigned int cac_time_ms; 529504f39047SSimon Wunderlich 52963d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 5297d3236553SJohannes Berg /* wext data */ 5298cbe8fa9cSJohannes Berg struct { 5299cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 5300f2129354SJohannes Berg struct cfg80211_connect_params connect; 5301fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 5302c1e5f471SJohannes Berg const u8 *ie; 5303f2129354SJohannes Berg size_t ie_len; 53049874b71fSJohannes Berg u8 bssid[ETH_ALEN]; 53059874b71fSJohannes Berg u8 prev_bssid[ETH_ALEN]; 5306f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 530708645126SJohannes Berg s8 default_key, default_mgmt_key; 5308ffb9eb3dSKalle Valo bool prev_bssid_valid; 5309cbe8fa9cSJohannes Berg } wext; 5310d3236553SJohannes Berg #endif 53114a4b8169SAndrew Zaborowski 53124a4b8169SAndrew Zaborowski struct cfg80211_cqm_config *cqm_config; 53139bb7e0f2SJohannes Berg 53149bb7e0f2SJohannes Berg struct list_head pmsr_list; 53159bb7e0f2SJohannes Berg spinlock_t pmsr_lock; 53169bb7e0f2SJohannes Berg struct work_struct pmsr_free_wk; 53174d797fceSJouni Malinen 53184d797fceSJouni Malinen unsigned long unprot_beacon_reported; 5319d3236553SJohannes Berg }; 5320d3236553SJohannes Berg 532198104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev) 532298104fdeSJohannes Berg { 532398104fdeSJohannes Berg if (wdev->netdev) 532498104fdeSJohannes Berg return wdev->netdev->dev_addr; 532598104fdeSJohannes Berg return wdev->address; 532698104fdeSJohannes Berg } 532798104fdeSJohannes Berg 532873c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev) 532973c7da3dSArend Van Spriel { 533073c7da3dSArend Van Spriel if (wdev->netdev) 533173c7da3dSArend Van Spriel return netif_running(wdev->netdev); 533273c7da3dSArend Van Spriel return wdev->is_running; 533373c7da3dSArend Van Spriel } 533473c7da3dSArend Van Spriel 5335d3236553SJohannes Berg /** 5336d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 5337d3236553SJohannes Berg * 5338d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 53390ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 5340d3236553SJohannes Berg */ 5341d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 5342d3236553SJohannes Berg { 5343d3236553SJohannes Berg BUG_ON(!wdev); 5344d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 5345d3236553SJohannes Berg } 5346d3236553SJohannes Berg 5347d70e9693SJohannes Berg /** 5348d70e9693SJohannes Berg * DOC: Utility functions 5349d70e9693SJohannes Berg * 5350d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 5351d3236553SJohannes Berg */ 5352d3236553SJohannes Berg 5353d3236553SJohannes Berg /** 5354934f4c7dSThomas Pedersen * ieee80211_channel_equal - compare two struct ieee80211_channel 5355934f4c7dSThomas Pedersen * 5356934f4c7dSThomas Pedersen * @a: 1st struct ieee80211_channel 5357934f4c7dSThomas Pedersen * @b: 2nd struct ieee80211_channel 5358934f4c7dSThomas Pedersen * Return: true if center frequency of @a == @b 5359934f4c7dSThomas Pedersen */ 5360934f4c7dSThomas Pedersen static inline bool 5361934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a, 5362934f4c7dSThomas Pedersen struct ieee80211_channel *b) 5363934f4c7dSThomas Pedersen { 5364934f4c7dSThomas Pedersen return (a->center_freq == b->center_freq && 5365934f4c7dSThomas Pedersen a->freq_offset == b->freq_offset); 5366934f4c7dSThomas Pedersen } 5367934f4c7dSThomas Pedersen 5368934f4c7dSThomas Pedersen /** 5369934f4c7dSThomas Pedersen * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz 5370934f4c7dSThomas Pedersen * @chan: struct ieee80211_channel to convert 5371934f4c7dSThomas Pedersen * Return: The corresponding frequency (in KHz) 5372934f4c7dSThomas Pedersen */ 5373934f4c7dSThomas Pedersen static inline u32 5374934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan) 5375934f4c7dSThomas Pedersen { 5376934f4c7dSThomas Pedersen return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset; 5377934f4c7dSThomas Pedersen } 5378934f4c7dSThomas Pedersen 5379934f4c7dSThomas Pedersen /** 538011b34737SThomas Pedersen * ieee80211_s1g_channel_width - get allowed channel width from @chan 538111b34737SThomas Pedersen * 538211b34737SThomas Pedersen * Only allowed for band NL80211_BAND_S1GHZ 538311b34737SThomas Pedersen * @chan: channel 538411b34737SThomas Pedersen * Return: The allowed channel width for this center_freq 538511b34737SThomas Pedersen */ 538611b34737SThomas Pedersen enum nl80211_chan_width 538711b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan); 538811b34737SThomas Pedersen 538911b34737SThomas Pedersen /** 5390934f4c7dSThomas Pedersen * ieee80211_channel_to_freq_khz - convert channel number to frequency 5391934f4c7dSThomas Pedersen * @chan: channel number 5392934f4c7dSThomas Pedersen * @band: band, necessary due to channel number overlap 5393934f4c7dSThomas Pedersen * Return: The corresponding frequency (in KHz), or 0 if the conversion failed. 5394934f4c7dSThomas Pedersen */ 5395934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band); 5396934f4c7dSThomas Pedersen 5397934f4c7dSThomas Pedersen /** 5398d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 5399abe37c4bSJohannes Berg * @chan: channel number 540059eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 54010ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 5402d3236553SJohannes Berg */ 5403934f4c7dSThomas Pedersen static inline int 5404934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band) 5405934f4c7dSThomas Pedersen { 5406934f4c7dSThomas Pedersen return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band)); 5407934f4c7dSThomas Pedersen } 5408934f4c7dSThomas Pedersen 5409934f4c7dSThomas Pedersen /** 5410934f4c7dSThomas Pedersen * ieee80211_freq_khz_to_channel - convert frequency to channel number 5411934f4c7dSThomas Pedersen * @freq: center frequency in KHz 5412934f4c7dSThomas Pedersen * Return: The corresponding channel, or 0 if the conversion failed. 5413934f4c7dSThomas Pedersen */ 5414934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq); 5415d3236553SJohannes Berg 5416d3236553SJohannes Berg /** 5417d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 5418934f4c7dSThomas Pedersen * @freq: center frequency in MHz 54190ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 5420d3236553SJohannes Berg */ 5421934f4c7dSThomas Pedersen static inline int 5422934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq) 5423934f4c7dSThomas Pedersen { 5424934f4c7dSThomas Pedersen return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq)); 5425934f4c7dSThomas Pedersen } 5426934f4c7dSThomas Pedersen 5427934f4c7dSThomas Pedersen /** 5428934f4c7dSThomas Pedersen * ieee80211_get_channel_khz - get channel struct from wiphy for specified 5429934f4c7dSThomas Pedersen * frequency 5430934f4c7dSThomas Pedersen * @wiphy: the struct wiphy to get the channel for 5431934f4c7dSThomas Pedersen * @freq: the center frequency (in KHz) of the channel 5432934f4c7dSThomas Pedersen * Return: The channel struct from @wiphy at @freq. 5433934f4c7dSThomas Pedersen */ 5434934f4c7dSThomas Pedersen struct ieee80211_channel * 5435934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq); 5436d3236553SJohannes Berg 5437d3236553SJohannes Berg /** 5438d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 5439543b921bSArend Van Spriel * 5440abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 5441934f4c7dSThomas Pedersen * @freq: the center frequency (in MHz) of the channel 54420ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 5443d3236553SJohannes Berg */ 5444934f4c7dSThomas Pedersen static inline struct ieee80211_channel * 5445934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq) 5446934f4c7dSThomas Pedersen { 5447934f4c7dSThomas Pedersen return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq)); 5448934f4c7dSThomas Pedersen } 5449d3236553SJohannes Berg 5450d3236553SJohannes Berg /** 5451afbc9c9eSJohannes Berg * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC 5452afbc9c9eSJohannes Berg * @chan: control channel to check 5453afbc9c9eSJohannes Berg * 5454afbc9c9eSJohannes Berg * The Preferred Scanning Channels (PSC) are defined in 5455afbc9c9eSJohannes Berg * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3 5456afbc9c9eSJohannes Berg */ 5457afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan) 5458afbc9c9eSJohannes Berg { 5459afbc9c9eSJohannes Berg if (chan->band != NL80211_BAND_6GHZ) 5460afbc9c9eSJohannes Berg return false; 5461afbc9c9eSJohannes Berg 5462afbc9c9eSJohannes Berg return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5; 5463afbc9c9eSJohannes Berg } 5464afbc9c9eSJohannes Berg 5465afbc9c9eSJohannes Berg /** 5466d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 5467d3236553SJohannes Berg * 5468d3236553SJohannes Berg * @sband: the band to look for rates in 5469d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 5470d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 5471d3236553SJohannes Berg * 54720ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 54730ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 54740ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 54750ae997dcSYacine Belkadi * rates in the band's bitrate table. 5476d3236553SJohannes Berg */ 5477d3236553SJohannes Berg struct ieee80211_rate * 5478d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 5479d3236553SJohannes Berg u32 basic_rates, int bitrate); 5480d3236553SJohannes Berg 5481b422c6cdSAshok Nagarajan /** 5482b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 5483b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 548474608acaSSimon Wunderlich * @scan_width: width of the control channel 5485b422c6cdSAshok Nagarajan * 5486b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 5487b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 5488b422c6cdSAshok Nagarajan */ 548974608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 549074608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 5491b422c6cdSAshok Nagarajan 5492d3236553SJohannes Berg /* 5493d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 5494d3236553SJohannes Berg * 5495d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 549666d495d0SMauro Carvalho Chehab * Documentation in Documentation/networking/radiotap-headers.rst 5497d3236553SJohannes Berg */ 5498d3236553SJohannes Berg 549933e5a2f7SJohannes Berg struct radiotap_align_size { 550033e5a2f7SJohannes Berg uint8_t align:4, size:4; 550133e5a2f7SJohannes Berg }; 550233e5a2f7SJohannes Berg 550333e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 550433e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 550533e5a2f7SJohannes Berg int n_bits; 550633e5a2f7SJohannes Berg uint32_t oui; 550733e5a2f7SJohannes Berg uint8_t subns; 550833e5a2f7SJohannes Berg }; 550933e5a2f7SJohannes Berg 551033e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 551133e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 551233e5a2f7SJohannes Berg int n_ns; 551333e5a2f7SJohannes Berg }; 551433e5a2f7SJohannes Berg 5515d3236553SJohannes Berg /** 5516d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 551733e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 551833e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 551933e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 552033e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 552133e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 552233e5a2f7SJohannes Berg * the beginning of the actual data portion 552333e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 552433e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 552533e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 552633e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 552733e5a2f7SJohannes Berg * radiotap namespace or not 552833e5a2f7SJohannes Berg * 552933e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 553033e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 553133e5a2f7SJohannes Berg * @_arg_index: next argument index 553233e5a2f7SJohannes Berg * @_arg: next argument pointer 553333e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 553433e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 553533e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 553633e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 553733e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 553833e5a2f7SJohannes Berg * next bitmap word 553933e5a2f7SJohannes Berg * 554033e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 554133e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 5542d3236553SJohannes Berg */ 5543d3236553SJohannes Berg 5544d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 554533e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 554633e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 554733e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 5548d3236553SJohannes Berg 554933e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 555067272440SJohannes Berg __le32 *_next_bitmap; 555133e5a2f7SJohannes Berg 555233e5a2f7SJohannes Berg unsigned char *this_arg; 555333e5a2f7SJohannes Berg int this_arg_index; 555433e5a2f7SJohannes Berg int this_arg_size; 555533e5a2f7SJohannes Berg 555633e5a2f7SJohannes Berg int is_radiotap_ns; 555733e5a2f7SJohannes Berg 555833e5a2f7SJohannes Berg int _max_length; 555933e5a2f7SJohannes Berg int _arg_index; 556033e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 556133e5a2f7SJohannes Berg int _reset_on_ext; 5562d3236553SJohannes Berg }; 5563d3236553SJohannes Berg 556410dd9b7cSJoe Perches int 556510dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 5566d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 556710dd9b7cSJoe Perches int max_length, 556810dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 5569d3236553SJohannes Berg 557010dd9b7cSJoe Perches int 557110dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 5572d3236553SJohannes Berg 557333e5a2f7SJohannes Berg 5574e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 5575e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 5576e31a16d6SZhu Yi 5577e31a16d6SZhu Yi /** 5578e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 5579e31a16d6SZhu Yi * 5580e31a16d6SZhu Yi * @skb: the frame 55810ae997dcSYacine Belkadi * 55820ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 55830ae997dcSYacine Belkadi * returns the 802.11 header length. 55840ae997dcSYacine Belkadi * 55850ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 55860ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 55870ae997dcSYacine Belkadi * 802.11 header. 5588e31a16d6SZhu Yi */ 5589e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 5590e31a16d6SZhu Yi 5591e31a16d6SZhu Yi /** 5592e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 5593e31a16d6SZhu Yi * @fc: frame control field in little-endian format 55940ae997dcSYacine Belkadi * Return: The header length in bytes. 5595e31a16d6SZhu Yi */ 5596633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 5597e31a16d6SZhu Yi 5598e31a16d6SZhu Yi /** 55999b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 56009b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 56019b395bc3SJohannes Berg * (first byte) will be accessed 56020ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 56039b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 56049b395bc3SJohannes Berg */ 56059b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 56069b395bc3SJohannes Berg 56079b395bc3SJohannes Berg /** 5608d70e9693SJohannes Berg * DOC: Data path helpers 5609d70e9693SJohannes Berg * 5610d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 5611d70e9693SJohannes Berg * functions that help implement the data path for devices 5612d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 5613d70e9693SJohannes Berg */ 5614d70e9693SJohannes Berg 5615d70e9693SJohannes Berg /** 56167f6990c8SJohannes Berg * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 56177f6990c8SJohannes Berg * @skb: the 802.11 data frame 56187f6990c8SJohannes Berg * @ehdr: pointer to a &struct ethhdr that will get the header, instead 56197f6990c8SJohannes Berg * of it being pushed into the SKB 56207f6990c8SJohannes Berg * @addr: the device MAC address 56217f6990c8SJohannes Berg * @iftype: the virtual interface type 562224bba078SFelix Fietkau * @data_offset: offset of payload after the 802.11 header 56237f6990c8SJohannes Berg * Return: 0 on success. Non-zero on error. 56247f6990c8SJohannes Berg */ 56257f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 562624bba078SFelix Fietkau const u8 *addr, enum nl80211_iftype iftype, 562724bba078SFelix Fietkau u8 data_offset); 56287f6990c8SJohannes Berg 56297f6990c8SJohannes Berg /** 5630e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 5631e31a16d6SZhu Yi * @skb: the 802.11 data frame 5632e31a16d6SZhu Yi * @addr: the device MAC address 5633e31a16d6SZhu Yi * @iftype: the virtual interface type 56340ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 5635e31a16d6SZhu Yi */ 56367f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 56377f6990c8SJohannes Berg enum nl80211_iftype iftype) 56387f6990c8SJohannes Berg { 563924bba078SFelix Fietkau return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); 56407f6990c8SJohannes Berg } 5641e31a16d6SZhu Yi 5642e31a16d6SZhu Yi /** 5643eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 5644eaf85ca7SZhu Yi * 56457f6990c8SJohannes Berg * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 56467f6990c8SJohannes Berg * The @list will be empty if the decode fails. The @skb must be fully 56477f6990c8SJohannes Berg * header-less before being passed in here; it is freed in this function. 5648eaf85ca7SZhu Yi * 56497f6990c8SJohannes Berg * @skb: The input A-MSDU frame without any headers. 5650eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 5651085a6c10SRandy Dunlap * initialized by the caller. 5652eaf85ca7SZhu Yi * @addr: The device MAC address. 5653eaf85ca7SZhu Yi * @iftype: The device interface type. 5654eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 56558b935ee2SJohannes Berg * @check_da: DA to check in the inner ethernet header, or NULL 56568b935ee2SJohannes Berg * @check_sa: SA to check in the inner ethernet header, or NULL 5657eaf85ca7SZhu Yi */ 5658eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 5659eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 56608b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 56618b935ee2SJohannes Berg const u8 *check_da, const u8 *check_sa); 5662eaf85ca7SZhu Yi 5663eaf85ca7SZhu Yi /** 5664e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 5665e31a16d6SZhu Yi * @skb: the data frame 5666fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 56670ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 5668e31a16d6SZhu Yi */ 5669fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 5670fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 5671e31a16d6SZhu Yi 5672c21dbf92SJohannes Berg /** 567349a68e0dSJohannes Berg * cfg80211_find_elem_match - match information element and byte array in data 567449a68e0dSJohannes Berg * 567549a68e0dSJohannes Berg * @eid: element ID 567649a68e0dSJohannes Berg * @ies: data consisting of IEs 567749a68e0dSJohannes Berg * @len: length of data 567849a68e0dSJohannes Berg * @match: byte array to match 567949a68e0dSJohannes Berg * @match_len: number of bytes in the match array 568049a68e0dSJohannes Berg * @match_offset: offset in the IE data where the byte array should match. 568149a68e0dSJohannes Berg * Note the difference to cfg80211_find_ie_match() which considers 568249a68e0dSJohannes Berg * the offset to start from the element ID byte, but here we take 568349a68e0dSJohannes Berg * the data portion instead. 568449a68e0dSJohannes Berg * 568549a68e0dSJohannes Berg * Return: %NULL if the element ID could not be found or if 568649a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 568749a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 568849a68e0dSJohannes Berg * requested element struct. 568949a68e0dSJohannes Berg * 569049a68e0dSJohannes Berg * Note: There are no checks on the element length other than 569149a68e0dSJohannes Berg * having to fit into the given data and being large enough for the 569249a68e0dSJohannes Berg * byte array to match. 569349a68e0dSJohannes Berg */ 569449a68e0dSJohannes Berg const struct element * 569549a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len, 569649a68e0dSJohannes Berg const u8 *match, unsigned int match_len, 569749a68e0dSJohannes Berg unsigned int match_offset); 569849a68e0dSJohannes Berg 569949a68e0dSJohannes Berg /** 5700fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 5701fbd05e4aSLuca Coelho * 5702fbd05e4aSLuca Coelho * @eid: element ID 5703fbd05e4aSLuca Coelho * @ies: data consisting of IEs 5704fbd05e4aSLuca Coelho * @len: length of data 5705fbd05e4aSLuca Coelho * @match: byte array to match 5706fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 5707fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 5708fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 5709fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 5710fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 5711fbd05e4aSLuca Coelho * the second byte is the IE length. 5712fbd05e4aSLuca Coelho * 5713fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 5714fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 5715fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 5716fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 5717fbd05e4aSLuca Coelho * element ID. 5718fbd05e4aSLuca Coelho * 5719fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 5720fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 5721fbd05e4aSLuca Coelho * byte array to match. 5722fbd05e4aSLuca Coelho */ 572349a68e0dSJohannes Berg static inline const u8 * 572449a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len, 572549a68e0dSJohannes Berg const u8 *match, unsigned int match_len, 572649a68e0dSJohannes Berg unsigned int match_offset) 572749a68e0dSJohannes Berg { 572849a68e0dSJohannes Berg /* match_offset can't be smaller than 2, unless match_len is 572949a68e0dSJohannes Berg * zero, in which case match_offset must be zero as well. 573049a68e0dSJohannes Berg */ 573149a68e0dSJohannes Berg if (WARN_ON((match_len && match_offset < 2) || 573249a68e0dSJohannes Berg (!match_len && match_offset))) 573349a68e0dSJohannes Berg return NULL; 573449a68e0dSJohannes Berg 573549a68e0dSJohannes Berg return (void *)cfg80211_find_elem_match(eid, ies, len, 573649a68e0dSJohannes Berg match, match_len, 573749a68e0dSJohannes Berg match_offset ? 573849a68e0dSJohannes Berg match_offset - 2 : 0); 573949a68e0dSJohannes Berg } 574049a68e0dSJohannes Berg 574149a68e0dSJohannes Berg /** 574249a68e0dSJohannes Berg * cfg80211_find_elem - find information element in data 574349a68e0dSJohannes Berg * 574449a68e0dSJohannes Berg * @eid: element ID 574549a68e0dSJohannes Berg * @ies: data consisting of IEs 574649a68e0dSJohannes Berg * @len: length of data 574749a68e0dSJohannes Berg * 574849a68e0dSJohannes Berg * Return: %NULL if the element ID could not be found or if 574949a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 575049a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 575149a68e0dSJohannes Berg * requested element struct. 575249a68e0dSJohannes Berg * 575349a68e0dSJohannes Berg * Note: There are no checks on the element length other than 575449a68e0dSJohannes Berg * having to fit into the given data. 575549a68e0dSJohannes Berg */ 575649a68e0dSJohannes Berg static inline const struct element * 575749a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len) 575849a68e0dSJohannes Berg { 575949a68e0dSJohannes Berg return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0); 576049a68e0dSJohannes Berg } 5761fbd05e4aSLuca Coelho 5762fbd05e4aSLuca Coelho /** 5763c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 5764c21dbf92SJohannes Berg * 5765c21dbf92SJohannes Berg * @eid: element ID 5766c21dbf92SJohannes Berg * @ies: data consisting of IEs 5767c21dbf92SJohannes Berg * @len: length of data 5768c21dbf92SJohannes Berg * 57690ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 57700ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 57710ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 57720ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 57730ae997dcSYacine Belkadi * 57740ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 57750ae997dcSYacine Belkadi * having to fit into the given data. 5776c21dbf92SJohannes Berg */ 5777fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 5778fbd05e4aSLuca Coelho { 5779fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 5780fbd05e4aSLuca Coelho } 5781c21dbf92SJohannes Berg 5782d70e9693SJohannes Berg /** 578349a68e0dSJohannes Berg * cfg80211_find_ext_elem - find information element with EID Extension in data 578449a68e0dSJohannes Berg * 578549a68e0dSJohannes Berg * @ext_eid: element ID Extension 578649a68e0dSJohannes Berg * @ies: data consisting of IEs 578749a68e0dSJohannes Berg * @len: length of data 578849a68e0dSJohannes Berg * 578949a68e0dSJohannes Berg * Return: %NULL if the etended element could not be found or if 579049a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 579149a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 579249a68e0dSJohannes Berg * requested element struct. 579349a68e0dSJohannes Berg * 579449a68e0dSJohannes Berg * Note: There are no checks on the element length other than 579549a68e0dSJohannes Berg * having to fit into the given data. 579649a68e0dSJohannes Berg */ 579749a68e0dSJohannes Berg static inline const struct element * 579849a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len) 579949a68e0dSJohannes Berg { 580049a68e0dSJohannes Berg return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len, 580149a68e0dSJohannes Berg &ext_eid, 1, 0); 580249a68e0dSJohannes Berg } 580349a68e0dSJohannes Berg 580449a68e0dSJohannes Berg /** 58053f817fe7SJouni Malinen * cfg80211_find_ext_ie - find information element with EID Extension in data 58063f817fe7SJouni Malinen * 58073f817fe7SJouni Malinen * @ext_eid: element ID Extension 58083f817fe7SJouni Malinen * @ies: data consisting of IEs 58093f817fe7SJouni Malinen * @len: length of data 58103f817fe7SJouni Malinen * 58113f817fe7SJouni Malinen * Return: %NULL if the extended element ID could not be found or if 58123f817fe7SJouni Malinen * the element is invalid (claims to be longer than the given 58133f817fe7SJouni Malinen * data), or a pointer to the first byte of the requested 58143f817fe7SJouni Malinen * element, that is the byte containing the element ID. 58153f817fe7SJouni Malinen * 58163f817fe7SJouni Malinen * Note: There are no checks on the element length other than 58173f817fe7SJouni Malinen * having to fit into the given data. 58183f817fe7SJouni Malinen */ 58193f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 58203f817fe7SJouni Malinen { 58213f817fe7SJouni Malinen return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 58223f817fe7SJouni Malinen &ext_eid, 1, 2); 58233f817fe7SJouni Malinen } 58243f817fe7SJouni Malinen 58253f817fe7SJouni Malinen /** 582649a68e0dSJohannes Berg * cfg80211_find_vendor_elem - find vendor specific information element in data 582749a68e0dSJohannes Berg * 582849a68e0dSJohannes Berg * @oui: vendor OUI 582949a68e0dSJohannes Berg * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 583049a68e0dSJohannes Berg * @ies: data consisting of IEs 583149a68e0dSJohannes Berg * @len: length of data 583249a68e0dSJohannes Berg * 583349a68e0dSJohannes Berg * Return: %NULL if the vendor specific element ID could not be found or if the 583449a68e0dSJohannes Berg * element is invalid (claims to be longer than the given data); otherwise 583549a68e0dSJohannes Berg * return the element structure for the requested element. 583649a68e0dSJohannes Berg * 583749a68e0dSJohannes Berg * Note: There are no checks on the element length other than having to fit into 583849a68e0dSJohannes Berg * the given data. 583949a68e0dSJohannes Berg */ 584049a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type, 584149a68e0dSJohannes Berg const u8 *ies, 584249a68e0dSJohannes Berg unsigned int len); 584349a68e0dSJohannes Berg 584449a68e0dSJohannes Berg /** 58450c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 58460c28ec58SEliad Peller * 58470c28ec58SEliad Peller * @oui: vendor OUI 58489e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 58490c28ec58SEliad Peller * @ies: data consisting of IEs 58500c28ec58SEliad Peller * @len: length of data 58510c28ec58SEliad Peller * 58520ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 58530ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 58540ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 58550ae997dcSYacine Belkadi * element ID. 58560ae997dcSYacine Belkadi * 58570ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 58580ae997dcSYacine Belkadi * the given data. 58590c28ec58SEliad Peller */ 586049a68e0dSJohannes Berg static inline const u8 * 586149a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 586249a68e0dSJohannes Berg const u8 *ies, unsigned int len) 586349a68e0dSJohannes Berg { 586449a68e0dSJohannes Berg return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len); 586549a68e0dSJohannes Berg } 58660c28ec58SEliad Peller 58670c28ec58SEliad Peller /** 586830ca1aa5SDedy Lansky * cfg80211_send_layer2_update - send layer 2 update frame 586930ca1aa5SDedy Lansky * 587030ca1aa5SDedy Lansky * @dev: network device 587130ca1aa5SDedy Lansky * @addr: STA MAC address 587230ca1aa5SDedy Lansky * 587330ca1aa5SDedy Lansky * Wireless drivers can use this function to update forwarding tables in bridge 587430ca1aa5SDedy Lansky * devices upon STA association. 587530ca1aa5SDedy Lansky */ 587630ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); 587730ca1aa5SDedy Lansky 587830ca1aa5SDedy Lansky /** 5879d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 5880d70e9693SJohannes Berg * 5881d70e9693SJohannes Berg * TODO 5882d3236553SJohannes Berg */ 5883d3236553SJohannes Berg 5884d3236553SJohannes Berg /** 5885d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 5886d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 5887d3236553SJohannes Berg * conflicts) 5888d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 5889d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 5890d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 5891d3236553SJohannes Berg * alpha2. 5892d3236553SJohannes Berg * 5893d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 5894d3236553SJohannes Berg * what it believes should be the current regulatory domain by 5895d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 5896d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 5897d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 5898d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 5899d3236553SJohannes Berg * 5900d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 5901d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 5902d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 5903d3236553SJohannes Berg * 5904d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 5905d3236553SJohannes Berg * an -ENOMEM. 59060ae997dcSYacine Belkadi * 59070ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 5908d3236553SJohannes Berg */ 590910dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 5910d3236553SJohannes Berg 5911d3236553SJohannes Berg /** 5912b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 5913b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 5914b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 5915b0d7aa59SJonathan Doron * 5916b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 5917b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 5918b0d7aa59SJonathan Doron * information. 5919b0d7aa59SJonathan Doron * 5920b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 5921b0d7aa59SJonathan Doron */ 5922b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 5923b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 5924b0d7aa59SJonathan Doron 5925b0d7aa59SJonathan Doron /** 59262c3e861cSArik Nemtsov * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers 59272c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 59282c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 59292c3e861cSArik Nemtsov * 59302c3e861cSArik Nemtsov * This functions requires the RTNL to be held and applies the new regdomain 59312c3e861cSArik Nemtsov * synchronously to this wiphy. For more details see 59322c3e861cSArik Nemtsov * regulatory_set_wiphy_regd(). 59332c3e861cSArik Nemtsov * 59342c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 59352c3e861cSArik Nemtsov */ 59362c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 59372c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 59382c3e861cSArik Nemtsov 59392c3e861cSArik Nemtsov /** 5940d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 5941d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 5942d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 5943d3236553SJohannes Berg * 5944d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 5945d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 5946d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 5947d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 5948d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 5949d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 5950222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 5951ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 5952222ea581SLuis R. Rodriguez * that called this helper. 5953d3236553SJohannes Berg */ 595410dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 5955d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 5956d3236553SJohannes Berg 5957d3236553SJohannes Berg /** 5958d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 5959d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 5960d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 5961d3236553SJohannes Berg * 5962d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 5963d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 5964d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 5965d3236553SJohannes Berg * and processed already. 5966d3236553SJohannes Berg * 59670ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 59680ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 59690ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 59700ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 59710ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 59720ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 59730ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 5974d3236553SJohannes Berg */ 5975361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 5976361c9c8bSJohannes Berg u32 center_freq); 5977d3236553SJohannes Berg 5978034c6d6eSLuis R. Rodriguez /** 5979034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 5980034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 5981034c6d6eSLuis R. Rodriguez * 5982034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 5983034c6d6eSLuis R. Rodriguez * proper string representation. 5984034c6d6eSLuis R. Rodriguez */ 5985034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 5986034c6d6eSLuis R. Rodriguez 598719d3577eSHaim Dreyfuss /** 5988dc0c18edSAaron Komisar * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom 5989dc0c18edSAaron Komisar * @wiphy: wiphy for which pre-CAC capability is checked. 5990dc0c18edSAaron Komisar * 5991dc0c18edSAaron Komisar * Pre-CAC is allowed only in some regdomains (notable ETSI). 5992dc0c18edSAaron Komisar */ 5993dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 5994dc0c18edSAaron Komisar 5995dc0c18edSAaron Komisar /** 599619d3577eSHaim Dreyfuss * DOC: Internal regulatory db functions 599719d3577eSHaim Dreyfuss * 599819d3577eSHaim Dreyfuss */ 599919d3577eSHaim Dreyfuss 600019d3577eSHaim Dreyfuss /** 600119d3577eSHaim Dreyfuss * reg_query_regdb_wmm - Query internal regulatory db for wmm rule 600219d3577eSHaim Dreyfuss * Regulatory self-managed driver can use it to proactively 600319d3577eSHaim Dreyfuss * 600419d3577eSHaim Dreyfuss * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 600519d3577eSHaim Dreyfuss * @freq: the freqency(in MHz) to be queried. 600619d3577eSHaim Dreyfuss * @rule: pointer to store the wmm rule from the regulatory db. 600719d3577eSHaim Dreyfuss * 600819d3577eSHaim Dreyfuss * Self-managed wireless drivers can use this function to query 600919d3577eSHaim Dreyfuss * the internal regulatory database to check whether the given 601019d3577eSHaim Dreyfuss * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations. 601119d3577eSHaim Dreyfuss * 601219d3577eSHaim Dreyfuss * Drivers should check the return value, its possible you can get 601319d3577eSHaim Dreyfuss * an -ENODATA. 601419d3577eSHaim Dreyfuss * 601519d3577eSHaim Dreyfuss * Return: 0 on success. -ENODATA. 601619d3577eSHaim Dreyfuss */ 601738cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq, 601838cb87eeSStanislaw Gruszka struct ieee80211_reg_rule *rule); 601919d3577eSHaim Dreyfuss 6020d3236553SJohannes Berg /* 6021d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 6022d3236553SJohannes Berg * functions and BSS handling helpers 6023d3236553SJohannes Berg */ 6024d3236553SJohannes Berg 60252a519311SJohannes Berg /** 60262a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 60272a519311SJohannes Berg * 60282a519311SJohannes Berg * @request: the corresponding scan request 60291d76250bSAvraham Stern * @info: information about the completed scan 60302a519311SJohannes Berg */ 60311d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 60321d76250bSAvraham Stern struct cfg80211_scan_info *info); 60332a519311SJohannes Berg 60342a519311SJohannes Berg /** 6035807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 6036807f8a8cSLuciano Coelho * 6037807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 6038b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 6039807f8a8cSLuciano Coelho */ 6040b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 6041807f8a8cSLuciano Coelho 6042807f8a8cSLuciano Coelho /** 6043807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 6044807f8a8cSLuciano Coelho * 6045807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 6046b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 6047807f8a8cSLuciano Coelho * 6048807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 6049807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 6050807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 6051807f8a8cSLuciano Coelho */ 6052b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 6053807f8a8cSLuciano Coelho 6054807f8a8cSLuciano Coelho /** 6055792e6aa7SEliad Peller * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped 6056792e6aa7SEliad Peller * 6057792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 6058b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 6059792e6aa7SEliad Peller * 6060792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 6061792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 6062792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 6063792e6aa7SEliad Peller * This function should be called with rtnl locked. 6064792e6aa7SEliad Peller */ 6065b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid); 6066792e6aa7SEliad Peller 6067792e6aa7SEliad Peller /** 60686e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 60692a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 60706e19bc4bSDmitry Shmidt * @data: the BSS metadata 6071abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 6072abe37c4bSJohannes Berg * @len: length of the management frame 60732a519311SJohannes Berg * @gfp: context flags 60742a519311SJohannes Berg * 60752a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 60762a519311SJohannes Berg * the BSS should be updated/added. 6077ef100682SJohannes Berg * 60780ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 60790ae997dcSYacine Belkadi * Or %NULL on error. 60802a519311SJohannes Berg */ 6081ef100682SJohannes Berg struct cfg80211_bss * __must_check 60826e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 60836e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 60846e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 60856e19bc4bSDmitry Shmidt gfp_t gfp); 60866e19bc4bSDmitry Shmidt 60876e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 6088dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 60893afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 6090dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 6091dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 60926e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 60936e19bc4bSDmitry Shmidt { 60946e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 60956e19bc4bSDmitry Shmidt .chan = rx_channel, 60966e19bc4bSDmitry Shmidt .scan_width = scan_width, 60976e19bc4bSDmitry Shmidt .signal = signal, 60986e19bc4bSDmitry Shmidt }; 60996e19bc4bSDmitry Shmidt 61006e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 61016e19bc4bSDmitry Shmidt } 6102dcd6eac1SSimon Wunderlich 6103dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 61042a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 61053afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 61062a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 6107dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 6108dcd6eac1SSimon Wunderlich { 61096e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 61106e19bc4bSDmitry Shmidt .chan = rx_channel, 61116e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 61126e19bc4bSDmitry Shmidt .signal = signal, 61136e19bc4bSDmitry Shmidt }; 61146e19bc4bSDmitry Shmidt 61156e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 6116dcd6eac1SSimon Wunderlich } 61172a519311SJohannes Berg 6118abe37c4bSJohannes Berg /** 61197ece9c37SSara Sharon * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID 61207ece9c37SSara Sharon * @bssid: transmitter BSSID 61217ece9c37SSara Sharon * @max_bssid: max BSSID indicator, taken from Multiple BSSID element 61227ece9c37SSara Sharon * @mbssid_index: BSSID index, taken from Multiple BSSID index element 61235d4071abSJohannes Berg * @new_bssid: calculated nontransmitted BSSID 61247ece9c37SSara Sharon */ 61257ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid, 61265d4071abSJohannes Berg u8 mbssid_index, u8 *new_bssid) 61277ece9c37SSara Sharon { 61285d4071abSJohannes Berg u64 bssid_u64 = ether_addr_to_u64(bssid); 61295d4071abSJohannes Berg u64 mask = GENMASK_ULL(max_bssid - 1, 0); 61305d4071abSJohannes Berg u64 new_bssid_u64; 61317ece9c37SSara Sharon 61325d4071abSJohannes Berg new_bssid_u64 = bssid_u64 & ~mask; 61337ece9c37SSara Sharon 61345d4071abSJohannes Berg new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask; 61357ece9c37SSara Sharon 61365d4071abSJohannes Berg u64_to_ether_addr(new_bssid_u64, new_bssid); 61377ece9c37SSara Sharon } 61387ece9c37SSara Sharon 61397ece9c37SSara Sharon /** 6140f7dacfb1SSara Sharon * cfg80211_is_element_inherited - returns if element ID should be inherited 6141f7dacfb1SSara Sharon * @element: element to check 6142f7dacfb1SSara Sharon * @non_inherit_element: non inheritance element 6143f7dacfb1SSara Sharon */ 6144f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element, 6145f7dacfb1SSara Sharon const struct element *non_inherit_element); 6146f7dacfb1SSara Sharon 6147f7dacfb1SSara Sharon /** 6148fe806e49SSara Sharon * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs 6149fe806e49SSara Sharon * @ie: ies 6150fe806e49SSara Sharon * @ielen: length of IEs 6151fe806e49SSara Sharon * @mbssid_elem: current MBSSID element 6152fe806e49SSara Sharon * @sub_elem: current MBSSID subelement (profile) 6153fe806e49SSara Sharon * @merged_ie: location of the merged profile 6154fe806e49SSara Sharon * @max_copy_len: max merged profile length 6155fe806e49SSara Sharon */ 6156fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen, 6157fe806e49SSara Sharon const struct element *mbssid_elem, 6158fe806e49SSara Sharon const struct element *sub_elem, 61595809a5d5SDan Carpenter u8 *merged_ie, size_t max_copy_len); 6160fe806e49SSara Sharon 6161fe806e49SSara Sharon /** 61625bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 61635bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 61645bc8c1f2SJohannes Berg * from a beacon or probe response 61655bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 61665bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 61675bc8c1f2SJohannes Berg */ 61685bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 61695bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 61705bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 61715bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 61725bc8c1f2SJohannes Berg }; 61735bc8c1f2SJohannes Berg 61745bc8c1f2SJohannes Berg /** 61756e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 6176abe37c4bSJohannes Berg * 6177abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 61786e19bc4bSDmitry Shmidt * @data: the BSS metadata 61795bc8c1f2SJohannes Berg * @ftype: frame type (if known) 6180abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 61817b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 6182abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 6183abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 6184abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 6185abe37c4bSJohannes Berg * @ielen: length of the additional IEs 6186abe37c4bSJohannes Berg * @gfp: context flags 6187abe37c4bSJohannes Berg * 6188abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 6189abe37c4bSJohannes Berg * the BSS should be updated/added. 6190ef100682SJohannes Berg * 61910ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 61920ae997dcSYacine Belkadi * Or %NULL on error. 6193abe37c4bSJohannes Berg */ 6194ef100682SJohannes Berg struct cfg80211_bss * __must_check 61956e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 61966e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 61976e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 61986e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 61996e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 62006e19bc4bSDmitry Shmidt gfp_t gfp); 62016e19bc4bSDmitry Shmidt 62026e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 6203dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 62043afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 6205dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 62065bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 6207dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 6208dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 62096e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 62106e19bc4bSDmitry Shmidt { 62116e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 62126e19bc4bSDmitry Shmidt .chan = rx_channel, 62136e19bc4bSDmitry Shmidt .scan_width = scan_width, 62146e19bc4bSDmitry Shmidt .signal = signal, 62156e19bc4bSDmitry Shmidt }; 62166e19bc4bSDmitry Shmidt 62176e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 62186e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 62196e19bc4bSDmitry Shmidt gfp); 62206e19bc4bSDmitry Shmidt } 6221dcd6eac1SSimon Wunderlich 6222dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 622306aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 62243afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 62255bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 62267b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 62277b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 6228dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 6229dcd6eac1SSimon Wunderlich { 62306e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 62316e19bc4bSDmitry Shmidt .chan = rx_channel, 62326e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 62336e19bc4bSDmitry Shmidt .signal = signal, 62346e19bc4bSDmitry Shmidt }; 62356e19bc4bSDmitry Shmidt 62366e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 62376e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 6238dcd6eac1SSimon Wunderlich gfp); 6239dcd6eac1SSimon Wunderlich } 624006aa7afaSJussi Kivilinna 624127548677SJohannes Berg /** 624227548677SJohannes Berg * cfg80211_get_bss - get a BSS reference 624327548677SJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 624427548677SJohannes Berg * @channel: the channel to search on (or %NULL) 624527548677SJohannes Berg * @bssid: the desired BSSID (or %NULL) 624627548677SJohannes Berg * @ssid: the desired SSID (or %NULL) 624727548677SJohannes Berg * @ssid_len: length of the SSID (or 0) 624827548677SJohannes Berg * @bss_type: type of BSS, see &enum ieee80211_bss_type 624927548677SJohannes Berg * @privacy: privacy filter, see &enum ieee80211_privacy 625027548677SJohannes Berg */ 62512a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 62522a519311SJohannes Berg struct ieee80211_channel *channel, 62532a519311SJohannes Berg const u8 *bssid, 625479420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 62556eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 625627548677SJohannes Berg enum ieee80211_privacy privacy); 625779420f09SJohannes Berg static inline struct cfg80211_bss * 625879420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 625979420f09SJohannes Berg struct ieee80211_channel *channel, 626079420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 626179420f09SJohannes Berg { 626279420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 62636eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 62646eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 626579420f09SJohannes Berg } 626679420f09SJohannes Berg 62674c0c0b75SJohannes Berg /** 62684c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 62695b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 62704c0c0b75SJohannes Berg * @bss: the BSS struct to reference 62714c0c0b75SJohannes Berg * 62724c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 62734c0c0b75SJohannes Berg */ 62745b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 62754c0c0b75SJohannes Berg 62764c0c0b75SJohannes Berg /** 62774c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 62785b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 62794c0c0b75SJohannes Berg * @bss: the BSS struct 62804c0c0b75SJohannes Berg * 62814c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 62824c0c0b75SJohannes Berg */ 62835b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6284d3236553SJohannes Berg 6285d491af19SJohannes Berg /** 6286d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 6287d491af19SJohannes Berg * @wiphy: the wiphy 6288d491af19SJohannes Berg * @bss: the bss to remove 6289d491af19SJohannes Berg * 6290d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 6291d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 6292d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 6293d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 6294d491af19SJohannes Berg */ 6295d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6296fee52678SJohannes Berg 62974770c8f9SIlan Peer /** 62984770c8f9SIlan Peer * cfg80211_bss_iter - iterate all BSS entries 62994770c8f9SIlan Peer * 63004770c8f9SIlan Peer * This function iterates over the BSS entries associated with the given wiphy 63014770c8f9SIlan Peer * and calls the callback for the iterated BSS. The iterator function is not 63024770c8f9SIlan Peer * allowed to call functions that might modify the internal state of the BSS DB. 63034770c8f9SIlan Peer * 63044770c8f9SIlan Peer * @wiphy: the wiphy 63054770c8f9SIlan Peer * @chandef: if given, the iterator function will be called only if the channel 63064770c8f9SIlan Peer * of the currently iterated BSS is a subset of the given channel. 63074770c8f9SIlan Peer * @iter: the iterator function to call 63084770c8f9SIlan Peer * @iter_data: an argument to the iterator function 63094770c8f9SIlan Peer */ 63104770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy, 63114770c8f9SIlan Peer struct cfg80211_chan_def *chandef, 63124770c8f9SIlan Peer void (*iter)(struct wiphy *wiphy, 63134770c8f9SIlan Peer struct cfg80211_bss *bss, 63144770c8f9SIlan Peer void *data), 63154770c8f9SIlan Peer void *iter_data); 63164770c8f9SIlan Peer 6317dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 6318dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 6319dcd6eac1SSimon Wunderlich { 6320dcd6eac1SSimon Wunderlich switch (chandef->width) { 6321dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 6322dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 6323dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 6324dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 6325dcd6eac1SSimon Wunderlich default: 6326dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 6327dcd6eac1SSimon Wunderlich } 6328dcd6eac1SSimon Wunderlich } 6329dcd6eac1SSimon Wunderlich 63306039f6d2SJouni Malinen /** 63316ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 63326039f6d2SJouni Malinen * @dev: network device 63336039f6d2SJouni Malinen * @buf: authentication frame (header + body) 63346039f6d2SJouni Malinen * @len: length of the frame data 63356039f6d2SJouni Malinen * 63366ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 63376ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 63386ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 63396ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 63406ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 63416ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 63426ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 63436ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 63446ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 63456ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 63466ff57cf8SJohannes Berg * 63476ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 63486039f6d2SJouni Malinen */ 63496ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 63506039f6d2SJouni Malinen 63516039f6d2SJouni Malinen /** 63526ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 63531965c853SJouni Malinen * @dev: network device 63541965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 6355cb0b4bebSJohannes Berg * 63568d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 63578d61ffa5SJohannes Berg * mutex. 63581965c853SJouni Malinen */ 63596ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 63601965c853SJouni Malinen 63611965c853SJouni Malinen /** 63626ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 63636039f6d2SJouni Malinen * @dev: network device 63646ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 63656ff57cf8SJohannes Berg * moves to cfg80211 in this call 63664d9ec73dSJouni Malinen * @buf: (Re)Association Response frame (header + body) 63676039f6d2SJouni Malinen * @len: length of the frame data 6368f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 6369f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 63704d9ec73dSJouni Malinen * @req_ies: information elements from the (Re)Association Request frame 63714d9ec73dSJouni Malinen * @req_ies_len: length of req_ies data 63726039f6d2SJouni Malinen * 63736ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 63746ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 63756ff57cf8SJohannes Berg * 63766ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 63776039f6d2SJouni Malinen */ 63786ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 63796ff57cf8SJohannes Berg struct cfg80211_bss *bss, 6380b0b6aa2cSEliad Peller const u8 *buf, size_t len, 63814d9ec73dSJouni Malinen int uapsd_queues, 63824d9ec73dSJouni Malinen const u8 *req_ies, size_t req_ies_len); 63836039f6d2SJouni Malinen 63846039f6d2SJouni Malinen /** 63856ff57cf8SJohannes Berg * cfg80211_assoc_timeout - notification of timed out association 63861965c853SJouni Malinen * @dev: network device 6387959867faSJohannes Berg * @bss: The BSS entry with which association timed out. 6388cb0b4bebSJohannes Berg * 63898d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 63901965c853SJouni Malinen */ 6391959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss); 63921965c853SJouni Malinen 63931965c853SJouni Malinen /** 6394e6f462dfSJohannes Berg * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt 6395e6f462dfSJohannes Berg * @dev: network device 6396e6f462dfSJohannes Berg * @bss: The BSS entry with which association was abandoned. 6397e6f462dfSJohannes Berg * 6398e6f462dfSJohannes Berg * Call this whenever - for reasons reported through other API, like deauth RX, 6399e6f462dfSJohannes Berg * an association attempt was abandoned. 6400e6f462dfSJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 6401e6f462dfSJohannes Berg */ 6402e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss); 6403e6f462dfSJohannes Berg 6404e6f462dfSJohannes Berg /** 64056ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 64066039f6d2SJouni Malinen * @dev: network device 64076ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 64086039f6d2SJouni Malinen * @len: length of the frame data 64096039f6d2SJouni Malinen * 64106039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 641153b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 64128d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 64138d61ffa5SJohannes Berg * corresponding wdev's mutex. 64146039f6d2SJouni Malinen */ 64156ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 6416ce470613SHolger Schurig 6417ce470613SHolger Schurig /** 64186ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 6419cf4e594eSJouni Malinen * @dev: network device 64204d797fceSJouni Malinen * @buf: received management frame (header + body) 6421cf4e594eSJouni Malinen * @len: length of the frame data 6422cf4e594eSJouni Malinen * 64236ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 64246ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 64254d797fceSJouni Malinen * frame was not protected. This is also used to notify reception of a Beacon 64264d797fceSJouni Malinen * frame that was dropped because it did not include a valid MME MIC while 64274d797fceSJouni Malinen * beacon protection was enabled (BIGTK configured in station mode). 64284d797fceSJouni Malinen * 64294d797fceSJouni Malinen * This function may sleep. 6430cf4e594eSJouni Malinen */ 64316ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 64326ff57cf8SJohannes Berg const u8 *buf, size_t len); 6433cf4e594eSJouni Malinen 6434cf4e594eSJouni Malinen /** 6435a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 6436a3b8b056SJouni Malinen * @dev: network device 6437a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 6438a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 6439a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 6440a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 6441e6d6e342SJohannes Berg * @gfp: allocation flags 6442a3b8b056SJouni Malinen * 6443a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 6444a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 6445a3b8b056SJouni Malinen * primitive. 6446a3b8b056SJouni Malinen */ 6447a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 6448a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 6449e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 6450a3b8b056SJouni Malinen 645104a773adSJohannes Berg /** 645204a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 645304a773adSJohannes Berg * 645404a773adSJohannes Berg * @dev: network device 645504a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 6456fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 645704a773adSJohannes Berg * @gfp: allocation flags 645804a773adSJohannes Berg * 645904a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 646004a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 646104a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 646204a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 646304a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 646404a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 646504a773adSJohannes Berg */ 6466fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 6467fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 646804a773adSJohannes Berg 64691f87f7d3SJohannes Berg /** 6470*b1e8eb11SMauro Carvalho Chehab * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer 6471*b1e8eb11SMauro Carvalho Chehab * candidate 6472c93b5e71SJavier Cardona * 6473c93b5e71SJavier Cardona * @dev: network device 6474c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 6475c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 64765ac4a12dSMatteo Croce * @ie_len: length of the information elements buffer 6477c93b5e71SJavier Cardona * @gfp: allocation flags 6478c93b5e71SJavier Cardona * 6479c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 6480c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 6481c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 6482c93b5e71SJavier Cardona */ 6483c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 6484ecbc12adSBob Copeland const u8 *macaddr, const u8 *ie, u8 ie_len, 6485ecbc12adSBob Copeland int sig_dbm, gfp_t gfp); 6486c93b5e71SJavier Cardona 6487c93b5e71SJavier Cardona /** 6488d70e9693SJohannes Berg * DOC: RFkill integration 6489d70e9693SJohannes Berg * 6490d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 6491d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 6492d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 6493d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 6494d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 6495d70e9693SJohannes Berg * 6496d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 6497d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 6498d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 6499d70e9693SJohannes Berg */ 6500d70e9693SJohannes Berg 6501d70e9693SJohannes Berg /** 65021f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 65031f87f7d3SJohannes Berg * @wiphy: the wiphy 65041f87f7d3SJohannes Berg * @blocked: block status 65051f87f7d3SJohannes Berg */ 65061f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 65071f87f7d3SJohannes Berg 65081f87f7d3SJohannes Berg /** 65091f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 65101f87f7d3SJohannes Berg * @wiphy: the wiphy 65111f87f7d3SJohannes Berg */ 65121f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 65131f87f7d3SJohannes Berg 65141f87f7d3SJohannes Berg /** 65151f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 65161f87f7d3SJohannes Berg * @wiphy: the wiphy 65171f87f7d3SJohannes Berg */ 65181f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 65191f87f7d3SJohannes Berg 6520ad7e718cSJohannes Berg /** 6521ad7e718cSJohannes Berg * DOC: Vendor commands 6522ad7e718cSJohannes Berg * 6523ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 6524ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 6525ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 6526ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 6527ad7e718cSJohannes Berg * the configuration mechanism. 6528ad7e718cSJohannes Berg * 6529ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 6530ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 6531ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 6532ad7e718cSJohannes Berg * 6533ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 6534ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 6535ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 6536ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 6537ad7e718cSJohannes Berg * managers etc. need. 6538ad7e718cSJohannes Berg */ 6539ad7e718cSJohannes Berg 6540ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 6541ad7e718cSJohannes Berg enum nl80211_commands cmd, 6542ad7e718cSJohannes Berg enum nl80211_attrs attr, 6543ad7e718cSJohannes Berg int approxlen); 6544ad7e718cSJohannes Berg 6545567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 65466c09e791SAhmad Kholaif struct wireless_dev *wdev, 6547567ffc35SJohannes Berg enum nl80211_commands cmd, 6548567ffc35SJohannes Berg enum nl80211_attrs attr, 654955c1fdf0SJohannes Berg unsigned int portid, 6550567ffc35SJohannes Berg int vendor_event_idx, 6551567ffc35SJohannes Berg int approxlen, gfp_t gfp); 6552567ffc35SJohannes Berg 6553567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 6554567ffc35SJohannes Berg 6555ad7e718cSJohannes Berg /** 6556ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 6557ad7e718cSJohannes Berg * @wiphy: the wiphy 6558ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 6559ad7e718cSJohannes Berg * be put into the skb 6560ad7e718cSJohannes Berg * 6561ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 6562ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 6563ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 6564ad7e718cSJohannes Berg * 6565ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 6566ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 6567ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 6568ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 6569ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 6570ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 6571ad7e718cSJohannes Berg * You must not modify the skb in any other way. 6572ad7e718cSJohannes Berg * 6573ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 6574ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 6575ad7e718cSJohannes Berg * 6576ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6577ad7e718cSJohannes Berg */ 6578ad7e718cSJohannes Berg static inline struct sk_buff * 6579ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 6580ad7e718cSJohannes Berg { 6581ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 6582ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 6583ad7e718cSJohannes Berg } 6584ad7e718cSJohannes Berg 6585ad7e718cSJohannes Berg /** 6586ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 6587ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 6588ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 6589ad7e718cSJohannes Berg * 6590ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 6591ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 6592ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 6593ad7e718cSJohannes Berg * skb regardless of the return value. 6594ad7e718cSJohannes Berg * 6595ad7e718cSJohannes Berg * Return: An error code or 0 on success. 6596ad7e718cSJohannes Berg */ 6597ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 6598ad7e718cSJohannes Berg 6599567ffc35SJohannes Berg /** 660055c1fdf0SJohannes Berg * cfg80211_vendor_cmd_get_sender 660155c1fdf0SJohannes Berg * @wiphy: the wiphy 660255c1fdf0SJohannes Berg * 660355c1fdf0SJohannes Berg * Return the current netlink port ID in a vendor command handler. 660455c1fdf0SJohannes Berg * Valid to call only there. 660555c1fdf0SJohannes Berg */ 660655c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy); 660755c1fdf0SJohannes Berg 660855c1fdf0SJohannes Berg /** 6609567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 6610567ffc35SJohannes Berg * @wiphy: the wiphy 66116c09e791SAhmad Kholaif * @wdev: the wireless device 6612567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 6613567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 6614567ffc35SJohannes Berg * be put into the skb 6615567ffc35SJohannes Berg * @gfp: allocation flags 6616567ffc35SJohannes Berg * 6617567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 6618567ffc35SJohannes Berg * vendor-specific multicast group. 6619567ffc35SJohannes Berg * 66206c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 66216c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 66226c09e791SAhmad Kholaif * attribute. 66236c09e791SAhmad Kholaif * 6624567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 6625567ffc35SJohannes Berg * skb to send the event. 6626567ffc35SJohannes Berg * 6627567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6628567ffc35SJohannes Berg */ 6629567ffc35SJohannes Berg static inline struct sk_buff * 66306c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 66316c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 6632567ffc35SJohannes Berg { 66336c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 6634567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 663555c1fdf0SJohannes Berg 0, event_idx, approxlen, gfp); 663655c1fdf0SJohannes Berg } 663755c1fdf0SJohannes Berg 663855c1fdf0SJohannes Berg /** 663955c1fdf0SJohannes Berg * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb 664055c1fdf0SJohannes Berg * @wiphy: the wiphy 664155c1fdf0SJohannes Berg * @wdev: the wireless device 664255c1fdf0SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 664355c1fdf0SJohannes Berg * @portid: port ID of the receiver 664455c1fdf0SJohannes Berg * @approxlen: an upper bound of the length of the data that will 664555c1fdf0SJohannes Berg * be put into the skb 664655c1fdf0SJohannes Berg * @gfp: allocation flags 664755c1fdf0SJohannes Berg * 664855c1fdf0SJohannes Berg * This function allocates and pre-fills an skb for an event to send to 664955c1fdf0SJohannes Berg * a specific (userland) socket. This socket would previously have been 665055c1fdf0SJohannes Berg * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take 665155c1fdf0SJohannes Berg * care to register a netlink notifier to see when the socket closes. 665255c1fdf0SJohannes Berg * 665355c1fdf0SJohannes Berg * If wdev != NULL, both the ifindex and identifier of the specified 665455c1fdf0SJohannes Berg * wireless device are added to the event message before the vendor data 665555c1fdf0SJohannes Berg * attribute. 665655c1fdf0SJohannes Berg * 665755c1fdf0SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 665855c1fdf0SJohannes Berg * skb to send the event. 665955c1fdf0SJohannes Berg * 666055c1fdf0SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 666155c1fdf0SJohannes Berg */ 666255c1fdf0SJohannes Berg static inline struct sk_buff * 666355c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy, 666455c1fdf0SJohannes Berg struct wireless_dev *wdev, 666555c1fdf0SJohannes Berg unsigned int portid, int approxlen, 666655c1fdf0SJohannes Berg int event_idx, gfp_t gfp) 666755c1fdf0SJohannes Berg { 666855c1fdf0SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 666955c1fdf0SJohannes Berg NL80211_ATTR_VENDOR_DATA, 667055c1fdf0SJohannes Berg portid, event_idx, approxlen, gfp); 6671567ffc35SJohannes Berg } 6672567ffc35SJohannes Berg 6673567ffc35SJohannes Berg /** 6674567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 6675567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 6676567ffc35SJohannes Berg * @gfp: allocation flags 6677567ffc35SJohannes Berg * 6678567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 6679567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 6680567ffc35SJohannes Berg */ 6681567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 6682567ffc35SJohannes Berg { 6683567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 6684567ffc35SJohannes Berg } 6685567ffc35SJohannes Berg 6686aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 6687aff89a9bSJohannes Berg /** 6688d70e9693SJohannes Berg * DOC: Test mode 6689d70e9693SJohannes Berg * 6690d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 6691d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 6692d70e9693SJohannes Berg * factory programming. 6693d70e9693SJohannes Berg * 6694d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 6695d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 6696d70e9693SJohannes Berg */ 6697d70e9693SJohannes Berg 6698d70e9693SJohannes Berg /** 6699aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 6700aff89a9bSJohannes Berg * @wiphy: the wiphy 6701aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 6702aff89a9bSJohannes Berg * be put into the skb 6703aff89a9bSJohannes Berg * 6704aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 6705aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 6706aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 6707aff89a9bSJohannes Berg * 67080ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 67090ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 67100ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 67110ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 67120ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 67130ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 67140ae997dcSYacine Belkadi * must not modify the skb in any other way. 6715aff89a9bSJohannes Berg * 6716aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 6717aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 67180ae997dcSYacine Belkadi * 67190ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6720aff89a9bSJohannes Berg */ 6721ad7e718cSJohannes Berg static inline struct sk_buff * 6722ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 6723ad7e718cSJohannes Berg { 6724ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 6725ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 6726ad7e718cSJohannes Berg } 6727aff89a9bSJohannes Berg 6728aff89a9bSJohannes Berg /** 6729aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 6730aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 6731aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 6732aff89a9bSJohannes Berg * 67330ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 67340ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 67350ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 67360ae997dcSYacine Belkadi * regardless of the return value. 67370ae997dcSYacine Belkadi * 67380ae997dcSYacine Belkadi * Return: An error code or 0 on success. 6739aff89a9bSJohannes Berg */ 6740ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 6741ad7e718cSJohannes Berg { 6742ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 6743ad7e718cSJohannes Berg } 6744aff89a9bSJohannes Berg 6745aff89a9bSJohannes Berg /** 6746aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 6747aff89a9bSJohannes Berg * @wiphy: the wiphy 6748aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 6749aff89a9bSJohannes Berg * be put into the skb 6750aff89a9bSJohannes Berg * @gfp: allocation flags 6751aff89a9bSJohannes Berg * 6752aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 6753aff89a9bSJohannes Berg * testmode multicast group. 6754aff89a9bSJohannes Berg * 67550ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 67560ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 67570ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 67580ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 67590ae997dcSYacine Belkadi * in any other way. 6760aff89a9bSJohannes Berg * 6761aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 6762aff89a9bSJohannes Berg * skb to send the event. 67630ae997dcSYacine Belkadi * 67640ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 6765aff89a9bSJohannes Berg */ 6766567ffc35SJohannes Berg static inline struct sk_buff * 6767567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 6768567ffc35SJohannes Berg { 67696c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 677055c1fdf0SJohannes Berg NL80211_ATTR_TESTDATA, 0, -1, 6771567ffc35SJohannes Berg approxlen, gfp); 6772567ffc35SJohannes Berg } 6773aff89a9bSJohannes Berg 6774aff89a9bSJohannes Berg /** 6775aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 6776aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 6777aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 6778aff89a9bSJohannes Berg * @gfp: allocation flags 6779aff89a9bSJohannes Berg * 6780aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 6781aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 6782aff89a9bSJohannes Berg * consumes it. 6783aff89a9bSJohannes Berg */ 6784567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 6785567ffc35SJohannes Berg { 6786567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 6787567ffc35SJohannes Berg } 6788aff89a9bSJohannes Berg 6789aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 679071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 6791aff89a9bSJohannes Berg #else 6792aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 679371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 6794aff89a9bSJohannes Berg #endif 6795aff89a9bSJohannes Berg 6796b23aa676SSamuel Ortiz /** 679776804d28SArend Van Spriel * struct cfg80211_fils_resp_params - FILS connection response params 679876804d28SArend Van Spriel * @kek: KEK derived from a successful FILS connection (may be %NULL) 679976804d28SArend Van Spriel * @kek_len: Length of @fils_kek in octets 680076804d28SArend Van Spriel * @update_erp_next_seq_num: Boolean value to specify whether the value in 680176804d28SArend Van Spriel * @erp_next_seq_num is valid. 680276804d28SArend Van Spriel * @erp_next_seq_num: The next sequence number to use in ERP message in 680376804d28SArend Van Spriel * FILS Authentication. This value should be specified irrespective of the 680476804d28SArend Van Spriel * status for a FILS connection. 680576804d28SArend Van Spriel * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 680676804d28SArend Van Spriel * @pmk_len: Length of @pmk in octets 680776804d28SArend Van Spriel * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 680876804d28SArend Van Spriel * used for this FILS connection (may be %NULL). 680976804d28SArend Van Spriel */ 681076804d28SArend Van Spriel struct cfg80211_fils_resp_params { 681176804d28SArend Van Spriel const u8 *kek; 681276804d28SArend Van Spriel size_t kek_len; 681376804d28SArend Van Spriel bool update_erp_next_seq_num; 681476804d28SArend Van Spriel u16 erp_next_seq_num; 681576804d28SArend Van Spriel const u8 *pmk; 681676804d28SArend Van Spriel size_t pmk_len; 681776804d28SArend Van Spriel const u8 *pmkid; 681876804d28SArend Van Spriel }; 681976804d28SArend Van Spriel 682076804d28SArend Van Spriel /** 68215349a0f7SVidyullatha Kanchanapally * struct cfg80211_connect_resp_params - Connection response params 68225349a0f7SVidyullatha Kanchanapally * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 68235349a0f7SVidyullatha Kanchanapally * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 68245349a0f7SVidyullatha Kanchanapally * the real status code for failures. If this call is used to report a 68255349a0f7SVidyullatha Kanchanapally * failure due to a timeout (e.g., not receiving an Authentication frame 68265349a0f7SVidyullatha Kanchanapally * from the AP) instead of an explicit rejection by the AP, -1 is used to 68275349a0f7SVidyullatha Kanchanapally * indicate that this is a failure, but without a status code. 68285349a0f7SVidyullatha Kanchanapally * @timeout_reason is used to report the reason for the timeout in that 68295349a0f7SVidyullatha Kanchanapally * case. 68305349a0f7SVidyullatha Kanchanapally * @bssid: The BSSID of the AP (may be %NULL) 68315349a0f7SVidyullatha Kanchanapally * @bss: Entry of bss to which STA got connected to, can be obtained through 6832a3ce17d1SChaitanya Tata * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 6833a3ce17d1SChaitanya Tata * bss from the connect_request and hold a reference to it and return 6834a3ce17d1SChaitanya Tata * through this param to avoid a warning if the bss is expired during the 6835a3ce17d1SChaitanya Tata * connection, esp. for those drivers implementing connect op. 6836a3ce17d1SChaitanya Tata * Only one parameter among @bssid and @bss needs to be specified. 68375349a0f7SVidyullatha Kanchanapally * @req_ie: Association request IEs (may be %NULL) 68385349a0f7SVidyullatha Kanchanapally * @req_ie_len: Association request IEs length 68395349a0f7SVidyullatha Kanchanapally * @resp_ie: Association response IEs (may be %NULL) 68405349a0f7SVidyullatha Kanchanapally * @resp_ie_len: Association response IEs length 684176804d28SArend Van Spriel * @fils: FILS connection response parameters. 68425349a0f7SVidyullatha Kanchanapally * @timeout_reason: Reason for connection timeout. This is used when the 68435349a0f7SVidyullatha Kanchanapally * connection fails due to a timeout instead of an explicit rejection from 68445349a0f7SVidyullatha Kanchanapally * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 68455349a0f7SVidyullatha Kanchanapally * not known. This value is used only if @status < 0 to indicate that the 68465349a0f7SVidyullatha Kanchanapally * failure is due to a timeout and not due to explicit rejection by the AP. 68475349a0f7SVidyullatha Kanchanapally * This value is ignored in other cases (@status >= 0). 68485349a0f7SVidyullatha Kanchanapally */ 68495349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params { 68505349a0f7SVidyullatha Kanchanapally int status; 68515349a0f7SVidyullatha Kanchanapally const u8 *bssid; 68525349a0f7SVidyullatha Kanchanapally struct cfg80211_bss *bss; 68535349a0f7SVidyullatha Kanchanapally const u8 *req_ie; 68545349a0f7SVidyullatha Kanchanapally size_t req_ie_len; 68555349a0f7SVidyullatha Kanchanapally const u8 *resp_ie; 68565349a0f7SVidyullatha Kanchanapally size_t resp_ie_len; 685776804d28SArend Van Spriel struct cfg80211_fils_resp_params fils; 68585349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason; 68595349a0f7SVidyullatha Kanchanapally }; 68605349a0f7SVidyullatha Kanchanapally 68615349a0f7SVidyullatha Kanchanapally /** 68625349a0f7SVidyullatha Kanchanapally * cfg80211_connect_done - notify cfg80211 of connection result 68635349a0f7SVidyullatha Kanchanapally * 68645349a0f7SVidyullatha Kanchanapally * @dev: network device 68655349a0f7SVidyullatha Kanchanapally * @params: connection response parameters 68665349a0f7SVidyullatha Kanchanapally * @gfp: allocation flags 68675349a0f7SVidyullatha Kanchanapally * 68685349a0f7SVidyullatha Kanchanapally * It should be called by the underlying driver once execution of the connection 68695349a0f7SVidyullatha Kanchanapally * request from connect() has been completed. This is similar to 68705349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), but takes a structure pointer for connection response 68715349a0f7SVidyullatha Kanchanapally * parameters. Only one of the functions among cfg80211_connect_bss(), 68725349a0f7SVidyullatha Kanchanapally * cfg80211_connect_result(), cfg80211_connect_timeout(), 68735349a0f7SVidyullatha Kanchanapally * and cfg80211_connect_done() should be called. 68745349a0f7SVidyullatha Kanchanapally */ 68755349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev, 68765349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params *params, 68775349a0f7SVidyullatha Kanchanapally gfp_t gfp); 68785349a0f7SVidyullatha Kanchanapally 68795349a0f7SVidyullatha Kanchanapally /** 6880e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 6881e7054989SKanchanapally, Vidyullatha * 6882e7054989SKanchanapally, Vidyullatha * @dev: network device 6883e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 6884a3ce17d1SChaitanya Tata * @bss: Entry of bss to which STA got connected to, can be obtained through 6885a3ce17d1SChaitanya Tata * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 6886a3ce17d1SChaitanya Tata * bss from the connect_request and hold a reference to it and return 6887a3ce17d1SChaitanya Tata * through this param to avoid a warning if the bss is expired during the 6888a3ce17d1SChaitanya Tata * connection, esp. for those drivers implementing connect op. 6889a3ce17d1SChaitanya Tata * Only one parameter among @bssid and @bss needs to be specified. 6890e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 6891e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 6892e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 6893e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 6894c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 6895e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 6896c88215d7SJouni Malinen * the real status code for failures. If this call is used to report a 6897c88215d7SJouni Malinen * failure due to a timeout (e.g., not receiving an Authentication frame 6898c88215d7SJouni Malinen * from the AP) instead of an explicit rejection by the AP, -1 is used to 6899c88215d7SJouni Malinen * indicate that this is a failure, but without a status code. 6900c88215d7SJouni Malinen * @timeout_reason is used to report the reason for the timeout in that 6901c88215d7SJouni Malinen * case. 6902e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 69033093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. This is used when the 69043093ebbeSPurushottam Kushwaha * connection fails due to a timeout instead of an explicit rejection from 69053093ebbeSPurushottam Kushwaha * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 69063093ebbeSPurushottam Kushwaha * not known. This value is used only if @status < 0 to indicate that the 69073093ebbeSPurushottam Kushwaha * failure is due to a timeout and not due to explicit rejection by the AP. 69083093ebbeSPurushottam Kushwaha * This value is ignored in other cases (@status >= 0). 6909e7054989SKanchanapally, Vidyullatha * 6910c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 6911c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 6912c88215d7SJouni Malinen * cfg80211_connect_result(), but with the option of identifying the exact bss 69135349a0f7SVidyullatha Kanchanapally * entry for the connection. Only one of the functions among 69145349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 69155349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 6916e7054989SKanchanapally, Vidyullatha */ 69175349a0f7SVidyullatha Kanchanapally static inline void 69185349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 6919e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 6920e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 69213093ebbeSPurushottam Kushwaha size_t resp_ie_len, int status, gfp_t gfp, 69225349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason) 69235349a0f7SVidyullatha Kanchanapally { 69245349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params params; 69255349a0f7SVidyullatha Kanchanapally 69265349a0f7SVidyullatha Kanchanapally memset(¶ms, 0, sizeof(params)); 69275349a0f7SVidyullatha Kanchanapally params.status = status; 69285349a0f7SVidyullatha Kanchanapally params.bssid = bssid; 69295349a0f7SVidyullatha Kanchanapally params.bss = bss; 69305349a0f7SVidyullatha Kanchanapally params.req_ie = req_ie; 69315349a0f7SVidyullatha Kanchanapally params.req_ie_len = req_ie_len; 69325349a0f7SVidyullatha Kanchanapally params.resp_ie = resp_ie; 69335349a0f7SVidyullatha Kanchanapally params.resp_ie_len = resp_ie_len; 69345349a0f7SVidyullatha Kanchanapally params.timeout_reason = timeout_reason; 69355349a0f7SVidyullatha Kanchanapally 69365349a0f7SVidyullatha Kanchanapally cfg80211_connect_done(dev, ¶ms, gfp); 69375349a0f7SVidyullatha Kanchanapally } 6938e7054989SKanchanapally, Vidyullatha 6939e7054989SKanchanapally, Vidyullatha /** 6940b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 6941b23aa676SSamuel Ortiz * 6942b23aa676SSamuel Ortiz * @dev: network device 6943b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 6944b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 6945b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 6946b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 6947b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 6948c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 6949b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 6950b23aa676SSamuel Ortiz * the real status code for failures. 6951b23aa676SSamuel Ortiz * @gfp: allocation flags 6952b23aa676SSamuel Ortiz * 6953c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 6954c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 6955c88215d7SJouni Malinen * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 69565349a0f7SVidyullatha Kanchanapally * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 69575349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 6958b23aa676SSamuel Ortiz */ 6959e7054989SKanchanapally, Vidyullatha static inline void 6960e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 6961b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 6962b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 6963e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 6964e7054989SKanchanapally, Vidyullatha { 6965e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 69663093ebbeSPurushottam Kushwaha resp_ie_len, status, gfp, 69673093ebbeSPurushottam Kushwaha NL80211_TIMEOUT_UNSPECIFIED); 6968e7054989SKanchanapally, Vidyullatha } 6969b23aa676SSamuel Ortiz 6970b23aa676SSamuel Ortiz /** 6971bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 6972bf1ecd21SJouni Malinen * 6973bf1ecd21SJouni Malinen * @dev: network device 6974bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 6975bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 6976bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 6977bf1ecd21SJouni Malinen * @gfp: allocation flags 69783093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. 6979bf1ecd21SJouni Malinen * 6980bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 6981bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 6982bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 6983bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 69845349a0f7SVidyullatha Kanchanapally * waiting for the response. Only one of the functions among 69855349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 69865349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 6987bf1ecd21SJouni Malinen */ 6988bf1ecd21SJouni Malinen static inline void 6989bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 69903093ebbeSPurushottam Kushwaha const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 69913093ebbeSPurushottam Kushwaha enum nl80211_timeout_reason timeout_reason) 6992bf1ecd21SJouni Malinen { 6993bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 69943093ebbeSPurushottam Kushwaha gfp, timeout_reason); 6995bf1ecd21SJouni Malinen } 6996bf1ecd21SJouni Malinen 6997bf1ecd21SJouni Malinen /** 699829ce6ecbSAvraham Stern * struct cfg80211_roam_info - driver initiated roaming information 699929ce6ecbSAvraham Stern * 700029ce6ecbSAvraham Stern * @channel: the channel of the new AP 700129ce6ecbSAvraham Stern * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set) 700229ce6ecbSAvraham Stern * @bssid: the BSSID of the new AP (may be %NULL if %bss is set) 700329ce6ecbSAvraham Stern * @req_ie: association request IEs (maybe be %NULL) 700429ce6ecbSAvraham Stern * @req_ie_len: association request IEs length 700529ce6ecbSAvraham Stern * @resp_ie: association response IEs (may be %NULL) 700629ce6ecbSAvraham Stern * @resp_ie_len: assoc response IEs length 7007e841b7b1SArend Van Spriel * @fils: FILS related roaming information. 700829ce6ecbSAvraham Stern */ 700929ce6ecbSAvraham Stern struct cfg80211_roam_info { 701029ce6ecbSAvraham Stern struct ieee80211_channel *channel; 701129ce6ecbSAvraham Stern struct cfg80211_bss *bss; 701229ce6ecbSAvraham Stern const u8 *bssid; 701329ce6ecbSAvraham Stern const u8 *req_ie; 701429ce6ecbSAvraham Stern size_t req_ie_len; 701529ce6ecbSAvraham Stern const u8 *resp_ie; 701629ce6ecbSAvraham Stern size_t resp_ie_len; 7017e841b7b1SArend Van Spriel struct cfg80211_fils_resp_params fils; 701829ce6ecbSAvraham Stern }; 701929ce6ecbSAvraham Stern 702029ce6ecbSAvraham Stern /** 7021b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 7022b23aa676SSamuel Ortiz * 7023b23aa676SSamuel Ortiz * @dev: network device 702429ce6ecbSAvraham Stern * @info: information about the new BSS. struct &cfg80211_roam_info. 7025b23aa676SSamuel Ortiz * @gfp: allocation flags 7026b23aa676SSamuel Ortiz * 702729ce6ecbSAvraham Stern * This function may be called with the driver passing either the BSSID of the 702829ce6ecbSAvraham Stern * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 702929ce6ecbSAvraham Stern * It should be called by the underlying driver whenever it roamed from one AP 703029ce6ecbSAvraham Stern * to another while connected. Drivers which have roaming implemented in 703129ce6ecbSAvraham Stern * firmware should pass the bss entry to avoid a race in bss entry timeout where 703229ce6ecbSAvraham Stern * the bss entry of the new AP is seen in the driver, but gets timed out by the 703329ce6ecbSAvraham Stern * time it is accessed in __cfg80211_roamed() due to delay in scheduling 7034adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 703529ce6ecbSAvraham Stern * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 7036e1b18549SGeert Uytterhoeven * released while disconnecting from the current bss. 7037adbde344SVasanthakumar Thiagarajan */ 703829ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 703929ce6ecbSAvraham Stern gfp_t gfp); 7040adbde344SVasanthakumar Thiagarajan 7041adbde344SVasanthakumar Thiagarajan /** 7042503c1fb9SAvraham Stern * cfg80211_port_authorized - notify cfg80211 of successful security association 7043503c1fb9SAvraham Stern * 7044503c1fb9SAvraham Stern * @dev: network device 7045503c1fb9SAvraham Stern * @bssid: the BSSID of the AP 7046503c1fb9SAvraham Stern * @gfp: allocation flags 7047503c1fb9SAvraham Stern * 7048503c1fb9SAvraham Stern * This function should be called by a driver that supports 4 way handshake 7049503c1fb9SAvraham Stern * offload after a security association was successfully established (i.e., 7050503c1fb9SAvraham Stern * the 4 way handshake was completed successfully). The call to this function 7051503c1fb9SAvraham Stern * should be preceded with a call to cfg80211_connect_result(), 7052503c1fb9SAvraham Stern * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 7053503c1fb9SAvraham Stern * indicate the 802.11 association. 7054503c1fb9SAvraham Stern */ 7055503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, 7056503c1fb9SAvraham Stern gfp_t gfp); 7057503c1fb9SAvraham Stern 7058503c1fb9SAvraham Stern /** 7059b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 7060b23aa676SSamuel Ortiz * 7061b23aa676SSamuel Ortiz * @dev: network device 7062b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 7063b23aa676SSamuel Ortiz * @ie_len: length of IEs 7064b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 706580279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 7066b23aa676SSamuel Ortiz * @gfp: allocation flags 7067b23aa676SSamuel Ortiz * 7068b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 7069b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 7070b23aa676SSamuel Ortiz */ 7071b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 707280279fb7SJohannes Berg const u8 *ie, size_t ie_len, 707380279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 7074b23aa676SSamuel Ortiz 70759588bbd5SJouni Malinen /** 70769588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 707771bbc994SJohannes Berg * @wdev: wireless device 70789588bbd5SJouni Malinen * @cookie: the request cookie 70799588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 70809588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 70819588bbd5SJouni Malinen * channel 70829588bbd5SJouni Malinen * @gfp: allocation flags 70839588bbd5SJouni Malinen */ 708471bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 70859588bbd5SJouni Malinen struct ieee80211_channel *chan, 70869588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 70879588bbd5SJouni Malinen 70889588bbd5SJouni Malinen /** 70899588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 709071bbc994SJohannes Berg * @wdev: wireless device 70919588bbd5SJouni Malinen * @cookie: the request cookie 70929588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 70939588bbd5SJouni Malinen * @gfp: allocation flags 70949588bbd5SJouni Malinen */ 709571bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 70969588bbd5SJouni Malinen struct ieee80211_channel *chan, 70979588bbd5SJouni Malinen gfp_t gfp); 7098b23aa676SSamuel Ortiz 70998689c051SArend van Spriel /** 71001c38c7f2SJames Prestwood * cfg80211_tx_mgmt_expired - tx_mgmt duration expired 71011c38c7f2SJames Prestwood * @wdev: wireless device 71021c38c7f2SJames Prestwood * @cookie: the requested cookie 71031c38c7f2SJames Prestwood * @chan: The current channel (from tx_mgmt request) 71041c38c7f2SJames Prestwood * @gfp: allocation flags 71051c38c7f2SJames Prestwood */ 71061c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, 71071c38c7f2SJames Prestwood struct ieee80211_channel *chan, gfp_t gfp); 71081c38c7f2SJames Prestwood 71091c38c7f2SJames Prestwood /** 71108689c051SArend van Spriel * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. 71118689c051SArend van Spriel * 71128689c051SArend van Spriel * @sinfo: the station information 71138689c051SArend van Spriel * @gfp: allocation flags 71148689c051SArend van Spriel */ 71158689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); 711698b62183SJohannes Berg 711798b62183SJohannes Berg /** 71187ea3e110SJohannes Berg * cfg80211_sinfo_release_content - release contents of station info 71197ea3e110SJohannes Berg * @sinfo: the station information 71207ea3e110SJohannes Berg * 71217ea3e110SJohannes Berg * Releases any potentially allocated sub-information of the station 71227ea3e110SJohannes Berg * information, but not the struct itself (since it's typically on 71237ea3e110SJohannes Berg * the stack.) 71247ea3e110SJohannes Berg */ 71257ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) 71267ea3e110SJohannes Berg { 71277ea3e110SJohannes Berg kfree(sinfo->pertid); 71287ea3e110SJohannes Berg } 71297ea3e110SJohannes Berg 71307ea3e110SJohannes Berg /** 713198b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 713298b62183SJohannes Berg * 713398b62183SJohannes Berg * @dev: the netdev 713498b62183SJohannes Berg * @mac_addr: the station's address 713598b62183SJohannes Berg * @sinfo: the station information 713698b62183SJohannes Berg * @gfp: allocation flags 713798b62183SJohannes Berg */ 713898b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 713998b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 714098b62183SJohannes Berg 7141026331c4SJouni Malinen /** 7142cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 7143cf5ead82SJohannes Berg * @dev: the netdev 7144cf5ead82SJohannes Berg * @mac_addr: the station's address 7145cf5ead82SJohannes Berg * @sinfo: the station information/statistics 7146cf5ead82SJohannes Berg * @gfp: allocation flags 7147cf5ead82SJohannes Berg */ 7148cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 7149cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 7150cf5ead82SJohannes Berg 7151cf5ead82SJohannes Berg /** 7152ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 7153ec15e68bSJouni Malinen * 7154ec15e68bSJouni Malinen * @dev: the netdev 7155ec15e68bSJouni Malinen * @mac_addr: the station's address 7156ec15e68bSJouni Malinen * @gfp: allocation flags 7157ec15e68bSJouni Malinen */ 7158cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 7159cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 7160cf5ead82SJohannes Berg { 7161cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 7162cf5ead82SJohannes Berg } 7163ec15e68bSJouni Malinen 7164ec15e68bSJouni Malinen /** 7165ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 7166ed44a951SPandiyarajan Pitchaimuthu * 7167ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 7168ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 7169ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 7170ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 7171ed44a951SPandiyarajan Pitchaimuthu * 7172ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 7173ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 7174ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 7175ed44a951SPandiyarajan Pitchaimuthu * 7176ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 7177ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 7178ed44a951SPandiyarajan Pitchaimuthu */ 7179ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 7180ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 7181ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 7182ed44a951SPandiyarajan Pitchaimuthu 7183ed44a951SPandiyarajan Pitchaimuthu /** 7184e76fede8SThomas Pedersen * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame 7185e76fede8SThomas Pedersen * @wdev: wireless device receiving the frame 7186e76fede8SThomas Pedersen * @freq: Frequency on which the frame was received in KHz 7187e76fede8SThomas Pedersen * @sig_dbm: signal strength in dBm, or 0 if unknown 7188e76fede8SThomas Pedersen * @buf: Management frame (header + body) 7189e76fede8SThomas Pedersen * @len: length of the frame data 7190e76fede8SThomas Pedersen * @flags: flags, as defined in enum nl80211_rxmgmt_flags 7191e76fede8SThomas Pedersen * 7192e76fede8SThomas Pedersen * This function is called whenever an Action frame is received for a station 7193e76fede8SThomas Pedersen * mode interface, but is not processed in kernel. 7194e76fede8SThomas Pedersen * 7195e76fede8SThomas Pedersen * Return: %true if a user space application has registered for this frame. 7196e76fede8SThomas Pedersen * For action frames, that makes it responsible for rejecting unrecognized 7197e76fede8SThomas Pedersen * action frames; %false otherwise, in which case for action frames the 7198e76fede8SThomas Pedersen * driver is responsible for rejecting the frame. 7199e76fede8SThomas Pedersen */ 7200e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm, 7201e76fede8SThomas Pedersen const u8 *buf, size_t len, u32 flags); 7202e76fede8SThomas Pedersen 7203e76fede8SThomas Pedersen /** 72042e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 720571bbc994SJohannes Berg * @wdev: wireless device receiving the frame 7206026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 72076c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 72082e161f78SJohannes Berg * @buf: Management frame (header + body) 7209026331c4SJouni Malinen * @len: length of the frame data 721019504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 72112e161f78SJohannes Berg * 72120ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 72130ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 72140ae997dcSYacine Belkadi * 72150ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 72162e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 72172e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 72182e161f78SJohannes Berg * driver is responsible for rejecting the frame. 7219026331c4SJouni Malinen */ 7220e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, 7221e76fede8SThomas Pedersen int sig_dbm, const u8 *buf, size_t len, 7222e76fede8SThomas Pedersen u32 flags) 7223e76fede8SThomas Pedersen { 7224e76fede8SThomas Pedersen return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len, 7225e76fede8SThomas Pedersen flags); 7226e76fede8SThomas Pedersen } 7227026331c4SJouni Malinen 7228026331c4SJouni Malinen /** 72292e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 723071bbc994SJohannes Berg * @wdev: wireless device receiving the frame 72312e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 72322e161f78SJohannes Berg * @buf: Management frame (header + body) 7233026331c4SJouni Malinen * @len: length of the frame data 7234026331c4SJouni Malinen * @ack: Whether frame was acknowledged 7235026331c4SJouni Malinen * @gfp: context flags 7236026331c4SJouni Malinen * 72372e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 72382e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 7239026331c4SJouni Malinen * transmission attempt. 7240026331c4SJouni Malinen */ 724171bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 7242026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 7243026331c4SJouni Malinen 7244dca9ca2dSMarkus Theil /** 7245dca9ca2dSMarkus Theil * cfg80211_control_port_tx_status - notification of TX status for control 7246dca9ca2dSMarkus Theil * port frames 7247dca9ca2dSMarkus Theil * @wdev: wireless device receiving the frame 7248dca9ca2dSMarkus Theil * @cookie: Cookie returned by cfg80211_ops::tx_control_port() 7249dca9ca2dSMarkus Theil * @buf: Data frame (header + body) 7250dca9ca2dSMarkus Theil * @len: length of the frame data 7251dca9ca2dSMarkus Theil * @ack: Whether frame was acknowledged 7252dca9ca2dSMarkus Theil * @gfp: context flags 7253dca9ca2dSMarkus Theil * 7254dca9ca2dSMarkus Theil * This function is called whenever a control port frame was requested to be 7255dca9ca2dSMarkus Theil * transmitted with cfg80211_ops::tx_control_port() to report the TX status of 7256dca9ca2dSMarkus Theil * the transmission attempt. 7257dca9ca2dSMarkus Theil */ 7258dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, 7259dca9ca2dSMarkus Theil const u8 *buf, size_t len, bool ack, 7260dca9ca2dSMarkus Theil gfp_t gfp); 7261d6dc1a38SJuuso Oikarinen 7262d6dc1a38SJuuso Oikarinen /** 72636a671a50SDenis Kenzior * cfg80211_rx_control_port - notification about a received control port frame 72646a671a50SDenis Kenzior * @dev: The device the frame matched to 7265a948f713SDenis Kenzior * @skb: The skbuf with the control port frame. It is assumed that the skbuf 7266a948f713SDenis Kenzior * is 802.3 formatted (with 802.3 header). The skb can be non-linear. 7267a948f713SDenis Kenzior * This function does not take ownership of the skb, so the caller is 7268a948f713SDenis Kenzior * responsible for any cleanup. The caller must also ensure that 7269a948f713SDenis Kenzior * skb->protocol is set appropriately. 72706a671a50SDenis Kenzior * @unencrypted: Whether the frame was received unencrypted 72716a671a50SDenis Kenzior * 72726a671a50SDenis Kenzior * This function is used to inform userspace about a received control port 72736a671a50SDenis Kenzior * frame. It should only be used if userspace indicated it wants to receive 72746a671a50SDenis Kenzior * control port frames over nl80211. 72756a671a50SDenis Kenzior * 72766a671a50SDenis Kenzior * The frame is the data portion of the 802.3 or 802.11 data frame with all 72776a671a50SDenis Kenzior * network layer headers removed (e.g. the raw EAPoL frame). 72786a671a50SDenis Kenzior * 72796a671a50SDenis Kenzior * Return: %true if the frame was passed to userspace 72806a671a50SDenis Kenzior */ 72816a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev, 7282a948f713SDenis Kenzior struct sk_buff *skb, bool unencrypted); 72836a671a50SDenis Kenzior 72846a671a50SDenis Kenzior /** 7285d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 7286d6dc1a38SJuuso Oikarinen * @dev: network device 7287d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 7288bee427b8SAndrzej Zaborowski * @rssi_level: new RSSI level value or 0 if not available 7289d6dc1a38SJuuso Oikarinen * @gfp: context flags 7290d6dc1a38SJuuso Oikarinen * 7291d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 7292d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 7293d6dc1a38SJuuso Oikarinen */ 7294d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 7295d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 7296bee427b8SAndrzej Zaborowski s32 rssi_level, gfp_t gfp); 7297d6dc1a38SJuuso Oikarinen 7298c063dbf5SJohannes Berg /** 7299c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 7300c063dbf5SJohannes Berg * @dev: network device 7301c063dbf5SJohannes Berg * @peer: peer's MAC address 7302c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 7303c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 7304c063dbf5SJohannes Berg * threshold (to account for temporary interference) 7305c063dbf5SJohannes Berg * @gfp: context flags 7306c063dbf5SJohannes Berg */ 7307c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 7308c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 7309c063dbf5SJohannes Berg 7310e5497d76SJohannes Berg /** 731184f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 731284f10708SThomas Pedersen * @dev: network device 731384f10708SThomas Pedersen * @peer: peer's MAC address 731484f10708SThomas Pedersen * @num_packets: how many packets were lost 731584f10708SThomas Pedersen * @rate: % of packets which failed transmission 731684f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 731784f10708SThomas Pedersen * @gfp: context flags 731884f10708SThomas Pedersen * 731984f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 732084f10708SThomas Pedersen * given interval is exceeded. 732184f10708SThomas Pedersen */ 732284f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 732384f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 732484f10708SThomas Pedersen 732584f10708SThomas Pedersen /** 732698f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 732798f03342SJohannes Berg * @dev: network device 732898f03342SJohannes Berg * @gfp: context flags 732998f03342SJohannes Berg * 733098f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 733198f03342SJohannes Berg */ 733298f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 733398f03342SJohannes Berg 733498f03342SJohannes Berg /** 73355b97f49dSJohannes Berg * cfg80211_radar_event - radar detection event 73365b97f49dSJohannes Berg * @wiphy: the wiphy 73375b97f49dSJohannes Berg * @chandef: chandef for the current channel 73385b97f49dSJohannes Berg * @gfp: context flags 73395b97f49dSJohannes Berg * 73405b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 73415b97f49dSJohannes Berg */ 73425b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy, 73435b97f49dSJohannes Berg struct cfg80211_chan_def *chandef, gfp_t gfp); 73445b97f49dSJohannes Berg 73455b97f49dSJohannes Berg /** 7346466b9936Stamizhr@codeaurora.org * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event 7347466b9936Stamizhr@codeaurora.org * @dev: network device 7348466b9936Stamizhr@codeaurora.org * @mac: MAC address of a station which opmode got modified 7349466b9936Stamizhr@codeaurora.org * @sta_opmode: station's current opmode value 7350466b9936Stamizhr@codeaurora.org * @gfp: context flags 7351466b9936Stamizhr@codeaurora.org * 7352466b9936Stamizhr@codeaurora.org * Driver should call this function when station's opmode modified via action 7353466b9936Stamizhr@codeaurora.org * frame. 7354466b9936Stamizhr@codeaurora.org */ 7355466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, 7356466b9936Stamizhr@codeaurora.org struct sta_opmode_info *sta_opmode, 7357466b9936Stamizhr@codeaurora.org gfp_t gfp); 7358466b9936Stamizhr@codeaurora.org 7359466b9936Stamizhr@codeaurora.org /** 73605b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 73615b97f49dSJohannes Berg * @netdev: network device 73625b97f49dSJohannes Berg * @chandef: chandef for the current channel 73635b97f49dSJohannes Berg * @event: type of event 73645b97f49dSJohannes Berg * @gfp: context flags 73655b97f49dSJohannes Berg * 73665b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 73675b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 73685b97f49dSJohannes Berg * also by full-MAC drivers. 73695b97f49dSJohannes Berg */ 73705b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 73715b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 73725b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 73735b97f49dSJohannes Berg 73745b97f49dSJohannes Berg 73755b97f49dSJohannes Berg /** 7376e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 7377e5497d76SJohannes Berg * @dev: network device 7378e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 7379e5497d76SJohannes Berg * @replay_ctr: new replay counter 7380af71ff85SJohannes Berg * @gfp: allocation flags 7381e5497d76SJohannes Berg */ 7382e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 7383e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 7384e5497d76SJohannes Berg 7385c9df56b4SJouni Malinen /** 7386c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 7387c9df56b4SJouni Malinen * @dev: network device 7388c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 7389c9df56b4SJouni Malinen * @bssid: BSSID of AP 7390c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 7391c9df56b4SJouni Malinen * @gfp: allocation flags 7392c9df56b4SJouni Malinen */ 7393c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 7394c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 7395c9df56b4SJouni Malinen 739628946da7SJohannes Berg /** 739728946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 739828946da7SJohannes Berg * @dev: The device the frame matched to 739928946da7SJohannes Berg * @addr: the transmitter address 740028946da7SJohannes Berg * @gfp: context flags 740128946da7SJohannes Berg * 740228946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 740328946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 740428946da7SJohannes Berg * sender. 74050ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 740628946da7SJohannes Berg * for a reason other than not having a subscription.) 740728946da7SJohannes Berg */ 740828946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 740928946da7SJohannes Berg const u8 *addr, gfp_t gfp); 741028946da7SJohannes Berg 74117f6cf311SJohannes Berg /** 7412b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 7413b92ab5d8SJohannes Berg * @dev: The device the frame matched to 7414b92ab5d8SJohannes Berg * @addr: the transmitter address 7415b92ab5d8SJohannes Berg * @gfp: context flags 7416b92ab5d8SJohannes Berg * 7417b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 7418b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 7419b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 7420b92ab5d8SJohannes Berg * station to avoid event flooding. 74210ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 7422b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 7423b92ab5d8SJohannes Berg */ 7424b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 7425b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 7426b92ab5d8SJohannes Berg 7427b92ab5d8SJohannes Berg /** 74287f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 74297f6cf311SJohannes Berg * @dev: the device the probe was sent on 74307f6cf311SJohannes Berg * @addr: the address of the peer 74317f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 74327f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 7433c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the ACK frame. 7434c4b50cd3SVenkateswara Naralasetty * @is_valid_ack_signal: indicates the ack_signal is valid or not. 74357f6cf311SJohannes Berg * @gfp: allocation flags 74367f6cf311SJohannes Berg */ 74377f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 7438c4b50cd3SVenkateswara Naralasetty u64 cookie, bool acked, s32 ack_signal, 7439c4b50cd3SVenkateswara Naralasetty bool is_valid_ack_signal, gfp_t gfp); 74407f6cf311SJohannes Berg 74415e760230SJohannes Berg /** 7442e76fede8SThomas Pedersen * cfg80211_report_obss_beacon_khz - report beacon from other APs 7443e76fede8SThomas Pedersen * @wiphy: The wiphy that received the beacon 7444e76fede8SThomas Pedersen * @frame: the frame 7445e76fede8SThomas Pedersen * @len: length of the frame 7446e76fede8SThomas Pedersen * @freq: frequency the frame was received on in KHz 7447e76fede8SThomas Pedersen * @sig_dbm: signal strength in dBm, or 0 if unknown 7448e76fede8SThomas Pedersen * 7449e76fede8SThomas Pedersen * Use this function to report to userspace when a beacon was 7450e76fede8SThomas Pedersen * received. It is not useful to call this when there is no 7451e76fede8SThomas Pedersen * netdev that is in AP/GO mode. 7452e76fede8SThomas Pedersen */ 7453e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame, 7454e76fede8SThomas Pedersen size_t len, int freq, int sig_dbm); 7455e76fede8SThomas Pedersen 7456e76fede8SThomas Pedersen /** 74575e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 74585e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 74595e760230SJohannes Berg * @frame: the frame 74605e760230SJohannes Berg * @len: length of the frame 74615e760230SJohannes Berg * @freq: frequency the frame was received on 74626c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 74635e760230SJohannes Berg * 74645e760230SJohannes Berg * Use this function to report to userspace when a beacon was 74655e760230SJohannes Berg * received. It is not useful to call this when there is no 74665e760230SJohannes Berg * netdev that is in AP/GO mode. 74675e760230SJohannes Berg */ 7468e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy, 74695e760230SJohannes Berg const u8 *frame, size_t len, 7470e76fede8SThomas Pedersen int freq, int sig_dbm) 7471e76fede8SThomas Pedersen { 7472e76fede8SThomas Pedersen cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq), 7473e76fede8SThomas Pedersen sig_dbm); 7474e76fede8SThomas Pedersen } 74755e760230SJohannes Berg 7476d58e7e37SJohannes Berg /** 7477683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 747854858ee5SAlexander Simon * @wiphy: the wiphy 7479683b6d3bSJohannes Berg * @chandef: the channel definition 7480174e0cd2SIlan Peer * @iftype: interface type 7481d58e7e37SJohannes Berg * 74820ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 74830ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 748454858ee5SAlexander Simon */ 7485683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 7486174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 7487174e0cd2SIlan Peer enum nl80211_iftype iftype); 748854858ee5SAlexander Simon 7489923b352fSArik Nemtsov /** 7490923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 7491923b352fSArik Nemtsov * @wiphy: the wiphy 7492923b352fSArik Nemtsov * @chandef: the channel definition 7493923b352fSArik Nemtsov * @iftype: interface type 7494923b352fSArik Nemtsov * 7495923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 7496923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 7497923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 7498923b352fSArik Nemtsov * more permissive conditions. 7499923b352fSArik Nemtsov * 7500923b352fSArik Nemtsov * Requires the RTNL to be held. 7501923b352fSArik Nemtsov */ 7502923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 7503923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 7504923b352fSArik Nemtsov enum nl80211_iftype iftype); 7505923b352fSArik Nemtsov 75068097e149SThomas Pedersen /* 75075314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 75085314526bSThomas Pedersen * @dev: the device which switched channels 7509683b6d3bSJohannes Berg * @chandef: the new channel definition 75105314526bSThomas Pedersen * 7511e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 7512e487eaebSSimon Wunderlich * driver context! 75135314526bSThomas Pedersen */ 7514683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 7515683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 75165314526bSThomas Pedersen 7517f8d7552eSLuciano Coelho /* 7518f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 7519f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 7520f8d7552eSLuciano Coelho * @chandef: the future channel definition 7521f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 7522f8d7552eSLuciano Coelho * 7523f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 7524f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 7525f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 7526f8d7552eSLuciano Coelho */ 7527f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 7528f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 7529f8d7552eSLuciano Coelho u8 count); 7530f8d7552eSLuciano Coelho 75311ce3e82bSJohannes Berg /** 75321ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 75331ce3e82bSJohannes Berg * 75341ce3e82bSJohannes Berg * @operating_class: the operating class to convert 75351ce3e82bSJohannes Berg * @band: band pointer to fill 75361ce3e82bSJohannes Berg * 75371ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 75381ce3e82bSJohannes Berg */ 75391ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 754057fbcce3SJohannes Berg enum nl80211_band *band); 75411ce3e82bSJohannes Berg 7542a38700ddSArik Nemtsov /** 7543a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 7544a38700ddSArik Nemtsov * 7545a38700ddSArik Nemtsov * @chandef: the chandef to convert 7546a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 7547a38700ddSArik Nemtsov * 7548a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 7549a38700ddSArik Nemtsov */ 7550a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 7551a38700ddSArik Nemtsov u8 *op_class); 7552a38700ddSArik Nemtsov 7553934f4c7dSThomas Pedersen /** 7554934f4c7dSThomas Pedersen * ieee80211_chandef_to_khz - convert chandef to frequency in KHz 7555934f4c7dSThomas Pedersen * 7556934f4c7dSThomas Pedersen * @chandef: the chandef to convert 7557934f4c7dSThomas Pedersen * 7558934f4c7dSThomas Pedersen * Returns the center frequency of chandef (1st segment) in KHz. 7559934f4c7dSThomas Pedersen */ 7560934f4c7dSThomas Pedersen static inline u32 7561934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef) 7562934f4c7dSThomas Pedersen { 7563934f4c7dSThomas Pedersen return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 7564934f4c7dSThomas Pedersen } 7565934f4c7dSThomas Pedersen 75665314526bSThomas Pedersen /* 75673475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 75683475b094SJouni Malinen * @dev: the device on which the operation is requested 75693475b094SJouni Malinen * @peer: the MAC address of the peer device 75703475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 75713475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 75723475b094SJouni Malinen * @reason_code: the reason code for teardown request 75733475b094SJouni Malinen * @gfp: allocation flags 75743475b094SJouni Malinen * 75753475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 75763475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 75773475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 75783475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 75793475b094SJouni Malinen * based on traffic and signal strength for a peer). 75803475b094SJouni Malinen */ 75813475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 75823475b094SJouni Malinen enum nl80211_tdls_operation oper, 75833475b094SJouni Malinen u16 reason_code, gfp_t gfp); 75843475b094SJouni Malinen 75853475b094SJouni Malinen /* 75868097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 75878097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 75888097e149SThomas Pedersen * 75898097e149SThomas Pedersen * return 0 if MCS index >= 32 75908097e149SThomas Pedersen */ 75918eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 75928097e149SThomas Pedersen 759398104fdeSJohannes Berg /** 759498104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 759598104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 759698104fdeSJohannes Berg * 759798104fdeSJohannes Berg * Call this function only for wdevs that have no netdev assigned, 759898104fdeSJohannes Berg * e.g. P2P Devices. It removes the device from the list so that 759998104fdeSJohannes Berg * it can no longer be used. It is necessary to call this function 760098104fdeSJohannes Berg * even when cfg80211 requests the removal of the interface by 760198104fdeSJohannes Berg * calling the del_virtual_intf() callback. The function must also 760298104fdeSJohannes Berg * be called when the driver wishes to unregister the wdev, e.g. 760398104fdeSJohannes Berg * when the device is unbound from the driver. 760498104fdeSJohannes Berg * 760598104fdeSJohannes Berg * Requires the RTNL to be held. 760698104fdeSJohannes Berg */ 760798104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 760898104fdeSJohannes Berg 76090ee45355SJohannes Berg /** 7610*b1e8eb11SMauro Carvalho Chehab * struct cfg80211_ft_event_params - FT Information Elements 7611355199e0SJouni Malinen * @ies: FT IEs 7612355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 7613355199e0SJouni Malinen * @target_ap: target AP's MAC address 7614355199e0SJouni Malinen * @ric_ies: RIC IE 7615355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 7616355199e0SJouni Malinen */ 7617355199e0SJouni Malinen struct cfg80211_ft_event_params { 7618355199e0SJouni Malinen const u8 *ies; 7619355199e0SJouni Malinen size_t ies_len; 7620355199e0SJouni Malinen const u8 *target_ap; 7621355199e0SJouni Malinen const u8 *ric_ies; 7622355199e0SJouni Malinen size_t ric_ies_len; 7623355199e0SJouni Malinen }; 7624355199e0SJouni Malinen 7625355199e0SJouni Malinen /** 7626355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 7627355199e0SJouni Malinen * @netdev: network device 7628355199e0SJouni Malinen * @ft_event: IE information 7629355199e0SJouni Malinen */ 7630355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 7631355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 7632355199e0SJouni Malinen 7633355199e0SJouni Malinen /** 76340ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 76350ee45355SJohannes Berg * @ies: the input IE buffer 76360ee45355SJohannes Berg * @len: the input length 76370ee45355SJohannes Berg * @attr: the attribute ID to find 76380ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 76390ee45355SJohannes Berg * if the function is only called to get the needed buffer size 76400ee45355SJohannes Berg * @bufsize: size of the output buffer 76410ee45355SJohannes Berg * 76420ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 76430ee45355SJohannes Berg * copies its contents to the given buffer. 76440ee45355SJohannes Berg * 76450ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 76460ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 76470ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 76480ee45355SJohannes Berg */ 7649c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 7650c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 7651c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 76520ee45355SJohannes Berg 7653cd8f7cb4SJohannes Berg /** 765429464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 765529464cccSJohannes Berg * @ies: the IE buffer 765629464cccSJohannes Berg * @ielen: the length of the IE buffer 765729464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 76582512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 76592512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 766029464cccSJohannes Berg * @n_ids: the size of the element ID array 766129464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 766229464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 766329464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 766429464cccSJohannes Berg * 766529464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 766629464cccSJohannes Berg * variable to point to the location where the buffer should be 766729464cccSJohannes Berg * split. 766829464cccSJohannes Berg * 766929464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 767029464cccSJohannes Berg * has to be guaranteed by the caller! 767129464cccSJohannes Berg * 767229464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 767329464cccSJohannes Berg * correctly, if not the result of using this function will not 767429464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 767529464cccSJohannes Berg * 767629464cccSJohannes Berg * The function returns the offset where the next part of the 767729464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 767829464cccSJohannes Berg * of the buffer should be used. 767929464cccSJohannes Berg */ 768029464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 768129464cccSJohannes Berg const u8 *ids, int n_ids, 768229464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 768329464cccSJohannes Berg size_t offset); 768429464cccSJohannes Berg 768529464cccSJohannes Berg /** 768629464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 768729464cccSJohannes Berg * @ies: the IE buffer 768829464cccSJohannes Berg * @ielen: the length of the IE buffer 768929464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 76902512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 76912512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 769229464cccSJohannes Berg * @n_ids: the size of the element ID array 769329464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 769429464cccSJohannes Berg * 769529464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 769629464cccSJohannes Berg * variable to point to the location where the buffer should be 769729464cccSJohannes Berg * split. 769829464cccSJohannes Berg * 769929464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 770029464cccSJohannes Berg * has to be guaranteed by the caller! 770129464cccSJohannes Berg * 770229464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 770329464cccSJohannes Berg * correctly, if not the result of using this function will not 770429464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 770529464cccSJohannes Berg * 770629464cccSJohannes Berg * The function returns the offset where the next part of the 770729464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 770829464cccSJohannes Berg * of the buffer should be used. 770929464cccSJohannes Berg */ 77100483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 77110483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 77120483eeacSJohannes Berg { 77130483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 77140483eeacSJohannes Berg } 771529464cccSJohannes Berg 771629464cccSJohannes Berg /** 7717cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 7718cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 7719cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 7720cd8f7cb4SJohannes Berg * @gfp: allocation flags 7721cd8f7cb4SJohannes Berg * 7722cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 7723cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 7724cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 7725cd8f7cb4SJohannes Berg * else caused the wakeup. 7726cd8f7cb4SJohannes Berg */ 7727cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 7728cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 7729cd8f7cb4SJohannes Berg gfp_t gfp); 7730cd8f7cb4SJohannes Berg 77315de17984SArend van Spriel /** 77325de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 77335de17984SArend van Spriel * 77345de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 773503f831a6SRobert P. J. Day * @gfp: allocation flags 77365de17984SArend van Spriel * 77375de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 77385de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 77395de17984SArend van Spriel * by .crit_proto_start() has expired. 77405de17984SArend van Spriel */ 77415de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 77425de17984SArend van Spriel 7743bdfbec2dSIlan Peer /** 7744bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 7745bdfbec2dSIlan Peer * @wiphy: the wiphy 7746bdfbec2dSIlan Peer * 7747bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 7748bdfbec2dSIlan Peer */ 7749bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 7750bdfbec2dSIlan Peer 7751cb2d956dSLuciano Coelho /** 7752cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 7753cb2d956dSLuciano Coelho * 7754cb2d956dSLuciano Coelho * @wiphy: the wiphy 7755e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 7756cb2d956dSLuciano Coelho * 7757cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 7758cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 7759cb2d956dSLuciano Coelho * the interface combinations. 7760cb2d956dSLuciano Coelho */ 7761cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 7762e227300cSPurushottam Kushwaha struct iface_combination_params *params); 7763cb2d956dSLuciano Coelho 776465a124ddSMichal Kazior /** 776565a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 776665a124ddSMichal Kazior * 776765a124ddSMichal Kazior * @wiphy: the wiphy 7768e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 776965a124ddSMichal Kazior * @iter: function to call for each matching combination 777065a124ddSMichal Kazior * @data: pointer to pass to iter function 777165a124ddSMichal Kazior * 777265a124ddSMichal Kazior * This function can be called by the driver to check what possible 777365a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 777465a124ddSMichal Kazior * purposes. 777565a124ddSMichal Kazior */ 777665a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 7777e227300cSPurushottam Kushwaha struct iface_combination_params *params, 777865a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 777965a124ddSMichal Kazior void *data), 778065a124ddSMichal Kazior void *data); 778165a124ddSMichal Kazior 7782f04c2203SMichal Kazior /* 7783f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 7784f04c2203SMichal Kazior * 7785f04c2203SMichal Kazior * @wiphy: the wiphy 7786f04c2203SMichal Kazior * @wdev: wireless device 7787f04c2203SMichal Kazior * @gfp: context flags 7788f04c2203SMichal Kazior * 7789f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 7790f04c2203SMichal Kazior * disconnected. 7791f04c2203SMichal Kazior * 7792f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 7793f04c2203SMichal Kazior */ 7794f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 7795f04c2203SMichal Kazior gfp_t gfp); 7796f04c2203SMichal Kazior 7797f6837ba8SJohannes Berg /** 7798f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 7799f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 7800f6837ba8SJohannes Berg * 7801f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 7802f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 7803f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 7804f6837ba8SJohannes Berg * that really can't be recovered in any other way. 7805f6837ba8SJohannes Berg * 7806f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 7807f6837ba8SJohannes Berg * the driver while the function is running. 7808f6837ba8SJohannes Berg */ 7809f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 7810f6837ba8SJohannes Berg 7811d75bb06bSGautam Kumar Shukla /** 7812d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 7813d75bb06bSGautam Kumar Shukla * 7814d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 7815d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 7816d75bb06bSGautam Kumar Shukla * 7817d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 7818d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 7819d75bb06bSGautam Kumar Shukla */ 7820d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 7821d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 7822d75bb06bSGautam Kumar Shukla { 7823d75bb06bSGautam Kumar Shukla u8 *ft_byte; 7824d75bb06bSGautam Kumar Shukla 7825d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 7826d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 7827d75bb06bSGautam Kumar Shukla } 7828d75bb06bSGautam Kumar Shukla 7829d75bb06bSGautam Kumar Shukla /** 7830d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 7831d75bb06bSGautam Kumar Shukla * 7832d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 7833d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 7834d75bb06bSGautam Kumar Shukla * 7835d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 7836d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 7837d75bb06bSGautam Kumar Shukla */ 7838d75bb06bSGautam Kumar Shukla static inline bool 7839d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 7840d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 7841d75bb06bSGautam Kumar Shukla { 7842d75bb06bSGautam Kumar Shukla u8 ft_byte; 7843d75bb06bSGautam Kumar Shukla 7844d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 7845d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 7846d75bb06bSGautam Kumar Shukla } 7847b7ffbd7eSJohannes Berg 7848a442b761SAyala Beker /** 7849a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 7850a442b761SAyala Beker * @f: NAN function that should be freed 7851a442b761SAyala Beker * 7852a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 7853a442b761SAyala Beker */ 7854a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 7855a442b761SAyala Beker 785650bcd31dSAyala Beker /** 785750bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 785850bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 785950bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 786050bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 786150bcd31dSAyala Beker * result. 786250bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 786350bcd31dSAyala Beker * @inst_id: the local instance id 786450bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 786550bcd31dSAyala Beker * @addr: the MAC address of the peer 786650bcd31dSAyala Beker * @info_len: the length of the &info 786750bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 786850bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 786950bcd31dSAyala Beker */ 787050bcd31dSAyala Beker struct cfg80211_nan_match_params { 787150bcd31dSAyala Beker enum nl80211_nan_function_type type; 787250bcd31dSAyala Beker u8 inst_id; 787350bcd31dSAyala Beker u8 peer_inst_id; 787450bcd31dSAyala Beker const u8 *addr; 787550bcd31dSAyala Beker u8 info_len; 787650bcd31dSAyala Beker const u8 *info; 787750bcd31dSAyala Beker u64 cookie; 787850bcd31dSAyala Beker }; 787950bcd31dSAyala Beker 788050bcd31dSAyala Beker /** 788150bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 788250bcd31dSAyala Beker * @wdev: the wireless device reporting the match 788350bcd31dSAyala Beker * @match: match notification parameters 788450bcd31dSAyala Beker * @gfp: allocation flags 788550bcd31dSAyala Beker * 788650bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 788750bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 788850bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 788950bcd31dSAyala Beker */ 789050bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 789150bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 789250bcd31dSAyala Beker 7893368e5a7bSAyala Beker /** 7894368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 7895368e5a7bSAyala Beker * 7896368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 7897368e5a7bSAyala Beker * @inst_id: the local instance id 7898368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 7899368e5a7bSAyala Beker * @cookie: unique NAN function identifier 7900368e5a7bSAyala Beker * @gfp: allocation flags 7901368e5a7bSAyala Beker * 7902368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 7903368e5a7bSAyala Beker */ 7904368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 7905368e5a7bSAyala Beker u8 inst_id, 7906368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 7907368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 7908368e5a7bSAyala Beker 7909b7ffbd7eSJohannes Berg /* ethtool helper */ 7910b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 7911b7ffbd7eSJohannes Berg 791240cbfa90SSrinivas Dasari /** 791340cbfa90SSrinivas Dasari * cfg80211_external_auth_request - userspace request for authentication 791440cbfa90SSrinivas Dasari * @netdev: network device 791540cbfa90SSrinivas Dasari * @params: External authentication parameters 791640cbfa90SSrinivas Dasari * @gfp: allocation flags 791740cbfa90SSrinivas Dasari * Returns: 0 on success, < 0 on error 791840cbfa90SSrinivas Dasari */ 791940cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev, 792040cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params, 792140cbfa90SSrinivas Dasari gfp_t gfp); 792240cbfa90SSrinivas Dasari 79239bb7e0f2SJohannes Berg /** 79249bb7e0f2SJohannes Berg * cfg80211_pmsr_report - report peer measurement result data 79259bb7e0f2SJohannes Berg * @wdev: the wireless device reporting the measurement 79269bb7e0f2SJohannes Berg * @req: the original measurement request 79279bb7e0f2SJohannes Berg * @result: the result data 79289bb7e0f2SJohannes Berg * @gfp: allocation flags 79299bb7e0f2SJohannes Berg */ 79309bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev, 79319bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *req, 79329bb7e0f2SJohannes Berg struct cfg80211_pmsr_result *result, 79339bb7e0f2SJohannes Berg gfp_t gfp); 79349bb7e0f2SJohannes Berg 79359bb7e0f2SJohannes Berg /** 79369bb7e0f2SJohannes Berg * cfg80211_pmsr_complete - report peer measurement completed 79379bb7e0f2SJohannes Berg * @wdev: the wireless device reporting the measurement 79389bb7e0f2SJohannes Berg * @req: the original measurement request 79399bb7e0f2SJohannes Berg * @gfp: allocation flags 79409bb7e0f2SJohannes Berg * 79419bb7e0f2SJohannes Berg * Report that the entire measurement completed, after this 79429bb7e0f2SJohannes Berg * the request pointer will no longer be valid. 79439bb7e0f2SJohannes Berg */ 79449bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev, 79459bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *req, 79469bb7e0f2SJohannes Berg gfp_t gfp); 79479bb7e0f2SJohannes Berg 7948e6f40511SManikanta Pubbisetty /** 7949e6f40511SManikanta Pubbisetty * cfg80211_iftype_allowed - check whether the interface can be allowed 7950e6f40511SManikanta Pubbisetty * @wiphy: the wiphy 7951e6f40511SManikanta Pubbisetty * @iftype: interface type 7952e6f40511SManikanta Pubbisetty * @is_4addr: use_4addr flag, must be '0' when check_swif is '1' 7953e6f40511SManikanta Pubbisetty * @check_swif: check iftype against software interfaces 7954e6f40511SManikanta Pubbisetty * 7955e6f40511SManikanta Pubbisetty * Check whether the interface is allowed to operate; additionally, this API 7956e6f40511SManikanta Pubbisetty * can be used to check iftype against the software interfaces when 7957e6f40511SManikanta Pubbisetty * check_swif is '1'. 7958e6f40511SManikanta Pubbisetty */ 7959e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 7960e6f40511SManikanta Pubbisetty bool is_4addr, u8 check_swif); 7961e6f40511SManikanta Pubbisetty 7962e6f40511SManikanta Pubbisetty 7963e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 7964e1db74fcSJoe Perches 7965e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 7966e1db74fcSJoe Perches 7967e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 79689c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 7969e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 79709c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 7971e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 79729c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 7973e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 79749c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 7975e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 79769c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 7977e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 79789c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 7979e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 79809c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 7981e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 79829c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 7983073730d7SJoe Perches 7984a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...) \ 7985a58d7525SStanislaw Gruszka dev_err_ratelimited(&(wiphy)->dev, format, ##args) 7986a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...) \ 7987a58d7525SStanislaw Gruszka dev_warn_ratelimited(&(wiphy)->dev, format, ##args) 7988a58d7525SStanislaw Gruszka 79899c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 7990e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 79919c376639SJoe Perches 7992e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 79939c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 7994e1db74fcSJoe Perches 7995e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 7996e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 7997e1db74fcSJoe Perches #else 7998e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 7999e1db74fcSJoe Perches ({ \ 8000e1db74fcSJoe Perches if (0) \ 8001e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 8002e1db74fcSJoe Perches 0; \ 8003e1db74fcSJoe Perches }) 8004e1db74fcSJoe Perches #endif 8005e1db74fcSJoe Perches 8006e1db74fcSJoe Perches /* 8007e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 8008e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 8009e1db74fcSJoe Perches * file/line information and a backtrace. 8010e1db74fcSJoe Perches */ 8011e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 8012e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 8013e1db74fcSJoe Perches 8014cb74e977SSunil Dutt /** 8015cb74e977SSunil Dutt * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space 8016cb74e977SSunil Dutt * @netdev: network device 8017cb74e977SSunil Dutt * @owe_info: peer's owe info 8018cb74e977SSunil Dutt * @gfp: allocation flags 8019cb74e977SSunil Dutt */ 8020cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev, 8021cb74e977SSunil Dutt struct cfg80211_update_owe_info *owe_info, 8022cb74e977SSunil Dutt gfp_t gfp); 8023cb74e977SSunil Dutt 80242f1805eaSEmmanuel Grumbach /** 80252f1805eaSEmmanuel Grumbach * cfg80211_bss_flush - resets all the scan entries 80262f1805eaSEmmanuel Grumbach * @wiphy: the wiphy 80272f1805eaSEmmanuel Grumbach */ 80282f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy); 80292f1805eaSEmmanuel Grumbach 8030704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 8031