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 10b82730bfSJohannes Berg * Copyright (C) 2018-2024 Intel Corporation 11d3236553SJohannes Berg */ 12704232c2SJohannes Berg 13cc69837fSJakub Kicinski #include <linux/ethtool.h> 146f779a66SEmmanuel Grumbach #include <uapi/linux/rfkill.h> 15d3236553SJohannes Berg #include <linux/netdevice.h> 16d3236553SJohannes Berg #include <linux/debugfs.h> 17d3236553SJohannes Berg #include <linux/list.h> 18187f1882SPaul Gortmaker #include <linux/bug.h> 19704232c2SJohannes Berg #include <linux/netlink.h> 20704232c2SJohannes Berg #include <linux/skbuff.h> 2155682965SJohannes Berg #include <linux/nl80211.h> 222a519311SJohannes Berg #include <linux/if_ether.h> 232a519311SJohannes Berg #include <linux/ieee80211.h> 242a0e047eSJohannes Berg #include <linux/net.h> 25358ae888SEmmanuel Grumbach #include <linux/rfkill.h> 26d3236553SJohannes Berg #include <net/regulatory.h> 27d3236553SJohannes Berg 28d70e9693SJohannes Berg /** 29d70e9693SJohannes Berg * DOC: Introduction 30d70e9693SJohannes Berg * 31d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 32d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 33d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 34d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 35d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 36d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 37d70e9693SJohannes Berg * 38d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 39d70e9693SJohannes Berg * use restrictions. 40d70e9693SJohannes Berg */ 41d70e9693SJohannes Berg 42d70e9693SJohannes Berg 43d70e9693SJohannes Berg /** 44d70e9693SJohannes Berg * DOC: Device registration 45d70e9693SJohannes Berg * 46d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 47d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 48d70e9693SJohannes Berg * described below. 49d70e9693SJohannes Berg * 50d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 51d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 52d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 53d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 54d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 5505b23456SRandy Dunlap * the wireless part of the interface. Normally this struct is embedded in the 56d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 57d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 58d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 59d70e9693SJohannes Berg * 60d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 61d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 62d70e9693SJohannes Berg * structures here describe these capabilities in detail. 63d70e9693SJohannes Berg */ 64d70e9693SJohannes Berg 659f5e8f6eSJohannes Berg struct wiphy; 669f5e8f6eSJohannes Berg 67704232c2SJohannes Berg /* 68d3236553SJohannes Berg * wireless hardware capability structures 69d3236553SJohannes Berg */ 70d3236553SJohannes Berg 71d3236553SJohannes Berg /** 72d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 73d3236553SJohannes Berg * 74d3236553SJohannes Berg * Channel flags set by the regulatory control code. 75d3236553SJohannes Berg * 76d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 778fe02e16SLuis R. Rodriguez * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes 788fe02e16SLuis R. Rodriguez * sending probe requests or beaconing. 79ddd7f45cSWen Gong * @IEEE80211_CHAN_PSD: Power spectral density (in dBm) is set for this 80ddd7f45cSWen Gong * channel. 81d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 82689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 83d3236553SJohannes Berg * is not permitted. 84689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 85d3236553SJohannes Berg * is not permitted. 8603f6b084SSeth Forshee * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 87c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 88c7a6ee27SJohannes Berg * this flag indicates that an 80 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. 92c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 93c7a6ee27SJohannes Berg * this flag indicates that an 160 MHz channel cannot use this 94c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 95c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 96c7a6ee27SJohannes Berg * restrictions. 97570dbde1SDavid Spinadel * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 9806f207fcSArik Nemtsov * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 99ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 100ea077c1cSRostislav Lisovy * on this channel. 101ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 102ea077c1cSRostislav Lisovy * on this channel. 1031e61d82cSHaim Dreyfuss * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel. 104d65a9770SThomas Pedersen * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted 105d65a9770SThomas Pedersen * on this channel. 106d65a9770SThomas Pedersen * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted 107d65a9770SThomas Pedersen * on this channel. 108d65a9770SThomas Pedersen * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted 109d65a9770SThomas Pedersen * on this channel. 110d65a9770SThomas Pedersen * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted 111d65a9770SThomas Pedersen * on this channel. 112d65a9770SThomas Pedersen * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted 113d65a9770SThomas Pedersen * on this channel. 1143743bec6SJia Ding * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band, 1153743bec6SJia Ding * this flag indicates that a 320 MHz channel cannot use this 1163743bec6SJia Ding * channel as the control or any of the secondary channels. 1173743bec6SJia Ding * This may be due to the driver or due to regulatory bandwidth 1183743bec6SJia Ding * restrictions. 11931846b65SIlan Peer * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel. 12041a313d8SAndrei Otcheretianski * @IEEE80211_CHAN_DFS_CONCURRENT: See %NL80211_RRF_DFS_CONCURRENT 1217b5e25b8SJohannes Berg * @IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT: Client connection with VLP AP 122645f3d85SMukesh Sisodiya * not permitted using this channel 1237b5e25b8SJohannes Berg * @IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT: Client connection with AFC AP 124645f3d85SMukesh Sisodiya * not permitted using this channel 125*a110a3b7SJohannes Berg * @IEEE80211_CHAN_CAN_MONITOR: This channel can be used for monitor 126*a110a3b7SJohannes Berg * mode even in the presence of other (regulatory) restrictions, 127*a110a3b7SJohannes Berg * even if it is otherwise disabled. 128d3236553SJohannes Berg */ 129d3236553SJohannes Berg enum ieee80211_channel_flags { 130d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 1318fe02e16SLuis R. Rodriguez IEEE80211_CHAN_NO_IR = 1<<1, 132ddd7f45cSWen Gong IEEE80211_CHAN_PSD = 1<<2, 133d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 134689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 135689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 13603f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 137c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 138c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 139570dbde1SDavid Spinadel IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 14006f207fcSArik Nemtsov IEEE80211_CHAN_IR_CONCURRENT = 1<<10, 141ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_20MHZ = 1<<11, 142ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_10MHZ = 1<<12, 1431e61d82cSHaim Dreyfuss IEEE80211_CHAN_NO_HE = 1<<13, 144d65a9770SThomas Pedersen IEEE80211_CHAN_1MHZ = 1<<14, 145d65a9770SThomas Pedersen IEEE80211_CHAN_2MHZ = 1<<15, 146d65a9770SThomas Pedersen IEEE80211_CHAN_4MHZ = 1<<16, 147d65a9770SThomas Pedersen IEEE80211_CHAN_8MHZ = 1<<17, 148d65a9770SThomas Pedersen IEEE80211_CHAN_16MHZ = 1<<18, 1493743bec6SJia Ding IEEE80211_CHAN_NO_320MHZ = 1<<19, 15031846b65SIlan Peer IEEE80211_CHAN_NO_EHT = 1<<20, 15141a313d8SAndrei Otcheretianski IEEE80211_CHAN_DFS_CONCURRENT = 1<<21, 1527b5e25b8SJohannes Berg IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = 1<<22, 1537b5e25b8SJohannes Berg IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = 1<<23, 154*a110a3b7SJohannes Berg IEEE80211_CHAN_CAN_MONITOR = 1<<24, 155d3236553SJohannes Berg }; 156d3236553SJohannes Berg 157038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 158689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 159038659e7SLuis R. Rodriguez 16004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 16104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 16204f39047SSimon Wunderlich 163d3236553SJohannes Berg /** 164d3236553SJohannes Berg * struct ieee80211_channel - channel definition 165d3236553SJohannes Berg * 166d3236553SJohannes Berg * This structure describes a single channel for use 167d3236553SJohannes Berg * with cfg80211. 168d3236553SJohannes Berg * 169d3236553SJohannes Berg * @center_freq: center frequency in MHz 170934f4c7dSThomas Pedersen * @freq_offset: offset from @center_freq, in KHz 171d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 172d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 173d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 174d3236553SJohannes Berg * code to support devices with additional restrictions 175d3236553SJohannes Berg * @band: band this channel belongs to. 176d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 177d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 178eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 179d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 180d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 18177c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 182d3236553SJohannes Berg * @orig_mag: internal use 183d3236553SJohannes Berg * @orig_mpwr: internal use 18404f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 18504f39047SSimon Wunderlich * on this channel. 18604f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 187089027e5SJanusz Dziedzic * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 188ddd7f45cSWen Gong * @psd: power spectral density (in dBm) 189d3236553SJohannes Berg */ 190d3236553SJohannes Berg struct ieee80211_channel { 19157fbcce3SJohannes Berg enum nl80211_band band; 1929cf0a0b4SAlexei Avshalom Lazar u32 center_freq; 193934f4c7dSThomas Pedersen u16 freq_offset; 194d3236553SJohannes Berg u16 hw_value; 195d3236553SJohannes Berg u32 flags; 196d3236553SJohannes Berg int max_antenna_gain; 197d3236553SJohannes Berg int max_power; 198eccc068eSHong Wu int max_reg_power; 199d3236553SJohannes Berg bool beacon_found; 200d3236553SJohannes Berg u32 orig_flags; 201d3236553SJohannes Berg int orig_mag, orig_mpwr; 20204f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 20304f39047SSimon Wunderlich unsigned long dfs_state_entered; 204089027e5SJanusz Dziedzic unsigned int dfs_cac_ms; 205ddd7f45cSWen Gong s8 psd; 206d3236553SJohannes Berg }; 207d3236553SJohannes Berg 208d3236553SJohannes Berg /** 209d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 210d3236553SJohannes Berg * 211d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 212d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 213d3236553SJohannes Berg * different bands/PHY modes. 214d3236553SJohannes Berg * 215d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 216d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 217d3236553SJohannes Berg * with CCK rates. 218d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 219d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 220d3236553SJohannes Berg * core code when registering the wiphy. 221d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 222d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 223d3236553SJohannes Berg * core code when registering the wiphy. 224d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 225d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 226d3236553SJohannes Berg * core code when registering the wiphy. 227d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 22830e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 22930e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 230d3236553SJohannes Berg */ 231d3236553SJohannes Berg enum ieee80211_rate_flags { 232d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 233d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 234d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 235d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 236d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 23730e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 23830e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 239d3236553SJohannes Berg }; 240d3236553SJohannes Berg 241d3236553SJohannes Berg /** 2426eb18137SDedy Lansky * enum ieee80211_bss_type - BSS type filter 2436eb18137SDedy Lansky * 2446eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS 2456eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_PBSS: Personal BSS 2466eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_IBSS: Independent BSS 2476eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS 2486eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type 2496eb18137SDedy Lansky */ 2506eb18137SDedy Lansky enum ieee80211_bss_type { 2516eb18137SDedy Lansky IEEE80211_BSS_TYPE_ESS, 2526eb18137SDedy Lansky IEEE80211_BSS_TYPE_PBSS, 2536eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 2546eb18137SDedy Lansky IEEE80211_BSS_TYPE_MBSS, 2556eb18137SDedy Lansky IEEE80211_BSS_TYPE_ANY 2566eb18137SDedy Lansky }; 2576eb18137SDedy Lansky 2586eb18137SDedy Lansky /** 2596eb18137SDedy Lansky * enum ieee80211_privacy - BSS privacy filter 2606eb18137SDedy Lansky * 2616eb18137SDedy Lansky * @IEEE80211_PRIVACY_ON: privacy bit set 2626eb18137SDedy Lansky * @IEEE80211_PRIVACY_OFF: privacy bit clear 2636eb18137SDedy Lansky * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting 2646eb18137SDedy Lansky */ 2656eb18137SDedy Lansky enum ieee80211_privacy { 2666eb18137SDedy Lansky IEEE80211_PRIVACY_ON, 2676eb18137SDedy Lansky IEEE80211_PRIVACY_OFF, 2686eb18137SDedy Lansky IEEE80211_PRIVACY_ANY 2696eb18137SDedy Lansky }; 2706eb18137SDedy Lansky 2716eb18137SDedy Lansky #define IEEE80211_PRIVACY(x) \ 2726eb18137SDedy Lansky ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) 2736eb18137SDedy Lansky 2746eb18137SDedy Lansky /** 275d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 276d3236553SJohannes Berg * 277d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 278d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 279d3236553SJohannes Berg * are only for driver use when pointers to this structure are 280d3236553SJohannes Berg * passed around. 281d3236553SJohannes Berg * 2821dcf396bSDmitry Antipov * @flags: rate-specific flags from &enum ieee80211_rate_flags 283d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 284d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 285d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 286d3236553SJohannes Berg * short preamble is used 287d3236553SJohannes Berg */ 288d3236553SJohannes Berg struct ieee80211_rate { 289d3236553SJohannes Berg u32 flags; 290d3236553SJohannes Berg u16 bitrate; 291d3236553SJohannes Berg u16 hw_value, hw_value_short; 292d3236553SJohannes Berg }; 293d3236553SJohannes Berg 294d3236553SJohannes Berg /** 295796e90f4SJohn Crispin * struct ieee80211_he_obss_pd - AP settings for spatial reuse 296796e90f4SJohn Crispin * 297796e90f4SJohn Crispin * @enable: is the feature enabled. 298f5bec330SRajkumar Manoharan * @sr_ctrl: The SR Control field of SRP element. 299f5bec330SRajkumar Manoharan * @non_srg_max_offset: non-SRG maximum tx power offset 300796e90f4SJohn Crispin * @min_offset: minimal tx power offset an associated station shall use 301796e90f4SJohn Crispin * @max_offset: maximum tx power offset an associated station shall use 302f5bec330SRajkumar Manoharan * @bss_color_bitmap: bitmap that indicates the BSS color values used by 303f5bec330SRajkumar Manoharan * members of the SRG 304f5bec330SRajkumar Manoharan * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values 305f5bec330SRajkumar Manoharan * used by members of the SRG 306796e90f4SJohn Crispin */ 307796e90f4SJohn Crispin struct ieee80211_he_obss_pd { 308796e90f4SJohn Crispin bool enable; 309f5bec330SRajkumar Manoharan u8 sr_ctrl; 310f5bec330SRajkumar Manoharan u8 non_srg_max_offset; 311796e90f4SJohn Crispin u8 min_offset; 312796e90f4SJohn Crispin u8 max_offset; 313f5bec330SRajkumar Manoharan u8 bss_color_bitmap[8]; 314f5bec330SRajkumar Manoharan u8 partial_bssid_bitmap[8]; 315796e90f4SJohn Crispin }; 316796e90f4SJohn Crispin 317796e90f4SJohn Crispin /** 3185c5e52d1SJohn Crispin * struct cfg80211_he_bss_color - AP settings for BSS coloring 3195c5e52d1SJohn Crispin * 3205c5e52d1SJohn Crispin * @color: the current color. 32175e6b594SJohannes Berg * @enabled: HE BSS color is used 3225c5e52d1SJohn Crispin * @partial: define the AID equation. 3235c5e52d1SJohn Crispin */ 3245c5e52d1SJohn Crispin struct cfg80211_he_bss_color { 3255c5e52d1SJohn Crispin u8 color; 32675e6b594SJohannes Berg bool enabled; 3275c5e52d1SJohn Crispin bool partial; 3285c5e52d1SJohn Crispin }; 3295c5e52d1SJohn Crispin 3305c5e52d1SJohn Crispin /** 331d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 332d3236553SJohannes Berg * 333d3236553SJohannes Berg * This structure describes most essential parameters needed 334d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 335d3236553SJohannes Berg * 336d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 337d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 338d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 339d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 340d3236553SJohannes Berg * @mcs: Supported MCS rates 341d3236553SJohannes Berg */ 342d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 343d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 344d3236553SJohannes Berg bool ht_supported; 345d3236553SJohannes Berg u8 ampdu_factor; 346d3236553SJohannes Berg u8 ampdu_density; 347d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 348d3236553SJohannes Berg }; 349d3236553SJohannes Berg 350d3236553SJohannes Berg /** 351bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 352bf0c111eSMahesh Palivela * 353bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 354bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 355bf0c111eSMahesh Palivela * 356bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 357bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 358bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 359bf0c111eSMahesh Palivela */ 360bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 361bf0c111eSMahesh Palivela bool vht_supported; 362bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 363bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 364bf0c111eSMahesh Palivela }; 365bf0c111eSMahesh Palivela 366c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN 25 367c4cbaf79SLuca Coelho 368c4cbaf79SLuca Coelho /** 369c4cbaf79SLuca Coelho * struct ieee80211_sta_he_cap - STA's HE capabilities 370c4cbaf79SLuca Coelho * 371c4cbaf79SLuca Coelho * This structure describes most essential parameters needed 372c4cbaf79SLuca Coelho * to describe 802.11ax HE capabilities for a STA. 373c4cbaf79SLuca Coelho * 374c4cbaf79SLuca Coelho * @has_he: true iff HE data is valid. 375c4cbaf79SLuca Coelho * @he_cap_elem: Fixed portion of the HE capabilities element. 376c4cbaf79SLuca Coelho * @he_mcs_nss_supp: The supported NSS/MCS combinations. 377c4cbaf79SLuca Coelho * @ppe_thres: Holds the PPE Thresholds data. 378c4cbaf79SLuca Coelho */ 379c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap { 380c4cbaf79SLuca Coelho bool has_he; 381c4cbaf79SLuca Coelho struct ieee80211_he_cap_elem he_cap_elem; 382c4cbaf79SLuca Coelho struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 383c4cbaf79SLuca Coelho u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; 384c4cbaf79SLuca Coelho }; 385c4cbaf79SLuca Coelho 386c4cbaf79SLuca Coelho /** 3875cd5a8a3SIlan Peer * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS 3885cd5a8a3SIlan Peer * 3895cd5a8a3SIlan Peer * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS 3905cd5a8a3SIlan Peer * and NSS Set field" 3915cd5a8a3SIlan Peer * 3925cd5a8a3SIlan Peer * @only_20mhz: MCS/NSS support for 20 MHz-only STA. 3932d8b08feSMauro Carvalho Chehab * @bw: MCS/NSS support for 80, 160 and 320 MHz 3945cd5a8a3SIlan Peer * @bw._80: MCS/NSS support for BW <= 80 MHz 3955cd5a8a3SIlan Peer * @bw._160: MCS/NSS support for BW = 160 MHz 3965cd5a8a3SIlan Peer * @bw._320: MCS/NSS support for BW = 320 MHz 3975cd5a8a3SIlan Peer */ 3985cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp { 3995cd5a8a3SIlan Peer union { 4005cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz; 4015cd5a8a3SIlan Peer struct { 4025cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_bw _80; 4035cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_bw _160; 4045cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_bw _320; 4055cd5a8a3SIlan Peer } __packed bw; 4065cd5a8a3SIlan Peer } __packed; 4075cd5a8a3SIlan Peer } __packed; 4085cd5a8a3SIlan Peer 4095cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN 32 4105cd5a8a3SIlan Peer 4115cd5a8a3SIlan Peer /** 4125cd5a8a3SIlan Peer * struct ieee80211_sta_eht_cap - STA's EHT capabilities 4135cd5a8a3SIlan Peer * 4145cd5a8a3SIlan Peer * This structure describes most essential parameters needed 4155cd5a8a3SIlan Peer * to describe 802.11be EHT capabilities for a STA. 4165cd5a8a3SIlan Peer * 4175cd5a8a3SIlan Peer * @has_eht: true iff EHT data is valid. 4185cd5a8a3SIlan Peer * @eht_cap_elem: Fixed portion of the eht capabilities element. 4195cd5a8a3SIlan Peer * @eht_mcs_nss_supp: The supported NSS/MCS combinations. 4205cd5a8a3SIlan Peer * @eht_ppe_thres: Holds the PPE Thresholds data. 4215cd5a8a3SIlan Peer */ 4225cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap { 4235cd5a8a3SIlan Peer bool has_eht; 4245cd5a8a3SIlan Peer struct ieee80211_eht_cap_elem_fixed eht_cap_elem; 4255cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp; 4265cd5a8a3SIlan Peer u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN]; 4275cd5a8a3SIlan Peer }; 4285cd5a8a3SIlan Peer 429e8c18412SJohannes Berg /* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */ 430e8c18412SJohannes Berg #ifdef __CHECKER__ 431e8c18412SJohannes Berg /* 432e8c18412SJohannes Berg * This is used to mark the sband->iftype_data pointer which is supposed 433e8c18412SJohannes Berg * to be an array with special access semantics (per iftype), but a lot 434e8c18412SJohannes Berg * of code got it wrong in the past, so with this marking sparse will be 435e8c18412SJohannes Berg * noisy when the pointer is used directly. 436e8c18412SJohannes Berg */ 437e8c18412SJohannes Berg # define __iftd __attribute__((noderef, address_space(__iftype_data))) 438e8c18412SJohannes Berg #else 439e8c18412SJohannes Berg # define __iftd 440e8c18412SJohannes Berg #endif /* __CHECKER__ */ 441e8c18412SJohannes Berg 4425cd5a8a3SIlan Peer /** 4435d9c358dSRandy Dunlap * struct ieee80211_sband_iftype_data - sband data per interface type 444c4cbaf79SLuca Coelho * 445c4cbaf79SLuca Coelho * This structure encapsulates sband data that is relevant for the 446c4cbaf79SLuca Coelho * interface types defined in @types_mask. Each type in the 447c4cbaf79SLuca Coelho * @types_mask must be unique across all instances of iftype_data. 448c4cbaf79SLuca Coelho * 449c4cbaf79SLuca Coelho * @types_mask: interface types mask 450c4cbaf79SLuca Coelho * @he_cap: holds the HE capabilities 45122395217SJohannes Berg * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a 45222395217SJohannes Berg * 6 GHz band channel (and 0 may be valid value). 4532d8b08feSMauro Carvalho Chehab * @eht_cap: STA's EHT capabilities 454f4f86505SJohannes Berg * @vendor_elems: vendor element(s) to advertise 455f4f86505SJohannes Berg * @vendor_elems.data: vendor element(s) data 456f4f86505SJohannes Berg * @vendor_elems.len: vendor element(s) length 457c4cbaf79SLuca Coelho */ 458c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data { 459c4cbaf79SLuca Coelho u16 types_mask; 460c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap he_cap; 46122395217SJohannes Berg struct ieee80211_he_6ghz_capa he_6ghz_capa; 4625cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap eht_cap; 463f4f86505SJohannes Berg struct { 464f4f86505SJohannes Berg const u8 *data; 465f4f86505SJohannes Berg unsigned int len; 466f4f86505SJohannes Berg } vendor_elems; 467c4cbaf79SLuca Coelho }; 468c4cbaf79SLuca Coelho 469bf0c111eSMahesh Palivela /** 4702a38075cSAlexei Avshalom Lazar * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations 4712a38075cSAlexei Avshalom Lazar * 4722a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz 4732a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz 4742a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz 4752a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz 4762a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz 4772a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz 4782a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz 4792a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and 4802a38075cSAlexei Avshalom Lazar * 2.16GHz+2.16GHz 4812a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and 4822a38075cSAlexei Avshalom Lazar * 4.32GHz + 4.32GHz 4832a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and 4842a38075cSAlexei Avshalom Lazar * 4.32GHz + 4.32GHz 4852a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz 4862a38075cSAlexei Avshalom Lazar * and 4.32GHz + 4.32GHz 4872a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz, 4882a38075cSAlexei Avshalom Lazar * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz 4892a38075cSAlexei Avshalom Lazar */ 4902a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config { 4912a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_4 = 4, 4922a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_5 = 5, 4932a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_6 = 6, 4942a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_7 = 7, 4952a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_8 = 8, 4962a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_9 = 9, 4972a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_10 = 10, 4982a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_11 = 11, 4992a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_12 = 12, 5002a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_13 = 13, 5012a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_14 = 14, 5022a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_15 = 15, 5032a38075cSAlexei Avshalom Lazar }; 5042a38075cSAlexei Avshalom Lazar 5052a38075cSAlexei Avshalom Lazar /** 5062a38075cSAlexei Avshalom Lazar * struct ieee80211_edmg - EDMG configuration 5072a38075cSAlexei Avshalom Lazar * 5082a38075cSAlexei Avshalom Lazar * This structure describes most essential parameters needed 5092a38075cSAlexei Avshalom Lazar * to describe 802.11ay EDMG configuration 5102a38075cSAlexei Avshalom Lazar * 5112a38075cSAlexei Avshalom Lazar * @channels: bitmap that indicates the 2.16 GHz channel(s) 5122a38075cSAlexei Avshalom Lazar * that are allowed to be used for transmissions. 5132a38075cSAlexei Avshalom Lazar * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc. 5142a38075cSAlexei Avshalom Lazar * Set to 0 indicate EDMG not supported. 5152a38075cSAlexei Avshalom Lazar * @bw_config: Channel BW Configuration subfield encodes 5162a38075cSAlexei Avshalom Lazar * the allowed channel bandwidth configurations 5172a38075cSAlexei Avshalom Lazar */ 5182a38075cSAlexei Avshalom Lazar struct ieee80211_edmg { 5192a38075cSAlexei Avshalom Lazar u8 channels; 5202a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config bw_config; 5212a38075cSAlexei Avshalom Lazar }; 5222a38075cSAlexei Avshalom Lazar 5232a38075cSAlexei Avshalom Lazar /** 524df78a0c0SThomas Pedersen * struct ieee80211_sta_s1g_cap - STA's S1G capabilities 525df78a0c0SThomas Pedersen * 526df78a0c0SThomas Pedersen * This structure describes most essential parameters needed 527df78a0c0SThomas Pedersen * to describe 802.11ah S1G capabilities for a STA. 528df78a0c0SThomas Pedersen * 5292d8b08feSMauro Carvalho Chehab * @s1g: is STA an S1G STA 530df78a0c0SThomas Pedersen * @cap: S1G capabilities information 531df78a0c0SThomas Pedersen * @nss_mcs: Supported NSS MCS set 532df78a0c0SThomas Pedersen */ 533df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap { 534df78a0c0SThomas Pedersen bool s1g; 535df78a0c0SThomas Pedersen u8 cap[10]; /* use S1G_CAPAB_ */ 536df78a0c0SThomas Pedersen u8 nss_mcs[5]; 537df78a0c0SThomas Pedersen }; 538df78a0c0SThomas Pedersen 539df78a0c0SThomas Pedersen /** 540d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 541d3236553SJohannes Berg * 542d3236553SJohannes Berg * This structure describes a frequency band a wiphy 543d3236553SJohannes Berg * is able to operate in. 544d3236553SJohannes Berg * 545085a6c10SRandy Dunlap * @channels: Array of channels the hardware can operate with 546d3236553SJohannes Berg * in this band. 547d3236553SJohannes Berg * @band: the band this structure represents 548d3236553SJohannes Berg * @n_channels: Number of channels in @channels 549d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 550d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 551d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 552d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 553abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 554c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 5558a50c057SMauro Carvalho Chehab * @s1g_cap: S1G capabilities in this band 5562a38075cSAlexei Avshalom Lazar * @edmg_cap: EDMG capabilities in this band 5579ff167e1SJohannes Berg * @s1g_cap: S1G capabilities in this band (S1B band only, of course) 558c4cbaf79SLuca Coelho * @n_iftype_data: number of iftype data entries 559c4cbaf79SLuca Coelho * @iftype_data: interface type data entries. Note that the bits in 560c4cbaf79SLuca Coelho * @types_mask inside this structure cannot overlap (i.e. only 561c4cbaf79SLuca Coelho * one occurrence of each type is allowed across all instances of 562c4cbaf79SLuca Coelho * iftype_data). 563d3236553SJohannes Berg */ 564d3236553SJohannes Berg struct ieee80211_supported_band { 565d3236553SJohannes Berg struct ieee80211_channel *channels; 566d3236553SJohannes Berg struct ieee80211_rate *bitrates; 56757fbcce3SJohannes Berg enum nl80211_band band; 568d3236553SJohannes Berg int n_channels; 569d3236553SJohannes Berg int n_bitrates; 570d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 571bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 572df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap s1g_cap; 5732a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg_cap; 574c4cbaf79SLuca Coelho u16 n_iftype_data; 575e8c18412SJohannes Berg const struct ieee80211_sband_iftype_data __iftd *iftype_data; 576d3236553SJohannes Berg }; 577d3236553SJohannes Berg 578e691ac2fSRafał Miłecki /** 579e8c18412SJohannes Berg * _ieee80211_set_sband_iftype_data - set sband iftype data array 580e8c18412SJohannes Berg * @sband: the sband to initialize 581e8c18412SJohannes Berg * @iftd: the iftype data array pointer 582e8c18412SJohannes Berg * @n_iftd: the length of the iftype data array 583e8c18412SJohannes Berg * 584e8c18412SJohannes Berg * Set the sband iftype data array; use this where the length cannot 585e8c18412SJohannes Berg * be derived from the ARRAY_SIZE() of the argument, but prefer 586e8c18412SJohannes Berg * ieee80211_set_sband_iftype_data() where it can be used. 587e8c18412SJohannes Berg */ 588e8c18412SJohannes Berg static inline void 589e8c18412SJohannes Berg _ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband, 590e8c18412SJohannes Berg const struct ieee80211_sband_iftype_data *iftd, 591e8c18412SJohannes Berg u16 n_iftd) 592e8c18412SJohannes Berg { 593e8c18412SJohannes Berg sband->iftype_data = (const void __iftd __force *)iftd; 594e8c18412SJohannes Berg sband->n_iftype_data = n_iftd; 595e8c18412SJohannes Berg } 596e8c18412SJohannes Berg 597e8c18412SJohannes Berg /** 598e8c18412SJohannes Berg * ieee80211_set_sband_iftype_data - set sband iftype data array 599e8c18412SJohannes Berg * @sband: the sband to initialize 600e8c18412SJohannes Berg * @iftd: the iftype data array 601e8c18412SJohannes Berg */ 602e8c18412SJohannes Berg #define ieee80211_set_sband_iftype_data(sband, iftd) \ 603e8c18412SJohannes Berg _ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd)) 604e8c18412SJohannes Berg 605e8c18412SJohannes Berg /** 606e8c18412SJohannes Berg * for_each_sband_iftype_data - iterate sband iftype data entries 607e8c18412SJohannes Berg * @sband: the sband whose iftype_data array to iterate 608e8c18412SJohannes Berg * @i: iterator counter 609e8c18412SJohannes Berg * @iftd: iftype data pointer to set 610e8c18412SJohannes Berg */ 611e8c18412SJohannes Berg #define for_each_sband_iftype_data(sband, i, iftd) \ 612e8c18412SJohannes Berg for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i]; \ 613e8c18412SJohannes Berg i < (sband)->n_iftype_data; \ 614e8c18412SJohannes Berg i++, iftd = (const void __force *)&(sband)->iftype_data[i]) 615e8c18412SJohannes Berg 616e8c18412SJohannes Berg /** 617c4cbaf79SLuca Coelho * ieee80211_get_sband_iftype_data - return sband data for a given iftype 618c4cbaf79SLuca Coelho * @sband: the sband to search for the STA on 619c4cbaf79SLuca Coelho * @iftype: enum nl80211_iftype 620c4cbaf79SLuca Coelho * 621c4cbaf79SLuca Coelho * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found 622c4cbaf79SLuca Coelho */ 623c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data * 624c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, 625c4cbaf79SLuca Coelho u8 iftype) 626c4cbaf79SLuca Coelho { 627e8c18412SJohannes Berg const struct ieee80211_sband_iftype_data *data; 628c4cbaf79SLuca Coelho int i; 629c4cbaf79SLuca Coelho 630c4cbaf79SLuca Coelho if (WARN_ON(iftype >= NL80211_IFTYPE_MAX)) 631c4cbaf79SLuca Coelho return NULL; 632c4cbaf79SLuca Coelho 6335fb9a9fbSFelix Fietkau if (iftype == NL80211_IFTYPE_AP_VLAN) 6345fb9a9fbSFelix Fietkau iftype = NL80211_IFTYPE_AP; 6355fb9a9fbSFelix Fietkau 636e8c18412SJohannes Berg for_each_sband_iftype_data(sband, i, data) { 637c4cbaf79SLuca Coelho if (data->types_mask & BIT(iftype)) 638c4cbaf79SLuca Coelho return data; 639c4cbaf79SLuca Coelho } 640c4cbaf79SLuca Coelho 641c4cbaf79SLuca Coelho return NULL; 642c4cbaf79SLuca Coelho } 643c4cbaf79SLuca Coelho 644c4cbaf79SLuca Coelho /** 645d7edf40cSJohn Crispin * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype 646d7edf40cSJohn Crispin * @sband: the sband to search for the iftype on 647d7edf40cSJohn Crispin * @iftype: enum nl80211_iftype 648d7edf40cSJohn Crispin * 649d7edf40cSJohn Crispin * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 650d7edf40cSJohn Crispin */ 651d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap * 652d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband, 653d7edf40cSJohn Crispin u8 iftype) 654d7edf40cSJohn Crispin { 655d7edf40cSJohn Crispin const struct ieee80211_sband_iftype_data *data = 656d7edf40cSJohn Crispin ieee80211_get_sband_iftype_data(sband, iftype); 657d7edf40cSJohn Crispin 658d7edf40cSJohn Crispin if (data && data->he_cap.has_he) 659d7edf40cSJohn Crispin return &data->he_cap; 660d7edf40cSJohn Crispin 661d7edf40cSJohn Crispin return NULL; 662d7edf40cSJohn Crispin } 663d7edf40cSJohn Crispin 664d7edf40cSJohn Crispin /** 6652ad2274cSIlan Peer * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities 6662ad2274cSIlan Peer * @sband: the sband to search for the STA on 6672ad2274cSIlan Peer * @iftype: the iftype to search for 6682ad2274cSIlan Peer * 6692ad2274cSIlan Peer * Return: the 6GHz capabilities 6702ad2274cSIlan Peer */ 6712ad2274cSIlan Peer static inline __le16 6722ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband, 6732ad2274cSIlan Peer enum nl80211_iftype iftype) 6742ad2274cSIlan Peer { 6752ad2274cSIlan Peer const struct ieee80211_sband_iftype_data *data = 6762ad2274cSIlan Peer ieee80211_get_sband_iftype_data(sband, iftype); 6772ad2274cSIlan Peer 6782ad2274cSIlan Peer if (WARN_ON(!data || !data->he_cap.has_he)) 6792ad2274cSIlan Peer return 0; 6802ad2274cSIlan Peer 6812ad2274cSIlan Peer return data->he_6ghz_capa.capa; 6822ad2274cSIlan Peer } 6832ad2274cSIlan Peer 6842ad2274cSIlan Peer /** 6855cd5a8a3SIlan Peer * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype 6865cd5a8a3SIlan Peer * @sband: the sband to search for the iftype on 6875cd5a8a3SIlan Peer * @iftype: enum nl80211_iftype 6885cd5a8a3SIlan Peer * 6895cd5a8a3SIlan Peer * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found 6905cd5a8a3SIlan Peer */ 6915cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap * 6925cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband, 6935cd5a8a3SIlan Peer enum nl80211_iftype iftype) 6945cd5a8a3SIlan Peer { 6955cd5a8a3SIlan Peer const struct ieee80211_sband_iftype_data *data = 6965cd5a8a3SIlan Peer ieee80211_get_sband_iftype_data(sband, iftype); 6975cd5a8a3SIlan Peer 6985cd5a8a3SIlan Peer if (data && data->eht_cap.has_eht) 6995cd5a8a3SIlan Peer return &data->eht_cap; 7005cd5a8a3SIlan Peer 7015cd5a8a3SIlan Peer return NULL; 7025cd5a8a3SIlan Peer } 7035cd5a8a3SIlan Peer 7045cd5a8a3SIlan Peer /** 705e691ac2fSRafał Miłecki * wiphy_read_of_freq_limits - read frequency limits from device tree 706e691ac2fSRafał Miłecki * 707e691ac2fSRafał Miłecki * @wiphy: the wireless device to get extra limits for 708e691ac2fSRafał Miłecki * 709e691ac2fSRafał Miłecki * Some devices may have extra limitations specified in DT. This may be useful 710e691ac2fSRafał Miłecki * for chipsets that normally support more bands but are limited due to board 711e691ac2fSRafał Miłecki * design (e.g. by antennas or external power amplifier). 712e691ac2fSRafał Miłecki * 713e691ac2fSRafał Miłecki * This function reads info from DT and uses it to *modify* channels (disable 714e691ac2fSRafał Miłecki * unavailable ones). It's usually a *bad* idea to use it in drivers with 715e691ac2fSRafał Miłecki * shared channel data as DT limitations are device specific. You should make 716e691ac2fSRafał Miłecki * sure to call it only if channels in wiphy are copied and can be modified 717e691ac2fSRafał Miłecki * without affecting other devices. 718e691ac2fSRafał Miłecki * 719e691ac2fSRafał Miłecki * As this function access device node it has to be called after set_wiphy_dev. 720e691ac2fSRafał Miłecki * It also modifies channels so they have to be set first. 721e691ac2fSRafał Miłecki * If using this helper, call it before wiphy_register(). 722e691ac2fSRafał Miłecki */ 723e691ac2fSRafał Miłecki #ifdef CONFIG_OF 724e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy); 725e691ac2fSRafał Miłecki #else /* CONFIG_OF */ 726e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) 727e691ac2fSRafał Miłecki { 728e691ac2fSRafał Miłecki } 729e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */ 730e691ac2fSRafał Miłecki 731e691ac2fSRafał Miłecki 732d3236553SJohannes Berg /* 733d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 734704232c2SJohannes Berg */ 735704232c2SJohannes Berg 7362ec600d6SLuis Carlos Cobo /** 737d70e9693SJohannes Berg * DOC: Actions and configuration 738d70e9693SJohannes Berg * 739d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 740d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 741d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 742d70e9693SJohannes Berg * operations use are described separately. 743d70e9693SJohannes Berg * 744d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 745d70e9693SJohannes Berg * information via some functions that drivers need to call. 746d70e9693SJohannes Berg * 747d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 748d70e9693SJohannes Berg * in a separate chapter. 749d70e9693SJohannes Berg */ 750d70e9693SJohannes Berg 751c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 752c6e6a0c8SAviya Erenfeld WLAN_USER_POSITION_LEN) 753c6e6a0c8SAviya Erenfeld 754d70e9693SJohannes Berg /** 7552ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 756818a986eSJohannes Berg * @flags: monitor interface flags, unchanged if 0, otherwise 757818a986eSJohannes Berg * %MONITOR_FLAG_CHANGED will be set 7588b787643SFelix Fietkau * @use_4addr: use 4-address frames 759e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 760e8f479b1SBen Greear * If this parameter is set to zero address the driver may 761e8f479b1SBen Greear * determine the address as needed. 762e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 763e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 764e8f479b1SBen Greear ** only p2p devices with specified MAC. 765b0265024SJohannes Berg * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets 766b0265024SJohannes Berg * belonging to that MU-MIMO groupID; %NULL if not changed 767b0265024SJohannes Berg * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring 768b0265024SJohannes Berg * MU-MIMO packets going to the specified station; %NULL if not changed 7692ec600d6SLuis Carlos Cobo */ 7702ec600d6SLuis Carlos Cobo struct vif_params { 771818a986eSJohannes Berg u32 flags; 7728b787643SFelix Fietkau int use_4addr; 7731c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 774b0265024SJohannes Berg const u8 *vht_mumimo_groups; 775b0265024SJohannes Berg const u8 *vht_mumimo_follow_addr; 7762ec600d6SLuis Carlos Cobo }; 7772ec600d6SLuis Carlos Cobo 77841ade00fSJohannes Berg /** 77941ade00fSJohannes Berg * struct key_params - key information 78041ade00fSJohannes Berg * 78141ade00fSJohannes Berg * Information about a key 78241ade00fSJohannes Berg * 78341ade00fSJohannes Berg * @key: key material 78441ade00fSJohannes Berg * @key_len: length of key material 78541ade00fSJohannes Berg * @cipher: cipher suite selector 78641ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 78741ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 78841ade00fSJohannes Berg * length given by @seq_len. 789abe37c4bSJohannes Berg * @seq_len: length of @seq. 79014f34e36SGurumoorthi Gnanasambandhan * @vlan_id: vlan_id for VLAN group key (if nonzero) 7916cdd3979SAlexander Wetzel * @mode: key install mode (RX_TX, NO_TX or SET_TX) 79241ade00fSJohannes Berg */ 79341ade00fSJohannes Berg struct key_params { 794c1e5f471SJohannes Berg const u8 *key; 795c1e5f471SJohannes Berg const u8 *seq; 79641ade00fSJohannes Berg int key_len; 79741ade00fSJohannes Berg int seq_len; 79814f34e36SGurumoorthi Gnanasambandhan u16 vlan_id; 79941ade00fSJohannes Berg u32 cipher; 8006cdd3979SAlexander Wetzel enum nl80211_key_mode mode; 80141ade00fSJohannes Berg }; 80241ade00fSJohannes Berg 803ed1b6cc7SJohannes Berg /** 804683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 805683b6d3bSJohannes Berg * @chan: the (control) channel 8063d9d1d66SJohannes Berg * @width: channel width 8073d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 8083d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 8093d9d1d66SJohannes Berg * (only with 80+80 MHz) 8102a38075cSAlexei Avshalom Lazar * @edmg: define the EDMG channels configuration. 8112a38075cSAlexei Avshalom Lazar * If edmg is requested (i.e. the .channels member is non-zero), 8122a38075cSAlexei Avshalom Lazar * chan will define the primary channel and all other 8132a38075cSAlexei Avshalom Lazar * parameters are ignored. 814934f4c7dSThomas Pedersen * @freq1_offset: offset from @center_freq1, in KHz 815b82730bfSJohannes Berg * @punctured: mask of the punctured 20 MHz subchannels, with 816b82730bfSJohannes Berg * bits turned on being disabled (punctured); numbered 817b82730bfSJohannes Berg * from lower to higher frequency (like in the spec) 818683b6d3bSJohannes Berg */ 819683b6d3bSJohannes Berg struct cfg80211_chan_def { 820683b6d3bSJohannes Berg struct ieee80211_channel *chan; 8213d9d1d66SJohannes Berg enum nl80211_chan_width width; 8223d9d1d66SJohannes Berg u32 center_freq1; 8233d9d1d66SJohannes Berg u32 center_freq2; 8242a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg; 825934f4c7dSThomas Pedersen u16 freq1_offset; 826b82730bfSJohannes Berg u16 punctured; 827683b6d3bSJohannes Berg }; 828683b6d3bSJohannes Berg 8299a5f6488STamizh Chelvam /* 8309a5f6488STamizh Chelvam * cfg80211_bitrate_mask - masks for bitrate control 8319a5f6488STamizh Chelvam */ 8329a5f6488STamizh Chelvam struct cfg80211_bitrate_mask { 8339a5f6488STamizh Chelvam struct { 8349a5f6488STamizh Chelvam u32 legacy; 8359a5f6488STamizh Chelvam u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 8369a5f6488STamizh Chelvam u16 vht_mcs[NL80211_VHT_NSS_MAX]; 837eb89a6a6SMiles Hu u16 he_mcs[NL80211_HE_NSS_MAX]; 8389a5f6488STamizh Chelvam enum nl80211_txrate_gi gi; 839eb89a6a6SMiles Hu enum nl80211_he_gi he_gi; 840eb89a6a6SMiles Hu enum nl80211_he_ltf he_ltf; 8419a5f6488STamizh Chelvam } control[NUM_NL80211_BANDS]; 8429a5f6488STamizh Chelvam }; 8439a5f6488STamizh Chelvam 8449a5f6488STamizh Chelvam 84577f576deSTamizh chelvam /** 8463710a8a6SJohannes Berg * struct cfg80211_tid_cfg - TID specific configuration 84777f576deSTamizh chelvam * @config_override: Flag to notify driver to reset TID configuration 84877f576deSTamizh chelvam * of the peer. 8493710a8a6SJohannes Berg * @tids: bitmap of TIDs to modify 8503710a8a6SJohannes Berg * @mask: bitmap of attributes indicating which parameter changed, 8513710a8a6SJohannes Berg * similar to &nl80211_tid_config_supp. 85277f576deSTamizh chelvam * @noack: noack configuration value for the TID 8536a21d16cSTamizh chelvam * @retry_long: retry count value 8546a21d16cSTamizh chelvam * @retry_short: retry count value 85533462e68SSergey Matyukevich * @ampdu: Enable/Disable MPDU aggregation 85604f7d142STamizh chelvam * @rtscts: Enable/Disable RTS/CTS 85733462e68SSergey Matyukevich * @amsdu: Enable/Disable MSDU aggregation 8589a5f6488STamizh Chelvam * @txrate_type: Tx bitrate mask type 8599a5f6488STamizh Chelvam * @txrate_mask: Tx bitrate to be applied for the TID 86077f576deSTamizh chelvam */ 8613710a8a6SJohannes Berg struct cfg80211_tid_cfg { 86277f576deSTamizh chelvam bool config_override; 8633710a8a6SJohannes Berg u8 tids; 8642d5d9b7fSSergey Matyukevich u64 mask; 86577f576deSTamizh chelvam enum nl80211_tid_config noack; 8666a21d16cSTamizh chelvam u8 retry_long, retry_short; 867ade274b2STamizh chelvam enum nl80211_tid_config ampdu; 86804f7d142STamizh chelvam enum nl80211_tid_config rtscts; 86933462e68SSergey Matyukevich enum nl80211_tid_config amsdu; 8709a5f6488STamizh Chelvam enum nl80211_tx_rate_setting txrate_type; 8719a5f6488STamizh Chelvam struct cfg80211_bitrate_mask txrate_mask; 87277f576deSTamizh chelvam }; 87377f576deSTamizh chelvam 87477f576deSTamizh chelvam /** 8753710a8a6SJohannes Berg * struct cfg80211_tid_config - TID configuration 87677f576deSTamizh chelvam * @peer: Station's MAC address 87777f576deSTamizh chelvam * @n_tid_conf: Number of TID specific configurations to be applied 87877f576deSTamizh chelvam * @tid_conf: Configuration change info 87977f576deSTamizh chelvam */ 8803710a8a6SJohannes Berg struct cfg80211_tid_config { 88177f576deSTamizh chelvam const u8 *peer; 88277f576deSTamizh chelvam u32 n_tid_conf; 883545d3523SKees Cook struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf); 88477f576deSTamizh chelvam }; 88577f576deSTamizh chelvam 8863d9d1d66SJohannes Berg /** 887e306784aSSubrat Mishra * struct cfg80211_fils_aad - FILS AAD data 888e306784aSSubrat Mishra * @macaddr: STA MAC address 889e306784aSSubrat Mishra * @kek: FILS KEK 890e306784aSSubrat Mishra * @kek_len: FILS KEK length 891e306784aSSubrat Mishra * @snonce: STA Nonce 892e306784aSSubrat Mishra * @anonce: AP Nonce 893e306784aSSubrat Mishra */ 894e306784aSSubrat Mishra struct cfg80211_fils_aad { 895e306784aSSubrat Mishra const u8 *macaddr; 896e306784aSSubrat Mishra const u8 *kek; 897e306784aSSubrat Mishra u8 kek_len; 898e306784aSSubrat Mishra const u8 *snonce; 899e306784aSSubrat Mishra const u8 *anonce; 900e306784aSSubrat Mishra }; 901e306784aSSubrat Mishra 902e306784aSSubrat Mishra /** 903cbbaf2bbSAvraham Stern * struct cfg80211_set_hw_timestamp - enable/disable HW timestamping 904cbbaf2bbSAvraham Stern * @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all 905cbbaf2bbSAvraham Stern * addresses. 906cbbaf2bbSAvraham Stern * @enable: if set, enable HW timestamping for the specified MAC address. 907cbbaf2bbSAvraham Stern * Otherwise disable HW timestamping for the specified MAC address. 908cbbaf2bbSAvraham Stern */ 909cbbaf2bbSAvraham Stern struct cfg80211_set_hw_timestamp { 910cbbaf2bbSAvraham Stern const u8 *macaddr; 911cbbaf2bbSAvraham Stern bool enable; 912cbbaf2bbSAvraham Stern }; 913cbbaf2bbSAvraham Stern 914cbbaf2bbSAvraham Stern /** 9153d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 9163d9d1d66SJohannes Berg * @chandef: the channel definition 9173d9d1d66SJohannes Berg * 9180ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 9193d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 9203d9d1d66SJohannes Berg */ 921683b6d3bSJohannes Berg static inline enum nl80211_channel_type 922683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 923683b6d3bSJohannes Berg { 9243d9d1d66SJohannes Berg switch (chandef->width) { 9253d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 9263d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 9273d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 9283d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 9293d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 9303d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 9313d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 9323d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 9333d9d1d66SJohannes Berg default: 9343d9d1d66SJohannes Berg WARN_ON(1); 9353d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 936683b6d3bSJohannes Berg } 9373d9d1d66SJohannes Berg } 9383d9d1d66SJohannes Berg 9393d9d1d66SJohannes Berg /** 9403d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 9413d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 9423d9d1d66SJohannes Berg * @channel: the control channel 9433d9d1d66SJohannes Berg * @chantype: the channel type 9443d9d1d66SJohannes Berg * 9453d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 9463d9d1d66SJohannes Berg */ 9473d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 9483d9d1d66SJohannes Berg struct ieee80211_channel *channel, 9493d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 9503d9d1d66SJohannes Berg 9513d9d1d66SJohannes Berg /** 9523d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 9533d9d1d66SJohannes Berg * @chandef1: first channel definition 9543d9d1d66SJohannes Berg * @chandef2: second channel definition 9553d9d1d66SJohannes Berg * 9560ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 9573d9d1d66SJohannes Berg * identical, %false otherwise. 9583d9d1d66SJohannes Berg */ 9593d9d1d66SJohannes Berg static inline bool 9603d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 9613d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 9623d9d1d66SJohannes Berg { 9633d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 9643d9d1d66SJohannes Berg chandef1->width == chandef2->width && 9653d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 966934f4c7dSThomas Pedersen chandef1->freq1_offset == chandef2->freq1_offset && 967b82730bfSJohannes Berg chandef1->center_freq2 == chandef2->center_freq2 && 968b82730bfSJohannes Berg chandef1->punctured == chandef2->punctured); 9693d9d1d66SJohannes Berg } 9703d9d1d66SJohannes Berg 9713d9d1d66SJohannes Berg /** 9722a38075cSAlexei Avshalom Lazar * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel 9732a38075cSAlexei Avshalom Lazar * 9742a38075cSAlexei Avshalom Lazar * @chandef: the channel definition 9752a38075cSAlexei Avshalom Lazar * 9762a38075cSAlexei Avshalom Lazar * Return: %true if EDMG defined, %false otherwise. 9772a38075cSAlexei Avshalom Lazar */ 9782a38075cSAlexei Avshalom Lazar static inline bool 9792a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef) 9802a38075cSAlexei Avshalom Lazar { 9812a38075cSAlexei Avshalom Lazar return chandef->edmg.channels || chandef->edmg.bw_config; 9822a38075cSAlexei Avshalom Lazar } 9832a38075cSAlexei Avshalom Lazar 9842a38075cSAlexei Avshalom Lazar /** 9853d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 9863d9d1d66SJohannes Berg * @chandef1: first channel definition 9873d9d1d66SJohannes Berg * @chandef2: second channel definition 9883d9d1d66SJohannes Berg * 9890ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 9903d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 9913d9d1d66SJohannes Berg */ 9923d9d1d66SJohannes Berg const struct cfg80211_chan_def * 9933d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 9943d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 995683b6d3bSJohannes Berg 996683b6d3bSJohannes Berg /** 99710fa22b6SEvan Quan * nl80211_chan_width_to_mhz - get the channel width in MHz 99810fa22b6SEvan Quan * @chan_width: the channel width from &enum nl80211_chan_width 99910fa22b6SEvan Quan * 100010fa22b6SEvan Quan * Return: channel width in MHz if the chan_width from &enum nl80211_chan_width 100110fa22b6SEvan Quan * is valid. -1 otherwise. 100210fa22b6SEvan Quan */ 100310fa22b6SEvan Quan int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width); 100410fa22b6SEvan Quan 100510fa22b6SEvan Quan /** 10069f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 10079f5e8f6eSJohannes Berg * @chandef: the channel definition to check 10080ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 10099f5e8f6eSJohannes Berg */ 10109f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 10119f5e8f6eSJohannes Berg 10129f5e8f6eSJohannes Berg /** 10139f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 10149f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 10159f5e8f6eSJohannes Berg * @chandef: the channel definition to check 10160ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 10170ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 10189f5e8f6eSJohannes Berg */ 10199f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 10209f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 10219f5e8f6eSJohannes Berg u32 prohibited_flags); 10229f5e8f6eSJohannes Berg 10239f5e8f6eSJohannes Berg /** 1024774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 1025774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 1026774f0734SSimon Wunderlich * @chandef: the channel definition to check 10272beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 10282beb6dabSLuciano Coelho * Returns: 10292beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 1030774f0734SSimon Wunderlich */ 1031774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 10322beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 1033c3d62036SLuciano Coelho enum nl80211_iftype iftype); 1034774f0734SSimon Wunderlich 1035774f0734SSimon Wunderlich /** 103630ca8b0cSAditya Kumar Singh * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we 103730ca8b0cSAditya Kumar Singh * can/need start CAC on such channel 103830ca8b0cSAditya Kumar Singh * @wiphy: the wiphy to validate against 103930ca8b0cSAditya Kumar Singh * @chandef: the channel definition to check 104030ca8b0cSAditya Kumar Singh * 104130ca8b0cSAditya Kumar Singh * Return: true if all channels available and at least 104230ca8b0cSAditya Kumar Singh * one channel requires CAC (NL80211_DFS_USABLE) 104330ca8b0cSAditya Kumar Singh */ 104430ca8b0cSAditya Kumar Singh bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy, 104530ca8b0cSAditya Kumar Singh const struct cfg80211_chan_def *chandef); 104630ca8b0cSAditya Kumar Singh 104730ca8b0cSAditya Kumar Singh /** 104830ca8b0cSAditya Kumar Singh * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given 104930ca8b0cSAditya Kumar Singh * channel definition 105030ca8b0cSAditya Kumar Singh * @wiphy: the wiphy to validate against 105130ca8b0cSAditya Kumar Singh * @chandef: the channel definition to check 105230ca8b0cSAditya Kumar Singh * 105330ca8b0cSAditya Kumar Singh * Returns: DFS CAC time (in ms) which applies for this channel definition 105430ca8b0cSAditya Kumar Singh */ 105530ca8b0cSAditya Kumar Singh unsigned int 105630ca8b0cSAditya Kumar Singh cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, 105730ca8b0cSAditya Kumar Singh const struct cfg80211_chan_def *chandef); 105830ca8b0cSAditya Kumar Singh 105930ca8b0cSAditya Kumar Singh /** 1060d4655db0SJohannes Berg * cfg80211_chandef_primary - calculate primary 40/80/160 MHz freq 10618f251a0aSJohannes Berg * @chandef: chandef to calculate for 10628f251a0aSJohannes Berg * @primary_chan_width: primary channel width to calculate center for 1063b82730bfSJohannes Berg * @punctured: punctured sub-channel bitmap, will be recalculated 1064b82730bfSJohannes Berg * according to the new bandwidth, can be %NULL 10658f251a0aSJohannes Berg * 10668f251a0aSJohannes Berg * Returns: the primary 40/80/160 MHz channel center frequency, or -1 1067b82730bfSJohannes Berg * for errors, updating the punctured bitmap 10688f251a0aSJohannes Berg */ 1069b82730bfSJohannes Berg int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef, 1070b82730bfSJohannes Berg enum nl80211_chan_width primary_chan_width, 1071b82730bfSJohannes Berg u16 *punctured); 10728f251a0aSJohannes Berg 10738f251a0aSJohannes Berg /** 10745097f844SJaewan Kim * nl80211_send_chandef - sends the channel definition. 10755097f844SJaewan Kim * @msg: the msg to send channel definition 10765097f844SJaewan Kim * @chandef: the channel definition to check 10775097f844SJaewan Kim * 10785097f844SJaewan Kim * Returns: 0 if sent the channel definition to msg, < 0 on error 10795097f844SJaewan Kim **/ 10805097f844SJaewan Kim int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef); 10815097f844SJaewan Kim 10825097f844SJaewan Kim /** 108319654a61SJohannes Berg * ieee80211_chanwidth_rate_flags - return rate flags for channel width 108419654a61SJohannes Berg * @width: the channel width of the channel 108530e74732SSimon Wunderlich * 108630e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 108730e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 108830e74732SSimon Wunderlich * 108919654a61SJohannes Berg * Returns: rate flags which apply for this channel width 109030e74732SSimon Wunderlich */ 109130e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 109219654a61SJohannes Berg ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width) 109330e74732SSimon Wunderlich { 109419654a61SJohannes Berg switch (width) { 109530e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 109630e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 109730e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 109830e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 109930e74732SSimon Wunderlich default: 110030e74732SSimon Wunderlich break; 110130e74732SSimon Wunderlich } 110230e74732SSimon Wunderlich return 0; 110330e74732SSimon Wunderlich } 110430e74732SSimon Wunderlich 110530e74732SSimon Wunderlich /** 110619654a61SJohannes Berg * ieee80211_chandef_rate_flags - returns rate flags for a channel 110719654a61SJohannes Berg * @chandef: channel definition for the channel 110819654a61SJohannes Berg * 110919654a61SJohannes Berg * See ieee80211_chanwidth_rate_flags(). 111019654a61SJohannes Berg * 111119654a61SJohannes Berg * Returns: rate flags which apply for this channel 111219654a61SJohannes Berg */ 111319654a61SJohannes Berg static inline enum ieee80211_rate_flags 111419654a61SJohannes Berg ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 111519654a61SJohannes Berg { 111619654a61SJohannes Berg return ieee80211_chanwidth_rate_flags(chandef->width); 111719654a61SJohannes Berg } 111819654a61SJohannes Berg 111919654a61SJohannes Berg /** 11200430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 11210430c883SSimon Wunderlich * 11220430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 11230430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 11240430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 11250430c883SSimon Wunderlich * 11260430c883SSimon Wunderlich * @chandef: channel definition for the channel 11270430c883SSimon Wunderlich * 11280430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 11290430c883SSimon Wunderlich */ 11300430c883SSimon Wunderlich static inline int 11310430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 11320430c883SSimon Wunderlich { 11330430c883SSimon Wunderlich switch (chandef->width) { 11340430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 11350430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 11360430c883SSimon Wunderlich chandef->chan->max_power); 11370430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 11380430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 11390430c883SSimon Wunderlich chandef->chan->max_power); 11400430c883SSimon Wunderlich default: 11410430c883SSimon Wunderlich break; 11420430c883SSimon Wunderlich } 11430430c883SSimon Wunderlich return chandef->chan->max_power; 11440430c883SSimon Wunderlich } 11450430c883SSimon Wunderlich 11460430c883SSimon Wunderlich /** 1147be989891SJohannes Berg * cfg80211_any_usable_channels - check for usable channels 1148be989891SJohannes Berg * @wiphy: the wiphy to check for 1149be989891SJohannes Berg * @band_mask: which bands to check on 1150be989891SJohannes Berg * @prohibited_flags: which channels to not consider usable, 1151be989891SJohannes Berg * %IEEE80211_CHAN_DISABLED is always taken into account 1152be989891SJohannes Berg */ 1153be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy, 1154be989891SJohannes Berg unsigned long band_mask, 1155be989891SJohannes Berg u32 prohibited_flags); 1156be989891SJohannes Berg 1157be989891SJohannes Berg /** 115861fa713cSHolger Schurig * enum survey_info_flags - survey information flags 115961fa713cSHolger Schurig * 1160abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 116117e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 11624ed20bebSJohannes Berg * @SURVEY_INFO_TIME: active time (in ms) was filled in 11634ed20bebSJohannes Berg * @SURVEY_INFO_TIME_BUSY: busy time was filled in 11644ed20bebSJohannes Berg * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 11654ed20bebSJohannes Berg * @SURVEY_INFO_TIME_RX: receive time was filled in 11664ed20bebSJohannes Berg * @SURVEY_INFO_TIME_TX: transmit time was filled in 1167052536abSJohannes Berg * @SURVEY_INFO_TIME_SCAN: scan time was filled in 1168c8cd6e7fSFelix Fietkau * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in 1169abe37c4bSJohannes Berg * 117061fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 117161fa713cSHolger Schurig * it has filled in during the get_survey(). 117261fa713cSHolger Schurig */ 117361fa713cSHolger Schurig enum survey_info_flags { 11744ed20bebSJohannes Berg SURVEY_INFO_NOISE_DBM = BIT(0), 11754ed20bebSJohannes Berg SURVEY_INFO_IN_USE = BIT(1), 11764ed20bebSJohannes Berg SURVEY_INFO_TIME = BIT(2), 11774ed20bebSJohannes Berg SURVEY_INFO_TIME_BUSY = BIT(3), 11784ed20bebSJohannes Berg SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 11794ed20bebSJohannes Berg SURVEY_INFO_TIME_RX = BIT(5), 11804ed20bebSJohannes Berg SURVEY_INFO_TIME_TX = BIT(6), 1181052536abSJohannes Berg SURVEY_INFO_TIME_SCAN = BIT(7), 1182c8cd6e7fSFelix Fietkau SURVEY_INFO_TIME_BSS_RX = BIT(8), 118361fa713cSHolger Schurig }; 118461fa713cSHolger Schurig 118561fa713cSHolger Schurig /** 118661fa713cSHolger Schurig * struct survey_info - channel survey response 118761fa713cSHolger Schurig * 118811f78ac3SJohannes Berg * @channel: the channel this survey record reports, may be %NULL for a single 118911f78ac3SJohannes Berg * record to report global statistics 119061fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 119161fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 119261fa713cSHolger Schurig * optional 11934ed20bebSJohannes Berg * @time: amount of time in ms the radio was turn on (on the channel) 11944ed20bebSJohannes Berg * @time_busy: amount of time the primary channel was sensed busy 11954ed20bebSJohannes Berg * @time_ext_busy: amount of time the extension channel was sensed busy 11964ed20bebSJohannes Berg * @time_rx: amount of time the radio spent receiving data 11974ed20bebSJohannes Berg * @time_tx: amount of time the radio spent transmitting data 1198052536abSJohannes Berg * @time_scan: amount of time the radio spent for scanning 1199c8cd6e7fSFelix Fietkau * @time_bss_rx: amount of time the radio spent receiving data on a local BSS 120061fa713cSHolger Schurig * 1201abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 1202abe37c4bSJohannes Berg * 120361fa713cSHolger Schurig * This structure can later be expanded with things like 120461fa713cSHolger Schurig * channel duty cycle etc. 120561fa713cSHolger Schurig */ 120661fa713cSHolger Schurig struct survey_info { 120761fa713cSHolger Schurig struct ieee80211_channel *channel; 12084ed20bebSJohannes Berg u64 time; 12094ed20bebSJohannes Berg u64 time_busy; 12104ed20bebSJohannes Berg u64 time_ext_busy; 12114ed20bebSJohannes Berg u64 time_rx; 12124ed20bebSJohannes Berg u64 time_tx; 1213052536abSJohannes Berg u64 time_scan; 1214c8cd6e7fSFelix Fietkau u64 time_bss_rx; 121561fa713cSHolger Schurig u32 filled; 121661fa713cSHolger Schurig s8 noise; 121761fa713cSHolger Schurig }; 121861fa713cSHolger Schurig 1219ecad3b0bSVeerendranath Jakkam #define CFG80211_MAX_NUM_AKM_SUITES 10 1220b8676221SDavid Spinadel 122161fa713cSHolger Schurig /** 12225fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 12235fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 12245fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 12255fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 12265fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 12275fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 12285fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 12295fb628e9SJouni Malinen * @akm_suites: AKM suites 12305fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 12315fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 12325fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 12335fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 12345fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 12355fb628e9SJouni Malinen * allowed through even on unauthorized ports 12365fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 12375fb628e9SJouni Malinen * protocol frames. 123864bf3d4bSDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 123964bf3d4bSDenis Kenzior * port frames over NL80211 instead of the network interface. 1240a710d214SLothar Rubusch * @control_port_no_preauth: disables pre-auth rx over the nl80211 control 1241a710d214SLothar Rubusch * port for mac80211 124291b5ab62SEliad Peller * @psk: PSK (for devices supporting 4-way-handshake offload) 124326f7044eSChung-Hsien Hsu * @sae_pwd: password for SAE authentication (for devices supporting SAE 124426f7044eSChung-Hsien Hsu * offload) 124526f7044eSChung-Hsien Hsu * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) 1246da1e9dd3SJohannes Berg * @sae_pwe: The mechanisms allowed for SAE PWE derivation: 1247da1e9dd3SJohannes Berg * 1248da1e9dd3SJohannes Berg * NL80211_SAE_PWE_UNSPECIFIED 1249da1e9dd3SJohannes Berg * Not-specified, used to indicate userspace did not specify any 1250da1e9dd3SJohannes Berg * preference. The driver should follow its internal policy in 1251da1e9dd3SJohannes Berg * such a scenario. 1252da1e9dd3SJohannes Berg * 1253da1e9dd3SJohannes Berg * NL80211_SAE_PWE_HUNT_AND_PECK 1254da1e9dd3SJohannes Berg * Allow hunting-and-pecking loop only 1255da1e9dd3SJohannes Berg * 1256da1e9dd3SJohannes Berg * NL80211_SAE_PWE_HASH_TO_ELEMENT 1257da1e9dd3SJohannes Berg * Allow hash-to-element only 1258da1e9dd3SJohannes Berg * 1259da1e9dd3SJohannes Berg * NL80211_SAE_PWE_BOTH 1260da1e9dd3SJohannes Berg * Allow either hunting-and-pecking loop or hash-to-element 12615fb628e9SJouni Malinen */ 12625fb628e9SJouni Malinen struct cfg80211_crypto_settings { 12635fb628e9SJouni Malinen u32 wpa_versions; 12645fb628e9SJouni Malinen u32 cipher_group; 12655fb628e9SJouni Malinen int n_ciphers_pairwise; 12665fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 12675fb628e9SJouni Malinen int n_akm_suites; 1268ecad3b0bSVeerendranath Jakkam u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES]; 12695fb628e9SJouni Malinen bool control_port; 12705fb628e9SJouni Malinen __be16 control_port_ethertype; 12715fb628e9SJouni Malinen bool control_port_no_encrypt; 127264bf3d4bSDenis Kenzior bool control_port_over_nl80211; 12737f3f96ceSMarkus Theil bool control_port_no_preauth; 127491b5ab62SEliad Peller const u8 *psk; 127526f7044eSChung-Hsien Hsu const u8 *sae_pwd; 127626f7044eSChung-Hsien Hsu u8 sae_pwd_len; 12779f0ffa41SRohan Dutta enum nl80211_sae_pwe_mechanism sae_pwe; 12785fb628e9SJouni Malinen }; 12795fb628e9SJouni Malinen 12805fb628e9SJouni Malinen /** 1281dc1e3cb8SJohn Crispin * struct cfg80211_mbssid_config - AP settings for multi bssid 1282dc1e3cb8SJohn Crispin * 1283dc1e3cb8SJohn Crispin * @tx_wdev: pointer to the transmitted interface in the MBSSID set 1284dc1e3cb8SJohn Crispin * @index: index of this AP in the multi bssid group. 1285dc1e3cb8SJohn Crispin * @ema: set to true if the beacons should be sent out in EMA mode. 1286dc1e3cb8SJohn Crispin */ 1287dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config { 1288dc1e3cb8SJohn Crispin struct wireless_dev *tx_wdev; 1289dc1e3cb8SJohn Crispin u8 index; 1290dc1e3cb8SJohn Crispin bool ema; 1291dc1e3cb8SJohn Crispin }; 1292dc1e3cb8SJohn Crispin 1293dc1e3cb8SJohn Crispin /** 1294dc1e3cb8SJohn Crispin * struct cfg80211_mbssid_elems - Multiple BSSID elements 1295dc1e3cb8SJohn Crispin * 1296dc1e3cb8SJohn Crispin * @cnt: Number of elements in array %elems. 1297dc1e3cb8SJohn Crispin * 1298dc1e3cb8SJohn Crispin * @elem: Array of multiple BSSID element(s) to be added into Beacon frames. 1299dc1e3cb8SJohn Crispin * @elem.data: Data for multiple BSSID elements. 1300dc1e3cb8SJohn Crispin * @elem.len: Length of data. 1301dc1e3cb8SJohn Crispin */ 1302dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems { 1303dc1e3cb8SJohn Crispin u8 cnt; 1304dc1e3cb8SJohn Crispin struct { 1305dc1e3cb8SJohn Crispin const u8 *data; 1306dc1e3cb8SJohn Crispin size_t len; 1307c14679d7SKees Cook } elem[] __counted_by(cnt); 1308dc1e3cb8SJohn Crispin }; 1309dc1e3cb8SJohn Crispin 1310dc1e3cb8SJohn Crispin /** 1311dbbb27e1SAloka Dixit * struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements 1312dbbb27e1SAloka Dixit * 1313dbbb27e1SAloka Dixit * @cnt: Number of elements in array %elems. 1314dbbb27e1SAloka Dixit * 1315dbbb27e1SAloka Dixit * @elem: Array of RNR element(s) to be added into Beacon frames. 1316dbbb27e1SAloka Dixit * @elem.data: Data for RNR elements. 1317dbbb27e1SAloka Dixit * @elem.len: Length of data. 1318dbbb27e1SAloka Dixit */ 1319dbbb27e1SAloka Dixit struct cfg80211_rnr_elems { 1320dbbb27e1SAloka Dixit u8 cnt; 1321dbbb27e1SAloka Dixit struct { 1322dbbb27e1SAloka Dixit const u8 *data; 1323dbbb27e1SAloka Dixit size_t len; 13247b6d7087SKees Cook } elem[] __counted_by(cnt); 1325dbbb27e1SAloka Dixit }; 1326dbbb27e1SAloka Dixit 1327dbbb27e1SAloka Dixit /** 13288860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 13297b0a0e3cSJohannes Berg * @link_id: the link ID for the AP MLD link sending this beacon 1330ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 1331ed1b6cc7SJohannes Berg * or %NULL if not changed 1332ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 1333ed1b6cc7SJohannes Berg * or %NULL if not changed 1334ed1b6cc7SJohannes Berg * @head_len: length of @head 1335ed1b6cc7SJohannes Berg * @tail_len: length of @tail 13369946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 13379946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 13389946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 13399946ecfbSJouni Malinen * frames or %NULL 13409946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 13419946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 13429946ecfbSJouni Malinen * Response frames or %NULL 13439946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 134400f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 134500f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 1346dc1e3cb8SJohn Crispin * @mbssid_ies: multiple BSSID elements 1347dbbb27e1SAloka Dixit * @rnr_ies: reduced neighbor report elements 134881e54d08SPradeep Kumar Chitrapu * @ftm_responder: enable FTM responder functionality; -1 for no change 134981e54d08SPradeep Kumar Chitrapu * (which also implies no change in LCI/civic location data) 135030db641eSJohannes Berg * @lci: Measurement Report element content, starting with Measurement Token 135130db641eSJohannes Berg * (measurement type 8) 135230db641eSJohannes Berg * @civicloc: Measurement Report element content, starting with Measurement 135330db641eSJohannes Berg * Token (measurement type 11) 135481e54d08SPradeep Kumar Chitrapu * @lci_len: LCI data length 135581e54d08SPradeep Kumar Chitrapu * @civicloc_len: Civic location data length 13563d48cb74SRameshkumar Sundaram * @he_bss_color: BSS Color settings 13573d48cb74SRameshkumar Sundaram * @he_bss_color_valid: indicates whether bss color 1358ee0e2f51SJohannes Berg * attribute is present in beacon data or not. 1359ed1b6cc7SJohannes Berg */ 13608860020eSJohannes Berg struct cfg80211_beacon_data { 13617b0a0e3cSJohannes Berg unsigned int link_id; 13627b0a0e3cSJohannes Berg 13638860020eSJohannes Berg const u8 *head, *tail; 13648860020eSJohannes Berg const u8 *beacon_ies; 13658860020eSJohannes Berg const u8 *proberesp_ies; 13668860020eSJohannes Berg const u8 *assocresp_ies; 13678860020eSJohannes Berg const u8 *probe_resp; 136881e54d08SPradeep Kumar Chitrapu const u8 *lci; 136981e54d08SPradeep Kumar Chitrapu const u8 *civicloc; 1370dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems *mbssid_ies; 1371dbbb27e1SAloka Dixit struct cfg80211_rnr_elems *rnr_ies; 137281e54d08SPradeep Kumar Chitrapu s8 ftm_responder; 13738860020eSJohannes Berg 13748860020eSJohannes Berg size_t head_len, tail_len; 13758860020eSJohannes Berg size_t beacon_ies_len; 13768860020eSJohannes Berg size_t proberesp_ies_len; 13778860020eSJohannes Berg size_t assocresp_ies_len; 13788860020eSJohannes Berg size_t probe_resp_len; 137981e54d08SPradeep Kumar Chitrapu size_t lci_len; 138081e54d08SPradeep Kumar Chitrapu size_t civicloc_len; 13813d48cb74SRameshkumar Sundaram struct cfg80211_he_bss_color he_bss_color; 13823d48cb74SRameshkumar Sundaram bool he_bss_color_valid; 13838860020eSJohannes Berg }; 13848860020eSJohannes Berg 13856d45a74bSVasanthakumar Thiagarajan struct mac_address { 13866d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 13876d45a74bSVasanthakumar Thiagarajan }; 13886d45a74bSVasanthakumar Thiagarajan 13898860020eSJohannes Berg /** 139077765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 139177765eafSVasanthakumar Thiagarajan * 139277765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 1393077f897aSJohannes Berg * entry specified by mac_addr 139477765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 139577765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 139677765eafSVasanthakumar Thiagarajan */ 139777765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 139877765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 139977765eafSVasanthakumar Thiagarajan int n_acl_entries; 140077765eafSVasanthakumar Thiagarajan 140177765eafSVasanthakumar Thiagarajan /* Keep it last */ 140293ca8244SKees Cook struct mac_address mac_addrs[] __counted_by(n_acl_entries); 140377765eafSVasanthakumar Thiagarajan }; 140477765eafSVasanthakumar Thiagarajan 14058860020eSJohannes Berg /** 1406291c49deSAloka Dixit * struct cfg80211_fils_discovery - FILS discovery parameters from 1407291c49deSAloka Dixit * IEEE Std 802.11ai-2016, Annex C.3 MIB detail. 1408291c49deSAloka Dixit * 14090cfaec25SAloka Dixit * @update: Set to true if the feature configuration should be updated. 1410291c49deSAloka Dixit * @min_interval: Minimum packet interval in TUs (0 - 10000) 1411291c49deSAloka Dixit * @max_interval: Maximum packet interval in TUs (0 - 10000) 1412291c49deSAloka Dixit * @tmpl_len: Template length 1413291c49deSAloka Dixit * @tmpl: Template data for FILS discovery frame including the action 1414291c49deSAloka Dixit * frame headers. 1415291c49deSAloka Dixit */ 1416291c49deSAloka Dixit struct cfg80211_fils_discovery { 14170cfaec25SAloka Dixit bool update; 1418291c49deSAloka Dixit u32 min_interval; 1419291c49deSAloka Dixit u32 max_interval; 1420291c49deSAloka Dixit size_t tmpl_len; 1421291c49deSAloka Dixit const u8 *tmpl; 1422291c49deSAloka Dixit }; 1423291c49deSAloka Dixit 1424291c49deSAloka Dixit /** 14257443dcd1SAloka Dixit * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe 14267443dcd1SAloka Dixit * response parameters in 6GHz. 14277443dcd1SAloka Dixit * 14280cfaec25SAloka Dixit * @update: Set to true if the feature configuration should be updated. 14297443dcd1SAloka Dixit * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned 14307443dcd1SAloka Dixit * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive 14317443dcd1SAloka Dixit * scanning 14327443dcd1SAloka Dixit * @tmpl_len: Template length 14337443dcd1SAloka Dixit * @tmpl: Template data for probe response 14347443dcd1SAloka Dixit */ 14357443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp { 14360cfaec25SAloka Dixit bool update; 14377443dcd1SAloka Dixit u32 interval; 14387443dcd1SAloka Dixit size_t tmpl_len; 14397443dcd1SAloka Dixit const u8 *tmpl; 14407443dcd1SAloka Dixit }; 14417443dcd1SAloka Dixit 14427443dcd1SAloka Dixit /** 14438860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 14448860020eSJohannes Berg * 14458860020eSJohannes Berg * Used to configure an AP interface. 14468860020eSJohannes Berg * 1447683b6d3bSJohannes Berg * @chandef: defines the channel to use 14488860020eSJohannes Berg * @beacon: beacon data 14498860020eSJohannes Berg * @beacon_interval: beacon interval 14508860020eSJohannes Berg * @dtim_period: DTIM period 14518860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 14528860020eSJohannes Berg * user space) 14538860020eSJohannes Berg * @ssid_len: length of @ssid 14548860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 14558860020eSJohannes Berg * @crypto: crypto settings 14568860020eSJohannes Berg * @privacy: the BSS uses privacy 14578860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 145818998c38SEliad Peller * @smps_mode: SMPS mode 14591b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 146053cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 146153cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 146277765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 146377765eafSVasanthakumar Thiagarajan * MAC address based access control 146434d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 146534d50519SLior David * networks. 14668564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 146766cd794eSJohannes Berg * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 146866cd794eSJohannes Berg * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 1469244eb9aeSShaul Triebitz * @he_cap: HE capabilities (or %NULL if HE isn't enabled) 14708bc65d38SAloka Dixit * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled) 14718bc65d38SAloka Dixit * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled) 147266cd794eSJohannes Berg * @ht_required: stations must support HT 147366cd794eSJohannes Berg * @vht_required: stations must support VHT 1474a0de1ca3SJohn Crispin * @twt_responder: Enable Target Wait Time 14752a392596SIlan Peer * @he_required: stations must support HE 1476d6587602SIlan Peer * @sae_h2e_required: stations must support direct H2E technique in SAE 14771dcf396bSDmitry Antipov * @flags: flags, as defined in &enum nl80211_ap_settings_flags 1478796e90f4SJohn Crispin * @he_obss_pd: OBSS Packet Detection settings 14797e8d6f12SShaul Triebitz * @he_oper: HE operation IE (or %NULL if HE isn't enabled) 1480291c49deSAloka Dixit * @fils_discovery: FILS discovery transmission parameters 14817443dcd1SAloka Dixit * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1482dc1e3cb8SJohn Crispin * @mbssid_config: AP settings for multiple bssid 14838860020eSJohannes Berg */ 14848860020eSJohannes Berg struct cfg80211_ap_settings { 1485683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1486aa430da4SJohannes Berg 14878860020eSJohannes Berg struct cfg80211_beacon_data beacon; 14888860020eSJohannes Berg 14898860020eSJohannes Berg int beacon_interval, dtim_period; 149032e9de84SJouni Malinen const u8 *ssid; 149132e9de84SJouni Malinen size_t ssid_len; 149232e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 14935fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 14945fb628e9SJouni Malinen bool privacy; 14955fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 149618998c38SEliad Peller enum nl80211_smps_mode smps_mode; 14971b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 149853cabad7SJohannes Berg u8 p2p_ctwindow; 149953cabad7SJohannes Berg bool p2p_opp_ps; 150077765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 150134d50519SLior David bool pbss; 1502a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask beacon_rate; 150366cd794eSJohannes Berg 150466cd794eSJohannes Berg const struct ieee80211_ht_cap *ht_cap; 150566cd794eSJohannes Berg const struct ieee80211_vht_cap *vht_cap; 1506244eb9aeSShaul Triebitz const struct ieee80211_he_cap_elem *he_cap; 15077e8d6f12SShaul Triebitz const struct ieee80211_he_operation *he_oper; 15088bc65d38SAloka Dixit const struct ieee80211_eht_cap_elem *eht_cap; 15098bc65d38SAloka Dixit const struct ieee80211_eht_operation *eht_oper; 1510d6587602SIlan Peer bool ht_required, vht_required, he_required, sae_h2e_required; 1511a0de1ca3SJohn Crispin bool twt_responder; 1512fe494370SSrinivas Dasari u32 flags; 1513796e90f4SJohn Crispin struct ieee80211_he_obss_pd he_obss_pd; 1514291c49deSAloka Dixit struct cfg80211_fils_discovery fils_discovery; 15157443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1516dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config mbssid_config; 1517ed1b6cc7SJohannes Berg }; 1518ed1b6cc7SJohannes Berg 1519bb55441cSJohannes Berg 1520bb55441cSJohannes Berg /** 1521bb55441cSJohannes Berg * struct cfg80211_ap_update - AP configuration update 1522bb55441cSJohannes Berg * 1523bb55441cSJohannes Berg * Subset of &struct cfg80211_ap_settings, for updating a running AP. 1524bb55441cSJohannes Berg * 1525bb55441cSJohannes Berg * @beacon: beacon data 1526bb55441cSJohannes Berg * @fils_discovery: FILS discovery transmission parameters 1527bb55441cSJohannes Berg * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1528bb55441cSJohannes Berg */ 1529bb55441cSJohannes Berg struct cfg80211_ap_update { 1530bb55441cSJohannes Berg struct cfg80211_beacon_data beacon; 1531bb55441cSJohannes Berg struct cfg80211_fils_discovery fils_discovery; 1532bb55441cSJohannes Berg struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1533bb55441cSJohannes Berg }; 1534bb55441cSJohannes Berg 15355727ef1bSJohannes Berg /** 153616ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 153716ef1fe2SSimon Wunderlich * 153816ef1fe2SSimon Wunderlich * Used for channel switch 153916ef1fe2SSimon Wunderlich * 154016ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 154116ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 15429a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 15439a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 15449a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 15459a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 154616ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 154716ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 154816ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 154916ef1fe2SSimon Wunderlich * @count: number of beacons until switch 15504ace04c0SAditya Kumar Singh * @link_id: defines the link on which channel switch is expected during 15514ace04c0SAditya Kumar Singh * MLO. 0 in case of non-MLO. 155216ef1fe2SSimon Wunderlich */ 155316ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 155416ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 155516ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 15569a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 15579a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 15589a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 15599a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 156016ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 156116ef1fe2SSimon Wunderlich bool radar_required; 156216ef1fe2SSimon Wunderlich bool block_tx; 156316ef1fe2SSimon Wunderlich u8 count; 15644ace04c0SAditya Kumar Singh u8 link_id; 156516ef1fe2SSimon Wunderlich }; 156616ef1fe2SSimon Wunderlich 156716ef1fe2SSimon Wunderlich /** 15680d2ab3aeSJohn Crispin * struct cfg80211_color_change_settings - color change settings 15690d2ab3aeSJohn Crispin * 15700d2ab3aeSJohn Crispin * Used for bss color change 15710d2ab3aeSJohn Crispin * 15720d2ab3aeSJohn Crispin * @beacon_color_change: beacon data while performing the color countdown 15732d8b08feSMauro Carvalho Chehab * @counter_offset_beacon: offsets of the counters within the beacon (tail) 15742d8b08feSMauro Carvalho Chehab * @counter_offset_presp: offsets of the counters within the probe response 15750d2ab3aeSJohn Crispin * @beacon_next: beacon data to be used after the color change 15760d2ab3aeSJohn Crispin * @count: number of beacons until the color change 15770d2ab3aeSJohn Crispin * @color: the color used after the change 15780d2ab3aeSJohn Crispin */ 15790d2ab3aeSJohn Crispin struct cfg80211_color_change_settings { 15800d2ab3aeSJohn Crispin struct cfg80211_beacon_data beacon_color_change; 15810d2ab3aeSJohn Crispin u16 counter_offset_beacon; 15820d2ab3aeSJohn Crispin u16 counter_offset_presp; 15830d2ab3aeSJohn Crispin struct cfg80211_beacon_data beacon_next; 15840d2ab3aeSJohn Crispin u8 count; 15850d2ab3aeSJohn Crispin u8 color; 15860d2ab3aeSJohn Crispin }; 15870d2ab3aeSJohn Crispin 15880d2ab3aeSJohn Crispin /** 1589e227300cSPurushottam Kushwaha * struct iface_combination_params - input parameters for interface combinations 1590e227300cSPurushottam Kushwaha * 1591e227300cSPurushottam Kushwaha * Used to pass interface combination parameters 1592e227300cSPurushottam Kushwaha * 1593e227300cSPurushottam Kushwaha * @num_different_channels: the number of different channels we want 1594e227300cSPurushottam Kushwaha * to use for verification 1595e227300cSPurushottam Kushwaha * @radar_detect: a bitmap where each bit corresponds to a channel 1596e227300cSPurushottam Kushwaha * width where radar detection is needed, as in the definition of 1597e227300cSPurushottam Kushwaha * &struct ieee80211_iface_combination.@radar_detect_widths 1598e227300cSPurushottam Kushwaha * @iftype_num: array with the number of interfaces of each interface 1599e227300cSPurushottam Kushwaha * type. The index is the interface type as specified in &enum 1600e227300cSPurushottam Kushwaha * nl80211_iftype. 16014c8dea63SJohannes Berg * @new_beacon_int: set this to the beacon interval of a new interface 16024c8dea63SJohannes Berg * that's not operating yet, if such is to be checked as part of 16034c8dea63SJohannes Berg * the verification 1604e227300cSPurushottam Kushwaha */ 1605e227300cSPurushottam Kushwaha struct iface_combination_params { 1606e227300cSPurushottam Kushwaha int num_different_channels; 1607e227300cSPurushottam Kushwaha u8 radar_detect; 1608e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 16094c8dea63SJohannes Berg u32 new_beacon_int; 1610e227300cSPurushottam Kushwaha }; 1611e227300cSPurushottam Kushwaha 1612e227300cSPurushottam Kushwaha /** 16133b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 16143b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 16159d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 1616f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 16173b9ce80cSJohannes Berg * 16183b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 16193b9ce80cSJohannes Berg * for those that don't these flags will are used. 16203b9ce80cSJohannes Berg */ 16213b9ce80cSJohannes Berg enum station_parameters_apply_mask { 16223b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 16239d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 1624f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 1625e96d1cd2SAshok Raj Nagarajan }; 1626e96d1cd2SAshok Raj Nagarajan 1627e96d1cd2SAshok Raj Nagarajan /** 1628e96d1cd2SAshok Raj Nagarajan * struct sta_txpwr - station txpower configuration 1629e96d1cd2SAshok Raj Nagarajan * 1630e96d1cd2SAshok Raj Nagarajan * Used to configure txpower for station. 1631e96d1cd2SAshok Raj Nagarajan * 1632e96d1cd2SAshok Raj Nagarajan * @power: tx power (in dBm) to be used for sending data traffic. If tx power 1633e96d1cd2SAshok Raj Nagarajan * is not provided, the default per-interface tx power setting will be 1634e96d1cd2SAshok Raj Nagarajan * overriding. Driver should be picking up the lowest tx power, either tx 1635e96d1cd2SAshok Raj Nagarajan * power per-interface or per-station. 1636e96d1cd2SAshok Raj Nagarajan * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power 1637e96d1cd2SAshok Raj Nagarajan * will be less than or equal to specified from userspace, whereas if TPC 1638e96d1cd2SAshok Raj Nagarajan * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power. 1639e96d1cd2SAshok Raj Nagarajan * NL80211_TX_POWER_FIXED is not a valid configuration option for 1640e96d1cd2SAshok Raj Nagarajan * per peer TPC. 1641e96d1cd2SAshok Raj Nagarajan */ 1642e96d1cd2SAshok Raj Nagarajan struct sta_txpwr { 1643e96d1cd2SAshok Raj Nagarajan s16 power; 1644e96d1cd2SAshok Raj Nagarajan enum nl80211_tx_power_setting type; 16453b9ce80cSJohannes Berg }; 16463b9ce80cSJohannes Berg 16473b9ce80cSJohannes Berg /** 1648577e5b8cSShaul Triebitz * struct link_station_parameters - link station parameters 1649577e5b8cSShaul Triebitz * 1650577e5b8cSShaul Triebitz * Used to change and create a new link station. 1651577e5b8cSShaul Triebitz * 1652577e5b8cSShaul Triebitz * @mld_mac: MAC address of the station 1653577e5b8cSShaul Triebitz * @link_id: the link id (-1 for non-MLD station) 1654577e5b8cSShaul Triebitz * @link_mac: MAC address of the link 1655577e5b8cSShaul Triebitz * @supported_rates: supported rates in IEEE 802.11 format 1656577e5b8cSShaul Triebitz * (or NULL for no change) 1657577e5b8cSShaul Triebitz * @supported_rates_len: number of supported rates 1658577e5b8cSShaul Triebitz * @ht_capa: HT capabilities of station 1659577e5b8cSShaul Triebitz * @vht_capa: VHT capabilities of station 1660577e5b8cSShaul Triebitz * @opmode_notif: operating mode field from Operating Mode Notification 1661577e5b8cSShaul Triebitz * @opmode_notif_used: information if operating mode field is used 1662577e5b8cSShaul Triebitz * @he_capa: HE capabilities of station 1663577e5b8cSShaul Triebitz * @he_capa_len: the length of the HE capabilities 1664577e5b8cSShaul Triebitz * @txpwr: transmit power for an associated station 1665577e5b8cSShaul Triebitz * @txpwr_set: txpwr field is set 1666577e5b8cSShaul Triebitz * @he_6ghz_capa: HE 6 GHz Band capabilities of station 1667577e5b8cSShaul Triebitz * @eht_capa: EHT capabilities of station 1668577e5b8cSShaul Triebitz * @eht_capa_len: the length of the EHT capabilities 1669577e5b8cSShaul Triebitz */ 1670577e5b8cSShaul Triebitz struct link_station_parameters { 1671577e5b8cSShaul Triebitz const u8 *mld_mac; 1672577e5b8cSShaul Triebitz int link_id; 1673577e5b8cSShaul Triebitz const u8 *link_mac; 1674577e5b8cSShaul Triebitz const u8 *supported_rates; 1675577e5b8cSShaul Triebitz u8 supported_rates_len; 1676577e5b8cSShaul Triebitz const struct ieee80211_ht_cap *ht_capa; 1677577e5b8cSShaul Triebitz const struct ieee80211_vht_cap *vht_capa; 1678577e5b8cSShaul Triebitz u8 opmode_notif; 1679577e5b8cSShaul Triebitz bool opmode_notif_used; 1680577e5b8cSShaul Triebitz const struct ieee80211_he_cap_elem *he_capa; 1681577e5b8cSShaul Triebitz u8 he_capa_len; 1682577e5b8cSShaul Triebitz struct sta_txpwr txpwr; 1683577e5b8cSShaul Triebitz bool txpwr_set; 1684577e5b8cSShaul Triebitz const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 1685577e5b8cSShaul Triebitz const struct ieee80211_eht_cap_elem *eht_capa; 1686577e5b8cSShaul Triebitz u8 eht_capa_len; 1687577e5b8cSShaul Triebitz }; 1688577e5b8cSShaul Triebitz 1689577e5b8cSShaul Triebitz /** 1690577e5b8cSShaul Triebitz * struct link_station_del_parameters - link station deletion parameters 1691577e5b8cSShaul Triebitz * 1692577e5b8cSShaul Triebitz * Used to delete a link station entry (or all stations). 1693577e5b8cSShaul Triebitz * 1694577e5b8cSShaul Triebitz * @mld_mac: MAC address of the station 1695577e5b8cSShaul Triebitz * @link_id: the link id 1696577e5b8cSShaul Triebitz */ 1697577e5b8cSShaul Triebitz struct link_station_del_parameters { 1698577e5b8cSShaul Triebitz const u8 *mld_mac; 1699577e5b8cSShaul Triebitz u32 link_id; 1700577e5b8cSShaul Triebitz }; 1701577e5b8cSShaul Triebitz 1702577e5b8cSShaul Triebitz /** 1703b61e6b41SIlan Peer * struct cfg80211_ttlm_params: TID to link mapping parameters 1704b61e6b41SIlan Peer * 1705b61e6b41SIlan Peer * Used for setting a TID to link mapping. 1706b61e6b41SIlan Peer * 1707b61e6b41SIlan Peer * @dlink: Downlink TID to link mapping, as defined in section 9.4.2.314 1708b61e6b41SIlan Peer * (TID-To-Link Mapping element) in Draft P802.11be_D4.0. 1709b61e6b41SIlan Peer * @ulink: Uplink TID to link mapping, as defined in section 9.4.2.314 1710b61e6b41SIlan Peer * (TID-To-Link Mapping element) in Draft P802.11be_D4.0. 1711b61e6b41SIlan Peer */ 1712b61e6b41SIlan Peer struct cfg80211_ttlm_params { 1713b61e6b41SIlan Peer u16 dlink[8]; 1714b61e6b41SIlan Peer u16 ulink[8]; 1715b61e6b41SIlan Peer }; 1716b61e6b41SIlan Peer 1717b61e6b41SIlan Peer /** 17185727ef1bSJohannes Berg * struct station_parameters - station parameters 17195727ef1bSJohannes Berg * 17205727ef1bSJohannes Berg * Used to change and create a new station. 17215727ef1bSJohannes Berg * 17225727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 1723eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 1724819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1725eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 1726819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 17275727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 17285727ef1bSJohannes Berg * @aid: AID or zero for no change 172914f34e36SGurumoorthi Gnanasambandhan * @vlan_id: VLAN ID for station (if nonzero) 17307d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 1731abe37c4bSJohannes Berg * @plink_action: plink action to take 17329c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 1733910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 1734910868dbSEliad Peller * as the AC bitmap in the QoS info field 1735910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 1736910868dbSEliad Peller * QoS info field (but already shifted down) 1737c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 1738c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 1739c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 17403b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 17413b1c5a53SMarco Porsch * to unknown) 17429d62a986SJouni Malinen * @capability: station capability 17439d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 17449d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 1745c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 1746c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 1747c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 1748c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 174917b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 175036647055SToke Høiland-Jørgensen * @airtime_weight: airtime scheduler weight for this station 1751b95eb7f0SShaul Triebitz * @link_sta_params: link related params. 17525727ef1bSJohannes Berg */ 17535727ef1bSJohannes Berg struct station_parameters { 17545727ef1bSJohannes Berg struct net_device *vlan; 1755eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 17563b9ce80cSJohannes Berg u32 sta_modify_mask; 17575727ef1bSJohannes Berg int listen_interval; 17585727ef1bSJohannes Berg u16 aid; 175914f34e36SGurumoorthi Gnanasambandhan u16 vlan_id; 17607d27a0baSMasashi Honma u16 peer_aid; 17612ec600d6SLuis Carlos Cobo u8 plink_action; 17629c3990aaSJavier Cardona u8 plink_state; 1763c75786c9SEliad Peller u8 uapsd_queues; 1764c75786c9SEliad Peller u8 max_sp; 17653b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 17669d62a986SJouni Malinen u16 capability; 17672c1aabf3SJohannes Berg const u8 *ext_capab; 17689d62a986SJouni Malinen u8 ext_capab_len; 1769c01fc9adSSunil Dutt const u8 *supported_channels; 1770c01fc9adSSunil Dutt u8 supported_channels_len; 1771c01fc9adSSunil Dutt const u8 *supported_oper_classes; 1772c01fc9adSSunil Dutt u8 supported_oper_classes_len; 177317b94247SAyala Beker int support_p2p_ps; 177436647055SToke Høiland-Jørgensen u16 airtime_weight; 1775b95eb7f0SShaul Triebitz struct link_station_parameters link_sta_params; 17765727ef1bSJohannes Berg }; 17775727ef1bSJohannes Berg 1778fd5b74dcSJohannes Berg /** 177989c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 178089c771e5SJouni Malinen * 178189c771e5SJouni Malinen * Used to delete a station entry (or all stations). 178289c771e5SJouni Malinen * 178389c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 178498856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 178598856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 178698856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 1787f6ca96aaSAditya Kumar Singh * @link_id: Link ID indicating a link that stations to be flushed must be 1788f6ca96aaSAditya Kumar Singh * using; valid only for MLO, but can also be -1 for MLO to really 1789f6ca96aaSAditya Kumar Singh * remove all stations. 179089c771e5SJouni Malinen */ 179189c771e5SJouni Malinen struct station_del_parameters { 179289c771e5SJouni Malinen const u8 *mac; 179398856866SJouni Malinen u8 subtype; 179498856866SJouni Malinen u16 reason_code; 1795f6ca96aaSAditya Kumar Singh int link_id; 179689c771e5SJouni Malinen }; 179789c771e5SJouni Malinen 179889c771e5SJouni Malinen /** 179977ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 180077ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 180147edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 180247edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 180377ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 180477ee7c89SJohannes Berg * the AP MLME in the device 180577ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 180677ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 180777ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 180877ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 180977ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 181077ee7c89SJohannes Berg * supported/used) 181177ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 181277ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 1813eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 1814eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 181577ee7c89SJohannes Berg */ 181677ee7c89SJohannes Berg enum cfg80211_station_type { 181777ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 181847edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 181977ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 182077ee7c89SJohannes Berg CFG80211_STA_AP_STA, 182177ee7c89SJohannes Berg CFG80211_STA_IBSS, 182277ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 182377ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 1824eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 1825eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 182677ee7c89SJohannes Berg }; 182777ee7c89SJohannes Berg 182877ee7c89SJohannes Berg /** 182977ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 183077ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 183177ee7c89SJohannes Berg * @params: the new parameters for a station 183277ee7c89SJohannes Berg * @statype: the type of station being modified 183377ee7c89SJohannes Berg * 183477ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 183577ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 183677ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 183777ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 183877ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 183977ee7c89SJohannes Berg */ 184077ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 184177ee7c89SJohannes Berg struct station_parameters *params, 184277ee7c89SJohannes Berg enum cfg80211_station_type statype); 184377ee7c89SJohannes Berg 184477ee7c89SJohannes Berg /** 1845b1e8eb11SMauro Carvalho Chehab * enum rate_info_flags - bitrate info flags 1846420e7fabSHenning Rogge * 1847420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 1848420e7fabSHenning Rogge * type for 802.11n transmissions. 1849420e7fabSHenning Rogge * 1850db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 1851db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 1852420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 18532a38075cSAlexei Avshalom Lazar * @RATE_INFO_FLAGS_DMG: 60GHz MCS 1854c4cbaf79SLuca Coelho * @RATE_INFO_FLAGS_HE_MCS: HE MCS information 18552a38075cSAlexei Avshalom Lazar * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode 1856d9c85e24SMax Chen * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS 1857cfb14110SVeerendranath Jakkam * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information 18582ad66fcbSGilad Itzkovitch * @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS 1859420e7fabSHenning Rogge */ 1860420e7fabSHenning Rogge enum rate_info_flags { 1861db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 1862db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 1863b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 18642a38075cSAlexei Avshalom Lazar RATE_INFO_FLAGS_DMG = BIT(3), 1865c4cbaf79SLuca Coelho RATE_INFO_FLAGS_HE_MCS = BIT(4), 18662a38075cSAlexei Avshalom Lazar RATE_INFO_FLAGS_EDMG = BIT(5), 1867d9c85e24SMax Chen RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6), 1868cfb14110SVeerendranath Jakkam RATE_INFO_FLAGS_EHT_MCS = BIT(7), 18692ad66fcbSGilad Itzkovitch RATE_INFO_FLAGS_S1G_MCS = BIT(8), 1870b51f3beeSJohannes Berg }; 1871b51f3beeSJohannes Berg 1872b51f3beeSJohannes Berg /** 1873b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 1874b51f3beeSJohannes Berg * 1875b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 1876b51f3beeSJohannes Berg * 1877b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 1878b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 1879b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 1880b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 1881b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 1882b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 1883c4cbaf79SLuca Coelho * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation 1884cfb14110SVeerendranath Jakkam * @RATE_INFO_BW_320: 320 MHz bandwidth 1885cfb14110SVeerendranath Jakkam * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation 18862ad66fcbSGilad Itzkovitch * @RATE_INFO_BW_1: 1 MHz bandwidth 18872ad66fcbSGilad Itzkovitch * @RATE_INFO_BW_2: 2 MHz bandwidth 18882ad66fcbSGilad Itzkovitch * @RATE_INFO_BW_4: 4 MHz bandwidth 18892ad66fcbSGilad Itzkovitch * @RATE_INFO_BW_8: 8 MHz bandwidth 18902ad66fcbSGilad Itzkovitch * @RATE_INFO_BW_16: 16 MHz bandwidth 1891b51f3beeSJohannes Berg */ 1892b51f3beeSJohannes Berg enum rate_info_bw { 1893842be75cSJohannes Berg RATE_INFO_BW_20 = 0, 1894b51f3beeSJohannes Berg RATE_INFO_BW_5, 1895b51f3beeSJohannes Berg RATE_INFO_BW_10, 1896b51f3beeSJohannes Berg RATE_INFO_BW_40, 1897b51f3beeSJohannes Berg RATE_INFO_BW_80, 1898b51f3beeSJohannes Berg RATE_INFO_BW_160, 1899c4cbaf79SLuca Coelho RATE_INFO_BW_HE_RU, 1900cfb14110SVeerendranath Jakkam RATE_INFO_BW_320, 1901cfb14110SVeerendranath Jakkam RATE_INFO_BW_EHT_RU, 19022ad66fcbSGilad Itzkovitch RATE_INFO_BW_1, 19032ad66fcbSGilad Itzkovitch RATE_INFO_BW_2, 19042ad66fcbSGilad Itzkovitch RATE_INFO_BW_4, 19052ad66fcbSGilad Itzkovitch RATE_INFO_BW_8, 19062ad66fcbSGilad Itzkovitch RATE_INFO_BW_16, 1907420e7fabSHenning Rogge }; 1908420e7fabSHenning Rogge 1909420e7fabSHenning Rogge /** 1910420e7fabSHenning Rogge * struct rate_info - bitrate information 1911420e7fabSHenning Rogge * 1912420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 1913420e7fabSHenning Rogge * 1914420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 1915420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 19162ad66fcbSGilad Itzkovitch * @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate 1917c4cbaf79SLuca Coelho * @nss: number of streams (VHT & HE only) 1918b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 1919c4cbaf79SLuca Coelho * @he_gi: HE guard interval (from &enum nl80211_he_gi) 1920c4cbaf79SLuca Coelho * @he_dcm: HE DCM value 1921c4cbaf79SLuca Coelho * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc, 1922c4cbaf79SLuca Coelho * only valid if bw is %RATE_INFO_BW_HE_RU) 19232a38075cSAlexei Avshalom Lazar * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4) 1924cfb14110SVeerendranath Jakkam * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi) 1925cfb14110SVeerendranath Jakkam * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc, 1926cfb14110SVeerendranath Jakkam * only valid if bw is %RATE_INFO_BW_EHT_RU) 1927420e7fabSHenning Rogge */ 1928420e7fabSHenning Rogge struct rate_info { 19292ad66fcbSGilad Itzkovitch u16 flags; 1930420e7fabSHenning Rogge u16 legacy; 19312ad66fcbSGilad Itzkovitch u8 mcs; 1932db9c64cfSJohannes Berg u8 nss; 1933b51f3beeSJohannes Berg u8 bw; 1934c4cbaf79SLuca Coelho u8 he_gi; 1935c4cbaf79SLuca Coelho u8 he_dcm; 1936c4cbaf79SLuca Coelho u8 he_ru_alloc; 19372a38075cSAlexei Avshalom Lazar u8 n_bonded_ch; 1938cfb14110SVeerendranath Jakkam u8 eht_gi; 1939cfb14110SVeerendranath Jakkam u8 eht_ru_alloc; 1940fd5b74dcSJohannes Berg }; 1941fd5b74dcSJohannes Berg 1942fd5b74dcSJohannes Berg /** 1943b1e8eb11SMauro Carvalho Chehab * enum bss_param_flags - bitrate info flags 1944f4263c98SPaul Stewart * 1945f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1946f4263c98SPaul Stewart * type for 802.11n transmissions. 1947f4263c98SPaul Stewart * 1948f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1949f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1950f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1951f4263c98SPaul Stewart */ 1952f4263c98SPaul Stewart enum bss_param_flags { 1953f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1954f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1955f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1956f4263c98SPaul Stewart }; 1957f4263c98SPaul Stewart 1958f4263c98SPaul Stewart /** 1959f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1960f4263c98SPaul Stewart * 1961f4263c98SPaul Stewart * Information about the currently associated BSS 1962f4263c98SPaul Stewart * 1963f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1964f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1965f4263c98SPaul Stewart * @beacon_interval: beacon interval 1966f4263c98SPaul Stewart */ 1967f4263c98SPaul Stewart struct sta_bss_parameters { 1968f4263c98SPaul Stewart u8 flags; 1969f4263c98SPaul Stewart u8 dtim_period; 1970f4263c98SPaul Stewart u16 beacon_interval; 1971f4263c98SPaul Stewart }; 1972f4263c98SPaul Stewart 19736de39808SJohannes Berg /** 197452539ca8SToke Høiland-Jørgensen * struct cfg80211_txq_stats - TXQ statistics for this TID 197552539ca8SToke Høiland-Jørgensen * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to 197652539ca8SToke Høiland-Jørgensen * indicate the relevant values in this struct are filled 197752539ca8SToke Høiland-Jørgensen * @backlog_bytes: total number of bytes currently backlogged 197852539ca8SToke Høiland-Jørgensen * @backlog_packets: total number of packets currently backlogged 197952539ca8SToke Høiland-Jørgensen * @flows: number of new flows seen 198052539ca8SToke Høiland-Jørgensen * @drops: total number of packets dropped 198152539ca8SToke Høiland-Jørgensen * @ecn_marks: total number of packets marked with ECN CE 198252539ca8SToke Høiland-Jørgensen * @overlimit: number of drops due to queue space overflow 198352539ca8SToke Høiland-Jørgensen * @overmemory: number of drops due to memory limit overflow 198452539ca8SToke Høiland-Jørgensen * @collisions: number of hash collisions 198552539ca8SToke Høiland-Jørgensen * @tx_bytes: total number of bytes dequeued 198652539ca8SToke Høiland-Jørgensen * @tx_packets: total number of packets dequeued 198752539ca8SToke Høiland-Jørgensen * @max_flows: maximum number of flows supported 198852539ca8SToke Høiland-Jørgensen */ 198952539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats { 199052539ca8SToke Høiland-Jørgensen u32 filled; 199152539ca8SToke Høiland-Jørgensen u32 backlog_bytes; 199252539ca8SToke Høiland-Jørgensen u32 backlog_packets; 199352539ca8SToke Høiland-Jørgensen u32 flows; 199452539ca8SToke Høiland-Jørgensen u32 drops; 199552539ca8SToke Høiland-Jørgensen u32 ecn_marks; 199652539ca8SToke Høiland-Jørgensen u32 overlimit; 199752539ca8SToke Høiland-Jørgensen u32 overmemory; 199852539ca8SToke Høiland-Jørgensen u32 collisions; 199952539ca8SToke Høiland-Jørgensen u32 tx_bytes; 200052539ca8SToke Høiland-Jørgensen u32 tx_packets; 200152539ca8SToke Høiland-Jørgensen u32 max_flows; 200252539ca8SToke Høiland-Jørgensen }; 200352539ca8SToke Høiland-Jørgensen 200452539ca8SToke Høiland-Jørgensen /** 20056de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 20066de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 20076de39808SJohannes Berg * indicate the relevant values in this struct are filled 20086de39808SJohannes Berg * @rx_msdu: number of received MSDUs 20096de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 20106de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 20116de39808SJohannes Berg * transmitted MSDUs 20126de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 201352539ca8SToke Høiland-Jørgensen * @txq_stats: TXQ statistics 20146de39808SJohannes Berg */ 20156de39808SJohannes Berg struct cfg80211_tid_stats { 20166de39808SJohannes Berg u32 filled; 20176de39808SJohannes Berg u64 rx_msdu; 20186de39808SJohannes Berg u64 tx_msdu; 20196de39808SJohannes Berg u64 tx_msdu_retries; 20206de39808SJohannes Berg u64 tx_msdu_failed; 202152539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats txq_stats; 20226de39808SJohannes Berg }; 20236de39808SJohannes Berg 2024119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 2025119363c7SFelix Fietkau 2026f4263c98SPaul Stewart /** 20272ec600d6SLuis Carlos Cobo * struct station_info - station information 2028fd5b74dcSJohannes Berg * 20292ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 2030fd5b74dcSJohannes Berg * 2031319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 2032319090bfSJohannes Berg * indicate the relevant values in this struct for them 2033ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 2034fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 20356c7a0033SBen Greear * @assoc_at: bootime (ns) of the last association 20368d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 20378d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 20382ec600d6SLuis Carlos Cobo * @llid: mesh local link id 20392ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 20402ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 204173c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 204273c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 204373c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 204473c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 2045119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 2046119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 2047119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 2048858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 2049858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 20508d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 20518d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 20528d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 20538d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 20545a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 20551ba01458SRandy Dunlap * @bss_param: current BSS parameters 2056f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 2057f5ea9120SJohannes Berg * This number should increase every time the list of stations 2058f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 2059f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 206050d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 206150d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 206250d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 206350d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 206450d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 2065c26887d2SJohannes Berg * @sta_flags: station flags mask & values 2066a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 2067d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 20683b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 20693b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 20703b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 2071867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 2072867d849fSAntonio Quartulli * towards this station. 2073a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 2074a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 2075a76b1942SJohannes Berg * from this peer 2076dbdaee7aSBob Copeland * @connected_to_gate: true if mesh STA has a path to mesh gate 2077739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 207836647055SToke Høiland-Jørgensen * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer 207936647055SToke Høiland-Jørgensen * @airtime_weight: current airtime scheduling weight 20806de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 20816de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 20828689c051SArend van Spriel * Note that this doesn't use the @filled bit, but is used if non-NULL. 2083c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the last ACK frame. 208481d5439dSBalaji Pothunoori * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 208581d5439dSBalaji Pothunoori * been sent. 20860d4e14a3SAnkita Bajaj * @rx_mpdu_count: number of MPDUs received from this station 20870d4e14a3SAnkita Bajaj * @fcs_err_count: number of packets (MPDUs) received from this station with 20880d4e14a3SAnkita Bajaj * an FCS error. This counter should be incremented only when TA of the 20890d4e14a3SAnkita Bajaj * received packet with an FCS error matches the peer MAC address. 2090ab60633cSNarayanraddi Masti * @airtime_link_metric: mesh airtime link metric. 20911303a51cSMarkus Theil * @connected_to_as: true if mesh STA has a path to authentication server 2092a42e59ebSVeerendranath Jakkam * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled 2093a42e59ebSVeerendranath Jakkam * by driver. Drivers use this only in cfg80211_new_sta() calls when AP 2094a42e59ebSVeerendranath Jakkam * MLD's MLME/SME is offload to driver. Drivers won't fill this 2095a42e59ebSVeerendranath Jakkam * information in cfg80211_del_sta_sinfo(), get_station() and 2096a42e59ebSVeerendranath Jakkam * dump_station() callbacks. 2097a42e59ebSVeerendranath Jakkam * @assoc_link_id: Indicates MLO link ID of the AP, with which the station 2098a42e59ebSVeerendranath Jakkam * completed (re)association. This information filled for both MLO 2099a42e59ebSVeerendranath Jakkam * and non-MLO STA connections when the AP affiliated with an MLD. 2100a42e59ebSVeerendranath Jakkam * @mld_addr: For MLO STA connection, filled with MLD address of the station. 2101a42e59ebSVeerendranath Jakkam * For non-MLO STA connection, filled with all zeros. 2102a42e59ebSVeerendranath Jakkam * @assoc_resp_ies: IEs from (Re)Association Response. 2103a42e59ebSVeerendranath Jakkam * This is used only when in AP mode with drivers that do not use user 2104a42e59ebSVeerendranath Jakkam * space MLME/SME implementation. The information is provided only for the 2105a42e59ebSVeerendranath Jakkam * cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't 2106a42e59ebSVeerendranath Jakkam * fill this information in cfg80211_del_sta_sinfo(), get_station() and 2107a42e59ebSVeerendranath Jakkam * dump_station() callbacks. User space needs this information to determine 2108a42e59ebSVeerendranath Jakkam * the accepted and rejected affiliated links of the connected station. 2109a42e59ebSVeerendranath Jakkam * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets. 2110fd5b74dcSJohannes Berg */ 21112ec600d6SLuis Carlos Cobo struct station_info { 2112739960f1SMohammed Shafi Shajakhan u64 filled; 2113ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 2114fd5b74dcSJohannes Berg u32 inactive_time; 21156c7a0033SBen Greear u64 assoc_at; 211642745e03SVladimir Kondratiev u64 rx_bytes; 211742745e03SVladimir Kondratiev u64 tx_bytes; 21182ec600d6SLuis Carlos Cobo u16 llid; 21192ec600d6SLuis Carlos Cobo u16 plid; 21202ec600d6SLuis Carlos Cobo u8 plink_state; 2121420e7fabSHenning Rogge s8 signal; 2122541a45a1SBruno Randolf s8 signal_avg; 2123119363c7SFelix Fietkau 2124119363c7SFelix Fietkau u8 chains; 2125119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 2126119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 2127119363c7SFelix Fietkau 2128420e7fabSHenning Rogge struct rate_info txrate; 2129c8dcfd8aSFelix Fietkau struct rate_info rxrate; 213098c8a60aSJouni Malinen u32 rx_packets; 213198c8a60aSJouni Malinen u32 tx_packets; 2132b206b4efSBruno Randolf u32 tx_retries; 2133b206b4efSBruno Randolf u32 tx_failed; 21345a5c731aSBen Greear u32 rx_dropped_misc; 2135f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 2136bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 2137f5ea9120SJohannes Berg 2138f5ea9120SJohannes Berg int generation; 213950d3dfb7SJouni Malinen 214050d3dfb7SJouni Malinen const u8 *assoc_req_ies; 214150d3dfb7SJouni Malinen size_t assoc_req_ies_len; 2142f612cedfSJouni Malinen 2143a85e1d55SPaul Stewart u32 beacon_loss_count; 2144d299a1f2SJavier Cardona s64 t_offset; 21453b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 21463b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 21473b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 2148a85e1d55SPaul Stewart 2149867d849fSAntonio Quartulli u32 expected_throughput; 2150a76b1942SJohannes Berg 215136647055SToke Høiland-Jørgensen u64 tx_duration; 2152739960f1SMohammed Shafi Shajakhan u64 rx_duration; 215336647055SToke Høiland-Jørgensen u64 rx_beacon; 2154a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 2155dbdaee7aSBob Copeland u8 connected_to_gate; 2156dbdaee7aSBob Copeland 21578689c051SArend van Spriel struct cfg80211_tid_stats *pertid; 2158c4b50cd3SVenkateswara Naralasetty s8 ack_signal; 215981d5439dSBalaji Pothunoori s8 avg_ack_signal; 21600d4e14a3SAnkita Bajaj 216136647055SToke Høiland-Jørgensen u16 airtime_weight; 216236647055SToke Høiland-Jørgensen 21630d4e14a3SAnkita Bajaj u32 rx_mpdu_count; 21640d4e14a3SAnkita Bajaj u32 fcs_err_count; 2165ab60633cSNarayanraddi Masti 2166ab60633cSNarayanraddi Masti u32 airtime_link_metric; 21671303a51cSMarkus Theil 21681303a51cSMarkus Theil u8 connected_to_as; 2169a42e59ebSVeerendranath Jakkam 2170a42e59ebSVeerendranath Jakkam bool mlo_params_valid; 2171a42e59ebSVeerendranath Jakkam u8 assoc_link_id; 2172a42e59ebSVeerendranath Jakkam u8 mld_addr[ETH_ALEN] __aligned(2); 2173a42e59ebSVeerendranath Jakkam const u8 *assoc_resp_ies; 2174a42e59ebSVeerendranath Jakkam size_t assoc_resp_ies_len; 2175fd5b74dcSJohannes Berg }; 2176fd5b74dcSJohannes Berg 21776bdb68ceSCarl Huang /** 21786bdb68ceSCarl Huang * struct cfg80211_sar_sub_specs - sub specs limit 21796bdb68ceSCarl Huang * @power: power limitation in 0.25dbm 21806bdb68ceSCarl Huang * @freq_range_index: index the power limitation applies to 21816bdb68ceSCarl Huang */ 21826bdb68ceSCarl Huang struct cfg80211_sar_sub_specs { 21836bdb68ceSCarl Huang s32 power; 21846bdb68ceSCarl Huang u32 freq_range_index; 21856bdb68ceSCarl Huang }; 21866bdb68ceSCarl Huang 21876bdb68ceSCarl Huang /** 21886bdb68ceSCarl Huang * struct cfg80211_sar_specs - sar limit specs 21896bdb68ceSCarl Huang * @type: it's set with power in 0.25dbm or other types 21906bdb68ceSCarl Huang * @num_sub_specs: number of sar sub specs 21916bdb68ceSCarl Huang * @sub_specs: memory to hold the sar sub specs 21926bdb68ceSCarl Huang */ 21936bdb68ceSCarl Huang struct cfg80211_sar_specs { 21946bdb68ceSCarl Huang enum nl80211_sar_type type; 21956bdb68ceSCarl Huang u32 num_sub_specs; 21966bdb68ceSCarl Huang struct cfg80211_sar_sub_specs sub_specs[]; 21976bdb68ceSCarl Huang }; 21986bdb68ceSCarl Huang 21996bdb68ceSCarl Huang 22006bdb68ceSCarl Huang /** 2201c2083e28SMauro Carvalho Chehab * struct cfg80211_sar_freq_ranges - sar frequency ranges 22026bdb68ceSCarl Huang * @start_freq: start range edge frequency 22036bdb68ceSCarl Huang * @end_freq: end range edge frequency 22046bdb68ceSCarl Huang */ 22056bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges { 22066bdb68ceSCarl Huang u32 start_freq; 22076bdb68ceSCarl Huang u32 end_freq; 22086bdb68ceSCarl Huang }; 22096bdb68ceSCarl Huang 22106bdb68ceSCarl Huang /** 22116bdb68ceSCarl Huang * struct cfg80211_sar_capa - sar limit capability 22126bdb68ceSCarl Huang * @type: it's set via power in 0.25dbm or other types 22136bdb68ceSCarl Huang * @num_freq_ranges: number of frequency ranges 22146bdb68ceSCarl Huang * @freq_ranges: memory to hold the freq ranges. 22156bdb68ceSCarl Huang * 22166bdb68ceSCarl Huang * Note: WLAN driver may append new ranges or split an existing 22176bdb68ceSCarl Huang * range to small ones and then append them. 22186bdb68ceSCarl Huang */ 22196bdb68ceSCarl Huang struct cfg80211_sar_capa { 22206bdb68ceSCarl Huang enum nl80211_sar_type type; 22216bdb68ceSCarl Huang u32 num_freq_ranges; 22226bdb68ceSCarl Huang const struct cfg80211_sar_freq_ranges *freq_ranges; 22236bdb68ceSCarl Huang }; 22246bdb68ceSCarl Huang 222561aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 222666f7ac50SMichael Wu /** 22277406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 22287406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 22297406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 22307406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 22317406353dSAntonio Quartulli * 22327406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 22337406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 22347406353dSAntonio Quartulli * considered undefined. 22357406353dSAntonio Quartulli */ 22367406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 22377406353dSAntonio Quartulli struct station_info *sinfo); 223861aaa0e8SLinus Lüssing #else 223961aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 224061aaa0e8SLinus Lüssing const u8 *mac_addr, 224161aaa0e8SLinus Lüssing struct station_info *sinfo) 224261aaa0e8SLinus Lüssing { 224361aaa0e8SLinus Lüssing return -ENOENT; 224461aaa0e8SLinus Lüssing } 224561aaa0e8SLinus Lüssing #endif 22467406353dSAntonio Quartulli 22477406353dSAntonio Quartulli /** 224866f7ac50SMichael Wu * enum monitor_flags - monitor flags 224966f7ac50SMichael Wu * 225066f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 225166f7ac50SMichael Wu * according to the nl80211 flags. 225266f7ac50SMichael Wu * 2253818a986eSJohannes Berg * @MONITOR_FLAG_CHANGED: set if the flags were changed 225466f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 225566f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 225666f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 225766f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 225866f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 2259e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 226066f7ac50SMichael Wu */ 226166f7ac50SMichael Wu enum monitor_flags { 2262818a986eSJohannes Berg MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID, 226366f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 226466f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 226566f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 226666f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 226766f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 2268e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 226966f7ac50SMichael Wu }; 227066f7ac50SMichael Wu 22712ec600d6SLuis Carlos Cobo /** 22722ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 22732ec600d6SLuis Carlos Cobo * 22742ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 22752ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 22762ec600d6SLuis Carlos Cobo * 2277abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 2278abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 2279abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 2280abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 2281abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 2282abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 2283abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 2284cc241636SJulan Hsu * @MPATH_INFO_HOP_COUNT: @hop_count filled 22859874b71fSJohannes Berg * @MPATH_INFO_PATH_CHANGE: @path_change_count filled 22862ec600d6SLuis Carlos Cobo */ 22872ec600d6SLuis Carlos Cobo enum mpath_info_flags { 22882ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 2289d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 22902ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 22912ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 22922ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 22932ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 22942ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 2295540bbcb9SJulan Hsu MPATH_INFO_HOP_COUNT = BIT(7), 2296540bbcb9SJulan Hsu MPATH_INFO_PATH_CHANGE = BIT(8), 22972ec600d6SLuis Carlos Cobo }; 22982ec600d6SLuis Carlos Cobo 22992ec600d6SLuis Carlos Cobo /** 23002ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 23012ec600d6SLuis Carlos Cobo * 23022ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 23032ec600d6SLuis Carlos Cobo * 23042ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 23052ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 2306d19b3bf6SRui Paulo * @sn: target sequence number 23072ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 23082ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 23091dcf396bSDmitry Antipov * @flags: mesh path flags from &enum mesh_path_flags 23102ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 23112ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 2312f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 2313f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 2314f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 2315f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 2316cc241636SJulan Hsu * @hop_count: hops to destination 2317540bbcb9SJulan Hsu * @path_change_count: total number of path changes to destination 23182ec600d6SLuis Carlos Cobo */ 23192ec600d6SLuis Carlos Cobo struct mpath_info { 23202ec600d6SLuis Carlos Cobo u32 filled; 23212ec600d6SLuis Carlos Cobo u32 frame_qlen; 2322d19b3bf6SRui Paulo u32 sn; 23232ec600d6SLuis Carlos Cobo u32 metric; 23242ec600d6SLuis Carlos Cobo u32 exptime; 23252ec600d6SLuis Carlos Cobo u32 discovery_timeout; 23262ec600d6SLuis Carlos Cobo u8 discovery_retries; 23272ec600d6SLuis Carlos Cobo u8 flags; 2328cc241636SJulan Hsu u8 hop_count; 2329540bbcb9SJulan Hsu u32 path_change_count; 2330f5ea9120SJohannes Berg 2331f5ea9120SJohannes Berg int generation; 23322ec600d6SLuis Carlos Cobo }; 23332ec600d6SLuis Carlos Cobo 23349f1ba906SJouni Malinen /** 23359f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 23369f1ba906SJouni Malinen * 23379f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 23389f1ba906SJouni Malinen * 23391e0f8cc9SJohannes Berg * @link_id: link_id or -1 for non-MLD 23409f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 23419f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 23429f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 23439f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 23449f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 23459f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 234690c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 234790c97a04SJouni Malinen * (or NULL for no change) 234890c97a04SJouni Malinen * @basic_rates_len: number of basic rates 2349fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 23509d6e371dSWright Feng * (0 = no, 1 = yes, -1 = do not change) 235150b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 235250b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 235353cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 235453cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 23559f1ba906SJouni Malinen */ 23569f1ba906SJouni Malinen struct bss_parameters { 23571e0f8cc9SJohannes Berg int link_id; 23589f1ba906SJouni Malinen int use_cts_prot; 23599f1ba906SJouni Malinen int use_short_preamble; 23609f1ba906SJouni Malinen int use_short_slot_time; 2361c1e5f471SJohannes Berg const u8 *basic_rates; 236290c97a04SJouni Malinen u8 basic_rates_len; 2363fd8aaaf3SFelix Fietkau int ap_isolate; 236450b12f59SHelmut Schaa int ht_opmode; 236553cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 23669f1ba906SJouni Malinen }; 23672ec600d6SLuis Carlos Cobo 23683ddd53f3SChun-Yeow Yeoh /** 236929cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 237029cbe68cSJohannes Berg * 237129cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 23723ddd53f3SChun-Yeow Yeoh * 23733ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 23743ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 23753ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 23763ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 23773ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 23783ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 23793ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 23803ddd53f3SChun-Yeow Yeoh * mesh interface 23813ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 23823ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 23833ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 23843ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 23853ddd53f3SChun-Yeow Yeoh * elements 23863ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 23873ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 23883ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 23893ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 23903ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 23913ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 23923ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 23933ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 23943ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 23953ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 23963ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 23973ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 23983ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 23993ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 24003ddd53f3SChun-Yeow Yeoh * element 24013ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 24023ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 24033ddd53f3SChun-Yeow Yeoh * element 24043ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 24053ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 24063ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 24073ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 24083ddd53f3SChun-Yeow Yeoh * announcements are transmitted 24093ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 24103ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 24113ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 24123ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 24133ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 24143ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 24153ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 24163ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 24173ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 24183ddd53f3SChun-Yeow Yeoh * station to establish a peer link 24193ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 2420ac1073a6SChun-Yeow Yeoh * 2421ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 2422ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 2423ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 2424ac1073a6SChun-Yeow Yeoh * 2425ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 2426ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 2427728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 2428728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 2429728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 24303b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 24313b1c5a53SMarco Porsch * setting for new peer links. 24323b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 24333b1c5a53SMarco Porsch * after transmitting its beacon. 24348e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 24358e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 24368e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 24372d8b08feSMauro Carvalho Chehab * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA 24382d8b08feSMauro Carvalho Chehab * will advertise that it is connected to a authentication server 24392d8b08feSMauro Carvalho Chehab * in the mesh formation field. 244001d66fbdSBob Copeland * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is 244101d66fbdSBob Copeland * connected to a mesh gate in mesh formation info. If false, the 244201d66fbdSBob Copeland * value in mesh formation is determined by the presence of root paths 244301d66fbdSBob Copeland * in the mesh path table 2444e3718a61SLinus Lüssing * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP 2445e3718a61SLinus Lüssing * for HWMP) if the destination is a direct neighbor. Note that this might 2446e3718a61SLinus Lüssing * not be the optimal decision as a multi-hop route might be better. So 2447e3718a61SLinus Lüssing * if using this setting you will likely also want to disable 2448e3718a61SLinus Lüssing * dot11MeshForwarding and use another mesh routing protocol on top. 244929cbe68cSJohannes Berg */ 245093da9cc1Scolin@cozybit.com struct mesh_config { 245193da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 245293da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 245393da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 245493da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 245593da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 245693da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 245745904f21SJavier Cardona u8 element_ttl; 245893da9cc1Scolin@cozybit.com bool auto_open_plinks; 2459d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 246093da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 246193da9cc1Scolin@cozybit.com u32 path_refresh_time; 246293da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 246393da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 246493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 2465dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 246693da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 246763c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 246801d66fbdSBob Copeland bool dot11MeshConnectedToMeshGate; 2469184eebe6SMarkus Theil bool dot11MeshConnectedToAuthServer; 24700507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 247116dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 247294f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 247355335137SAshok Nagarajan s32 rssi_threshold; 247470c33eaaSAshok Nagarajan u16 ht_opmode; 2475ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 2476ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 2477728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 24783b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 24793b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 24808e7c0538SColleen Twitty u32 plink_timeout; 2481e3718a61SLinus Lüssing bool dot11MeshNolearn; 248293da9cc1Scolin@cozybit.com }; 248393da9cc1Scolin@cozybit.com 248431888487SJouni Malinen /** 248529cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 2486683b6d3bSJohannes Berg * @chandef: defines the channel to use 248729cbe68cSJohannes Berg * @mesh_id: the mesh ID 248829cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 2489d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 2490c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 2491c80d545dSJavier Cardona * @path_metric: which metric to use 24926e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 2493581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 2494581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 2495b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 2496b130e5ceSJavier Cardona * @is_secure: this mesh uses security 2497bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 24989bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 24999bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 250098e0c7f8SRandy Dunlap * @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a] 2501ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 25028564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 2503d37d49c2SBenjamin Berg * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 2504d37d49c2SBenjamin Berg * changes the channel when a radar is detected. This is required 2505d37d49c2SBenjamin Berg * to operate on DFS channels. 25061224f583SDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 25071224f583SDenis Kenzior * port frames over NL80211 instead of the network interface. 250829cbe68cSJohannes Berg * 250929cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 251029cbe68cSJohannes Berg */ 251129cbe68cSJohannes Berg struct mesh_setup { 2512683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 251329cbe68cSJohannes Berg const u8 *mesh_id; 251429cbe68cSJohannes Berg u8 mesh_id_len; 2515d299a1f2SJavier Cardona u8 sync_method; 2516c80d545dSJavier Cardona u8 path_sel_proto; 2517c80d545dSJavier Cardona u8 path_metric; 25186e16d90bSColleen Twitty u8 auth_id; 2519581a8b0fSJavier Cardona const u8 *ie; 2520581a8b0fSJavier Cardona u8 ie_len; 2521b130e5ceSJavier Cardona bool is_authenticated; 252215d5dda6SJavier Cardona bool is_secure; 2523bb2798d4SThomas Pedersen bool user_mpm; 25249bdbf04dSMarco Porsch u8 dtim_period; 25259bdbf04dSMarco Porsch u16 beacon_interval; 252657fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2527ffb3cf30SAshok Nagarajan u32 basic_rates; 25288564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 2529d37d49c2SBenjamin Berg bool userspace_handles_dfs; 25301224f583SDenis Kenzior bool control_port_over_nl80211; 253129cbe68cSJohannes Berg }; 253229cbe68cSJohannes Berg 253329cbe68cSJohannes Berg /** 25346e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 25356e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 25366e0bd6c3SRostislav Lisovy * 25376e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 25386e0bd6c3SRostislav Lisovy */ 25396e0bd6c3SRostislav Lisovy struct ocb_setup { 25406e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 25416e0bd6c3SRostislav Lisovy }; 25426e0bd6c3SRostislav Lisovy 25436e0bd6c3SRostislav Lisovy /** 254431888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 2545a3304b0aSJohannes Berg * @ac: AC identifier 254631888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 254731888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 254831888487SJouni Malinen * 1..32767] 254931888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 255031888487SJouni Malinen * 1..32767] 255131888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 25529d2bb84dSShaul Triebitz * @link_id: link_id or -1 for non-MLD 255331888487SJouni Malinen */ 255431888487SJouni Malinen struct ieee80211_txq_params { 2555a3304b0aSJohannes Berg enum nl80211_ac ac; 255631888487SJouni Malinen u16 txop; 255731888487SJouni Malinen u16 cwmin; 255831888487SJouni Malinen u16 cwmax; 255931888487SJouni Malinen u8 aifs; 25609d2bb84dSShaul Triebitz int link_id; 256131888487SJouni Malinen }; 256231888487SJouni Malinen 2563d70e9693SJohannes Berg /** 2564d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 2565d70e9693SJohannes Berg * 2566d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 2567d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 2568d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 2569d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 2570d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 2571d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 2572d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 2573d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 2574d70e9693SJohannes Berg * in the wiphy structure. 2575d70e9693SJohannes Berg * 2576d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 2577d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 2578d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 2579d70e9693SJohannes Berg * 2580d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 2581d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 2582d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 2583d70e9693SJohannes Berg * to userspace. 2584d70e9693SJohannes Berg */ 258572bdcf34SJouni Malinen 2586704232c2SJohannes Berg /** 25872a519311SJohannes Berg * struct cfg80211_ssid - SSID description 25882a519311SJohannes Berg * @ssid: the SSID 25892a519311SJohannes Berg * @ssid_len: length of the ssid 25902a519311SJohannes Berg */ 25912a519311SJohannes Berg struct cfg80211_ssid { 25922a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 25932a519311SJohannes Berg u8 ssid_len; 25942a519311SJohannes Berg }; 25952a519311SJohannes Berg 25962a519311SJohannes Berg /** 25971d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 25981d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 25991d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 26001d76250bSAvraham Stern * information is not available, this field is left zero. 26011d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 26021d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 26031d76250bSAvraham Stern * userspace will be notified of that 26041d76250bSAvraham Stern */ 26051d76250bSAvraham Stern struct cfg80211_scan_info { 26061d76250bSAvraham Stern u64 scan_start_tsf; 26071d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 26081d76250bSAvraham Stern bool aborted; 26091d76250bSAvraham Stern }; 26101d76250bSAvraham Stern 26111d76250bSAvraham Stern /** 2612c8cb5b85STova Mussai * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only 2613c8cb5b85STova Mussai * 26142d8b08feSMauro Carvalho Chehab * @short_ssid: short ssid to scan for 2615c8cb5b85STova Mussai * @bssid: bssid to scan for 2616c8cb5b85STova Mussai * @channel_idx: idx of the channel in the channel array in the scan request 261705b23456SRandy Dunlap * which the above info is relevant to 2618c8cb5b85STova Mussai * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU 26192d8b08feSMauro Carvalho Chehab * @short_ssid_valid: @short_ssid is valid and can be used 2620c8cb5b85STova Mussai * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait 2621c8cb5b85STova Mussai * 20 TUs before starting to send probe requests. 26224ef2f53eSIlan Peer * @psd_20: The AP's 20 MHz PSD value. 2623c8cb5b85STova Mussai */ 2624c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params { 2625c8cb5b85STova Mussai u32 short_ssid; 2626c8cb5b85STova Mussai u32 channel_idx; 2627c8cb5b85STova Mussai u8 bssid[ETH_ALEN]; 2628c8cb5b85STova Mussai bool unsolicited_probe; 2629c8cb5b85STova Mussai bool short_ssid_valid; 2630c8cb5b85STova Mussai bool psc_no_listen; 26314ef2f53eSIlan Peer s8 psd_20; 2632c8cb5b85STova Mussai }; 2633c8cb5b85STova Mussai 2634c8cb5b85STova Mussai /** 26352a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 26362a519311SJohannes Berg * 26372a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 26382a519311SJohannes Berg * @n_ssids: number of SSIDs 26392a519311SJohannes Berg * @channels: channels to scan on. 2640ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 264170692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 264270692ad2SJouni Malinen * @ie_len: length of ie in octets 26431d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 26441d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 26451d76250bSAvraham Stern * the actual dwell time may be shorter. 26461d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 26471d76250bSAvraham Stern * %duration field. 26481dcf396bSDmitry Antipov * @flags: control flags from &enum nl80211_scan_flags 264934850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 26502a519311SJohannes Berg * @wiphy: the wiphy this was for 265115d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 2652fd014284SJohannes Berg * @wdev: the wireless device to scan for 26531d76250bSAvraham Stern * @info: (internal) information about completed scan 26545fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 2655e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 2656ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 2657ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 2658ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 2659ad2b26abSJohannes Berg * be taken from the @mac_addr 2660c8cb5b85STova Mussai * @scan_6ghz: relevant for split scan request only, 2661c8cb5b85STova Mussai * true if this is the second scan request 2662c8cb5b85STova Mussai * @n_6ghz_params: number of 6 GHz params 2663c8cb5b85STova Mussai * @scan_6ghz_params: 6 GHz params 2664818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 26656285ee30SIlan Peer * @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be 26666285ee30SIlan Peer * used for TSF reporting. Can be set to -1 to indicate no preference. 26672a519311SJohannes Berg */ 26682a519311SJohannes Berg struct cfg80211_scan_request { 26692a519311SJohannes Berg struct cfg80211_ssid *ssids; 26702a519311SJohannes Berg int n_ssids; 26712a519311SJohannes Berg u32 n_channels; 2672de95a54bSJohannes Berg const u8 *ie; 267370692ad2SJouni Malinen size_t ie_len; 26741d76250bSAvraham Stern u16 duration; 26751d76250bSAvraham Stern bool duration_mandatory; 2676ed473771SSam Leffler u32 flags; 26772a519311SJohannes Berg 267857fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 267934850ab2SJohannes Berg 2680fd014284SJohannes Berg struct wireless_dev *wdev; 2681fd014284SJohannes Berg 2682ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 2683ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2684818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 2685ad2b26abSJohannes Berg 26862a519311SJohannes Berg /* internal */ 26872a519311SJohannes Berg struct wiphy *wiphy; 268815d6030bSSam Leffler unsigned long scan_start; 26891d76250bSAvraham Stern struct cfg80211_scan_info info; 26901d76250bSAvraham Stern bool notified; 2691e9f935e3SRajkumar Manoharan bool no_cck; 2692c8cb5b85STova Mussai bool scan_6ghz; 2693c8cb5b85STova Mussai u32 n_6ghz_params; 2694c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params *scan_6ghz_params; 26956285ee30SIlan Peer s8 tsf_report_link_id; 26965ba63533SJohannes Berg 26975ba63533SJohannes Berg /* keep last */ 2698e3eac9f3SKees Cook struct ieee80211_channel *channels[] __counted_by(n_channels); 26992a519311SJohannes Berg }; 27002a519311SJohannes Berg 2701ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 2702ad2b26abSJohannes Berg { 2703ad2b26abSJohannes Berg int i; 2704ad2b26abSJohannes Berg 2705ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 2706ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 2707ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 2708ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 2709ad2b26abSJohannes Berg } 2710ad2b26abSJohannes Berg } 2711ad2b26abSJohannes Berg 27122a519311SJohannes Berg /** 2713a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 2714a1f1c21cSLuciano Coelho * 27153007e352SArend Van Spriel * @ssid: SSID to be matched; may be zero-length in case of BSSID match 27163007e352SArend Van Spriel * or no match (RSSI only) 27173007e352SArend Van Spriel * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 27183007e352SArend Van Spriel * or no match (RSSI only) 2719ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 2720a1f1c21cSLuciano Coelho */ 2721a1f1c21cSLuciano Coelho struct cfg80211_match_set { 2722a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 27233007e352SArend Van Spriel u8 bssid[ETH_ALEN]; 2724ea73cbceSJohannes Berg s32 rssi_thold; 2725a1f1c21cSLuciano Coelho }; 2726a1f1c21cSLuciano Coelho 2727a1f1c21cSLuciano Coelho /** 27283b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 27293b06d277SAvraham Stern * 27303b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 27313b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 27323b06d277SAvraham Stern * infinite loop. 27333b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 27343b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 27353b06d277SAvraham Stern */ 27363b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 27373b06d277SAvraham Stern u32 interval; 27383b06d277SAvraham Stern u32 iterations; 27393b06d277SAvraham Stern }; 27403b06d277SAvraham Stern 27413b06d277SAvraham Stern /** 2742bf95ecdbSvamsi krishna * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 2743bf95ecdbSvamsi krishna * 2744bf95ecdbSvamsi krishna * @band: band of BSS which should match for RSSI level adjustment. 2745bf95ecdbSvamsi krishna * @delta: value of RSSI level adjustment. 2746bf95ecdbSvamsi krishna */ 2747bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust { 2748bf95ecdbSvamsi krishna enum nl80211_band band; 2749bf95ecdbSvamsi krishna s8 delta; 2750bf95ecdbSvamsi krishna }; 2751bf95ecdbSvamsi krishna 2752bf95ecdbSvamsi krishna /** 2753807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 2754807f8a8cSLuciano Coelho * 275596b08fd6SArend Van Spriel * @reqid: identifies this request. 2756807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 2757807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 2758807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 2759807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 2760807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 27611dcf396bSDmitry Antipov * @flags: control flags from &enum nl80211_scan_flags 2762a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 2763a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 2764a1f1c21cSLuciano Coelho * (others are filtered out). 276598e0c7f8SRandy Dunlap * If omitted, all results are passed. 2766a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 27676406c919SJohannes Berg * @report_results: indicates that results were reported for this request 2768807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 2769807f8a8cSLuciano Coelho * @dev: the interface 2770077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 2771807f8a8cSLuciano Coelho * @channels: channels to scan 2772ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 2773ea73cbceSJohannes Berg * contains the minimum over all matchsets 2774ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 2775ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 2776ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 2777ad2b26abSJohannes Berg * be taken from the @mac_addr 27783b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 27793b06d277SAvraham Stern * index must be executed first. 27803b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 278131a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 278293a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 278393a1e86cSJukka Rissanen * owned by a particular socket) 2784ca986ad9SArend Van Spriel * @nl_owner_dead: netlink owner socket was closed - this request be freed 2785ca986ad9SArend Van Spriel * @list: for keeping list of requests. 27869c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 27879c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 27889c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 27899c748934SLuciano Coelho * supported. 2790bf95ecdbSvamsi krishna * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 2791bf95ecdbSvamsi krishna * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 2792bf95ecdbSvamsi krishna * reporting in connected state to cases where a matching BSS is determined 2793bf95ecdbSvamsi krishna * to have better or slightly worse RSSI than the current connected BSS. 2794bf95ecdbSvamsi krishna * The relative RSSI threshold values are ignored in disconnected state. 2795bf95ecdbSvamsi krishna * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 2796bf95ecdbSvamsi krishna * to the specified band while deciding whether a better BSS is reported 2797bf95ecdbSvamsi krishna * using @relative_rssi. If delta is a negative number, the BSSs that 2798bf95ecdbSvamsi krishna * belong to the specified band will be penalized by delta dB in relative 279998e0c7f8SRandy Dunlap * comparisons. 2800807f8a8cSLuciano Coelho */ 2801807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 280296b08fd6SArend Van Spriel u64 reqid; 2803807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 2804807f8a8cSLuciano Coelho int n_ssids; 2805807f8a8cSLuciano Coelho u32 n_channels; 2806807f8a8cSLuciano Coelho const u8 *ie; 2807807f8a8cSLuciano Coelho size_t ie_len; 2808ed473771SSam Leffler u32 flags; 2809a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 2810a1f1c21cSLuciano Coelho int n_match_sets; 2811ea73cbceSJohannes Berg s32 min_rssi_thold; 28129c748934SLuciano Coelho u32 delay; 28133b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 28143b06d277SAvraham Stern int n_scan_plans; 2815807f8a8cSLuciano Coelho 2816ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 2817ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2818ad2b26abSJohannes Berg 2819bf95ecdbSvamsi krishna bool relative_rssi_set; 2820bf95ecdbSvamsi krishna s8 relative_rssi; 2821bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust rssi_adjust; 2822bf95ecdbSvamsi krishna 2823807f8a8cSLuciano Coelho /* internal */ 2824807f8a8cSLuciano Coelho struct wiphy *wiphy; 2825807f8a8cSLuciano Coelho struct net_device *dev; 282615d6030bSSam Leffler unsigned long scan_start; 2827b34939b9SArend Van Spriel bool report_results; 282831a60ed1SJukka Rissanen struct rcu_head rcu_head; 282993a1e86cSJukka Rissanen u32 owner_nlportid; 2830ca986ad9SArend Van Spriel bool nl_owner_dead; 2831ca986ad9SArend Van Spriel struct list_head list; 2832807f8a8cSLuciano Coelho 2833807f8a8cSLuciano Coelho /* keep last */ 2834396fba0aSGustavo A. R. Silva struct ieee80211_channel *channels[]; 2835807f8a8cSLuciano Coelho }; 2836807f8a8cSLuciano Coelho 2837807f8a8cSLuciano Coelho /** 28382a519311SJohannes Berg * enum cfg80211_signal_type - signal type 28392a519311SJohannes Berg * 28402a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 28412a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 28422a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 28432a519311SJohannes Berg */ 28442a519311SJohannes Berg enum cfg80211_signal_type { 28452a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 28462a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 28472a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 28482a519311SJohannes Berg }; 28492a519311SJohannes Berg 28502a519311SJohannes Berg /** 28516e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 28526e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 28536e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 28546e19bc4bSDmitry Shmidt * signal type 28556e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 28566e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 28576e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 28586e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 28596e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 28609285ec4cSJason A. Donenfeld * ktime_get_boottime_ns() is likely appropriate. 28611d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 28621d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 28631d76250bSAvraham Stern * by %parent_bssid. 28641d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 28651d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 2866983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 2867983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 2868d02a12b8SJohannes Berg * @restrict_use: restrict usage, if not set, assume @use_for is 2869d02a12b8SJohannes Berg * %NL80211_BSS_USE_FOR_NORMAL. 2870d02a12b8SJohannes Berg * @use_for: bitmap of possible usage for this BSS, see 2871d02a12b8SJohannes Berg * &enum nl80211_bss_use_for 2872d02a12b8SJohannes Berg * @cannot_use_reasons: the reasons (bitmap) for not being able to connect, 2873d02a12b8SJohannes Berg * if @restrict_use is set and @use_for is zero (empty); may be 0 for 2874d02a12b8SJohannes Berg * unspecified reasons; see &enum nl80211_bss_cannot_use_reasons 28755db25290SBenjamin Berg * @drv_data: Data to be passed through to @inform_bss 28766e19bc4bSDmitry Shmidt */ 28776e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 28786e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 28796e19bc4bSDmitry Shmidt s32 signal; 28806e19bc4bSDmitry Shmidt u64 boottime_ns; 28811d76250bSAvraham Stern u64 parent_tsf; 28821d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 2883983dafaaSSunil Dutt u8 chains; 2884983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 28855db25290SBenjamin Berg 2886d02a12b8SJohannes Berg u8 restrict_use:1, use_for:7; 2887d02a12b8SJohannes Berg u8 cannot_use_reasons; 2888d02a12b8SJohannes Berg 28895db25290SBenjamin Berg void *drv_data; 28906e19bc4bSDmitry Shmidt }; 28916e19bc4bSDmitry Shmidt 28926e19bc4bSDmitry Shmidt /** 28932aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 28948cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 28959caf0364SJohannes Berg * @rcu_head: internal use, for freeing 28969caf0364SJohannes Berg * @len: length of the IEs 28970e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 28989caf0364SJohannes Berg * @data: IE data 28999caf0364SJohannes Berg */ 29009caf0364SJohannes Berg struct cfg80211_bss_ies { 29018cef2c9dSJohannes Berg u64 tsf; 29029caf0364SJohannes Berg struct rcu_head rcu_head; 29039caf0364SJohannes Berg int len; 29040e227084SJohannes Berg bool from_beacon; 29059caf0364SJohannes Berg u8 data[]; 29069caf0364SJohannes Berg }; 29079caf0364SJohannes Berg 29089caf0364SJohannes Berg /** 29092a519311SJohannes Berg * struct cfg80211_bss - BSS description 29102a519311SJohannes Berg * 29112a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 29122a519311SJohannes Berg * for use in scan results and similar. 29132a519311SJohannes Berg * 2914abe37c4bSJohannes Berg * @channel: channel this BSS is on 29152a519311SJohannes Berg * @bssid: BSSID of the BSS 29162a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 29172a519311SJohannes Berg * @capability: the capability field in host byte order 291883c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 291983c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 292083c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 292183c7aa1aSJohannes Berg * received. It is always non-%NULL. 292234a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 2923776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 2924776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 2925776b3580SJohannes Berg * @hidden_beacon_bss struct) 292634a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 2927177fbbcbSJohannes Berg * @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame, 2928177fbbcbSJohannes Berg * cannot rely on it having valid data 2929776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 2930776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 2931776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 2932776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 2933851ae31dSJohannes Berg * @transmitted_bss: pointer to the transmitted BSS, if this is a 2934851ae31dSJohannes Berg * non-transmitted one (multi-BSSID support) 2935851ae31dSJohannes Berg * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one 2936851ae31dSJohannes Berg * (multi-BSSID support) 293777965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 2938983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 2939983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 29400cd01efbSSara Sharon * @bssid_index: index in the multiple BSS set 29410cd01efbSSara Sharon * @max_bssid_indicator: max number of members in the BSS set 2942d02a12b8SJohannes Berg * @use_for: bitmap of possible usage for this BSS, see 2943d02a12b8SJohannes Berg * &enum nl80211_bss_use_for 2944d02a12b8SJohannes Berg * @cannot_use_reasons: the reasons (bitmap) for not being able to connect, 2945d02a12b8SJohannes Berg * if @restrict_use is set and @use_for is zero (empty); may be 0 for 2946d02a12b8SJohannes Berg * unspecified reasons; see &enum nl80211_bss_cannot_use_reasons 29472a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 29482a519311SJohannes Berg */ 29492a519311SJohannes Berg struct cfg80211_bss { 29502a519311SJohannes Berg struct ieee80211_channel *channel; 29512a519311SJohannes Berg 29529caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 29539caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 29549caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 29559caf0364SJohannes Berg 2956776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 29577011ba58SSara Sharon struct cfg80211_bss *transmitted_bss; 29587011ba58SSara Sharon struct list_head nontrans_list; 29592a519311SJohannes Berg 29602a519311SJohannes Berg s32 signal; 29612a519311SJohannes Berg 29629caf0364SJohannes Berg u16 beacon_interval; 29639caf0364SJohannes Berg u16 capability; 29649caf0364SJohannes Berg 29659caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 2966983dafaaSSunil Dutt u8 chains; 2967983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 29689caf0364SJohannes Berg 2969177fbbcbSJohannes Berg u8 proberesp_ecsa_stuck:1; 2970177fbbcbSJohannes Berg 29710cd01efbSSara Sharon u8 bssid_index; 29720cd01efbSSara Sharon u8 max_bssid_indicator; 29730cd01efbSSara Sharon 2974d02a12b8SJohannes Berg u8 use_for; 2975d02a12b8SJohannes Berg u8 cannot_use_reasons; 2976d02a12b8SJohannes Berg 2977396fba0aSGustavo A. R. Silva u8 priv[] __aligned(sizeof(void *)); 29782a519311SJohannes Berg }; 29792a519311SJohannes Berg 29802a519311SJohannes Berg /** 298149a68e0dSJohannes Berg * ieee80211_bss_get_elem - find element with given ID 2982517357c6SJohannes Berg * @bss: the bss to search 298349a68e0dSJohannes Berg * @id: the element ID 29849caf0364SJohannes Berg * 29859caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 29869caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 29870ae997dcSYacine Belkadi * Return: %NULL if not found. 2988517357c6SJohannes Berg */ 298949a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id); 299049a68e0dSJohannes Berg 299149a68e0dSJohannes Berg /** 299249a68e0dSJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 299349a68e0dSJohannes Berg * @bss: the bss to search 299449a68e0dSJohannes Berg * @id: the element ID 299549a68e0dSJohannes Berg * 299649a68e0dSJohannes Berg * Note that the return value is an RCU-protected pointer, so 299749a68e0dSJohannes Berg * rcu_read_lock() must be held when calling this function. 299849a68e0dSJohannes Berg * Return: %NULL if not found. 299949a68e0dSJohannes Berg */ 300049a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id) 300149a68e0dSJohannes Berg { 30027e367b06SJohannes Berg return (const void *)ieee80211_bss_get_elem(bss, id); 300349a68e0dSJohannes Berg } 3004517357c6SJohannes Berg 3005517357c6SJohannes Berg 3006517357c6SJohannes Berg /** 3007636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 3008636a5d36SJouni Malinen * 3009636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 3010636a5d36SJouni Malinen * authentication. 3011636a5d36SJouni Malinen * 3012959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 3013959867faSJohannes Berg * to it if it needs to keep it. 3014636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 3015636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 3016636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 3017fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 3018fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 3019fffd0934SJohannes Berg * @key: WEP key for shared key authentication 302011b6b5a4SJouni Malinen * @auth_data: Fields and elements in Authentication frames. This contains 302111b6b5a4SJouni Malinen * the authentication frame body (non-IE and IE data), excluding the 302211b6b5a4SJouni Malinen * Authentication algorithm number, i.e., starting at the Authentication 302311b6b5a4SJouni Malinen * transaction sequence number field. 302411b6b5a4SJouni Malinen * @auth_data_len: Length of auth_data buffer in octets 3025d648c230SJohannes Berg * @link_id: if >= 0, indicates authentication should be done as an MLD, 3026d648c230SJohannes Berg * the interface address is included as the MLD address and the 3027d648c230SJohannes Berg * necessary link (with the given link_id) will be created (and 3028d648c230SJohannes Berg * given an MLD address) by the driver 3029d648c230SJohannes Berg * @ap_mld_addr: AP MLD address in case of authentication request with 3030d648c230SJohannes Berg * an AP MLD, valid iff @link_id >= 0 3031636a5d36SJouni Malinen */ 3032636a5d36SJouni Malinen struct cfg80211_auth_request { 303319957bb3SJohannes Berg struct cfg80211_bss *bss; 3034636a5d36SJouni Malinen const u8 *ie; 3035636a5d36SJouni Malinen size_t ie_len; 303619957bb3SJohannes Berg enum nl80211_auth_type auth_type; 3037fffd0934SJohannes Berg const u8 *key; 303823cc6d8cSJohannes Berg u8 key_len; 303923cc6d8cSJohannes Berg s8 key_idx; 304011b6b5a4SJouni Malinen const u8 *auth_data; 304111b6b5a4SJouni Malinen size_t auth_data_len; 3042d648c230SJohannes Berg s8 link_id; 3043d648c230SJohannes Berg const u8 *ap_mld_addr; 3044d648c230SJohannes Berg }; 3045d648c230SJohannes Berg 3046d648c230SJohannes Berg /** 3047d648c230SJohannes Berg * struct cfg80211_assoc_link - per-link information for MLO association 3048d648c230SJohannes Berg * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss; 3049d648c230SJohannes Berg * if this is %NULL for a link, that link is not requested 3050d648c230SJohannes Berg * @elems: extra elements for the per-STA profile for this link 3051d648c230SJohannes Berg * @elems_len: length of the elements 30526cf963edSIlan Peer * @disabled: If set this link should be included during association etc. but it 30536cf963edSIlan Peer * should not be used until enabled by the AP MLD. 3054a7b2cc59SBenjamin Berg * @error: per-link error code, must be <= 0. If there is an error, then the 3055a7b2cc59SBenjamin Berg * operation as a whole must fail. 3056d648c230SJohannes Berg */ 3057d648c230SJohannes Berg struct cfg80211_assoc_link { 3058d648c230SJohannes Berg struct cfg80211_bss *bss; 3059d648c230SJohannes Berg const u8 *elems; 3060d648c230SJohannes Berg size_t elems_len; 30616cf963edSIlan Peer bool disabled; 3062a7b2cc59SBenjamin Berg int error; 3063636a5d36SJouni Malinen }; 3064636a5d36SJouni Malinen 3065636a5d36SJouni Malinen /** 30667e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 30677e7c8926SBen Greear * 30687e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 3069ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 3070bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 307140cbfa90SSrinivas Dasari * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external 307240cbfa90SSrinivas Dasari * authentication capability. Drivers can offload authentication to 307340cbfa90SSrinivas Dasari * userspace if this flag is set. Only applicable for cfg80211_connect() 307440cbfa90SSrinivas Dasari * request (connect callback). 3075b6db0f89SBen Greear * @ASSOC_REQ_DISABLE_HE: Disable HE 307636f84235SMuna Sinada * @ASSOC_REQ_DISABLE_EHT: Disable EHT 3077efbabc11SVeerendranath Jakkam * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links. 3078efbabc11SVeerendranath Jakkam * Drivers shall disable MLO features for the current association if this 3079efbabc11SVeerendranath Jakkam * flag is not set. 30802518e89dSJohannes Berg * @ASSOC_REQ_SPP_AMSDU: SPP A-MSDUs will be used on this connection (if any) 30817e7c8926SBen Greear */ 30827e7c8926SBen Greear enum cfg80211_assoc_req_flags { 30837e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 3084ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 3085bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 308640cbfa90SSrinivas Dasari CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), 3087b6db0f89SBen Greear ASSOC_REQ_DISABLE_HE = BIT(4), 308836f84235SMuna Sinada ASSOC_REQ_DISABLE_EHT = BIT(5), 3089efbabc11SVeerendranath Jakkam CONNECT_REQ_MLO_SUPPORT = BIT(6), 30902518e89dSJohannes Berg ASSOC_REQ_SPP_AMSDU = BIT(7), 30917e7c8926SBen Greear }; 30927e7c8926SBen Greear 30937e7c8926SBen Greear /** 3094636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 3095636a5d36SJouni Malinen * 3096636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 3097636a5d36SJouni Malinen * (re)association. 3098959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 3099959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 3100959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 3101959867faSJohannes Berg * association requests while already associating must be rejected. 3102d648c230SJohannes Berg * This also applies to the @links.bss parameter, which is used instead 3103d648c230SJohannes Berg * of this one (it is %NULL) for MLO associations. 3104636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 3105636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 3106dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 3107b23aa676SSamuel Ortiz * @crypto: crypto settings 310835eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 310935eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 311035eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 311135eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 311235eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 311335eb8f7bSJouni Malinen * frame. 31147e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 31157e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 31167e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 31177e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 3118ee2aca34SJohannes Berg * @vht_capa: VHT capability override 3119ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 3120348bd456SJouni Malinen * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 3121348bd456SJouni Malinen * %NULL if FILS is not used. 3122348bd456SJouni Malinen * @fils_kek_len: Length of fils_kek in octets 3123348bd456SJouni Malinen * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 3124348bd456SJouni Malinen * Request/Response frame or %NULL if FILS is not used. This field starts 3125348bd456SJouni Malinen * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 3126d2b7588aSThomas Pedersen * @s1g_capa: S1G capability override 3127d2b7588aSThomas Pedersen * @s1g_capa_mask: S1G capability override mask 3128d648c230SJohannes Berg * @links: per-link information for MLO connections 3129d648c230SJohannes Berg * @link_id: >= 0 for MLO connections, where links are given, and indicates 3130d648c230SJohannes Berg * the link on which the association request should be sent 3131d648c230SJohannes Berg * @ap_mld_addr: AP MLD address in case of MLO association request, 3132d648c230SJohannes Berg * valid iff @link_id >= 0 3133636a5d36SJouni Malinen */ 3134636a5d36SJouni Malinen struct cfg80211_assoc_request { 313519957bb3SJohannes Berg struct cfg80211_bss *bss; 31363e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 3137636a5d36SJouni Malinen size_t ie_len; 3138b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 313919957bb3SJohannes Berg bool use_mfp; 31407e7c8926SBen Greear u32 flags; 31417e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 31427e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 3143ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 3144348bd456SJouni Malinen const u8 *fils_kek; 3145348bd456SJouni Malinen size_t fils_kek_len; 3146348bd456SJouni Malinen const u8 *fils_nonces; 3147d2b7588aSThomas Pedersen struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask; 3148d648c230SJohannes Berg struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS]; 3149d648c230SJohannes Berg const u8 *ap_mld_addr; 3150d648c230SJohannes Berg s8 link_id; 3151636a5d36SJouni Malinen }; 3152636a5d36SJouni Malinen 3153636a5d36SJouni Malinen /** 3154636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 3155636a5d36SJouni Malinen * 3156636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 3157636a5d36SJouni Malinen * deauthentication. 3158636a5d36SJouni Malinen * 31598f6e0dfcSJohannes Berg * @bssid: the BSSID or AP MLD address to deauthenticate from 3160636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 3161636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 316219957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 3163077f897aSJohannes Berg * @local_state_change: if set, change local state only and 3164077f897aSJohannes Berg * do not set a deauth frame 3165636a5d36SJouni Malinen */ 3166636a5d36SJouni Malinen struct cfg80211_deauth_request { 316795de817bSJohannes Berg const u8 *bssid; 3168636a5d36SJouni Malinen const u8 *ie; 3169636a5d36SJouni Malinen size_t ie_len; 317019957bb3SJohannes Berg u16 reason_code; 31716863255bSStanislaw Gruszka bool local_state_change; 3172636a5d36SJouni Malinen }; 3173636a5d36SJouni Malinen 3174636a5d36SJouni Malinen /** 3175636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 3176636a5d36SJouni Malinen * 3177636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 317866f00449SMasahiro Yamada * disassociation. 3179636a5d36SJouni Malinen * 31808f6e0dfcSJohannes Berg * @ap_addr: the BSSID or AP MLD address to disassociate from 3181636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 3182636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 318319957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 3184d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 3185d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 3186636a5d36SJouni Malinen */ 3187636a5d36SJouni Malinen struct cfg80211_disassoc_request { 31888f6e0dfcSJohannes Berg const u8 *ap_addr; 3189636a5d36SJouni Malinen const u8 *ie; 3190636a5d36SJouni Malinen size_t ie_len; 319119957bb3SJohannes Berg u16 reason_code; 3192d5cdfacbSJouni Malinen bool local_state_change; 3193636a5d36SJouni Malinen }; 3194636a5d36SJouni Malinen 3195636a5d36SJouni Malinen /** 319604a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 319704a773adSJohannes Berg * 319804a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 319904a773adSJohannes Berg * method. 320004a773adSJohannes Berg * 320104a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 320204a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 320304a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 320404a773adSJohannes Berg * search for IBSSs with a different BSSID. 3205683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 320604a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 320704a773adSJohannes Berg * IBSSs to join on other channels. 320804a773adSJohannes Berg * @ie: information element(s) to include in the beacon 320904a773adSJohannes Berg * @ie_len: length of that 32108e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 3211fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 3212fffd0934SJohannes Berg * after joining 3213267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 3214267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 3215267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 3216267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 3217c3bfe1f6SDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 3218c3bfe1f6SDenis Kenzior * port frames over NL80211 instead of the network interface. 32195336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 32205336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 32215336fa88SSimon Wunderlich * to operate on DFS channels. 3222fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 3223dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 3224803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 3225803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 3226803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 32279ae3b172STova Mussai * @wep_keys: static WEP keys, if not NULL points to an array of 32289ae3b172STova Mussai * CFG80211_MAX_WEP_KEYS WEP keys 32299ae3b172STova Mussai * @wep_tx_key: key index (0..3) of the default TX static WEP key 323004a773adSJohannes Berg */ 323104a773adSJohannes Berg struct cfg80211_ibss_params { 3232c1e5f471SJohannes Berg const u8 *ssid; 3233c1e5f471SJohannes Berg const u8 *bssid; 3234683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 3235c1e5f471SJohannes Berg const u8 *ie; 323604a773adSJohannes Berg u8 ssid_len, ie_len; 32378e30bc55SJohannes Berg u16 beacon_interval; 3238fbd2c8dcSTeemu Paasikivi u32 basic_rates; 323904a773adSJohannes Berg bool channel_fixed; 3240fffd0934SJohannes Berg bool privacy; 3241267335d6SAntonio Quartulli bool control_port; 3242c3bfe1f6SDenis Kenzior bool control_port_over_nl80211; 32435336fa88SSimon Wunderlich bool userspace_handles_dfs; 324457fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 3245803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 3246803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 32479ae3b172STova Mussai struct key_params *wep_keys; 32489ae3b172STova Mussai int wep_tx_key; 324904a773adSJohannes Berg }; 325004a773adSJohannes Berg 325104a773adSJohannes Berg /** 325238de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 325338de03d2SArend van Spriel * 325438de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 325538de03d2SArend van Spriel * @param: parameters for requestion behaviour. 325633615978SJonathan Corbet * @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 325733615978SJonathan Corbet * @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 325838de03d2SArend van Spriel */ 325938de03d2SArend van Spriel struct cfg80211_bss_selection { 326038de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 326138de03d2SArend van Spriel union { 326257fbcce3SJohannes Berg enum nl80211_band band_pref; 326338de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 326438de03d2SArend van Spriel } param; 326538de03d2SArend van Spriel }; 326638de03d2SArend van Spriel 326738de03d2SArend van Spriel /** 3268b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 3269b23aa676SSamuel Ortiz * 3270b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 3271b23aa676SSamuel Ortiz * authentication and association. 3272b23aa676SSamuel Ortiz * 3273b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 3274b23aa676SSamuel Ortiz * on scan results) 32751df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 32761df4a510SJouni Malinen * %NULL if not specified 3277b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 3278b23aa676SSamuel Ortiz * results) 32791df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 32801df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 32811df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 32821df4a510SJouni Malinen * to use. 3283b23aa676SSamuel Ortiz * @ssid: SSID 3284b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 3285b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 3286abe37c4bSJohannes Berg * @ie: IEs for association request 3287abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 3288b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 3289cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 3290b23aa676SSamuel Ortiz * @crypto: crypto settings 3291fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 3292fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 3293fffd0934SJohannes Berg * @key: WEP key for shared key authentication 32947e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 32954486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 32964486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 32977e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 32987e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 32997e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 3300ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 3301ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 330234d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 330334d50519SLior David * networks. 330438de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 330535eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 330635eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 330735eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 330835eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 330935eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 331035eb8f7bSJouni Malinen * frame. 3311a3caf744SVidyullatha Kanchanapally * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 3312a3caf744SVidyullatha Kanchanapally * NAI or %NULL if not specified. This is used to construct FILS wrapped 3313a3caf744SVidyullatha Kanchanapally * data IE. 3314a3caf744SVidyullatha Kanchanapally * @fils_erp_username_len: Length of @fils_erp_username in octets. 3315a3caf744SVidyullatha Kanchanapally * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 3316a3caf744SVidyullatha Kanchanapally * %NULL if not specified. This specifies the domain name of ER server and 3317a3caf744SVidyullatha Kanchanapally * is used to construct FILS wrapped data IE. 3318a3caf744SVidyullatha Kanchanapally * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 3319a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 3320a3caf744SVidyullatha Kanchanapally * messages. This is also used to construct FILS wrapped data IE. 3321a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 3322a3caf744SVidyullatha Kanchanapally * keys in FILS or %NULL if not specified. 3323a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 33243a00df57SAvraham Stern * @want_1x: indicates user-space supports and wants to use 802.1X driver 33253a00df57SAvraham Stern * offload of 4-way handshake. 33262a38075cSAlexei Avshalom Lazar * @edmg: define the EDMG channels. 33272a38075cSAlexei Avshalom Lazar * This may specify multiple channels and bonding options for the driver 33282a38075cSAlexei Avshalom Lazar * to choose from, based on BSS configuration. 3329b23aa676SSamuel Ortiz */ 3330b23aa676SSamuel Ortiz struct cfg80211_connect_params { 3331b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 33321df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 3333664834deSJouni Malinen const u8 *bssid; 33341df4a510SJouni Malinen const u8 *bssid_hint; 3335664834deSJouni Malinen const u8 *ssid; 3336b23aa676SSamuel Ortiz size_t ssid_len; 3337b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 33384b5800feSJohannes Berg const u8 *ie; 3339b23aa676SSamuel Ortiz size_t ie_len; 3340b23aa676SSamuel Ortiz bool privacy; 3341cee00a95SJouni Malinen enum nl80211_mfp mfp; 3342b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 3343fffd0934SJohannes Berg const u8 *key; 3344fffd0934SJohannes Berg u8 key_len, key_idx; 33457e7c8926SBen Greear u32 flags; 33464486ea98SBala Shanmugam int bg_scan_period; 33477e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 33487e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 3349ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 3350ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 335134d50519SLior David bool pbss; 335238de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 3353ba6fbacfSJouni Malinen const u8 *prev_bssid; 3354a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_username; 3355a3caf744SVidyullatha Kanchanapally size_t fils_erp_username_len; 3356a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_realm; 3357a3caf744SVidyullatha Kanchanapally size_t fils_erp_realm_len; 3358a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 3359a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_rrk; 3360a3caf744SVidyullatha Kanchanapally size_t fils_erp_rrk_len; 33613a00df57SAvraham Stern bool want_1x; 33622a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg; 3363b23aa676SSamuel Ortiz }; 3364b23aa676SSamuel Ortiz 3365b23aa676SSamuel Ortiz /** 3366088e8df8Svamsi krishna * enum cfg80211_connect_params_changed - Connection parameters being updated 3367088e8df8Svamsi krishna * 3368088e8df8Svamsi krishna * This enum provides information of all connect parameters that 3369088e8df8Svamsi krishna * have to be updated as part of update_connect_params() call. 3370088e8df8Svamsi krishna * 3371088e8df8Svamsi krishna * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 33727f9a3e15SVidyullatha Kanchanapally * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm, 33737f9a3e15SVidyullatha Kanchanapally * username, erp sequence number and rrk) are updated 33747f9a3e15SVidyullatha Kanchanapally * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated 3375088e8df8Svamsi krishna */ 3376088e8df8Svamsi krishna enum cfg80211_connect_params_changed { 3377088e8df8Svamsi krishna UPDATE_ASSOC_IES = BIT(0), 33787f9a3e15SVidyullatha Kanchanapally UPDATE_FILS_ERP_INFO = BIT(1), 33797f9a3e15SVidyullatha Kanchanapally UPDATE_AUTH_TYPE = BIT(2), 3380088e8df8Svamsi krishna }; 3381088e8df8Svamsi krishna 3382088e8df8Svamsi krishna /** 3383b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 3384abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 3385abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 3386abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 3387abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 3388abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 33893057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 339052539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed 339152539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed 339252539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum 3393b9a5f8caSJouni Malinen */ 3394b9a5f8caSJouni Malinen enum wiphy_params_flags { 3395b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 3396b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 3397b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 3398b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 339981077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 34003057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 340152539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_LIMIT = 1 << 6, 340252539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7, 340352539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, 3404b9a5f8caSJouni Malinen }; 3405b9a5f8caSJouni Malinen 340636647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 340736647055SToke Høiland-Jørgensen 34083ace10f5SKan Yan /* The per TXQ device queue limit in airtime */ 34093ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 34103ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 34113ace10f5SKan Yan 34123ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */ 34133ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD 24000 34143ace10f5SKan Yan 341567fbb16bSSamuel Ortiz /** 341667fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 341767fbb16bSSamuel Ortiz * 341867fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 341967fbb16bSSamuel Ortiz * caching. 342067fbb16bSSamuel Ortiz * 3421a3caf744SVidyullatha Kanchanapally * @bssid: The AP's BSSID (may be %NULL). 3422a3caf744SVidyullatha Kanchanapally * @pmkid: The identifier to refer a PMKSA. 3423a3caf744SVidyullatha Kanchanapally * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 3424a3caf744SVidyullatha Kanchanapally * derivation by a FILS STA. Otherwise, %NULL. 3425a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 3426a3caf744SVidyullatha Kanchanapally * the hash algorithm used to generate this. 3427a3caf744SVidyullatha Kanchanapally * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 3428a3caf744SVidyullatha Kanchanapally * cache identifier (may be %NULL). 3429a3caf744SVidyullatha Kanchanapally * @ssid_len: Length of the @ssid in octets. 3430a3caf744SVidyullatha Kanchanapally * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 3431a3caf744SVidyullatha Kanchanapally * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 3432a3caf744SVidyullatha Kanchanapally * %NULL). 34337fc82af8SVeerendranath Jakkam * @pmk_lifetime: Maximum lifetime for PMKSA in seconds 34347fc82af8SVeerendranath Jakkam * (dot11RSNAConfigPMKLifetime) or 0 if not specified. 34357fc82af8SVeerendranath Jakkam * The configured PMKSA must not be used for PMKSA caching after 34367fc82af8SVeerendranath Jakkam * expiration and any keys derived from this PMK become invalid on 34377fc82af8SVeerendranath Jakkam * expiration, i.e., the current association must be dropped if the PMK 34387fc82af8SVeerendranath Jakkam * used for it expires. 34397fc82af8SVeerendranath Jakkam * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of 34407fc82af8SVeerendranath Jakkam * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified. 34417fc82af8SVeerendranath Jakkam * Drivers are expected to trigger a full authentication instead of using 34427fc82af8SVeerendranath Jakkam * this PMKSA for caching when reassociating to a new BSS after this 34437fc82af8SVeerendranath Jakkam * threshold to generate a new PMK before the current one expires. 344467fbb16bSSamuel Ortiz */ 344567fbb16bSSamuel Ortiz struct cfg80211_pmksa { 3446c1e5f471SJohannes Berg const u8 *bssid; 3447c1e5f471SJohannes Berg const u8 *pmkid; 3448a3caf744SVidyullatha Kanchanapally const u8 *pmk; 3449a3caf744SVidyullatha Kanchanapally size_t pmk_len; 3450a3caf744SVidyullatha Kanchanapally const u8 *ssid; 3451a3caf744SVidyullatha Kanchanapally size_t ssid_len; 3452a3caf744SVidyullatha Kanchanapally const u8 *cache_id; 34537fc82af8SVeerendranath Jakkam u32 pmk_lifetime; 34547fc82af8SVeerendranath Jakkam u8 pmk_reauth_threshold; 345567fbb16bSSamuel Ortiz }; 34569930380fSJohannes Berg 34577643a2c3SJohannes Berg /** 345850ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 3459ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 3460ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 3461ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 3462ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 3463bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 3464ff1b6e69SJohannes Berg * 3465ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 3466ff1b6e69SJohannes Berg * memory, free @mask only! 3467ff1b6e69SJohannes Berg */ 346850ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 3469922bd80fSJohannes Berg const u8 *mask, *pattern; 3470ff1b6e69SJohannes Berg int pattern_len; 3471bb92d199SAmitkumar Karwar int pkt_offset; 3472ff1b6e69SJohannes Berg }; 3473ff1b6e69SJohannes Berg 3474ff1b6e69SJohannes Berg /** 34752a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 34762a0e047eSJohannes Berg * 34772a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 34782a0e047eSJohannes Berg * @src: source IP address 34792a0e047eSJohannes Berg * @dst: destination IP address 34802a0e047eSJohannes Berg * @dst_mac: destination MAC address 34812a0e047eSJohannes Berg * @src_port: source port 34822a0e047eSJohannes Berg * @dst_port: destination port 34832a0e047eSJohannes Berg * @payload_len: data payload length 34842a0e047eSJohannes Berg * @payload: data payload buffer 34852a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 34862a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 34872a0e047eSJohannes Berg * @wake_len: wakeup payload match length 34882a0e047eSJohannes Berg * @wake_data: wakeup payload match data 34892a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 34902a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 34912a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 34922a0e047eSJohannes Berg */ 34932a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 34942a0e047eSJohannes Berg struct socket *sock; 34952a0e047eSJohannes Berg __be32 src, dst; 34962a0e047eSJohannes Berg u16 src_port, dst_port; 34972a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 34982a0e047eSJohannes Berg int payload_len; 34992a0e047eSJohannes Berg const u8 *payload; 35002a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 35012a0e047eSJohannes Berg u32 data_interval; 35022a0e047eSJohannes Berg u32 wake_len; 35032a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 35042a0e047eSJohannes Berg u32 tokens_size; 35052a0e047eSJohannes Berg /* must be last, variable member */ 35062a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 3507ff1b6e69SJohannes Berg }; 3508ff1b6e69SJohannes Berg 3509ff1b6e69SJohannes Berg /** 3510ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 3511ff1b6e69SJohannes Berg * 3512ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 3513ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 3514ff1b6e69SJohannes Berg * operating as normal during suspend 3515ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 3516ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 3517ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 3518ff1b6e69SJohannes Berg * @n_patterns: number of patterns 351977dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 352077dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 352177dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 352277dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 35232a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 35242a0e047eSJohannes Berg * NULL if not configured. 35258cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 3526ff1b6e69SJohannes Berg */ 3527ff1b6e69SJohannes Berg struct cfg80211_wowlan { 352877dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 352977dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 353077dbbb13SJohannes Berg rfkill_release; 353150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 35322a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 3533ff1b6e69SJohannes Berg int n_patterns; 35348cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 3535ff1b6e69SJohannes Berg }; 3536ff1b6e69SJohannes Berg 3537ff1b6e69SJohannes Berg /** 3538be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 3539be29b99aSAmitkumar Karwar * 3540be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 3541be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 3542be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 3543be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 3544be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 3545be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 3546be29b99aSAmitkumar Karwar */ 3547be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 3548be29b99aSAmitkumar Karwar int delay; 3549be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 3550be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 3551be29b99aSAmitkumar Karwar int n_patterns; 3552be29b99aSAmitkumar Karwar }; 3553be29b99aSAmitkumar Karwar 3554be29b99aSAmitkumar Karwar /** 3555be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 3556be29b99aSAmitkumar Karwar * 3557be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 3558be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 3559be29b99aSAmitkumar Karwar * @n_rules: number of rules 3560be29b99aSAmitkumar Karwar */ 3561be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 3562be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 3563be29b99aSAmitkumar Karwar int n_rules; 3564be29b99aSAmitkumar Karwar }; 3565be29b99aSAmitkumar Karwar 3566be29b99aSAmitkumar Karwar /** 35678cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 35688cd4d456SLuciano Coelho * 35698cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 35708cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 35718cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 35728cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 35738cd4d456SLuciano Coelho * occurred (in MHz) 35748cd4d456SLuciano Coelho */ 35758cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 35768cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 35778cd4d456SLuciano Coelho int n_channels; 35788cd4d456SLuciano Coelho u32 channels[]; 35798cd4d456SLuciano Coelho }; 35808cd4d456SLuciano Coelho 35818cd4d456SLuciano Coelho /** 35828cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 35838cd4d456SLuciano Coelho * 35848cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 35858cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 35868cd4d456SLuciano Coelho * match information. 35878cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 35888cd4d456SLuciano Coelho * the matches that triggered the wake up. 35898cd4d456SLuciano Coelho */ 35908cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 35918cd4d456SLuciano Coelho int n_matches; 35928cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 35938cd4d456SLuciano Coelho }; 35948cd4d456SLuciano Coelho 35958cd4d456SLuciano Coelho /** 3596cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 3597cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 3598cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 3599cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 3600cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 3601cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 3602cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 3603cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 3604cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 3605cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 3606cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 3607cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 3608cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 3609cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 3610cd8f7cb4SJohannes Berg * it is. 36112a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 36122a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 36132a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 36148cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 3615cd8f7cb4SJohannes Berg */ 3616cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 3617cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 3618cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 36192a0e047eSJohannes Berg rfkill_release, packet_80211, 36202a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 3621cd8f7cb4SJohannes Berg s32 pattern_idx; 3622cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 3623cd8f7cb4SJohannes Berg const void *packet; 36248cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 3625cd8f7cb4SJohannes Berg }; 3626cd8f7cb4SJohannes Berg 3627cd8f7cb4SJohannes Berg /** 3628e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 3629093a48d2SNathan Errera * @kek: key encryption key (@kek_len bytes) 3630093a48d2SNathan Errera * @kck: key confirmation key (@kck_len bytes) 363178f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 3632093a48d2SNathan Errera * @kek_len: length of kek 36332d8b08feSMauro Carvalho Chehab * @kck_len: length of kck 3634093a48d2SNathan Errera * @akm: akm (oui, id) 3635e5497d76SJohannes Berg */ 3636e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 363778f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 3638093a48d2SNathan Errera u32 akm; 3639093a48d2SNathan Errera u8 kek_len, kck_len; 3640e5497d76SJohannes Berg }; 3641e5497d76SJohannes Berg 3642e5497d76SJohannes Berg /** 3643355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 3644355199e0SJouni Malinen * 3645355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 3646355199e0SJouni Malinen * 3647355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 3648355199e0SJouni Malinen * @ie: Fast Transition IEs 3649355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 3650355199e0SJouni Malinen */ 3651355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 3652355199e0SJouni Malinen u16 md; 3653355199e0SJouni Malinen const u8 *ie; 3654355199e0SJouni Malinen size_t ie_len; 3655355199e0SJouni Malinen }; 3656355199e0SJouni Malinen 3657355199e0SJouni Malinen /** 3658b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 3659b176e629SAndrei Otcheretianski * 3660b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 3661b176e629SAndrei Otcheretianski * 3662b176e629SAndrei Otcheretianski * @chan: channel to use 366398e0c7f8SRandy Dunlap * @offchan: indicates whether off channel operation is required 3664b176e629SAndrei Otcheretianski * @wait: duration for ROC 3665b176e629SAndrei Otcheretianski * @buf: buffer to transmit 3666b176e629SAndrei Otcheretianski * @len: buffer length 3667b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 3668b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 366934d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 367034d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 367195f498bbSJohannes Berg * @link_id: for MLO, the link ID to transmit on, -1 if not given; note 367295f498bbSJohannes Berg * that the link ID isn't validated (much), it's in range but the 367395f498bbSJohannes Berg * link might not exist (or be used by the receiver STA) 3674b176e629SAndrei Otcheretianski */ 3675b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 3676b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 3677b176e629SAndrei Otcheretianski bool offchan; 3678b176e629SAndrei Otcheretianski unsigned int wait; 3679b176e629SAndrei Otcheretianski const u8 *buf; 3680b176e629SAndrei Otcheretianski size_t len; 3681b176e629SAndrei Otcheretianski bool no_cck; 3682b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 368334d22ce2SAndrei Otcheretianski int n_csa_offsets; 368434d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 368595f498bbSJohannes Berg int link_id; 3686b176e629SAndrei Otcheretianski }; 3687b176e629SAndrei Otcheretianski 3688b176e629SAndrei Otcheretianski /** 3689fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 3690fa9ffc74SKyeyoon Park * 3691fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 3692fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 3693fa9ffc74SKyeyoon Park */ 3694fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 3695fa9ffc74SKyeyoon Park u8 dscp; 3696fa9ffc74SKyeyoon Park u8 up; 3697fa9ffc74SKyeyoon Park }; 3698fa9ffc74SKyeyoon Park 3699fa9ffc74SKyeyoon Park /** 3700fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 3701fa9ffc74SKyeyoon Park * 3702fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 3703fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 3704fa9ffc74SKyeyoon Park */ 3705fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 3706fa9ffc74SKyeyoon Park u8 low; 3707fa9ffc74SKyeyoon Park u8 high; 3708fa9ffc74SKyeyoon Park }; 3709fa9ffc74SKyeyoon Park 3710fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 3711fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 3712fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 3713fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 3714fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 3715fa9ffc74SKyeyoon Park 3716fa9ffc74SKyeyoon Park /** 3717fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 3718fa9ffc74SKyeyoon Park * 3719fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 3720fa9ffc74SKyeyoon Park * 3721fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 3722fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 3723fa9ffc74SKyeyoon Park * the user priority DSCP range definition 3724fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 3725fa9ffc74SKyeyoon Park */ 3726fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 3727fa9ffc74SKyeyoon Park u8 num_des; 3728fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 3729fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 3730fa9ffc74SKyeyoon Park }; 3731fa9ffc74SKyeyoon Park 3732fa9ffc74SKyeyoon Park /** 3733cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 3734cb3b7d87SAyala Beker * 3735cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 3736cb3b7d87SAyala Beker * 3737cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 37388585989dSLuca Coelho * @bands: operating bands, a bitmap of &enum nl80211_band values. 37398585989dSLuca Coelho * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 37408585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 3741cb3b7d87SAyala Beker */ 3742cb3b7d87SAyala Beker struct cfg80211_nan_conf { 3743cb3b7d87SAyala Beker u8 master_pref; 37448585989dSLuca Coelho u8 bands; 3745cb3b7d87SAyala Beker }; 3746cb3b7d87SAyala Beker 3747cb3b7d87SAyala Beker /** 3748a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 3749a5a9dcf2SAyala Beker * configuration 3750a5a9dcf2SAyala Beker * 3751a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 37528585989dSLuca Coelho * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 3753a5a9dcf2SAyala Beker */ 3754a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 3755a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 37568585989dSLuca Coelho CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 3757a5a9dcf2SAyala Beker }; 3758a5a9dcf2SAyala Beker 3759a5a9dcf2SAyala Beker /** 3760a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 3761a442b761SAyala Beker * 3762a442b761SAyala Beker * @filter: the content of the filter 3763a442b761SAyala Beker * @len: the length of the filter 3764a442b761SAyala Beker */ 3765a442b761SAyala Beker struct cfg80211_nan_func_filter { 3766a442b761SAyala Beker const u8 *filter; 3767a442b761SAyala Beker u8 len; 3768a442b761SAyala Beker }; 3769a442b761SAyala Beker 3770a442b761SAyala Beker /** 3771a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 3772a442b761SAyala Beker * 3773a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 3774a442b761SAyala Beker * @service_id: the service ID of the function 3775a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 3776a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 3777a442b761SAyala Beker * implementation specific. 3778a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 3779a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 3780a442b761SAyala Beker * @followup_id: the instance ID for follow up 378198e0c7f8SRandy Dunlap * @followup_reqid: the requester instance ID for follow up 3782a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 3783a442b761SAyala Beker * @ttl: time to live counter in DW. 3784a442b761SAyala Beker * @serv_spec_info: Service Specific Info 3785a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 3786a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 3787a442b761SAyala Beker * @srf_bf: Bloom Filter 3788a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 3789a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 3790a442b761SAyala Beker * @srf_macs: SRF MAC addresses 3791a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 3792a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 3793a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 3794a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 3795a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 3796a442b761SAyala Beker * @instance_id: driver allocated id of the function. 3797a442b761SAyala Beker * @cookie: unique NAN function identifier. 3798a442b761SAyala Beker */ 3799a442b761SAyala Beker struct cfg80211_nan_func { 3800a442b761SAyala Beker enum nl80211_nan_function_type type; 3801a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 3802a442b761SAyala Beker u8 publish_type; 3803a442b761SAyala Beker bool close_range; 3804a442b761SAyala Beker bool publish_bcast; 3805a442b761SAyala Beker bool subscribe_active; 3806a442b761SAyala Beker u8 followup_id; 3807a442b761SAyala Beker u8 followup_reqid; 3808a442b761SAyala Beker struct mac_address followup_dest; 3809a442b761SAyala Beker u32 ttl; 3810a442b761SAyala Beker const u8 *serv_spec_info; 3811a442b761SAyala Beker u8 serv_spec_info_len; 3812a442b761SAyala Beker bool srf_include; 3813a442b761SAyala Beker const u8 *srf_bf; 3814a442b761SAyala Beker u8 srf_bf_len; 3815a442b761SAyala Beker u8 srf_bf_idx; 3816a442b761SAyala Beker struct mac_address *srf_macs; 3817a442b761SAyala Beker int srf_num_macs; 3818a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 3819a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 3820a442b761SAyala Beker u8 num_tx_filters; 3821a442b761SAyala Beker u8 num_rx_filters; 3822a442b761SAyala Beker u8 instance_id; 3823a442b761SAyala Beker u64 cookie; 3824a442b761SAyala Beker }; 3825a442b761SAyala Beker 3826a442b761SAyala Beker /** 38273a00df57SAvraham Stern * struct cfg80211_pmk_conf - PMK configuration 38283a00df57SAvraham Stern * 38293a00df57SAvraham Stern * @aa: authenticator address 38303a00df57SAvraham Stern * @pmk_len: PMK length in bytes. 38313a00df57SAvraham Stern * @pmk: the PMK material 38323a00df57SAvraham Stern * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK 38333a00df57SAvraham Stern * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field 38343a00df57SAvraham Stern * holds PMK-R0. 38353a00df57SAvraham Stern */ 38363a00df57SAvraham Stern struct cfg80211_pmk_conf { 38373a00df57SAvraham Stern const u8 *aa; 38383a00df57SAvraham Stern u8 pmk_len; 38393a00df57SAvraham Stern const u8 *pmk; 38403a00df57SAvraham Stern const u8 *pmk_r0_name; 38413a00df57SAvraham Stern }; 38423a00df57SAvraham Stern 38433a00df57SAvraham Stern /** 384440cbfa90SSrinivas Dasari * struct cfg80211_external_auth_params - Trigger External authentication. 384540cbfa90SSrinivas Dasari * 384640cbfa90SSrinivas Dasari * Commonly used across the external auth request and event interfaces. 384740cbfa90SSrinivas Dasari * 384840cbfa90SSrinivas Dasari * @action: action type / trigger for external authentication. Only significant 384940cbfa90SSrinivas Dasari * for the authentication request event interface (driver to user space). 385040cbfa90SSrinivas Dasari * @bssid: BSSID of the peer with which the authentication has 385140cbfa90SSrinivas Dasari * to happen. Used by both the authentication request event and 385240cbfa90SSrinivas Dasari * authentication response command interface. 385340cbfa90SSrinivas Dasari * @ssid: SSID of the AP. Used by both the authentication request event and 385440cbfa90SSrinivas Dasari * authentication response command interface. 385540cbfa90SSrinivas Dasari * @key_mgmt_suite: AKM suite of the respective authentication. Used by the 385640cbfa90SSrinivas Dasari * authentication request event interface. 385740cbfa90SSrinivas Dasari * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication, 385840cbfa90SSrinivas Dasari * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you 385940cbfa90SSrinivas Dasari * the real status code for failures. Used only for the authentication 386040cbfa90SSrinivas Dasari * response command interface (user space to driver). 3861fe494370SSrinivas Dasari * @pmkid: The identifier to refer a PMKSA. 38629a47c1efSVeerendranath Jakkam * @mld_addr: MLD address of the peer. Used by the authentication request event 38639a47c1efSVeerendranath Jakkam * interface. Driver indicates this to enable MLO during the authentication 38649a47c1efSVeerendranath Jakkam * offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT 38659a47c1efSVeerendranath Jakkam * flag capability in NL80211_CMD_CONNECT to know whether the user space 38669a47c1efSVeerendranath Jakkam * supports enabling MLO during the authentication offload. 38679a47c1efSVeerendranath Jakkam * User space should use the address of the interface (on which the 38689a47c1efSVeerendranath Jakkam * authentication request event reported) as self MLD address. User space 38699a47c1efSVeerendranath Jakkam * and driver should use MLD addresses in RA, TA and BSSID fields of 38709a47c1efSVeerendranath Jakkam * authentication frames sent or received via cfg80211. The driver 38719a47c1efSVeerendranath Jakkam * translates the MLD addresses to/from link addresses based on the link 38729a47c1efSVeerendranath Jakkam * chosen for the authentication. 387340cbfa90SSrinivas Dasari */ 387440cbfa90SSrinivas Dasari struct cfg80211_external_auth_params { 387540cbfa90SSrinivas Dasari enum nl80211_external_auth_action action; 387640cbfa90SSrinivas Dasari u8 bssid[ETH_ALEN] __aligned(2); 387740cbfa90SSrinivas Dasari struct cfg80211_ssid ssid; 387840cbfa90SSrinivas Dasari unsigned int key_mgmt_suite; 387940cbfa90SSrinivas Dasari u16 status; 3880fe494370SSrinivas Dasari const u8 *pmkid; 38819a47c1efSVeerendranath Jakkam u8 mld_addr[ETH_ALEN] __aligned(2); 388240cbfa90SSrinivas Dasari }; 388340cbfa90SSrinivas Dasari 388440cbfa90SSrinivas Dasari /** 38853453de98SRandy Dunlap * struct cfg80211_ftm_responder_stats - FTM responder statistics 388681e54d08SPradeep Kumar Chitrapu * 388781e54d08SPradeep Kumar Chitrapu * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to 388881e54d08SPradeep Kumar Chitrapu * indicate the relevant values in this struct for them 388981e54d08SPradeep Kumar Chitrapu * @success_num: number of FTM sessions in which all frames were successfully 389081e54d08SPradeep Kumar Chitrapu * answered 389181e54d08SPradeep Kumar Chitrapu * @partial_num: number of FTM sessions in which part of frames were 389281e54d08SPradeep Kumar Chitrapu * successfully answered 389381e54d08SPradeep Kumar Chitrapu * @failed_num: number of failed FTM sessions 389481e54d08SPradeep Kumar Chitrapu * @asap_num: number of ASAP FTM sessions 389581e54d08SPradeep Kumar Chitrapu * @non_asap_num: number of non-ASAP FTM sessions 389681e54d08SPradeep Kumar Chitrapu * @total_duration_ms: total sessions durations - gives an indication 389781e54d08SPradeep Kumar Chitrapu * of how much time the responder was busy 389881e54d08SPradeep Kumar Chitrapu * @unknown_triggers_num: number of unknown FTM triggers - triggers from 389981e54d08SPradeep Kumar Chitrapu * initiators that didn't finish successfully the negotiation phase with 390081e54d08SPradeep Kumar Chitrapu * the responder 390181e54d08SPradeep Kumar Chitrapu * @reschedule_requests_num: number of FTM reschedule requests - initiator asks 390281e54d08SPradeep Kumar Chitrapu * for a new scheduling although it already has scheduled FTM slot 390381e54d08SPradeep Kumar Chitrapu * @out_of_window_triggers_num: total FTM triggers out of scheduled window 390481e54d08SPradeep Kumar Chitrapu */ 390581e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats { 390681e54d08SPradeep Kumar Chitrapu u32 filled; 390781e54d08SPradeep Kumar Chitrapu u32 success_num; 390881e54d08SPradeep Kumar Chitrapu u32 partial_num; 390981e54d08SPradeep Kumar Chitrapu u32 failed_num; 391081e54d08SPradeep Kumar Chitrapu u32 asap_num; 391181e54d08SPradeep Kumar Chitrapu u32 non_asap_num; 391281e54d08SPradeep Kumar Chitrapu u64 total_duration_ms; 391381e54d08SPradeep Kumar Chitrapu u32 unknown_triggers_num; 391481e54d08SPradeep Kumar Chitrapu u32 reschedule_requests_num; 391581e54d08SPradeep Kumar Chitrapu u32 out_of_window_triggers_num; 391681e54d08SPradeep Kumar Chitrapu }; 391781e54d08SPradeep Kumar Chitrapu 391881e54d08SPradeep Kumar Chitrapu /** 39199bb7e0f2SJohannes Berg * struct cfg80211_pmsr_ftm_result - FTM result 39209bb7e0f2SJohannes Berg * @failure_reason: if this measurement failed (PMSR status is 39219bb7e0f2SJohannes Berg * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise 39229bb7e0f2SJohannes Berg * reason than just "failure" 39239bb7e0f2SJohannes Berg * @burst_index: if reporting partial results, this is the index 39249bb7e0f2SJohannes Berg * in [0 .. num_bursts-1] of the burst that's being reported 39259bb7e0f2SJohannes Berg * @num_ftmr_attempts: number of FTM request frames transmitted 39269bb7e0f2SJohannes Berg * @num_ftmr_successes: number of FTM request frames acked 39279bb7e0f2SJohannes Berg * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY, 39289bb7e0f2SJohannes Berg * fill this to indicate in how many seconds a retry is deemed possible 39299bb7e0f2SJohannes Berg * by the responder 39309bb7e0f2SJohannes Berg * @num_bursts_exp: actual number of bursts exponent negotiated 39319bb7e0f2SJohannes Berg * @burst_duration: actual burst duration negotiated 39329bb7e0f2SJohannes Berg * @ftms_per_burst: actual FTMs per burst negotiated 39339bb7e0f2SJohannes Berg * @lci_len: length of LCI information (if present) 39349bb7e0f2SJohannes Berg * @civicloc_len: length of civic location information (if present) 39359bb7e0f2SJohannes Berg * @lci: LCI data (may be %NULL) 39369bb7e0f2SJohannes Berg * @civicloc: civic location data (may be %NULL) 39379bb7e0f2SJohannes Berg * @rssi_avg: average RSSI over FTM action frames reported 39389bb7e0f2SJohannes Berg * @rssi_spread: spread of the RSSI over FTM action frames reported 39399bb7e0f2SJohannes Berg * @tx_rate: bitrate for transmitted FTM action frame response 39409bb7e0f2SJohannes Berg * @rx_rate: bitrate of received FTM action frame 39419bb7e0f2SJohannes Berg * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) 39429bb7e0f2SJohannes Berg * @rtt_variance: variance of RTTs measured (note that standard deviation is 39439bb7e0f2SJohannes Berg * the square root of the variance) 39449bb7e0f2SJohannes Berg * @rtt_spread: spread of the RTTs measured 39459bb7e0f2SJohannes Berg * @dist_avg: average of distances (mm) measured 39469bb7e0f2SJohannes Berg * (must have either this or @rtt_avg) 39479bb7e0f2SJohannes Berg * @dist_variance: variance of distances measured (see also @rtt_variance) 39489bb7e0f2SJohannes Berg * @dist_spread: spread of distances measured (see also @rtt_spread) 39499bb7e0f2SJohannes Berg * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid 39509bb7e0f2SJohannes Berg * @num_ftmr_successes_valid: @num_ftmr_successes is valid 39519bb7e0f2SJohannes Berg * @rssi_avg_valid: @rssi_avg is valid 39529bb7e0f2SJohannes Berg * @rssi_spread_valid: @rssi_spread is valid 39539bb7e0f2SJohannes Berg * @tx_rate_valid: @tx_rate is valid 39549bb7e0f2SJohannes Berg * @rx_rate_valid: @rx_rate is valid 39559bb7e0f2SJohannes Berg * @rtt_avg_valid: @rtt_avg is valid 39569bb7e0f2SJohannes Berg * @rtt_variance_valid: @rtt_variance is valid 39579bb7e0f2SJohannes Berg * @rtt_spread_valid: @rtt_spread is valid 39589bb7e0f2SJohannes Berg * @dist_avg_valid: @dist_avg is valid 39599bb7e0f2SJohannes Berg * @dist_variance_valid: @dist_variance is valid 39609bb7e0f2SJohannes Berg * @dist_spread_valid: @dist_spread is valid 39619bb7e0f2SJohannes Berg */ 39629bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result { 39639bb7e0f2SJohannes Berg const u8 *lci; 39649bb7e0f2SJohannes Berg const u8 *civicloc; 39659bb7e0f2SJohannes Berg unsigned int lci_len; 39669bb7e0f2SJohannes Berg unsigned int civicloc_len; 39679bb7e0f2SJohannes Berg enum nl80211_peer_measurement_ftm_failure_reasons failure_reason; 39689bb7e0f2SJohannes Berg u32 num_ftmr_attempts, num_ftmr_successes; 39699bb7e0f2SJohannes Berg s16 burst_index; 39709bb7e0f2SJohannes Berg u8 busy_retry_time; 39719bb7e0f2SJohannes Berg u8 num_bursts_exp; 39729bb7e0f2SJohannes Berg u8 burst_duration; 39739bb7e0f2SJohannes Berg u8 ftms_per_burst; 39749bb7e0f2SJohannes Berg s32 rssi_avg; 39759bb7e0f2SJohannes Berg s32 rssi_spread; 39769bb7e0f2SJohannes Berg struct rate_info tx_rate, rx_rate; 39779bb7e0f2SJohannes Berg s64 rtt_avg; 39789bb7e0f2SJohannes Berg s64 rtt_variance; 39799bb7e0f2SJohannes Berg s64 rtt_spread; 39809bb7e0f2SJohannes Berg s64 dist_avg; 39819bb7e0f2SJohannes Berg s64 dist_variance; 39829bb7e0f2SJohannes Berg s64 dist_spread; 39839bb7e0f2SJohannes Berg 39849bb7e0f2SJohannes Berg u16 num_ftmr_attempts_valid:1, 39859bb7e0f2SJohannes Berg num_ftmr_successes_valid:1, 39869bb7e0f2SJohannes Berg rssi_avg_valid:1, 39879bb7e0f2SJohannes Berg rssi_spread_valid:1, 39889bb7e0f2SJohannes Berg tx_rate_valid:1, 39899bb7e0f2SJohannes Berg rx_rate_valid:1, 39909bb7e0f2SJohannes Berg rtt_avg_valid:1, 39919bb7e0f2SJohannes Berg rtt_variance_valid:1, 39929bb7e0f2SJohannes Berg rtt_spread_valid:1, 39939bb7e0f2SJohannes Berg dist_avg_valid:1, 39949bb7e0f2SJohannes Berg dist_variance_valid:1, 39959bb7e0f2SJohannes Berg dist_spread_valid:1; 39969bb7e0f2SJohannes Berg }; 39979bb7e0f2SJohannes Berg 39989bb7e0f2SJohannes Berg /** 39999bb7e0f2SJohannes Berg * struct cfg80211_pmsr_result - peer measurement result 40009bb7e0f2SJohannes Berg * @addr: address of the peer 40019bb7e0f2SJohannes Berg * @host_time: host time (use ktime_get_boottime() adjust to the time when the 40029bb7e0f2SJohannes Berg * measurement was made) 40039bb7e0f2SJohannes Berg * @ap_tsf: AP's TSF at measurement time 40049bb7e0f2SJohannes Berg * @status: status of the measurement 40059bb7e0f2SJohannes Berg * @final: if reporting partial results, mark this as the last one; if not 40069bb7e0f2SJohannes Berg * reporting partial results always set this flag 40079bb7e0f2SJohannes Berg * @ap_tsf_valid: indicates the @ap_tsf value is valid 40089bb7e0f2SJohannes Berg * @type: type of the measurement reported, note that we only support reporting 40099bb7e0f2SJohannes Berg * one type at a time, but you can report multiple results separately and 40109bb7e0f2SJohannes Berg * they're all aggregated for userspace. 40112d8b08feSMauro Carvalho Chehab * @ftm: FTM result 40129bb7e0f2SJohannes Berg */ 40139bb7e0f2SJohannes Berg struct cfg80211_pmsr_result { 40149bb7e0f2SJohannes Berg u64 host_time, ap_tsf; 40159bb7e0f2SJohannes Berg enum nl80211_peer_measurement_status status; 40169bb7e0f2SJohannes Berg 40179bb7e0f2SJohannes Berg u8 addr[ETH_ALEN]; 40189bb7e0f2SJohannes Berg 40199bb7e0f2SJohannes Berg u8 final:1, 40209bb7e0f2SJohannes Berg ap_tsf_valid:1; 40219bb7e0f2SJohannes Berg 40229bb7e0f2SJohannes Berg enum nl80211_peer_measurement_type type; 40239bb7e0f2SJohannes Berg 40249bb7e0f2SJohannes Berg union { 40259bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result ftm; 40269bb7e0f2SJohannes Berg }; 40279bb7e0f2SJohannes Berg }; 40289bb7e0f2SJohannes Berg 40299bb7e0f2SJohannes Berg /** 40309bb7e0f2SJohannes Berg * struct cfg80211_pmsr_ftm_request_peer - FTM request data 40319bb7e0f2SJohannes Berg * @requested: indicates FTM is requested 40329bb7e0f2SJohannes Berg * @preamble: frame preamble to use 40339bb7e0f2SJohannes Berg * @burst_period: burst period to use 40349bb7e0f2SJohannes Berg * @asap: indicates to use ASAP mode 40359bb7e0f2SJohannes Berg * @num_bursts_exp: number of bursts exponent 40369bb7e0f2SJohannes Berg * @burst_duration: burst duration 40379bb7e0f2SJohannes Berg * @ftms_per_burst: number of FTMs per burst 40389bb7e0f2SJohannes Berg * @ftmr_retries: number of retries for FTM request 40399bb7e0f2SJohannes Berg * @request_lci: request LCI information 40409bb7e0f2SJohannes Berg * @request_civicloc: request civic location information 4041efb5520dSAvraham Stern * @trigger_based: use trigger based ranging for the measurement 4042efb5520dSAvraham Stern * If neither @trigger_based nor @non_trigger_based is set, 4043efb5520dSAvraham Stern * EDCA based ranging will be used. 4044efb5520dSAvraham Stern * @non_trigger_based: use non trigger based ranging for the measurement 4045efb5520dSAvraham Stern * If neither @trigger_based nor @non_trigger_based is set, 4046efb5520dSAvraham Stern * EDCA based ranging will be used. 404773807523SAvraham Stern * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either 404873807523SAvraham Stern * @trigger_based or @non_trigger_based is set. 4049dd3e4fc7SAvraham Stern * @bss_color: the bss color of the responder. Optional. Set to zero to 4050dd3e4fc7SAvraham Stern * indicate the driver should set the BSS color. Only valid if 4051dd3e4fc7SAvraham Stern * @non_trigger_based or @trigger_based is set. 40529bb7e0f2SJohannes Berg * 40539bb7e0f2SJohannes Berg * See also nl80211 for the respective attribute documentation. 40549bb7e0f2SJohannes Berg */ 40559bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer { 40569bb7e0f2SJohannes Berg enum nl80211_preamble preamble; 40579bb7e0f2SJohannes Berg u16 burst_period; 40589bb7e0f2SJohannes Berg u8 requested:1, 40599bb7e0f2SJohannes Berg asap:1, 40609bb7e0f2SJohannes Berg request_lci:1, 4061efb5520dSAvraham Stern request_civicloc:1, 4062efb5520dSAvraham Stern trigger_based:1, 406373807523SAvraham Stern non_trigger_based:1, 406473807523SAvraham Stern lmr_feedback:1; 40659bb7e0f2SJohannes Berg u8 num_bursts_exp; 40669bb7e0f2SJohannes Berg u8 burst_duration; 40679bb7e0f2SJohannes Berg u8 ftms_per_burst; 40689bb7e0f2SJohannes Berg u8 ftmr_retries; 4069dd3e4fc7SAvraham Stern u8 bss_color; 40709bb7e0f2SJohannes Berg }; 40719bb7e0f2SJohannes Berg 40729bb7e0f2SJohannes Berg /** 40739bb7e0f2SJohannes Berg * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request 40749bb7e0f2SJohannes Berg * @addr: MAC address 40759bb7e0f2SJohannes Berg * @chandef: channel to use 40769bb7e0f2SJohannes Berg * @report_ap_tsf: report the associated AP's TSF 40779bb7e0f2SJohannes Berg * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer 40789bb7e0f2SJohannes Berg */ 40799bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer { 40809bb7e0f2SJohannes Berg u8 addr[ETH_ALEN]; 40819bb7e0f2SJohannes Berg struct cfg80211_chan_def chandef; 40829bb7e0f2SJohannes Berg u8 report_ap_tsf:1; 40839bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer ftm; 40849bb7e0f2SJohannes Berg }; 40859bb7e0f2SJohannes Berg 40869bb7e0f2SJohannes Berg /** 40879bb7e0f2SJohannes Berg * struct cfg80211_pmsr_request - peer measurement request 40889bb7e0f2SJohannes Berg * @cookie: cookie, set by cfg80211 40899bb7e0f2SJohannes Berg * @nl_portid: netlink portid - used by cfg80211 40909bb7e0f2SJohannes Berg * @drv_data: driver data for this request, if required for aborting, 40919bb7e0f2SJohannes Berg * not otherwise freed or anything by cfg80211 40929bb7e0f2SJohannes Berg * @mac_addr: MAC address used for (randomised) request 40939bb7e0f2SJohannes Berg * @mac_addr_mask: MAC address mask used for randomisation, bits that 40949bb7e0f2SJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 40959bb7e0f2SJohannes Berg * be taken from the @mac_addr 40969bb7e0f2SJohannes Berg * @list: used by cfg80211 to hold on to the request 40979bb7e0f2SJohannes Berg * @timeout: timeout (in milliseconds) for the whole operation, if 40989bb7e0f2SJohannes Berg * zero it means there's no timeout 40999bb7e0f2SJohannes Berg * @n_peers: number of peers to do measurements with 41009bb7e0f2SJohannes Berg * @peers: per-peer measurement request data 41019bb7e0f2SJohannes Berg */ 41029bb7e0f2SJohannes Berg struct cfg80211_pmsr_request { 41039bb7e0f2SJohannes Berg u64 cookie; 41049bb7e0f2SJohannes Berg void *drv_data; 41059bb7e0f2SJohannes Berg u32 n_peers; 41069bb7e0f2SJohannes Berg u32 nl_portid; 41079bb7e0f2SJohannes Berg 41089bb7e0f2SJohannes Berg u32 timeout; 41099bb7e0f2SJohannes Berg 41109bb7e0f2SJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 41119bb7e0f2SJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 41129bb7e0f2SJohannes Berg 41139bb7e0f2SJohannes Berg struct list_head list; 41149bb7e0f2SJohannes Berg 4115342bc7c9SKees Cook struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers); 41169bb7e0f2SJohannes Berg }; 41179bb7e0f2SJohannes Berg 41189bb7e0f2SJohannes Berg /** 4119cb74e977SSunil Dutt * struct cfg80211_update_owe_info - OWE Information 4120cb74e977SSunil Dutt * 4121cb74e977SSunil Dutt * This structure provides information needed for the drivers to offload OWE 4122cb74e977SSunil Dutt * (Opportunistic Wireless Encryption) processing to the user space. 4123cb74e977SSunil Dutt * 4124cb74e977SSunil Dutt * Commonly used across update_owe_info request and event interfaces. 4125cb74e977SSunil Dutt * 4126cb74e977SSunil Dutt * @peer: MAC address of the peer device for which the OWE processing 4127cb74e977SSunil Dutt * has to be done. 4128cb74e977SSunil Dutt * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info 4129cb74e977SSunil Dutt * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space 4130cb74e977SSunil Dutt * cannot give you the real status code for failures. Used only for 4131cb74e977SSunil Dutt * OWE update request command interface (user space to driver). 4132cb74e977SSunil Dutt * @ie: IEs obtained from the peer or constructed by the user space. These are 4133cb74e977SSunil Dutt * the IEs of the remote peer in the event from the host driver and 4134cb74e977SSunil Dutt * the constructed IEs by the user space in the request interface. 4135cb74e977SSunil Dutt * @ie_len: Length of IEs in octets. 41368bb588d9SVeerendranath Jakkam * @assoc_link_id: MLO link ID of the AP, with which (re)association requested 41378bb588d9SVeerendranath Jakkam * by peer. This will be filled by driver for both MLO and non-MLO station 41388bb588d9SVeerendranath Jakkam * connections when the AP affiliated with an MLD. For non-MLD AP mode, it 41398bb588d9SVeerendranath Jakkam * will be -1. Used only with OWE update event (driver to user space). 41408bb588d9SVeerendranath Jakkam * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO 41418bb588d9SVeerendranath Jakkam * connection, it will be all zeros. This is applicable only when 41428bb588d9SVeerendranath Jakkam * @assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only 41438bb588d9SVeerendranath Jakkam * with OWE update event (driver to user space). 4144cb74e977SSunil Dutt */ 4145cb74e977SSunil Dutt struct cfg80211_update_owe_info { 4146cb74e977SSunil Dutt u8 peer[ETH_ALEN] __aligned(2); 4147cb74e977SSunil Dutt u16 status; 4148cb74e977SSunil Dutt const u8 *ie; 4149cb74e977SSunil Dutt size_t ie_len; 41508bb588d9SVeerendranath Jakkam int assoc_link_id; 41518bb588d9SVeerendranath Jakkam u8 peer_mld_addr[ETH_ALEN] __aligned(2); 4152cb74e977SSunil Dutt }; 4153cb74e977SSunil Dutt 4154cb74e977SSunil Dutt /** 41556cd536feSJohannes Berg * struct mgmt_frame_regs - management frame registrations data 41566cd536feSJohannes Berg * @global_stypes: bitmap of management frame subtypes registered 41576cd536feSJohannes Berg * for the entire device 41586cd536feSJohannes Berg * @interface_stypes: bitmap of management frame subtypes registered 41596cd536feSJohannes Berg * for the given interface 41602d8b08feSMauro Carvalho Chehab * @global_mcast_stypes: mcast RX is needed globally for these subtypes 41619dba48a6SJohannes Berg * @interface_mcast_stypes: mcast RX is needed on this interface 41629dba48a6SJohannes Berg * for these subtypes 41636cd536feSJohannes Berg */ 41646cd536feSJohannes Berg struct mgmt_frame_regs { 41656cd536feSJohannes Berg u32 global_stypes, interface_stypes; 41669dba48a6SJohannes Berg u32 global_mcast_stypes, interface_mcast_stypes; 41676cd536feSJohannes Berg }; 41686cd536feSJohannes Berg 41696cd536feSJohannes Berg /** 4170704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 4171704232c2SJohannes Berg * 4172704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 4173704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 4174704232c2SJohannes Berg * 4175704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 4176704232c2SJohannes Berg * on success or a negative error code. 4177704232c2SJohannes Berg * 4178a05829a7SJohannes Berg * All operations are invoked with the wiphy mutex held. The RTNL may be 4179a05829a7SJohannes Berg * held in addition (due to wireless extensions) but this cannot be relied 4180a05829a7SJohannes Berg * upon except in cases where documented below. Note that due to ordering, 4181a05829a7SJohannes Berg * the RTNL also cannot be acquired in any handlers. 418243fb45cbSJohannes Berg * 4183ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 4184ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 4185ff1b6e69SJohannes Berg * configured for the device. 41860378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 41876d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 41886d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 41896d52563fSJohannes Berg * the device. 41900378b3f1SJohannes Berg * 419160719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 4192463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 419384efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 419498104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 419598104fdeSJohannes Berg * also set the address member in the wdev. 4196a05829a7SJohannes Berg * This additionally holds the RTNL to be able to do netdev changes. 4197704232c2SJohannes Berg * 419884efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 4199a05829a7SJohannes Berg * This additionally holds the RTNL to be able to do netdev changes. 420055682965SJohannes Berg * 420160719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 420260719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 4203a05829a7SJohannes Berg * This additionally holds the RTNL to be able to do netdev changes. 420455682965SJohannes Berg * 4205f2a0290bSJohannes Berg * @add_intf_link: Add a new MLO link to the given interface. Note that 4206f2a0290bSJohannes Berg * the wdev->link[] data structure has been updated, so the new link 4207f2a0290bSJohannes Berg * address is available. 4208f2a0290bSJohannes Berg * @del_intf_link: Remove an MLO link from the given interface. 4209f2a0290bSJohannes Berg * 421041ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 4211e7a7b84eSVeerendranath Jakkam * when adding a group key. @link_id will be -1 for non-MLO connection. 4212e7a7b84eSVeerendranath Jakkam * For MLO connection, @link_id will be >= 0 for group key and -1 for 4213e7a7b84eSVeerendranath Jakkam * pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key. 421441ade00fSJohannes Berg * 421541ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 421641ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 421741ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 4218e3da574aSJohannes Berg * after it returns. This function should return an error if it is 4219e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 4220e7a7b84eSVeerendranath Jakkam * @link_id will be -1 for non-MLO connection. For MLO connection, 4221e7a7b84eSVeerendranath Jakkam * @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr 4222e7a7b84eSVeerendranath Jakkam * will be peer's MLD address for MLO pairwise key. 422341ade00fSJohannes Berg * 422441ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 4225e7a7b84eSVeerendranath Jakkam * and @key_index, return -ENOENT if the key doesn't exist. @link_id will 4226e7a7b84eSVeerendranath Jakkam * be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0 4227e7a7b84eSVeerendranath Jakkam * for group key and -1 for pairwise key, @mac_addr will be peer's MLD 4228e7a7b84eSVeerendranath Jakkam * address for MLO pairwise key. 422941ade00fSJohannes Berg * 4230e7a7b84eSVeerendranath Jakkam * @set_default_key: set the default key on an interface. @link_id will be >= 0 4231e7a7b84eSVeerendranath Jakkam * for MLO connection and -1 for non-MLO connection. 4232ed1b6cc7SJohannes Berg * 4233e7a7b84eSVeerendranath Jakkam * @set_default_mgmt_key: set the default management frame key on an interface. 4234e7a7b84eSVeerendranath Jakkam * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection. 42351f7e9f46SJohannes Berg * 4236e7a7b84eSVeerendranath Jakkam * @set_default_beacon_key: set the default Beacon frame key on an interface. 4237e7a7b84eSVeerendranath Jakkam * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection. 42383cfcf6acSJouni Malinen * 4239e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 4240e5497d76SJohannes Berg * 4241c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 4242c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 4243c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 4244c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 42455727ef1bSJohannes Berg * 42465727ef1bSJohannes Berg * @add_station: Add a new station. 424789c771e5SJouni Malinen * @del_station: Remove a station 4248bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 4249bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 4250bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 425177ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 425277ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 4253abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 4254abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 4255abe37c4bSJohannes Berg * 4256abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 4257abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 4258abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 4259abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 4260abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 426166be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 426266be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 4263f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 42648d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 4265f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 42668d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 42672ec600d6SLuis Carlos Cobo * 426824bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 426993da9cc1Scolin@cozybit.com * 427024bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 427193da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 427293da9cc1Scolin@cozybit.com * set, and which to leave alone. 427393da9cc1Scolin@cozybit.com * 42749f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 427531888487SJouni Malinen * 42765db25290SBenjamin Berg * @inform_bss: Called by cfg80211 while being informed about new BSS data 42775db25290SBenjamin Berg * for every BSS found within the reported data or frame. This is called 42785db25290SBenjamin Berg * from within the cfg8011 inform_bss handlers while holding the bss_lock. 42795db25290SBenjamin Berg * The data parameter is passed through from drv_data inside 42805db25290SBenjamin Berg * struct cfg80211_inform_bss. 42815db25290SBenjamin Berg * The new IE data for the BSS is explicitly passed. 42825db25290SBenjamin Berg * 428331888487SJouni Malinen * @set_txq_params: Set TX queue parameters 428472bdcf34SJouni Malinen * 4285e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 4286e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 4287e8c9bd5bSJohannes Berg * join the mesh instead. 4288e8c9bd5bSJohannes Berg * 4289e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 4290e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 4291e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 4292e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 42939aed3cc1SJouni Malinen * 42942a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 42952a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 42962a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 42972a519311SJohannes Berg * the scan/scan_done bracket too. 429891d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 429991d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 4300636a5d36SJouni Malinen * 4301636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 43028d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 4303636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 43048d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 4305636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 43068d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 4307636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 43088d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 430904a773adSJohannes Berg * 4310b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 4311bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 4312bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 4313bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 4314bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 4315bf1ecd21SJouni Malinen * was received. 4316bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 4317bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 4318bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 4319bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 4320bf1ecd21SJouni Malinen * frame instead of Association Request frame. 4321bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 4322bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 432335eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 4324bf1ecd21SJouni Malinen * indication of requesting reassociation. 4325bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 4326bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 432729ce6ecbSAvraham Stern * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 4328088e8df8Svamsi krishna * @update_connect_params: Update the connect parameters while connected to a 4329088e8df8Svamsi krishna * BSS. The updated parameters can be used by driver/firmware for 4330088e8df8Svamsi krishna * subsequent BSS selection (roaming) decisions and to form the 4331088e8df8Svamsi krishna * Authentication/(Re)Association Request frames. This call does not 4332088e8df8Svamsi krishna * request an immediate disassociation or reassociation with the current 4333088e8df8Svamsi krishna * BSS, i.e., this impacts only subsequent (re)associations. The bits in 4334088e8df8Svamsi krishna * changed are defined in &enum cfg80211_connect_params_changed. 4335088e8df8Svamsi krishna * (invoked with the wireless_dev mutex held) 43360711d638SIlan Peer * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 43370711d638SIlan Peer * connection is in progress. Once done, call cfg80211_disconnected() in 43380711d638SIlan Peer * case connection was already established (invoked with the 43390711d638SIlan Peer * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 4340b23aa676SSamuel Ortiz * 434104a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 434204a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 434304a773adSJohannes Berg * to a merge. 43448d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 434504a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 43468d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 4347b9a5f8caSJouni Malinen * 4348f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 4349f4e583c8SAntonio Quartulli * MESH mode) 4350f4e583c8SAntonio Quartulli * 4351b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 4352b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 4353b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 4354b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 43557643a2c3SJohannes Berg * 43561432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 4357c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 4358c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 4359c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 4360c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 43617643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 43621f87f7d3SJohannes Berg * return 0 if successful 43631f87f7d3SJohannes Berg * 43641f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 43651f87f7d3SJohannes Berg * functions to adjust rfkill hw state 4366aff89a9bSJohannes Berg * 436761fa713cSHolger Schurig * @dump_survey: get site survey information. 436861fa713cSHolger Schurig * 43699588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 43709588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 43719588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 43729588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 43739588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 43749588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 43759588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 43769588bbd5SJouni Malinen * the duration value. 4377f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 4378f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 4379f7ca38dfSJohannes Berg * frame on another channel 43809588bbd5SJouni Malinen * 4381fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 438271063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 438371063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 438471063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 438571063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 438671063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 438771063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 438867fbb16bSSamuel Ortiz * 4389abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 4390abe37c4bSJohannes Berg * 439167fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 439267fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 439367fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 439467fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 439567fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 43969043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 43979043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 4398d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 4399e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 4400e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 4401e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 4402e86abc68SJohannes Berg * disabled.) 44034a4b8169SAndrew Zaborowski * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 44044a4b8169SAndrew Zaborowski * connection quality monitor. An event is to be sent only when the 44054a4b8169SAndrew Zaborowski * signal level is found to be outside the two values. The driver should 44064a4b8169SAndrew Zaborowski * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 44074a4b8169SAndrew Zaborowski * If it is provided then there's no point providing @set_cqm_rssi_config. 440884f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 440984f10708SThomas Pedersen * thresholds. 4410807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 44113a3ecf1dSArend Van Spriel * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 44123a3ecf1dSArend Van Spriel * given request id. This call must stop the scheduled scan and be ready 44133a3ecf1dSArend Van Spriel * for starting a new one before it returns, i.e. @sched_scan_start may be 44143a3ecf1dSArend Van Spriel * called immediately after that again and should not fail in that case. 44153a3ecf1dSArend Van Spriel * The driver should not call cfg80211_sched_scan_stopped() for a requested 44163a3ecf1dSArend Van Spriel * stop (when this method returns 0). 441767fbb16bSSamuel Ortiz * 44186cd536feSJohannes Berg * @update_mgmt_frame_registrations: Notify the driver that management frame 44196cd536feSJohannes Berg * registrations were updated. The callback is allowed to sleep. 4420547025d5SBruno Randolf * 4421547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 4422547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 4423547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 4424547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 4425547025d5SBruno Randolf * 4426547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 44273677713bSJohn W. Linville * 4428109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 4429109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 44307f6cf311SJohannes Berg * 44317f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 44327f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 44331d9d9213SSimon Wunderlich * 44341d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 4435d6199218SBen Greear * 44365b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 44375b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 44385b7ccaf3SJohannes Berg * current monitoring channel. 443998104fdeSJohannes Berg * 444098104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 444198104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 444277765eafSVasanthakumar Thiagarajan * 444377765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 444477765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 444577765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 444677765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 444777765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 444877765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 444904f39047SSimon Wunderlich * 445004f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 44518bf24293SJouni Malinen * 445226ec17a1SOrr Mazor * @end_cac: End running CAC, probably because a related CAC 445326ec17a1SOrr Mazor * was finished on another phy. 445426ec17a1SOrr Mazor * 44558bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 44568bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 44578bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 44585de17984SArend van Spriel * 44595de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 44605de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 44615de17984SArend van Spriel * driver can take the most appropriate actions. 44625de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 44635de17984SArend van Spriel * reliability. This operation can not fail. 4464be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 446516ef1fe2SSimon Wunderlich * 446697dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 446797dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 446897dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 446997dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 447097dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 447197dc94f1SMichal Kazior * as soon as possible. 4472fa9ffc74SKyeyoon Park * 4473fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 4474e16821bcSJouni Malinen * 4475e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 4476e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 4477e16821bcSJouni Malinen * changes during the lifetime of the BSS. 4478960d01acSJohannes Berg * 4479960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 4480960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 4481960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 4482960d01acSJohannes Berg * account. 4483960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 4484960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 4485960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 4486960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 4487960d01acSJohannes Berg * rejected) 4488960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 44896e0bd6c3SRostislav Lisovy * 44906e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 44916e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 44926e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 44936e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 44941057d35eSArik Nemtsov * 44951057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 44961057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 44971057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 44981057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 44991057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 4500cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 4501cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 4502a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 4503a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 4504a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 4505a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 4506a442b761SAyala Beker * cfg80211_free_nan_func(). 4507a442b761SAyala Beker * On success the driver should assign an instance_id in the 4508a442b761SAyala Beker * provided @nan_func. 4509a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 4510a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 4511a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 4512a5a9dcf2SAyala Beker * All other parameters must be ignored. 4513ce0ce13aSMichael Braun * 4514ce0ce13aSMichael Braun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 45153a00df57SAvraham Stern * 451652539ca8SToke Høiland-Jørgensen * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this 451752539ca8SToke Høiland-Jørgensen * function should return phy stats, and interface stats otherwise. 451852539ca8SToke Høiland-Jørgensen * 45193a00df57SAvraham Stern * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 45203a00df57SAvraham Stern * If not deleted through @del_pmk the PMK remains valid until disconnect 45213a00df57SAvraham Stern * upon which the driver should clear it. 45223a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 45233a00df57SAvraham Stern * @del_pmk: delete the previously configured PMK for the given authenticator. 45243a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 452540cbfa90SSrinivas Dasari * 452640cbfa90SSrinivas Dasari * @external_auth: indicates result of offloaded authentication processing from 452740cbfa90SSrinivas Dasari * user space 45282576a9acSDenis Kenzior * 45292576a9acSDenis Kenzior * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter 45302576a9acSDenis Kenzior * tells the driver that the frame should not be encrypted. 453181e54d08SPradeep Kumar Chitrapu * 453281e54d08SPradeep Kumar Chitrapu * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. 453381e54d08SPradeep Kumar Chitrapu * Statistics should be cumulative, currently no way to reset is provided. 45349bb7e0f2SJohannes Berg * @start_pmsr: start peer measurement (e.g. FTM) 45359bb7e0f2SJohannes Berg * @abort_pmsr: abort peer measurement 4536cb74e977SSunil Dutt * 4537cb74e977SSunil Dutt * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME 4538cb74e977SSunil Dutt * but offloading OWE processing to the user space will get the updated 4539cb74e977SSunil Dutt * DH IE through this interface. 45405ab92e7fSRajkumar Manoharan * 45415ab92e7fSRajkumar Manoharan * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame 45425ab92e7fSRajkumar Manoharan * and overrule HWMP path selection algorithm. 454377f576deSTamizh chelvam * @set_tid_config: TID specific configuration, this can be peer or BSS specific 454477f576deSTamizh chelvam * This callback may sleep. 45453710a8a6SJohannes Berg * @reset_tid_config: Reset TID specific configuration for the peer, for the 45463710a8a6SJohannes Berg * given TIDs. This callback may sleep. 454770b6ff35SJohannes Berg * 454870b6ff35SJohannes Berg * @set_sar_specs: Update the SAR (TX power) settings. 45490d2ab3aeSJohn Crispin * 45500d2ab3aeSJohn Crispin * @color_change: Initiate a color change. 4551e306784aSSubrat Mishra * 4552e306784aSSubrat Mishra * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use 4553e306784aSSubrat Mishra * those to decrypt (Re)Association Request and encrypt (Re)Association 4554e306784aSSubrat Mishra * Response frame. 4555bc2dfc02SLorenzo Bianconi * 4556a95bfb87SLorenzo Bianconi * @set_radar_background: Configure dedicated offchannel chain available for 4557bc2dfc02SLorenzo Bianconi * radar/CAC detection on some hw. This chain can't be used to transmit 4558bc2dfc02SLorenzo Bianconi * or receive frames and it is bounded to a running wdev. 4559a95bfb87SLorenzo Bianconi * Background radar/CAC detection allows to avoid the CAC downtime 4560bc2dfc02SLorenzo Bianconi * switching to a different channel during CAC detection on the selected 4561bc2dfc02SLorenzo Bianconi * radar channel. 4562bc2dfc02SLorenzo Bianconi * The caller is expected to set chandef pointer to NULL in order to 4563a95bfb87SLorenzo Bianconi * disable background CAC/radar detection. 4564577e5b8cSShaul Triebitz * @add_link_station: Add a link to a station. 4565577e5b8cSShaul Triebitz * @mod_link_station: Modify a link of a station. 4566577e5b8cSShaul Triebitz * @del_link_station: Remove a link of a station. 4567cbbaf2bbSAvraham Stern * 4568cbbaf2bbSAvraham Stern * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. 4569b61e6b41SIlan Peer * @set_ttlm: set the TID to link mapping. 4570704232c2SJohannes Berg */ 4571704232c2SJohannes Berg struct cfg80211_ops { 4572ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 45730378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 45746d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 45750378b3f1SJohannes Berg 457684efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 4577552bff0cSJohannes Berg const char *name, 45786bab2e19STom Gundersen unsigned char name_assign_type, 4579f9e10ce4SJohannes Berg enum nl80211_iftype type, 45802ec600d6SLuis Carlos Cobo struct vif_params *params); 458184efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 458284efbb84SJohannes Berg struct wireless_dev *wdev); 4583e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 4584e36d56b6SJohannes Berg struct net_device *dev, 4585818a986eSJohannes Berg enum nl80211_iftype type, 45862ec600d6SLuis Carlos Cobo struct vif_params *params); 458741ade00fSJohannes Berg 4588f2a0290bSJohannes Berg int (*add_intf_link)(struct wiphy *wiphy, 4589f2a0290bSJohannes Berg struct wireless_dev *wdev, 4590f2a0290bSJohannes Berg unsigned int link_id); 4591f2a0290bSJohannes Berg void (*del_intf_link)(struct wiphy *wiphy, 4592f2a0290bSJohannes Berg struct wireless_dev *wdev, 4593f2a0290bSJohannes Berg unsigned int link_id); 4594f2a0290bSJohannes Berg 459541ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 4596e7a7b84eSVeerendranath Jakkam int link_id, u8 key_index, bool pairwise, 4597e7a7b84eSVeerendranath Jakkam const u8 *mac_addr, struct key_params *params); 459841ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 4599e7a7b84eSVeerendranath Jakkam int link_id, u8 key_index, bool pairwise, 4600e7a7b84eSVeerendranath Jakkam const u8 *mac_addr, void *cookie, 460141ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 460241ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 4603e7a7b84eSVeerendranath Jakkam int link_id, u8 key_index, bool pairwise, 4604e7a7b84eSVeerendranath Jakkam const u8 *mac_addr); 460541ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 4606e7a7b84eSVeerendranath Jakkam struct net_device *netdev, int link_id, 4607dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 46083cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 4609e7a7b84eSVeerendranath Jakkam struct net_device *netdev, int link_id, 46103cfcf6acSJouni Malinen u8 key_index); 461156be393fSJouni Malinen int (*set_default_beacon_key)(struct wiphy *wiphy, 461256be393fSJouni Malinen struct net_device *netdev, 4613e7a7b84eSVeerendranath Jakkam int link_id, 461456be393fSJouni Malinen u8 key_index); 4615ed1b6cc7SJohannes Berg 46168860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 46178860020eSJohannes Berg struct cfg80211_ap_settings *settings); 46188860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 4619bb55441cSJohannes Berg struct cfg80211_ap_update *info); 46207b0a0e3cSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev, 46217b0a0e3cSJohannes Berg unsigned int link_id); 46225727ef1bSJohannes Berg 46235727ef1bSJohannes Berg 46245727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 46253b3a0162SJohannes Berg const u8 *mac, 46263b3a0162SJohannes Berg struct station_parameters *params); 46275727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 462889c771e5SJouni Malinen struct station_del_parameters *params); 46295727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 46303b3a0162SJohannes Berg const u8 *mac, 46313b3a0162SJohannes Berg struct station_parameters *params); 4632fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 46333b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 46342ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 46352ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 46362ec600d6SLuis Carlos Cobo 46372ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 46383b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 46392ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 46403b3a0162SJohannes Berg const u8 *dst); 46412ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 46423b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 46432ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 46443b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 46452ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 46462ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 46472ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 464866be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 464966be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 465066be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 465166be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 465266be7d2bSHenning Rogge struct mpath_info *pinfo); 465324bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 465493da9cc1Scolin@cozybit.com struct net_device *dev, 465593da9cc1Scolin@cozybit.com struct mesh_config *conf); 465624bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 465729cbe68cSJohannes Berg struct net_device *dev, u32 mask, 465829cbe68cSJohannes Berg const struct mesh_config *nconf); 465929cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 466029cbe68cSJohannes Berg const struct mesh_config *conf, 466129cbe68cSJohannes Berg const struct mesh_setup *setup); 466229cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 466329cbe68cSJohannes Berg 46646e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 46656e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 46666e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 46676e0bd6c3SRostislav Lisovy 46689f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 46699f1ba906SJouni Malinen struct bss_parameters *params); 467031888487SJouni Malinen 46715db25290SBenjamin Berg void (*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss, 46725db25290SBenjamin Berg const struct cfg80211_bss_ies *ies, void *data); 46735db25290SBenjamin Berg 4674f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 467531888487SJouni Malinen struct ieee80211_txq_params *params); 467672bdcf34SJouni Malinen 4677e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 4678e8c9bd5bSJohannes Berg struct net_device *dev, 4679e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 4680e8c9bd5bSJohannes Berg 4681e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 4682683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 46839aed3cc1SJouni Malinen 4684fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 46852a519311SJohannes Berg struct cfg80211_scan_request *request); 468691d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4687636a5d36SJouni Malinen 4688636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 4689636a5d36SJouni Malinen struct cfg80211_auth_request *req); 4690636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 4691636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 4692636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 469363c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 4694636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 469563c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 469604a773adSJohannes Berg 4697b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 4698b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 4699088e8df8Svamsi krishna int (*update_connect_params)(struct wiphy *wiphy, 4700088e8df8Svamsi krishna struct net_device *dev, 4701088e8df8Svamsi krishna struct cfg80211_connect_params *sme, 4702088e8df8Svamsi krishna u32 changed); 4703b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 4704b23aa676SSamuel Ortiz u16 reason_code); 4705b23aa676SSamuel Ortiz 470604a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 470704a773adSJohannes Berg struct cfg80211_ibss_params *params); 470804a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 4709b9a5f8caSJouni Malinen 4710f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 471157fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 4712f4e583c8SAntonio Quartulli 4713b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 47147643a2c3SJohannes Berg 4715c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 4716fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 4717c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 4718c8442118SJohannes Berg int *dbm); 47191f87f7d3SJohannes Berg 47201f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 4721aff89a9bSJohannes Berg 4722aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4723fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 4724fc73f11fSDavid Spinadel void *data, int len); 472571063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 472671063f0eSWey-Yi Guy struct netlink_callback *cb, 472771063f0eSWey-Yi Guy void *data, int len); 4728aff89a9bSJohannes Berg #endif 4729bc92afd9SJohannes Berg 47309930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 47319930380fSJohannes Berg struct net_device *dev, 47327b0a0e3cSJohannes Berg unsigned int link_id, 47339930380fSJohannes Berg const u8 *peer, 47349930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 47359930380fSJohannes Berg 473661fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 473761fa713cSHolger Schurig int idx, struct survey_info *info); 473861fa713cSHolger Schurig 473967fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 474067fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 474167fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 474267fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 474367fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 474467fbb16bSSamuel Ortiz 47459588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 474671bbc994SJohannes Berg struct wireless_dev *wdev, 47479588bbd5SJouni Malinen struct ieee80211_channel *chan, 47489588bbd5SJouni Malinen unsigned int duration, 47499588bbd5SJouni Malinen u64 *cookie); 47509588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 475171bbc994SJohannes Berg struct wireless_dev *wdev, 47529588bbd5SJouni Malinen u64 cookie); 47539588bbd5SJouni Malinen 475471bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 4755b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 4756b176e629SAndrei Otcheretianski u64 *cookie); 4757f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 475871bbc994SJohannes Berg struct wireless_dev *wdev, 4759f7ca38dfSJohannes Berg u64 cookie); 4760026331c4SJouni Malinen 4761bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 4762bc92afd9SJohannes Berg bool enabled, int timeout); 4763d6dc1a38SJuuso Oikarinen 4764d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 4765d6dc1a38SJuuso Oikarinen struct net_device *dev, 4766d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 4767271733cfSJohannes Berg 47684a4b8169SAndrew Zaborowski int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 47694a4b8169SAndrew Zaborowski struct net_device *dev, 47704a4b8169SAndrew Zaborowski s32 rssi_low, s32 rssi_high); 47714a4b8169SAndrew Zaborowski 477284f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 477384f10708SThomas Pedersen struct net_device *dev, 477484f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 477584f10708SThomas Pedersen 47766cd536feSJohannes Berg void (*update_mgmt_frame_registrations)(struct wiphy *wiphy, 477771bbc994SJohannes Berg struct wireless_dev *wdev, 47786cd536feSJohannes Berg struct mgmt_frame_regs *upd); 4779afe0cbf8SBruno Randolf 4780afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 4781afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 47823677713bSJohn W. Linville 4783807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 4784807f8a8cSLuciano Coelho struct net_device *dev, 4785807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 47863a3ecf1dSArend Van Spriel int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 47873a3ecf1dSArend Van Spriel u64 reqid); 4788e5497d76SJohannes Berg 4789e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 4790e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 4791109086ceSArik Nemtsov 4792109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 4793c6112046SMukesh Sisodiya const u8 *peer, int link_id, 4794c6112046SMukesh Sisodiya u8 action_code, u8 dialog_token, u16 status_code, 4795c6112046SMukesh Sisodiya u32 peer_capability, bool initiator, 4796c6112046SMukesh Sisodiya const u8 *buf, size_t len); 4797109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 47983b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 47997f6cf311SJohannes Berg 48007f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 48017f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 4802e999882aSJohannes Berg 48031d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 48041d9d9213SSimon Wunderlich struct net_device *dev, 48051d9d9213SSimon Wunderlich u16 noack_map); 48061d9d9213SSimon Wunderlich 4807683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 48085b7ccaf3SJohannes Berg struct wireless_dev *wdev, 48097b0a0e3cSJohannes Berg unsigned int link_id, 4810683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 481198104fdeSJohannes Berg 481298104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 481398104fdeSJohannes Berg struct wireless_dev *wdev); 481498104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 481598104fdeSJohannes Berg struct wireless_dev *wdev); 481677765eafSVasanthakumar Thiagarajan 481777765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 481877765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 481904f39047SSimon Wunderlich 482004f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 482104f39047SSimon Wunderlich struct net_device *dev, 482231559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 482331559f35SJanusz Dziedzic u32 cac_time_ms); 482426ec17a1SOrr Mazor void (*end_cac)(struct wiphy *wiphy, 482526ec17a1SOrr Mazor struct net_device *dev); 4826355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 4827355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 48285de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 48295de17984SArend van Spriel struct wireless_dev *wdev, 48305de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 48315de17984SArend van Spriel u16 duration); 48325de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 48335de17984SArend van Spriel struct wireless_dev *wdev); 4834be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 4835be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 483616ef1fe2SSimon Wunderlich 483716ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 483816ef1fe2SSimon Wunderlich struct net_device *dev, 483916ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 4840e16821bcSJouni Malinen 4841fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 4842fa9ffc74SKyeyoon Park struct net_device *dev, 4843fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4844e16821bcSJouni Malinen 4845e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 48467b0a0e3cSJohannes Berg unsigned int link_id, 4847e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 4848960d01acSJohannes Berg 4849960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4850960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 4851960d01acSJohannes Berg u16 admitted_time); 4852960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4853960d01acSJohannes Berg u8 tsid, const u8 *peer); 48541057d35eSArik Nemtsov 48551057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 48561057d35eSArik Nemtsov struct net_device *dev, 48571057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 48581057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 48591057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 48601057d35eSArik Nemtsov struct net_device *dev, 48611057d35eSArik Nemtsov const u8 *addr); 4862cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 4863cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 4864cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4865a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4866a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 4867a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4868a442b761SAyala Beker u64 cookie); 4869a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 4870a5a9dcf2SAyala Beker struct wireless_dev *wdev, 4871a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 4872a5a9dcf2SAyala Beker u32 changes); 4873ce0ce13aSMichael Braun 4874ce0ce13aSMichael Braun int (*set_multicast_to_unicast)(struct wiphy *wiphy, 4875ce0ce13aSMichael Braun struct net_device *dev, 4876ce0ce13aSMichael Braun const bool enabled); 48773a00df57SAvraham Stern 487852539ca8SToke Høiland-Jørgensen int (*get_txq_stats)(struct wiphy *wiphy, 487952539ca8SToke Høiland-Jørgensen struct wireless_dev *wdev, 488052539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats *txqstats); 488152539ca8SToke Høiland-Jørgensen 48823a00df57SAvraham Stern int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 48833a00df57SAvraham Stern const struct cfg80211_pmk_conf *conf); 48843a00df57SAvraham Stern int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 48853a00df57SAvraham Stern const u8 *aa); 488640cbfa90SSrinivas Dasari int (*external_auth)(struct wiphy *wiphy, struct net_device *dev, 488740cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params); 48882576a9acSDenis Kenzior 48892576a9acSDenis Kenzior int (*tx_control_port)(struct wiphy *wiphy, 48902576a9acSDenis Kenzior struct net_device *dev, 48912576a9acSDenis Kenzior const u8 *buf, size_t len, 48928d74a623SJohannes Berg const u8 *dest, const __be16 proto, 489367207babSAndrei Otcheretianski const bool noencrypt, int link_id, 4894dca9ca2dSMarkus Theil u64 *cookie); 489581e54d08SPradeep Kumar Chitrapu 489681e54d08SPradeep Kumar Chitrapu int (*get_ftm_responder_stats)(struct wiphy *wiphy, 489781e54d08SPradeep Kumar Chitrapu struct net_device *dev, 489881e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats *ftm_stats); 48999bb7e0f2SJohannes Berg 49009bb7e0f2SJohannes Berg int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 49019bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *request); 49029bb7e0f2SJohannes Berg void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 49039bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *request); 4904cb74e977SSunil Dutt int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev, 4905cb74e977SSunil Dutt struct cfg80211_update_owe_info *owe_info); 49065ab92e7fSRajkumar Manoharan int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev, 49075ab92e7fSRajkumar Manoharan const u8 *buf, size_t len); 490877f576deSTamizh chelvam int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev, 49093710a8a6SJohannes Berg struct cfg80211_tid_config *tid_conf); 491077f576deSTamizh chelvam int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, 49113710a8a6SJohannes Berg const u8 *peer, u8 tids); 49126bdb68ceSCarl Huang int (*set_sar_specs)(struct wiphy *wiphy, 49136bdb68ceSCarl Huang struct cfg80211_sar_specs *sar); 49140d2ab3aeSJohn Crispin int (*color_change)(struct wiphy *wiphy, 49150d2ab3aeSJohn Crispin struct net_device *dev, 49160d2ab3aeSJohn Crispin struct cfg80211_color_change_settings *params); 4917e306784aSSubrat Mishra int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev, 4918e306784aSSubrat Mishra struct cfg80211_fils_aad *fils_aad); 4919a95bfb87SLorenzo Bianconi int (*set_radar_background)(struct wiphy *wiphy, 4920bc2dfc02SLorenzo Bianconi struct cfg80211_chan_def *chandef); 4921577e5b8cSShaul Triebitz int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev, 4922577e5b8cSShaul Triebitz struct link_station_parameters *params); 4923577e5b8cSShaul Triebitz int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev, 4924577e5b8cSShaul Triebitz struct link_station_parameters *params); 4925577e5b8cSShaul Triebitz int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev, 4926577e5b8cSShaul Triebitz struct link_station_del_parameters *params); 4927cbbaf2bbSAvraham Stern int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev, 4928cbbaf2bbSAvraham Stern struct cfg80211_set_hw_timestamp *hwts); 4929b61e6b41SIlan Peer int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev, 4930b61e6b41SIlan Peer struct cfg80211_ttlm_params *params); 4931704232c2SJohannes Berg }; 4932704232c2SJohannes Berg 4933d3236553SJohannes Berg /* 4934d3236553SJohannes Berg * wireless hardware and networking interfaces structures 4935d3236553SJohannes Berg * and registration/helper functions 4936d3236553SJohannes Berg */ 4937d3236553SJohannes Berg 4938d3236553SJohannes Berg /** 49395be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 49405be83de5SJohannes Berg * 4941c8cb5b85STova Mussai * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split 49427b5e25b8SJohannes Berg * into two, first for legacy bands and second for 6 GHz. 49435be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 49445be83de5SJohannes Berg * wiphy at all 49455be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 49465be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 49475be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 49485be83de5SJohannes Berg * reason to override the default 49499bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 495033d915d9SManikanta Pubbisetty * on a VLAN interface). This flag also serves an extra purpose of 495133d915d9SManikanta Pubbisetty * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. 49529bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 4953c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 4954c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 4955c0692b8fSJohannes Berg * control_port_no_encrypt flag. 4956e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 495715d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 495815d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 4959f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 4960f4b34b55SVivek Natarajan * firmware. 4961cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 4962109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 4963109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 4964109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 4965109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 4966109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 4967109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 4968562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 49695e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 49705e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 49715e760230SJohannes Berg * cfg80211_report_obss_beacon(). 497287bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 497387bbbe22SArik Nemtsov * responds to probe-requests in hardware. 49747c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 49757c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 49762f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 497716ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 497816ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 4979093a48d2SNathan Errera * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys 49807b0a0e3cSJohannes Berg * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs, 49817b0a0e3cSJohannes Berg * in order to not have them reachable in normal drivers, until we have 49827b0a0e3cSJohannes Berg * complete feature/interface combinations/etc. advertisement. No driver 49837b0a0e3cSJohannes Berg * should set this flag for now. 4984648fba79SShivani Baranwal * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys. 4985d99975c4SWen Gong * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for 4986d99975c4SWen Gong * NL80211_REGDOM_SET_BY_DRIVER. 4987b13b6bbfSAbhishek Kumar * @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver 4988b13b6bbfSAbhishek Kumar * set this flag to update channels on beacon hints. 4989d02a12b8SJohannes Berg * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link 4990d02a12b8SJohannes Berg * of an NSTR mobile AP MLD. 49915be83de5SJohannes Berg */ 49925be83de5SJohannes Berg enum wiphy_flags { 4993093a48d2SNathan Errera WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), 49947b0a0e3cSJohannes Berg WIPHY_FLAG_SUPPORTS_MLO = BIT(1), 4995c8cb5b85STova Mussai WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2), 49965be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 49975be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 49989bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 49999bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 5000c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 5001309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 500215d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 5003648fba79SShivani Baranwal WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11), 5004d02a12b8SJohannes Berg WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12), 5005f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 5006cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 5007109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 5008109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 5009562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 50105e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 501187bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 50127c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 50137c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 50142f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 501516ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 5016d99975c4SWen Gong WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24), 5017b13b6bbfSAbhishek Kumar WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25), 50187527a782SJohannes Berg }; 50197527a782SJohannes Berg 50207527a782SJohannes Berg /** 50217527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 50227527a782SJohannes Berg * @max: maximum number of interfaces of these types 50237527a782SJohannes Berg * @types: interface types (bits) 50247527a782SJohannes Berg */ 50257527a782SJohannes Berg struct ieee80211_iface_limit { 50267527a782SJohannes Berg u16 max; 50277527a782SJohannes Berg u16 types; 50287527a782SJohannes Berg }; 50297527a782SJohannes Berg 50307527a782SJohannes Berg /** 50317527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 50327527a782SJohannes Berg * 5033b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 5034b80edbc1SLuciano Coelho * combinations it supports concurrently. 50357527a782SJohannes Berg * 5036b80edbc1SLuciano Coelho * Examples: 5037b80edbc1SLuciano Coelho * 5038b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 50397527a782SJohannes Berg * 5040819bf593SJohannes Berg * .. code-block:: c 5041819bf593SJohannes Berg * 50427527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 50437527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 50444d371d6eSPhilipp Hortmann * { .max = 1, .types = BIT(NL80211_IFTYPE_AP), }, 50457527a782SJohannes Berg * }; 50467527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 50477527a782SJohannes Berg * .limits = limits1, 50487527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 50497527a782SJohannes Berg * .max_interfaces = 2, 50507527a782SJohannes Berg * .beacon_int_infra_match = true, 50517527a782SJohannes Berg * }; 50527527a782SJohannes Berg * 50537527a782SJohannes Berg * 5054b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 50557527a782SJohannes Berg * 5056819bf593SJohannes Berg * .. code-block:: c 5057819bf593SJohannes Berg * 50587527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 50597527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 50607527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 50617527a782SJohannes Berg * }; 50627527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 50637527a782SJohannes Berg * .limits = limits2, 50647527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 50657527a782SJohannes Berg * .max_interfaces = 8, 50667527a782SJohannes Berg * .num_different_channels = 1, 50677527a782SJohannes Berg * }; 50687527a782SJohannes Berg * 50697527a782SJohannes Berg * 5070b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 5071b80edbc1SLuciano Coelho * 50727527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 50737527a782SJohannes Berg * 5074819bf593SJohannes Berg * .. code-block:: c 5075819bf593SJohannes Berg * 50767527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 50777527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 50787527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 50797527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 50807527a782SJohannes Berg * }; 50817527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 50827527a782SJohannes Berg * .limits = limits3, 50837527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 50847527a782SJohannes Berg * .max_interfaces = 4, 50857527a782SJohannes Berg * .num_different_channels = 2, 50867527a782SJohannes Berg * }; 5087819bf593SJohannes Berg * 50887527a782SJohannes Berg */ 50897527a782SJohannes Berg struct ieee80211_iface_combination { 5090c6c94aeaSJohannes Berg /** 5091c6c94aeaSJohannes Berg * @limits: 5092c6c94aeaSJohannes Berg * limits for the given interface types 5093c6c94aeaSJohannes Berg */ 50947527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 5095c6c94aeaSJohannes Berg 5096c6c94aeaSJohannes Berg /** 5097c6c94aeaSJohannes Berg * @num_different_channels: 5098c6c94aeaSJohannes Berg * can use up to this many different channels 5099c6c94aeaSJohannes Berg */ 51007527a782SJohannes Berg u32 num_different_channels; 5101c6c94aeaSJohannes Berg 5102c6c94aeaSJohannes Berg /** 5103c6c94aeaSJohannes Berg * @max_interfaces: 5104c6c94aeaSJohannes Berg * maximum number of interfaces in total allowed in this group 5105c6c94aeaSJohannes Berg */ 51067527a782SJohannes Berg u16 max_interfaces; 5107c6c94aeaSJohannes Berg 5108c6c94aeaSJohannes Berg /** 5109c6c94aeaSJohannes Berg * @n_limits: 5110c6c94aeaSJohannes Berg * number of limitations 5111c6c94aeaSJohannes Berg */ 51127527a782SJohannes Berg u8 n_limits; 5113c6c94aeaSJohannes Berg 5114c6c94aeaSJohannes Berg /** 5115c6c94aeaSJohannes Berg * @beacon_int_infra_match: 5116c6c94aeaSJohannes Berg * In this combination, the beacon intervals between infrastructure 5117c6c94aeaSJohannes Berg * and AP types must match. This is required only in special cases. 5118c6c94aeaSJohannes Berg */ 51197527a782SJohannes Berg bool beacon_int_infra_match; 5120c6c94aeaSJohannes Berg 5121c6c94aeaSJohannes Berg /** 5122c6c94aeaSJohannes Berg * @radar_detect_widths: 5123c6c94aeaSJohannes Berg * bitmap of channel widths supported for radar detection 5124c6c94aeaSJohannes Berg */ 512511c4a075SSimon Wunderlich u8 radar_detect_widths; 5126c6c94aeaSJohannes Berg 5127c6c94aeaSJohannes Berg /** 5128c6c94aeaSJohannes Berg * @radar_detect_regions: 5129c6c94aeaSJohannes Berg * bitmap of regions supported for radar detection 5130c6c94aeaSJohannes Berg */ 51318c48b50aSFelix Fietkau u8 radar_detect_regions; 5132c6c94aeaSJohannes Berg 5133c6c94aeaSJohannes Berg /** 5134c6c94aeaSJohannes Berg * @beacon_int_min_gcd: 5135c6c94aeaSJohannes Berg * This interface combination supports different beacon intervals. 5136c6c94aeaSJohannes Berg * 5137c6c94aeaSJohannes Berg * = 0 5138c6c94aeaSJohannes Berg * all beacon intervals for different interface must be same. 5139c6c94aeaSJohannes Berg * > 0 5140c6c94aeaSJohannes Berg * any beacon interval for the interface part of this combination AND 5141c6c94aeaSJohannes Berg * GCD of all beacon intervals from beaconing interfaces of this 5142c6c94aeaSJohannes Berg * combination must be greater or equal to this value. 5143c6c94aeaSJohannes Berg */ 51440c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 51455be83de5SJohannes Berg }; 51465be83de5SJohannes Berg 51472e161f78SJohannes Berg struct ieee80211_txrx_stypes { 51482e161f78SJohannes Berg u16 tx, rx; 51492e161f78SJohannes Berg }; 51502e161f78SJohannes Berg 51515be83de5SJohannes Berg /** 5152ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 5153ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 5154ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 5155ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 5156ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 5157ff1b6e69SJohannes Berg * packet should be preserved in that case 5158ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 5159ff1b6e69SJohannes Berg * (see nl80211.h) 5160ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 516177dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 516277dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 516377dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 516477dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 516577dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 51668cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 5167ff1b6e69SJohannes Berg */ 5168ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 5169ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 5170ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 5171ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 517277dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 517377dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 517477dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 517577dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 517677dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 51778cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 5178ff1b6e69SJohannes Berg }; 5179ff1b6e69SJohannes Berg 51802a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 51812a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 51822a0e047eSJohannes Berg u32 data_payload_max; 51832a0e047eSJohannes Berg u32 data_interval_max; 51842a0e047eSJohannes Berg u32 wake_payload_max; 51852a0e047eSJohannes Berg bool seq; 51862a0e047eSJohannes Berg }; 51872a0e047eSJohannes Berg 5188ff1b6e69SJohannes Berg /** 5189ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 5190ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 5191ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 5192ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 5193ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 5194ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 5195bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 51968cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 51978cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 51988cd4d456SLuciano Coelho * scheduled scans. 51998cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 52008cd4d456SLuciano Coelho * details. 52012a0e047eSJohannes Berg * @tcp: TCP wakeup support information 5202ff1b6e69SJohannes Berg */ 5203ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 5204ff1b6e69SJohannes Berg u32 flags; 5205ff1b6e69SJohannes Berg int n_patterns; 5206ff1b6e69SJohannes Berg int pattern_max_len; 5207ff1b6e69SJohannes Berg int pattern_min_len; 5208bb92d199SAmitkumar Karwar int max_pkt_offset; 52098cd4d456SLuciano Coelho int max_nd_match_sets; 52102a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 5211ff1b6e69SJohannes Berg }; 5212ff1b6e69SJohannes Berg 5213ff1b6e69SJohannes Berg /** 5214be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 5215be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 5216be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 5217be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 5218be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 5219be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 5220be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 5221be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 5222be29b99aSAmitkumar Karwar */ 5223be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 5224be29b99aSAmitkumar Karwar int n_rules; 5225be29b99aSAmitkumar Karwar int max_delay; 5226be29b99aSAmitkumar Karwar int n_patterns; 5227be29b99aSAmitkumar Karwar int pattern_max_len; 5228be29b99aSAmitkumar Karwar int pattern_min_len; 5229be29b99aSAmitkumar Karwar int max_pkt_offset; 5230be29b99aSAmitkumar Karwar }; 5231be29b99aSAmitkumar Karwar 5232be29b99aSAmitkumar Karwar /** 5233ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 5234ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 5235ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 5236ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 5237ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 5238ad7e718cSJohannes Berg */ 5239ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 5240ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 5241ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 5242ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 5243ad7e718cSJohannes Berg }; 5244ad7e718cSJohannes Berg 5245ad7e718cSJohannes Berg /** 5246466b9936Stamizhr@codeaurora.org * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags 5247466b9936Stamizhr@codeaurora.org * 5248466b9936Stamizhr@codeaurora.org * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed 5249466b9936Stamizhr@codeaurora.org * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed 5250466b9936Stamizhr@codeaurora.org * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed 5251466b9936Stamizhr@codeaurora.org * 5252466b9936Stamizhr@codeaurora.org */ 5253466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag { 5254466b9936Stamizhr@codeaurora.org STA_OPMODE_MAX_BW_CHANGED = BIT(0), 5255466b9936Stamizhr@codeaurora.org STA_OPMODE_SMPS_MODE_CHANGED = BIT(1), 5256466b9936Stamizhr@codeaurora.org STA_OPMODE_N_SS_CHANGED = BIT(2), 5257466b9936Stamizhr@codeaurora.org }; 5258466b9936Stamizhr@codeaurora.org 5259466b9936Stamizhr@codeaurora.org /** 5260466b9936Stamizhr@codeaurora.org * struct sta_opmode_info - Station's ht/vht operation mode information 5261466b9936Stamizhr@codeaurora.org * @changed: contains value from &enum wiphy_opmode_flag 52625e78abd0Stamizhr@codeaurora.org * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station 52635e78abd0Stamizhr@codeaurora.org * @bw: new max bandwidth value from &enum nl80211_chan_width of a station 5264466b9936Stamizhr@codeaurora.org * @rx_nss: new rx_nss value of a station 5265466b9936Stamizhr@codeaurora.org */ 5266466b9936Stamizhr@codeaurora.org 5267466b9936Stamizhr@codeaurora.org struct sta_opmode_info { 5268466b9936Stamizhr@codeaurora.org u32 changed; 52695e78abd0Stamizhr@codeaurora.org enum nl80211_smps_mode smps_mode; 52705e78abd0Stamizhr@codeaurora.org enum nl80211_chan_width bw; 5271466b9936Stamizhr@codeaurora.org u8 rx_nss; 5272466b9936Stamizhr@codeaurora.org }; 5273466b9936Stamizhr@codeaurora.org 527491046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA)) 5275901bb989SJohannes Berg 5276466b9936Stamizhr@codeaurora.org /** 5277ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 5278ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 5279ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 5280ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 5281ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 5282ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 52837bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 52847bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 52857bdbe400SJohannes Berg * dumpit calls. 5286901bb989SJohannes Berg * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA. 5287901bb989SJohannes Berg * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the 5288901bb989SJohannes Berg * attribute is just raw data (e.g. a firmware command). 5289901bb989SJohannes Berg * @maxattr: highest attribute number in policy 52907bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 52917bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 52927bdbe400SJohannes Berg * are used with dump requests. 5293ad7e718cSJohannes Berg */ 5294ad7e718cSJohannes Berg struct wiphy_vendor_command { 5295ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 5296ad7e718cSJohannes Berg u32 flags; 5297ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 5298ad7e718cSJohannes Berg const void *data, int data_len); 52997bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 53007bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 53017bdbe400SJohannes Berg unsigned long *storage); 5302901bb989SJohannes Berg const struct nla_policy *policy; 5303901bb989SJohannes Berg unsigned int maxattr; 5304ad7e718cSJohannes Berg }; 5305ad7e718cSJohannes Berg 5306ad7e718cSJohannes Berg /** 5307019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 5308019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 5309019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 5310019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 5311019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 5312019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 5313019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 5314019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 5315019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 53164e9c3af3SJohannes Berg * @eml_capabilities: EML capabilities (for MLO) 53174e9c3af3SJohannes Berg * @mld_capa_and_ops: MLD capabilities and operations (for MLO) 5318019ae3a9SKanchanapally, Vidyullatha */ 5319019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 5320019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 5321019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 5322019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 5323019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 53244e9c3af3SJohannes Berg u16 eml_capabilities; 53254e9c3af3SJohannes Berg u16 mld_capa_and_ops; 5326019ae3a9SKanchanapally, Vidyullatha }; 5327019ae3a9SKanchanapally, Vidyullatha 5328019ae3a9SKanchanapally, Vidyullatha /** 53297464f665SJohannes Berg * cfg80211_get_iftype_ext_capa - lookup interface type extended capability 53307464f665SJohannes Berg * @wiphy: the wiphy to look up from 53317464f665SJohannes Berg * @type: the interface type to look up 53327464f665SJohannes Berg */ 53337464f665SJohannes Berg const struct wiphy_iftype_ext_capab * 53347464f665SJohannes Berg cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type); 53357464f665SJohannes Berg 53367464f665SJohannes Berg /** 53379bb7e0f2SJohannes Berg * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities 53389bb7e0f2SJohannes Berg * @max_peers: maximum number of peers in a single measurement 53399bb7e0f2SJohannes Berg * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement 53409bb7e0f2SJohannes Berg * @randomize_mac_addr: can randomize MAC address for measurement 53412d8b08feSMauro Carvalho Chehab * @ftm: FTM measurement data 53429bb7e0f2SJohannes Berg * @ftm.supported: FTM measurement is supported 53439bb7e0f2SJohannes Berg * @ftm.asap: ASAP-mode is supported 53449bb7e0f2SJohannes Berg * @ftm.non_asap: non-ASAP-mode is supported 53459bb7e0f2SJohannes Berg * @ftm.request_lci: can request LCI data 53469bb7e0f2SJohannes Berg * @ftm.request_civicloc: can request civic location data 53479bb7e0f2SJohannes Berg * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble) 53489bb7e0f2SJohannes Berg * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width) 53499bb7e0f2SJohannes Berg * @ftm.max_bursts_exponent: maximum burst exponent supported 53509bb7e0f2SJohannes Berg * (set to -1 if not limited; note that setting this will necessarily 53519bb7e0f2SJohannes Berg * forbid using the value 15 to let the responder pick) 53529bb7e0f2SJohannes Berg * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if 53539bb7e0f2SJohannes Berg * not limited) 5354efb5520dSAvraham Stern * @ftm.trigger_based: trigger based ranging measurement is supported 5355efb5520dSAvraham Stern * @ftm.non_trigger_based: non trigger based ranging measurement is supported 53569bb7e0f2SJohannes Berg */ 53579bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities { 53589bb7e0f2SJohannes Berg unsigned int max_peers; 53599bb7e0f2SJohannes Berg u8 report_ap_tsf:1, 53609bb7e0f2SJohannes Berg randomize_mac_addr:1; 53619bb7e0f2SJohannes Berg 53629bb7e0f2SJohannes Berg struct { 53639bb7e0f2SJohannes Berg u32 preambles; 53649bb7e0f2SJohannes Berg u32 bandwidths; 53659bb7e0f2SJohannes Berg s8 max_bursts_exponent; 53669bb7e0f2SJohannes Berg u8 max_ftms_per_burst; 53679bb7e0f2SJohannes Berg u8 supported:1, 53689bb7e0f2SJohannes Berg asap:1, 53699bb7e0f2SJohannes Berg non_asap:1, 53709bb7e0f2SJohannes Berg request_lci:1, 5371efb5520dSAvraham Stern request_civicloc:1, 5372efb5520dSAvraham Stern trigger_based:1, 5373efb5520dSAvraham Stern non_trigger_based:1; 53749bb7e0f2SJohannes Berg } ftm; 53759bb7e0f2SJohannes Berg }; 53769bb7e0f2SJohannes Berg 53779bb7e0f2SJohannes Berg /** 5378d6039a34SVeerendranath Jakkam * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm 5379d6039a34SVeerendranath Jakkam * suites for interface types defined in @iftypes_mask. Each type in the 5380d6039a34SVeerendranath Jakkam * @iftypes_mask must be unique across all instances of iftype_akm_suites. 5381d6039a34SVeerendranath Jakkam * 5382d6039a34SVeerendranath Jakkam * @iftypes_mask: bitmask of interfaces types 5383d6039a34SVeerendranath Jakkam * @akm_suites: points to an array of supported akm suites 5384d6039a34SVeerendranath Jakkam * @n_akm_suites: number of supported AKM suites 5385d6039a34SVeerendranath Jakkam */ 5386d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites { 5387d6039a34SVeerendranath Jakkam u16 iftypes_mask; 5388d6039a34SVeerendranath Jakkam const u32 *akm_suites; 5389d6039a34SVeerendranath Jakkam int n_akm_suites; 5390d6039a34SVeerendranath Jakkam }; 5391d6039a34SVeerendranath Jakkam 5392cbbaf2bbSAvraham Stern #define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff 5393cbbaf2bbSAvraham Stern 5394d6039a34SVeerendranath Jakkam /** 53955be83de5SJohannes Berg * struct wiphy - wireless hardware description 5396a05829a7SJohannes Berg * @mtx: mutex for the data (structures) of this device 53972784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 53982784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 53992784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 5400d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 5401d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 5402d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 5403d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 5404d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 5405d3236553SJohannes Berg * @cipher_suites: supported cipher suites 5406d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 5407d6039a34SVeerendranath Jakkam * @akm_suites: supported AKM suites. These are the default AKMs supported if 5408d6039a34SVeerendranath Jakkam * the supported AKMs not advertized for a specific interface type in 5409d6039a34SVeerendranath Jakkam * iftype_akm_suites. 5410ab4dfa20SVeerendranath Jakkam * @n_akm_suites: number of supported AKM suites 5411d6039a34SVeerendranath Jakkam * @iftype_akm_suites: array of supported akm suites info per interface type. 5412d6039a34SVeerendranath Jakkam * Note that the bits in @iftypes_mask inside this structure cannot 5413d6039a34SVeerendranath Jakkam * overlap (i.e. only one occurrence of each type is allowed across all 5414d6039a34SVeerendranath Jakkam * instances of iftype_akm_suites). 5415d6039a34SVeerendranath Jakkam * @num_iftype_akm_suites: number of interface types for which supported akm 5416d6039a34SVeerendranath Jakkam * suites are specified separately. 5417b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 5418b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 5419b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 5420b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 5421b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 5422abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 5423ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 5424ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 5425ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 54260fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 5427ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 5428ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 5429ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 5430ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 5431ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 5432ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 5433ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 5434ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 5435fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 5436fd235913SRandy Dunlap * unregister hardware 5437edf77192SJérôme Pouiller * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>). 5438edf77192SJérôme Pouiller * It will be renamed automatically on wiphy renames 543915bc6dfbSJérôme Pouiller * @dev: (virtual) struct device for this wiphy. The item in 544015bc6dfbSJérôme Pouiller * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev() 544115bc6dfbSJérôme Pouiller * (see below). 5442abe37c4bSJohannes Berg * @wext: wireless extension handlers 5443abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 5444abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 5445abe37c4bSJohannes Berg * must be set by driver 54467527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 54477527a782SJohannes Berg * list single interface types. 54487527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 54497527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 54507527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 5451abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 5452a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 5453a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 54541f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 5455d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 5456d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 5457abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 5458abe37c4bSJohannes Berg * this variable determines its size 5459abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 5460abe37c4bSJohannes Berg * any given scan 5461ca986ad9SArend Van Spriel * @max_sched_scan_reqs: maximum number of scheduled scan requests that 5462ca986ad9SArend Van Spriel * the device can run concurrently. 546393b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 546493b6aa69SLuciano Coelho * for in any given scheduled scan 5465a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 5466a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 5467a1f1c21cSLuciano Coelho * supported. 5468abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 5469abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 5470abe37c4bSJohannes Berg * include fixed IEs like supported rates 54715a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 54725a865badSLuciano Coelho * scans 54733b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 54743b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 54753b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 54763b06d277SAvraham Stern * single scan plan supported by the device. 54773b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 54783b06d277SAvraham Stern * scan plan supported by the device. 5479abe37c4bSJohannes Berg * @coverage_class: current coverage class 5480abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 5481abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 5482abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 5483abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 5484abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 5485abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 54862e161f78SJohannes Berg * 54872e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 54882e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 54892e161f78SJohannes Berg * type 5490a7ffac95SBruno Randolf * 54917f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 54927f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 54937f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 54947f531e03SBruno Randolf * 54957f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 54967f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 54977f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 5498a293911dSJohannes Berg * 549915f0ebc2SRandy Dunlap * @probe_resp_offload: 550015f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 550115f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 550215f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 550315f0ebc2SRandy Dunlap * 5504a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 5505a293911dSJohannes Berg * may request, if implemented. 5506ff1b6e69SJohannes Berg * 5507ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 55086abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 55096abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 55106abb9cb9SJohannes Berg * to the suspend() operation instead. 5511562a7480SJohannes Berg * 5512562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 55137e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 55147e7c8926SBen Greear * If null, then none can be over-ridden. 5515ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 5516ee2aca34SJohannes Berg * If null, then none can be over-ridden. 551777765eafSVasanthakumar Thiagarajan * 551853873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 551953873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 552053873f13SJohannes Berg * 552177765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 552277765eafSVasanthakumar Thiagarajan * supports for ACL. 5523a50df0c4SJohannes Berg * 5524a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 5525a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 5526a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 5527a50df0c4SJohannes Berg * and are in the same format as in the information element. See 5528019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 5529019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 5530019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 5531a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 5532a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 5533019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 5534019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 5535019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 5536be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 5537ad7e718cSJohannes Berg * 5538ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 5539ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 5540567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 5541567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 5542b43504cfSJouni Malinen * 5543b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 5544b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 5545b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 5546b43504cfSJouni Malinen * some cases, but may not always reach. 5547c2e4323bSLuciano Coelho * 5548c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 5549c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 5550c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 5551c2e4323bSLuciano Coelho * infinite. 555238de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 555338de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 555438de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 5555a442b761SAyala Beker * 55568585989dSLuca Coelho * @nan_supported_bands: bands supported by the device in NAN mode, a 55578585989dSLuca Coelho * bitmap of &enum nl80211_band values. For instance, for 55588585989dSLuca Coelho * NL80211_BAND_2GHZ, bit 0 would be set 55598585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 5560f3a7ca64SJohannes Berg * 5561f3a7ca64SJohannes Berg * @txq_limit: configuration of internal TX queue frame limit 5562f3a7ca64SJohannes Berg * @txq_memory_limit: configuration internal TX queue memory limit 5563f3a7ca64SJohannes Berg * @txq_quantum: configuration of internal TX queue scheduler quantum 55649bb7e0f2SJohannes Berg * 5565a710d214SLothar Rubusch * @tx_queue_len: allow setting transmit queue len for drivers not using 5566a710d214SLothar Rubusch * wake_tx_queue 5567a710d214SLothar Rubusch * 5568213ed579SSara Sharon * @support_mbssid: can HW support association with nontransmitted AP 5569213ed579SSara Sharon * @support_only_he_mbssid: don't parse MBSSID elements if it is not 5570213ed579SSara Sharon * HE AP, in order to avoid compatibility issues. 5571213ed579SSara Sharon * @support_mbssid must be set for this to have any effect. 5572213ed579SSara Sharon * 55739bb7e0f2SJohannes Berg * @pmsr_capa: peer measurement capabilities 55743710a8a6SJohannes Berg * 55753710a8a6SJohannes Berg * @tid_config_support: describes the per-TID config support that the 55763710a8a6SJohannes Berg * device has 55773710a8a6SJohannes Berg * @tid_config_support.vif: bitmap of attributes (configurations) 55783710a8a6SJohannes Berg * supported by the driver for each vif 55793710a8a6SJohannes Berg * @tid_config_support.peer: bitmap of attributes (configurations) 55803710a8a6SJohannes Berg * supported by the driver for each peer 55816a21d16cSTamizh chelvam * @tid_config_support.max_retry: maximum supported retry count for 55826a21d16cSTamizh chelvam * long/short retry configuration 5583a710d214SLothar Rubusch * 5584a710d214SLothar Rubusch * @max_data_retry_count: maximum supported per TID retry count for 5585a710d214SLothar Rubusch * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and 5586a710d214SLothar Rubusch * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes 558770b6ff35SJohannes Berg * @sar_capa: SAR control capabilities 5588358ae888SEmmanuel Grumbach * @rfkill: a pointer to the rfkill structure 5589dc1e3cb8SJohn Crispin * 5590dc1e3cb8SJohn Crispin * @mbssid_max_interfaces: maximum number of interfaces supported by the driver 5591dc1e3cb8SJohn Crispin * in a multiple BSSID set. This field must be set to a non-zero value 5592dc1e3cb8SJohn Crispin * by the driver to advertise MBSSID support. 5593f9d366d4SJohannes Berg * @ema_max_profile_periodicity: maximum profile periodicity supported by 5594dc1e3cb8SJohn Crispin * the driver. Setting this field to a non-zero value indicates that the 5595dc1e3cb8SJohn Crispin * driver supports enhanced multi-BSSID advertisements (EMA AP). 5596ecad3b0bSVeerendranath Jakkam * @max_num_akm_suites: maximum number of AKM suites allowed for 5597ecad3b0bSVeerendranath Jakkam * configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and 5598ecad3b0bSVeerendranath Jakkam * %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by 5599ecad3b0bSVeerendranath Jakkam * driver. If set by driver minimum allowed value is 5600ecad3b0bSVeerendranath Jakkam * NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with 5601ecad3b0bSVeerendranath Jakkam * legacy userspace and maximum allowed value is 5602ecad3b0bSVeerendranath Jakkam * CFG80211_MAX_NUM_AKM_SUITES. 5603cbbaf2bbSAvraham Stern * 5604cbbaf2bbSAvraham Stern * @hw_timestamp_max_peers: maximum number of peers that the driver supports 5605cbbaf2bbSAvraham Stern * enabling HW timestamping for concurrently. Setting this field to a 5606cbbaf2bbSAvraham Stern * non-zero value indicates that the driver supports HW timestamping. 5607cbbaf2bbSAvraham Stern * A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver 5608cbbaf2bbSAvraham Stern * supports enabling HW timestamping for all peers (i.e. no need to 5609cbbaf2bbSAvraham Stern * specify a mac address). 5610d3236553SJohannes Berg */ 5611d3236553SJohannes Berg struct wiphy { 5612a05829a7SJohannes Berg struct mutex mtx; 5613a05829a7SJohannes Berg 5614d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 5615d3236553SJohannes Berg 5616d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 5617ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 5618ef15aac6SJohannes Berg 5619ef15aac6SJohannes Berg struct mac_address *addresses; 5620d3236553SJohannes Berg 56212e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 56222e161f78SJohannes Berg 56237527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 56247527a782SJohannes Berg int n_iface_combinations; 56257527a782SJohannes Berg u16 software_iftypes; 56267527a782SJohannes Berg 56272e161f78SJohannes Berg u16 n_addresses; 56282e161f78SJohannes Berg 5629d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 5630d3236553SJohannes Berg u16 interface_modes; 5631d3236553SJohannes Berg 563277765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 563377765eafSVasanthakumar Thiagarajan 5634a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 5635d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 5636463d0183SJohannes Berg 5637562a7480SJohannes Berg u32 ap_sme_capa; 5638562a7480SJohannes Berg 5639d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 5640d3236553SJohannes Berg 5641d3236553SJohannes Berg int bss_priv_size; 5642d3236553SJohannes Berg u8 max_scan_ssids; 5643ca986ad9SArend Van Spriel u8 max_sched_scan_reqs; 564493b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 5645a1f1c21cSLuciano Coelho u8 max_match_sets; 5646d3236553SJohannes Berg u16 max_scan_ie_len; 56475a865badSLuciano Coelho u16 max_sched_scan_ie_len; 56483b06d277SAvraham Stern u32 max_sched_scan_plans; 56493b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 56503b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 5651d3236553SJohannes Berg 5652d3236553SJohannes Berg int n_cipher_suites; 5653d3236553SJohannes Berg const u32 *cipher_suites; 5654d3236553SJohannes Berg 5655ab4dfa20SVeerendranath Jakkam int n_akm_suites; 5656ab4dfa20SVeerendranath Jakkam const u32 *akm_suites; 5657ab4dfa20SVeerendranath Jakkam 5658d6039a34SVeerendranath Jakkam const struct wiphy_iftype_akm_suites *iftype_akm_suites; 5659d6039a34SVeerendranath Jakkam unsigned int num_iftype_akm_suites; 5660d6039a34SVeerendranath Jakkam 5661b9a5f8caSJouni Malinen u8 retry_short; 5662b9a5f8caSJouni Malinen u8 retry_long; 5663b9a5f8caSJouni Malinen u32 frag_threshold; 5664b9a5f8caSJouni Malinen u32 rts_threshold; 566581077e82SLukáš Turek u8 coverage_class; 5666b9a5f8caSJouni Malinen 566781135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 5668dfce95f5SKalle Valo u32 hw_version; 5669dfce95f5SKalle Valo 5670dfb89c56SJohannes Berg #ifdef CONFIG_PM 5671964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 56726abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 5673dfb89c56SJohannes Berg #endif 5674ff1b6e69SJohannes Berg 5675a293911dSJohannes Berg u16 max_remain_on_channel_duration; 5676a293911dSJohannes Berg 567767fbb16bSSamuel Ortiz u8 max_num_pmkids; 567867fbb16bSSamuel Ortiz 56797f531e03SBruno Randolf u32 available_antennas_tx; 56807f531e03SBruno Randolf u32 available_antennas_rx; 5681a7ffac95SBruno Randolf 568287bbbe22SArik Nemtsov u32 probe_resp_offload; 568387bbbe22SArik Nemtsov 5684a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 5685a50df0c4SJohannes Berg u8 extended_capabilities_len; 5686a50df0c4SJohannes Berg 5687019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 5688019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 5689019ae3a9SKanchanapally, Vidyullatha 5690cf5aa2f1SDavid Kilroy const void *privid; 5691d3236553SJohannes Berg 569257fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 5693d3236553SJohannes Berg 56940c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 5695d3236553SJohannes Berg struct regulatory_request *request); 5696d3236553SJohannes Berg 5697d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 5698d3236553SJohannes Berg 5699458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 5700d3236553SJohannes Berg 5701d3236553SJohannes Berg struct device dev; 5702d3236553SJohannes Berg 5703ecb44335SStanislaw Gruszka bool registered; 5704ecb44335SStanislaw Gruszka 5705d3236553SJohannes Berg struct dentry *debugfsdir; 5706d3236553SJohannes Berg 57077e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 5708ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 57097e7c8926SBen Greear 571053873f13SJohannes Berg struct list_head wdev_list; 571153873f13SJohannes Berg 57120c5c9fb5SEric W. Biederman possible_net_t _net; 5713463d0183SJohannes Berg 57143d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 57153d23e349SJohannes Berg const struct iw_handler_def *wext; 57163d23e349SJohannes Berg #endif 57173d23e349SJohannes Berg 5718be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 5719be29b99aSAmitkumar Karwar 5720ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 5721567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 5722567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 5723ad7e718cSJohannes Berg 5724b43504cfSJouni Malinen u16 max_ap_assoc_sta; 5725b43504cfSJouni Malinen 57269a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 57279a774c78SAndrei Otcheretianski 572838de03d2SArend van Spriel u32 bss_select_support; 572938de03d2SArend van Spriel 57308585989dSLuca Coelho u8 nan_supported_bands; 57318585989dSLuca Coelho 573252539ca8SToke Høiland-Jørgensen u32 txq_limit; 573352539ca8SToke Høiland-Jørgensen u32 txq_memory_limit; 573452539ca8SToke Høiland-Jørgensen u32 txq_quantum; 573552539ca8SToke Høiland-Jørgensen 57361f6e0baaSJohn Crispin unsigned long tx_queue_len; 57371f6e0baaSJohn Crispin 5738213ed579SSara Sharon u8 support_mbssid:1, 5739213ed579SSara Sharon support_only_he_mbssid:1; 5740213ed579SSara Sharon 57419bb7e0f2SJohannes Berg const struct cfg80211_pmsr_capabilities *pmsr_capa; 57429bb7e0f2SJohannes Berg 57433710a8a6SJohannes Berg struct { 57443710a8a6SJohannes Berg u64 peer, vif; 57456a21d16cSTamizh chelvam u8 max_retry; 57463710a8a6SJohannes Berg } tid_config_support; 57473710a8a6SJohannes Berg 57486a21d16cSTamizh chelvam u8 max_data_retry_count; 57496a21d16cSTamizh chelvam 57506bdb68ceSCarl Huang const struct cfg80211_sar_capa *sar_capa; 57516bdb68ceSCarl Huang 5752358ae888SEmmanuel Grumbach struct rfkill *rfkill; 5753358ae888SEmmanuel Grumbach 5754dc1e3cb8SJohn Crispin u8 mbssid_max_interfaces; 5755dc1e3cb8SJohn Crispin u8 ema_max_profile_periodicity; 5756ecad3b0bSVeerendranath Jakkam u16 max_num_akm_suites; 5757dc1e3cb8SJohn Crispin 5758cbbaf2bbSAvraham Stern u16 hw_timestamp_max_peers; 5759cbbaf2bbSAvraham Stern 5760396fba0aSGustavo A. R. Silva char priv[] __aligned(NETDEV_ALIGN); 5761d3236553SJohannes Berg }; 5762d3236553SJohannes Berg 5763463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 5764463d0183SJohannes Berg { 5765c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 5766463d0183SJohannes Berg } 5767463d0183SJohannes Berg 5768463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 5769463d0183SJohannes Berg { 5770c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 5771463d0183SJohannes Berg } 5772463d0183SJohannes Berg 5773d3236553SJohannes Berg /** 5774d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 5775d3236553SJohannes Berg * 5776d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 57770ae997dcSYacine Belkadi * Return: The priv of @wiphy. 5778d3236553SJohannes Berg */ 5779d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 5780d3236553SJohannes Berg { 5781d3236553SJohannes Berg BUG_ON(!wiphy); 5782d3236553SJohannes Berg return &wiphy->priv; 5783d3236553SJohannes Berg } 5784d3236553SJohannes Berg 5785d3236553SJohannes Berg /** 5786f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 5787f1f74825SDavid Kilroy * 5788f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 57890ae997dcSYacine Belkadi * Return: The wiphy of @priv. 5790f1f74825SDavid Kilroy */ 5791f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 5792f1f74825SDavid Kilroy { 5793f1f74825SDavid Kilroy BUG_ON(!priv); 5794f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 5795f1f74825SDavid Kilroy } 5796f1f74825SDavid Kilroy 5797f1f74825SDavid Kilroy /** 5798d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 5799d3236553SJohannes Berg * 5800d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 5801d3236553SJohannes Berg * @dev: The device to parent it to 5802d3236553SJohannes Berg */ 5803d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 5804d3236553SJohannes Berg { 5805d3236553SJohannes Berg wiphy->dev.parent = dev; 5806d3236553SJohannes Berg } 5807d3236553SJohannes Berg 5808d3236553SJohannes Berg /** 5809d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 5810d3236553SJohannes Berg * 5811d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 58120ae997dcSYacine Belkadi * Return: The dev of @wiphy. 5813d3236553SJohannes Berg */ 5814d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 5815d3236553SJohannes Berg { 5816d3236553SJohannes Berg return wiphy->dev.parent; 5817d3236553SJohannes Berg } 5818d3236553SJohannes Berg 5819d3236553SJohannes Berg /** 5820d3236553SJohannes Berg * wiphy_name - get wiphy name 5821d3236553SJohannes Berg * 5822d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 58230ae997dcSYacine Belkadi * Return: The name of @wiphy. 5824d3236553SJohannes Berg */ 5825e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 5826d3236553SJohannes Berg { 5827d3236553SJohannes Berg return dev_name(&wiphy->dev); 5828d3236553SJohannes Berg } 5829d3236553SJohannes Berg 5830d3236553SJohannes Berg /** 58311998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 58321998d90aSBen Greear * 58331998d90aSBen Greear * @ops: The configuration operations for this device 58341998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 58351998d90aSBen Greear * @requested_name: Request a particular name. 58361998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 58371998d90aSBen Greear * 58381998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 58391998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 58401998d90aSBen Greear * 58411998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 58421998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 58431998d90aSBen Greear */ 58441998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 58451998d90aSBen Greear const char *requested_name); 58461998d90aSBen Greear 58471998d90aSBen Greear /** 5848d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 5849d3236553SJohannes Berg * 5850d3236553SJohannes Berg * @ops: The configuration operations for this device 5851d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 5852d3236553SJohannes Berg * 5853d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 5854d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 5855d3236553SJohannes Berg * 58560ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 58570ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 5858d3236553SJohannes Berg */ 58591998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 58601998d90aSBen Greear int sizeof_priv) 58611998d90aSBen Greear { 58621998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 58631998d90aSBen Greear } 5864d3236553SJohannes Berg 5865d3236553SJohannes Berg /** 5866d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 5867d3236553SJohannes Berg * 5868d3236553SJohannes Berg * @wiphy: The wiphy to register. 5869d3236553SJohannes Berg * 58700ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 5871d3236553SJohannes Berg */ 587210dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 5873d3236553SJohannes Berg 5874a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */ 5875a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx) 5876a05829a7SJohannes Berg 5877a05829a7SJohannes Berg /** 5878a05829a7SJohannes Berg * rcu_dereference_wiphy - rcu_dereference with debug checking 5879a05829a7SJohannes Berg * @wiphy: the wiphy to check the locking on 5880a05829a7SJohannes Berg * @p: The pointer to read, prior to dereferencing 5881a05829a7SJohannes Berg * 5882a05829a7SJohannes Berg * Do an rcu_dereference(p), but check caller either holds rcu_read_lock() 5883a05829a7SJohannes Berg * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference(). 5884a05829a7SJohannes Berg */ 5885a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p) \ 5886a05829a7SJohannes Berg rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx)) 5887a05829a7SJohannes Berg 5888a05829a7SJohannes Berg /** 5889a05829a7SJohannes Berg * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx 5890a05829a7SJohannes Berg * @wiphy: the wiphy to check the locking on 5891a05829a7SJohannes Berg * @p: The pointer to read, prior to dereferencing 5892a05829a7SJohannes Berg * 5893a05829a7SJohannes Berg * Return the value of the specified RCU-protected pointer, but omit the 5894a05829a7SJohannes Berg * READ_ONCE(), because caller holds the wiphy mutex used for updates. 5895a05829a7SJohannes Berg */ 5896a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p) \ 5897a05829a7SJohannes Berg rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx)) 5898a05829a7SJohannes Berg 5899a05829a7SJohannes Berg /** 5900a05829a7SJohannes Berg * get_wiphy_regdom - get custom regdomain for the given wiphy 5901a05829a7SJohannes Berg * @wiphy: the wiphy to get the regdomain from 5902a05829a7SJohannes Berg */ 5903a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy); 5904a05829a7SJohannes Berg 5905d3236553SJohannes Berg /** 5906d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 5907d3236553SJohannes Berg * 5908d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 5909d3236553SJohannes Berg * 5910d3236553SJohannes Berg * After this call, no more requests can be made with this priv 5911d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 5912d3236553SJohannes Berg * request that is being handled. 5913d3236553SJohannes Berg */ 591410dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 5915d3236553SJohannes Berg 5916d3236553SJohannes Berg /** 5917d3236553SJohannes Berg * wiphy_free - free wiphy 5918d3236553SJohannes Berg * 5919d3236553SJohannes Berg * @wiphy: The wiphy to free 5920d3236553SJohannes Berg */ 592110dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 5922d3236553SJohannes Berg 5923fffd0934SJohannes Berg /* internal structs */ 59246829c878SJohannes Berg struct cfg80211_conn; 592519957bb3SJohannes Berg struct cfg80211_internal_bss; 5926fffd0934SJohannes Berg struct cfg80211_cached_keys; 59274a4b8169SAndrew Zaborowski struct cfg80211_cqm_config; 592819957bb3SJohannes Berg 5929d3236553SJohannes Berg /** 5930a05829a7SJohannes Berg * wiphy_lock - lock the wiphy 5931a05829a7SJohannes Berg * @wiphy: the wiphy to lock 5932a05829a7SJohannes Berg * 5933a3ee4dc8SJohannes Berg * This is needed around registering and unregistering netdevs that 5934a3ee4dc8SJohannes Berg * aren't created through cfg80211 calls, since that requires locking 5935a3ee4dc8SJohannes Berg * in cfg80211 when the notifiers is called, but that cannot 5936a3ee4dc8SJohannes Berg * differentiate which way it's called. 5937a3ee4dc8SJohannes Berg * 5938a3ee4dc8SJohannes Berg * It can also be used by drivers for their own purposes. 5939a05829a7SJohannes Berg * 5940a05829a7SJohannes Berg * When cfg80211 ops are called, the wiphy is already locked. 5941a3ee4dc8SJohannes Berg * 5942a3ee4dc8SJohannes Berg * Note that this makes sure that no workers that have been queued 5943a3ee4dc8SJohannes Berg * with wiphy_queue_work() are running. 5944a05829a7SJohannes Berg */ 5945a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy) 5946a05829a7SJohannes Berg __acquires(&wiphy->mtx) 5947a05829a7SJohannes Berg { 5948a05829a7SJohannes Berg mutex_lock(&wiphy->mtx); 5949a05829a7SJohannes Berg __acquire(&wiphy->mtx); 5950a05829a7SJohannes Berg } 5951a05829a7SJohannes Berg 5952a05829a7SJohannes Berg /** 5953a05829a7SJohannes Berg * wiphy_unlock - unlock the wiphy again 5954a05829a7SJohannes Berg * @wiphy: the wiphy to unlock 5955a05829a7SJohannes Berg */ 5956a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy) 5957a05829a7SJohannes Berg __releases(&wiphy->mtx) 5958a05829a7SJohannes Berg { 5959a05829a7SJohannes Berg __release(&wiphy->mtx); 5960a05829a7SJohannes Berg mutex_unlock(&wiphy->mtx); 5961a05829a7SJohannes Berg } 5962a05829a7SJohannes Berg 5963a3ee4dc8SJohannes Berg struct wiphy_work; 5964a3ee4dc8SJohannes Berg typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *); 5965a3ee4dc8SJohannes Berg 5966a3ee4dc8SJohannes Berg struct wiphy_work { 5967a3ee4dc8SJohannes Berg struct list_head entry; 5968a3ee4dc8SJohannes Berg wiphy_work_func_t func; 5969a3ee4dc8SJohannes Berg }; 5970a3ee4dc8SJohannes Berg 5971a3ee4dc8SJohannes Berg static inline void wiphy_work_init(struct wiphy_work *work, 5972a3ee4dc8SJohannes Berg wiphy_work_func_t func) 5973a3ee4dc8SJohannes Berg { 5974a3ee4dc8SJohannes Berg INIT_LIST_HEAD(&work->entry); 5975a3ee4dc8SJohannes Berg work->func = func; 5976a3ee4dc8SJohannes Berg } 5977a3ee4dc8SJohannes Berg 5978a3ee4dc8SJohannes Berg /** 5979a3ee4dc8SJohannes Berg * wiphy_work_queue - queue work for the wiphy 5980a3ee4dc8SJohannes Berg * @wiphy: the wiphy to queue for 5981a3ee4dc8SJohannes Berg * @work: the work item 5982a3ee4dc8SJohannes Berg * 5983a3ee4dc8SJohannes Berg * This is useful for work that must be done asynchronously, and work 5984a3ee4dc8SJohannes Berg * queued here has the special property that the wiphy mutex will be 5985a3ee4dc8SJohannes Berg * held as if wiphy_lock() was called, and that it cannot be running 5986a3ee4dc8SJohannes Berg * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can 5987a3ee4dc8SJohannes Berg * use just cancel_work() instead of cancel_work_sync(), it requires 5988a3ee4dc8SJohannes Berg * being in a section protected by wiphy_lock(). 5989a3ee4dc8SJohannes Berg */ 5990a3ee4dc8SJohannes Berg void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work); 5991a3ee4dc8SJohannes Berg 5992a3ee4dc8SJohannes Berg /** 5993a3ee4dc8SJohannes Berg * wiphy_work_cancel - cancel previously queued work 5994a3ee4dc8SJohannes Berg * @wiphy: the wiphy, for debug purposes 5995a3ee4dc8SJohannes Berg * @work: the work to cancel 5996a3ee4dc8SJohannes Berg * 5997a3ee4dc8SJohannes Berg * Cancel the work *without* waiting for it, this assumes being 5998a3ee4dc8SJohannes Berg * called under the wiphy mutex acquired by wiphy_lock(). 5999a3ee4dc8SJohannes Berg */ 6000a3ee4dc8SJohannes Berg void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work); 6001a3ee4dc8SJohannes Berg 600256cfb8ceSJohannes Berg /** 600356cfb8ceSJohannes Berg * wiphy_work_flush - flush previously queued work 600456cfb8ceSJohannes Berg * @wiphy: the wiphy, for debug purposes 600556cfb8ceSJohannes Berg * @work: the work to flush, this can be %NULL to flush all work 600656cfb8ceSJohannes Berg * 600756cfb8ceSJohannes Berg * Flush the work (i.e. run it if pending). This must be called 600856cfb8ceSJohannes Berg * under the wiphy mutex acquired by wiphy_lock(). 600956cfb8ceSJohannes Berg */ 601056cfb8ceSJohannes Berg void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work); 601156cfb8ceSJohannes Berg 6012a3ee4dc8SJohannes Berg struct wiphy_delayed_work { 6013a3ee4dc8SJohannes Berg struct wiphy_work work; 6014a3ee4dc8SJohannes Berg struct wiphy *wiphy; 6015a3ee4dc8SJohannes Berg struct timer_list timer; 6016a3ee4dc8SJohannes Berg }; 6017a3ee4dc8SJohannes Berg 6018a3ee4dc8SJohannes Berg void wiphy_delayed_work_timer(struct timer_list *t); 6019a3ee4dc8SJohannes Berg 6020a3ee4dc8SJohannes Berg static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork, 6021a3ee4dc8SJohannes Berg wiphy_work_func_t func) 6022a3ee4dc8SJohannes Berg { 6023a3ee4dc8SJohannes Berg timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0); 6024a3ee4dc8SJohannes Berg wiphy_work_init(&dwork->work, func); 6025a3ee4dc8SJohannes Berg } 6026a3ee4dc8SJohannes Berg 6027a3ee4dc8SJohannes Berg /** 6028a3ee4dc8SJohannes Berg * wiphy_delayed_work_queue - queue delayed work for the wiphy 6029a3ee4dc8SJohannes Berg * @wiphy: the wiphy to queue for 6030a3ee4dc8SJohannes Berg * @dwork: the delayable worker 6031a3ee4dc8SJohannes Berg * @delay: number of jiffies to wait before queueing 6032a3ee4dc8SJohannes Berg * 6033a3ee4dc8SJohannes Berg * This is useful for work that must be done asynchronously, and work 6034a3ee4dc8SJohannes Berg * queued here has the special property that the wiphy mutex will be 6035a3ee4dc8SJohannes Berg * held as if wiphy_lock() was called, and that it cannot be running 6036a3ee4dc8SJohannes Berg * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can 6037a3ee4dc8SJohannes Berg * use just cancel_work() instead of cancel_work_sync(), it requires 6038a3ee4dc8SJohannes Berg * being in a section protected by wiphy_lock(). 6039a3ee4dc8SJohannes Berg */ 6040a3ee4dc8SJohannes Berg void wiphy_delayed_work_queue(struct wiphy *wiphy, 6041a3ee4dc8SJohannes Berg struct wiphy_delayed_work *dwork, 6042a3ee4dc8SJohannes Berg unsigned long delay); 6043a3ee4dc8SJohannes Berg 6044a3ee4dc8SJohannes Berg /** 6045a3ee4dc8SJohannes Berg * wiphy_delayed_work_cancel - cancel previously queued delayed work 6046a3ee4dc8SJohannes Berg * @wiphy: the wiphy, for debug purposes 6047a3ee4dc8SJohannes Berg * @dwork: the delayed work to cancel 6048a3ee4dc8SJohannes Berg * 6049a3ee4dc8SJohannes Berg * Cancel the work *without* waiting for it, this assumes being 6050a3ee4dc8SJohannes Berg * called under the wiphy mutex acquired by wiphy_lock(). 6051a3ee4dc8SJohannes Berg */ 6052a3ee4dc8SJohannes Berg void wiphy_delayed_work_cancel(struct wiphy *wiphy, 6053a3ee4dc8SJohannes Berg struct wiphy_delayed_work *dwork); 6054a3ee4dc8SJohannes Berg 6055a05829a7SJohannes Berg /** 60568c73d524SJohannes Berg * wiphy_delayed_work_flush - flush previously queued delayed work 605756cfb8ceSJohannes Berg * @wiphy: the wiphy, for debug purposes 60589c386911SJohannes Berg * @dwork: the delayed work to flush 605956cfb8ceSJohannes Berg * 606056cfb8ceSJohannes Berg * Flush the work (i.e. run it if pending). This must be called 606156cfb8ceSJohannes Berg * under the wiphy mutex acquired by wiphy_lock(). 606256cfb8ceSJohannes Berg */ 606356cfb8ceSJohannes Berg void wiphy_delayed_work_flush(struct wiphy *wiphy, 606456cfb8ceSJohannes Berg struct wiphy_delayed_work *dwork); 606556cfb8ceSJohannes Berg 606656cfb8ceSJohannes Berg /** 606789a54e48SJohannes Berg * struct wireless_dev - wireless device state 6068d3236553SJohannes Berg * 606989a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 607089a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 607189a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 607289a54e48SJohannes Berg * It need not be registered then as netdev registration will 6073a05829a7SJohannes Berg * be intercepted by cfg80211 to see the new wireless device, 6074a05829a7SJohannes Berg * however, drivers must lock the wiphy before registering or 6075a05829a7SJohannes Berg * unregistering netdevs if they pre-create any netdevs (in ops 6076a05829a7SJohannes Berg * called from cfg80211, the wiphy is already locked.) 607789a54e48SJohannes Berg * 607889a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 607989a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 608089a54e48SJohannes Berg * there's no netdev registration in that case it may not be 608189a54e48SJohannes Berg * allocated outside of callback operations that return it. 6082d3236553SJohannes Berg * 6083d3236553SJohannes Berg * @wiphy: pointer to hardware description 6084d3236553SJohannes Berg * @iftype: interface type 60852fe8ef10SJohannes Berg * @registered: is this wdev already registered with cfg80211 608640c575d1SJohannes Berg * @registering: indicates we're doing registration under wiphy lock 608740c575d1SJohannes Berg * for the notifier 6088d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 608989a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 609089a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 609189a54e48SJohannes Berg * wireless device if it has no netdev 60922d8b08feSMauro Carvalho Chehab * @u: union containing data specific to @iftype 60937b0a0e3cSJohannes Berg * @connected: indicates if connected or not (STA mode) 6094d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 60959874b71fSJohannes Berg * @wext.ibss: (private) IBSS data part of wext handling 60969874b71fSJohannes Berg * @wext.connect: (private) connection handling data 60979874b71fSJohannes Berg * @wext.keys: (private) (WEP) key data 60989874b71fSJohannes Berg * @wext.ie: (private) extra elements for association 60999874b71fSJohannes Berg * @wext.ie_len: (private) length of extra elements 61009874b71fSJohannes Berg * @wext.bssid: (private) selected network BSSID 61019874b71fSJohannes Berg * @wext.ssid: (private) selected network SSID 61029874b71fSJohannes Berg * @wext.default_key: (private) selected default key index 61039874b71fSJohannes Berg * @wext.default_mgmt_key: (private) selected default management key index 61049874b71fSJohannes Berg * @wext.prev_bssid: (private) previous BSSID for reassociation 61059874b71fSJohannes Berg * @wext.prev_bssid_valid: (private) previous BSSID validity 61069bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 61079bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 61089bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 61099bc383deSJohannes Berg * by cfg80211 on change_interface 61102e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 611179ea1e12SJohannes Berg * @mgmt_registrations_need_update: mgmt registrations were updated, 611279ea1e12SJohannes Berg * need to propagate the update to the driver 611398104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 611473c7da3dSArend Van Spriel * @is_running: true if this is a non-netdev device that has been started, e.g. 611573c7da3dSArend Van Spriel * the P2P Device. 611604f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 611704f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 611831559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 6119780b40dfSJohannes Berg * @ps: powersave mode is enabled 6120780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 6121780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 6122780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 6123780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 6124780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 612534d50519SLior David * @conn_bss_type: connecting/connected BSS type 6126bd2522b1SAndrzej Zaborowski * @conn_owner_nlportid: (private) connection owner socket port ID 6127bd2522b1SAndrzej Zaborowski * @disconnect_wk: (private) auto-disconnect work 6128bd2522b1SAndrzej Zaborowski * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 6129780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 6130780b40dfSJohannes Berg * @event_lock: (private) lock for event list 613178f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 6132ab81007aSJohannes Berg * @nl_owner_dead: (private) owner socket went away 6133d1383077SJohannes Berg * @cqm_rssi_work: (private) CQM RSSI reporting work 61344a4b8169SAndrew Zaborowski * @cqm_config: (private) nl80211 RSSI monitor state 61359bb7e0f2SJohannes Berg * @pmsr_list: (private) peer measurement requests 61369bb7e0f2SJohannes Berg * @pmsr_lock: (private) peer measurements requests/results lock 61379bb7e0f2SJohannes Berg * @pmsr_free_wk: (private) peer measurements cleanup work 61384d797fceSJouni Malinen * @unprot_beacon_reported: (private) timestamp of last 61394d797fceSJouni Malinen * unprotected beacon report 61402d8b08feSMauro Carvalho Chehab * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr 61412d8b08feSMauro Carvalho Chehab * @ap and @client for each link 61422d8b08feSMauro Carvalho Chehab * @valid_links: bitmap describing what elements of @links are valid 6143d3236553SJohannes Berg */ 6144d3236553SJohannes Berg struct wireless_dev { 6145d3236553SJohannes Berg struct wiphy *wiphy; 6146d3236553SJohannes Berg enum nl80211_iftype iftype; 6147d3236553SJohannes Berg 6148667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 6149d3236553SJohannes Berg struct list_head list; 6150d3236553SJohannes Berg struct net_device *netdev; 6151d3236553SJohannes Berg 615289a54e48SJohannes Berg u32 identifier; 615389a54e48SJohannes Berg 61542e161f78SJohannes Berg struct list_head mgmt_registrations; 615579ea1e12SJohannes Berg u8 mgmt_registrations_need_update:1; 6156026331c4SJouni Malinen 615740c575d1SJohannes Berg bool use_4addr, is_running, registered, registering; 615898104fdeSJohannes Berg 615998104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 61609bc383deSJohannes Berg 6161b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 61626829c878SJohannes Berg struct cfg80211_conn *conn; 6163fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 616434d50519SLior David enum ieee80211_bss_type conn_bss_type; 6165bd2522b1SAndrzej Zaborowski u32 conn_owner_nlportid; 6166bd2522b1SAndrzej Zaborowski 6167bd2522b1SAndrzej Zaborowski struct work_struct disconnect_wk; 6168bd2522b1SAndrzej Zaborowski u8 disconnect_bssid[ETH_ALEN]; 6169d3236553SJohannes Berg 6170667503ddSJohannes Berg struct list_head event_list; 6171667503ddSJohannes Berg spinlock_t event_lock; 6172667503ddSJohannes Berg 61737b0a0e3cSJohannes Berg u8 connected:1; 6174f4489ebeSMichal Kazior 6175ffb9eb3dSKalle Valo bool ps; 6176ffb9eb3dSKalle Valo int ps_timeout; 6177ffb9eb3dSKalle Valo 617815e47304SEric W. Biederman u32 ap_unexpected_nlportid; 617928946da7SJohannes Berg 6180ab81007aSJohannes Berg u32 owner_nlportid; 6181ab81007aSJohannes Berg bool nl_owner_dead; 6182ab81007aSJohannes Berg 61837b0a0e3cSJohannes Berg /* FIXME: need to rework radar detection for MLO */ 618404f39047SSimon Wunderlich bool cac_started; 618504f39047SSimon Wunderlich unsigned long cac_start_time; 618631559f35SJanusz Dziedzic unsigned int cac_time_ms; 618704f39047SSimon Wunderlich 61883d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 6189d3236553SJohannes Berg /* wext data */ 6190cbe8fa9cSJohannes Berg struct { 6191cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 6192f2129354SJohannes Berg struct cfg80211_connect_params connect; 6193fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 6194c1e5f471SJohannes Berg const u8 *ie; 6195f2129354SJohannes Berg size_t ie_len; 61969874b71fSJohannes Berg u8 bssid[ETH_ALEN]; 61979874b71fSJohannes Berg u8 prev_bssid[ETH_ALEN]; 6198f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 619908645126SJohannes Berg s8 default_key, default_mgmt_key; 6200ffb9eb3dSKalle Valo bool prev_bssid_valid; 6201cbe8fa9cSJohannes Berg } wext; 6202d3236553SJohannes Berg #endif 62034a4b8169SAndrew Zaborowski 620437c20b2eSJohannes Berg struct wiphy_work cqm_rssi_work; 620537c20b2eSJohannes Berg struct cfg80211_cqm_config __rcu *cqm_config; 62069bb7e0f2SJohannes Berg 62079bb7e0f2SJohannes Berg struct list_head pmsr_list; 62089bb7e0f2SJohannes Berg spinlock_t pmsr_lock; 62099bb7e0f2SJohannes Berg struct work_struct pmsr_free_wk; 62104d797fceSJouni Malinen 62114d797fceSJouni Malinen unsigned long unprot_beacon_reported; 62127b0a0e3cSJohannes Berg 62137b0a0e3cSJohannes Berg union { 62147b0a0e3cSJohannes Berg struct { 62157b0a0e3cSJohannes Berg u8 connected_addr[ETH_ALEN] __aligned(2); 62167b0a0e3cSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 62177b0a0e3cSJohannes Berg u8 ssid_len; 62187b0a0e3cSJohannes Berg } client; 62197b0a0e3cSJohannes Berg struct { 62207b0a0e3cSJohannes Berg int beacon_interval; 62217b0a0e3cSJohannes Berg struct cfg80211_chan_def preset_chandef; 62227b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 62237b0a0e3cSJohannes Berg u8 id[IEEE80211_MAX_SSID_LEN]; 62247b0a0e3cSJohannes Berg u8 id_len, id_up_len; 62257b0a0e3cSJohannes Berg } mesh; 62267b0a0e3cSJohannes Berg struct { 62277b0a0e3cSJohannes Berg struct cfg80211_chan_def preset_chandef; 62287b0a0e3cSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 62297b0a0e3cSJohannes Berg u8 ssid_len; 62307b0a0e3cSJohannes Berg } ap; 62317b0a0e3cSJohannes Berg struct { 62327b0a0e3cSJohannes Berg struct cfg80211_internal_bss *current_bss; 62337b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 62347b0a0e3cSJohannes Berg int beacon_interval; 62357b0a0e3cSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 62367b0a0e3cSJohannes Berg u8 ssid_len; 62377b0a0e3cSJohannes Berg } ibss; 62387b0a0e3cSJohannes Berg struct { 62397b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 62407b0a0e3cSJohannes Berg } ocb; 62417b0a0e3cSJohannes Berg } u; 62427b0a0e3cSJohannes Berg 62437b0a0e3cSJohannes Berg struct { 62447b0a0e3cSJohannes Berg u8 addr[ETH_ALEN] __aligned(2); 62457b0a0e3cSJohannes Berg union { 62467b0a0e3cSJohannes Berg struct { 62477b0a0e3cSJohannes Berg unsigned int beacon_interval; 62487b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 62497b0a0e3cSJohannes Berg } ap; 62507b0a0e3cSJohannes Berg struct { 62517b0a0e3cSJohannes Berg struct cfg80211_internal_bss *current_bss; 62527b0a0e3cSJohannes Berg } client; 62537b0a0e3cSJohannes Berg }; 62547b0a0e3cSJohannes Berg } links[IEEE80211_MLD_MAX_NUM_LINKS]; 62557b0a0e3cSJohannes Berg u16 valid_links; 6256d3236553SJohannes Berg }; 6257d3236553SJohannes Berg 625810de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev) 625998104fdeSJohannes Berg { 626098104fdeSJohannes Berg if (wdev->netdev) 626198104fdeSJohannes Berg return wdev->netdev->dev_addr; 626298104fdeSJohannes Berg return wdev->address; 626398104fdeSJohannes Berg } 626498104fdeSJohannes Berg 626573c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev) 626673c7da3dSArend Van Spriel { 626773c7da3dSArend Van Spriel if (wdev->netdev) 626873c7da3dSArend Van Spriel return netif_running(wdev->netdev); 626973c7da3dSArend Van Spriel return wdev->is_running; 627073c7da3dSArend Van Spriel } 627173c7da3dSArend Van Spriel 6272d3236553SJohannes Berg /** 6273d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 6274d3236553SJohannes Berg * 6275d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 62760ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 6277d3236553SJohannes Berg */ 6278d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 6279d3236553SJohannes Berg { 6280d3236553SJohannes Berg BUG_ON(!wdev); 6281d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 6282d3236553SJohannes Berg } 6283d3236553SJohannes Berg 6284d70e9693SJohannes Berg /** 62857b0a0e3cSJohannes Berg * wdev_chandef - return chandef pointer from wireless_dev 62867b0a0e3cSJohannes Berg * @wdev: the wdev 62877b0a0e3cSJohannes Berg * @link_id: the link ID for MLO 62887b0a0e3cSJohannes Berg * 62897b0a0e3cSJohannes Berg * Return: The chandef depending on the mode, or %NULL. 62907b0a0e3cSJohannes Berg */ 62917b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev, 62927b0a0e3cSJohannes Berg unsigned int link_id); 62937b0a0e3cSJohannes Berg 62947b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev, 62957b0a0e3cSJohannes Berg unsigned int link_id) 62967b0a0e3cSJohannes Berg { 62977b0a0e3cSJohannes Berg WARN_ON(link_id && !wdev->valid_links); 62987b0a0e3cSJohannes Berg WARN_ON(wdev->valid_links && 62997b0a0e3cSJohannes Berg !(wdev->valid_links & BIT(link_id))); 63007b0a0e3cSJohannes Berg } 63017b0a0e3cSJohannes Berg 6302efbabc11SVeerendranath Jakkam #define for_each_valid_link(link_info, link_id) \ 63037b0a0e3cSJohannes Berg for (link_id = 0; \ 6304efbabc11SVeerendranath Jakkam link_id < ((link_info)->valid_links ? \ 6305efbabc11SVeerendranath Jakkam ARRAY_SIZE((link_info)->links) : 1); \ 63067b0a0e3cSJohannes Berg link_id++) \ 6307efbabc11SVeerendranath Jakkam if (!(link_info)->valid_links || \ 6308efbabc11SVeerendranath Jakkam ((link_info)->valid_links & BIT(link_id))) 63097b0a0e3cSJohannes Berg 63107b0a0e3cSJohannes Berg /** 6311d70e9693SJohannes Berg * DOC: Utility functions 6312d70e9693SJohannes Berg * 6313d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 6314d3236553SJohannes Berg */ 6315d3236553SJohannes Berg 6316d3236553SJohannes Berg /** 6317934f4c7dSThomas Pedersen * ieee80211_channel_equal - compare two struct ieee80211_channel 6318934f4c7dSThomas Pedersen * 6319934f4c7dSThomas Pedersen * @a: 1st struct ieee80211_channel 6320934f4c7dSThomas Pedersen * @b: 2nd struct ieee80211_channel 6321934f4c7dSThomas Pedersen * Return: true if center frequency of @a == @b 6322934f4c7dSThomas Pedersen */ 6323934f4c7dSThomas Pedersen static inline bool 6324934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a, 6325934f4c7dSThomas Pedersen struct ieee80211_channel *b) 6326934f4c7dSThomas Pedersen { 6327934f4c7dSThomas Pedersen return (a->center_freq == b->center_freq && 6328934f4c7dSThomas Pedersen a->freq_offset == b->freq_offset); 6329934f4c7dSThomas Pedersen } 6330934f4c7dSThomas Pedersen 6331934f4c7dSThomas Pedersen /** 6332934f4c7dSThomas Pedersen * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz 6333934f4c7dSThomas Pedersen * @chan: struct ieee80211_channel to convert 6334934f4c7dSThomas Pedersen * Return: The corresponding frequency (in KHz) 6335934f4c7dSThomas Pedersen */ 6336934f4c7dSThomas Pedersen static inline u32 6337934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan) 6338934f4c7dSThomas Pedersen { 6339934f4c7dSThomas Pedersen return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset; 6340934f4c7dSThomas Pedersen } 6341934f4c7dSThomas Pedersen 6342934f4c7dSThomas Pedersen /** 634311b34737SThomas Pedersen * ieee80211_s1g_channel_width - get allowed channel width from @chan 634411b34737SThomas Pedersen * 634511b34737SThomas Pedersen * Only allowed for band NL80211_BAND_S1GHZ 634611b34737SThomas Pedersen * @chan: channel 634711b34737SThomas Pedersen * Return: The allowed channel width for this center_freq 634811b34737SThomas Pedersen */ 634911b34737SThomas Pedersen enum nl80211_chan_width 635011b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan); 635111b34737SThomas Pedersen 635211b34737SThomas Pedersen /** 6353934f4c7dSThomas Pedersen * ieee80211_channel_to_freq_khz - convert channel number to frequency 6354934f4c7dSThomas Pedersen * @chan: channel number 6355934f4c7dSThomas Pedersen * @band: band, necessary due to channel number overlap 6356934f4c7dSThomas Pedersen * Return: The corresponding frequency (in KHz), or 0 if the conversion failed. 6357934f4c7dSThomas Pedersen */ 6358934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band); 6359934f4c7dSThomas Pedersen 6360934f4c7dSThomas Pedersen /** 6361d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 6362abe37c4bSJohannes Berg * @chan: channel number 636359eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 63640ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 6365d3236553SJohannes Berg */ 6366934f4c7dSThomas Pedersen static inline int 6367934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band) 6368934f4c7dSThomas Pedersen { 6369934f4c7dSThomas Pedersen return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band)); 6370934f4c7dSThomas Pedersen } 6371934f4c7dSThomas Pedersen 6372934f4c7dSThomas Pedersen /** 6373934f4c7dSThomas Pedersen * ieee80211_freq_khz_to_channel - convert frequency to channel number 6374934f4c7dSThomas Pedersen * @freq: center frequency in KHz 6375934f4c7dSThomas Pedersen * Return: The corresponding channel, or 0 if the conversion failed. 6376934f4c7dSThomas Pedersen */ 6377934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq); 6378d3236553SJohannes Berg 6379d3236553SJohannes Berg /** 6380d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 6381934f4c7dSThomas Pedersen * @freq: center frequency in MHz 63820ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 6383d3236553SJohannes Berg */ 6384934f4c7dSThomas Pedersen static inline int 6385934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq) 6386934f4c7dSThomas Pedersen { 6387934f4c7dSThomas Pedersen return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq)); 6388934f4c7dSThomas Pedersen } 6389934f4c7dSThomas Pedersen 6390934f4c7dSThomas Pedersen /** 6391934f4c7dSThomas Pedersen * ieee80211_get_channel_khz - get channel struct from wiphy for specified 6392934f4c7dSThomas Pedersen * frequency 6393934f4c7dSThomas Pedersen * @wiphy: the struct wiphy to get the channel for 6394934f4c7dSThomas Pedersen * @freq: the center frequency (in KHz) of the channel 6395934f4c7dSThomas Pedersen * Return: The channel struct from @wiphy at @freq. 6396934f4c7dSThomas Pedersen */ 6397934f4c7dSThomas Pedersen struct ieee80211_channel * 6398934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq); 6399d3236553SJohannes Berg 6400d3236553SJohannes Berg /** 6401d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 6402543b921bSArend Van Spriel * 6403abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 6404934f4c7dSThomas Pedersen * @freq: the center frequency (in MHz) of the channel 64050ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 6406d3236553SJohannes Berg */ 6407934f4c7dSThomas Pedersen static inline struct ieee80211_channel * 6408934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq) 6409934f4c7dSThomas Pedersen { 6410934f4c7dSThomas Pedersen return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq)); 6411934f4c7dSThomas Pedersen } 6412d3236553SJohannes Berg 6413d3236553SJohannes Berg /** 6414afbc9c9eSJohannes Berg * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC 6415afbc9c9eSJohannes Berg * @chan: control channel to check 6416afbc9c9eSJohannes Berg * 6417afbc9c9eSJohannes Berg * The Preferred Scanning Channels (PSC) are defined in 6418afbc9c9eSJohannes Berg * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3 6419afbc9c9eSJohannes Berg */ 6420afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan) 6421afbc9c9eSJohannes Berg { 6422afbc9c9eSJohannes Berg if (chan->band != NL80211_BAND_6GHZ) 6423afbc9c9eSJohannes Berg return false; 6424afbc9c9eSJohannes Berg 6425afbc9c9eSJohannes Berg return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5; 6426afbc9c9eSJohannes Berg } 6427afbc9c9eSJohannes Berg 6428afbc9c9eSJohannes Berg /** 6429d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 6430d3236553SJohannes Berg * 6431d3236553SJohannes Berg * @sband: the band to look for rates in 6432d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 6433d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 6434d3236553SJohannes Berg * 64350ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 64360ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 64370ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 64380ae997dcSYacine Belkadi * rates in the band's bitrate table. 6439d3236553SJohannes Berg */ 6440623b988fSJoe Perches const struct ieee80211_rate * 6441d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 6442d3236553SJohannes Berg u32 basic_rates, int bitrate); 6443d3236553SJohannes Berg 6444b422c6cdSAshok Nagarajan /** 6445b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 6446b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 6447b422c6cdSAshok Nagarajan * 6448b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 6449b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 6450b422c6cdSAshok Nagarajan */ 64515add321cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband); 6452b422c6cdSAshok Nagarajan 6453d3236553SJohannes Berg /* 6454d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 6455d3236553SJohannes Berg * 6456d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 645766d495d0SMauro Carvalho Chehab * Documentation in Documentation/networking/radiotap-headers.rst 6458d3236553SJohannes Berg */ 6459d3236553SJohannes Berg 646033e5a2f7SJohannes Berg struct radiotap_align_size { 646133e5a2f7SJohannes Berg uint8_t align:4, size:4; 646233e5a2f7SJohannes Berg }; 646333e5a2f7SJohannes Berg 646433e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 646533e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 646633e5a2f7SJohannes Berg int n_bits; 646733e5a2f7SJohannes Berg uint32_t oui; 646833e5a2f7SJohannes Berg uint8_t subns; 646933e5a2f7SJohannes Berg }; 647033e5a2f7SJohannes Berg 647133e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 647233e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 647333e5a2f7SJohannes Berg int n_ns; 647433e5a2f7SJohannes Berg }; 647533e5a2f7SJohannes Berg 6476d3236553SJohannes Berg /** 6477d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 647833e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 647933e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 648033e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 648133e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 648233e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 648333e5a2f7SJohannes Berg * the beginning of the actual data portion 648433e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 648533e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 648633e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 648733e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 648833e5a2f7SJohannes Berg * radiotap namespace or not 648933e5a2f7SJohannes Berg * 649033e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 649133e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 649233e5a2f7SJohannes Berg * @_arg_index: next argument index 649333e5a2f7SJohannes Berg * @_arg: next argument pointer 649433e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 649533e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 649633e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 649733e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 649833e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 649933e5a2f7SJohannes Berg * next bitmap word 650033e5a2f7SJohannes Berg * 650133e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 650233e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 6503d3236553SJohannes Berg */ 6504d3236553SJohannes Berg 6505d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 650633e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 650733e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 650833e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 6509d3236553SJohannes Berg 651033e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 651167272440SJohannes Berg __le32 *_next_bitmap; 651233e5a2f7SJohannes Berg 651333e5a2f7SJohannes Berg unsigned char *this_arg; 651433e5a2f7SJohannes Berg int this_arg_index; 651533e5a2f7SJohannes Berg int this_arg_size; 651633e5a2f7SJohannes Berg 651733e5a2f7SJohannes Berg int is_radiotap_ns; 651833e5a2f7SJohannes Berg 651933e5a2f7SJohannes Berg int _max_length; 652033e5a2f7SJohannes Berg int _arg_index; 652133e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 652233e5a2f7SJohannes Berg int _reset_on_ext; 6523d3236553SJohannes Berg }; 6524d3236553SJohannes Berg 652510dd9b7cSJoe Perches int 652610dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 6527d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 652810dd9b7cSJoe Perches int max_length, 652910dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 6530d3236553SJohannes Berg 653110dd9b7cSJoe Perches int 653210dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 6533d3236553SJohannes Berg 653433e5a2f7SJohannes Berg 6535e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 6536e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 6537e31a16d6SZhu Yi 6538e31a16d6SZhu Yi /** 6539e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 6540e31a16d6SZhu Yi * 6541e31a16d6SZhu Yi * @skb: the frame 65420ae997dcSYacine Belkadi * 65430ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 65440ae997dcSYacine Belkadi * returns the 802.11 header length. 65450ae997dcSYacine Belkadi * 65460ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 65470ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 65480ae997dcSYacine Belkadi * 802.11 header. 6549e31a16d6SZhu Yi */ 6550e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 6551e31a16d6SZhu Yi 6552e31a16d6SZhu Yi /** 6553e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 6554e31a16d6SZhu Yi * @fc: frame control field in little-endian format 65550ae997dcSYacine Belkadi * Return: The header length in bytes. 6556e31a16d6SZhu Yi */ 6557633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 6558e31a16d6SZhu Yi 6559e31a16d6SZhu Yi /** 65609b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 65619b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 65629b395bc3SJohannes Berg * (first byte) will be accessed 65630ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 65649b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 65659b395bc3SJohannes Berg */ 65669b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 65679b395bc3SJohannes Berg 65689b395bc3SJohannes Berg /** 6569d70e9693SJohannes Berg * DOC: Data path helpers 6570d70e9693SJohannes Berg * 6571d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 6572d70e9693SJohannes Berg * functions that help implement the data path for devices 6573d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 6574d70e9693SJohannes Berg */ 6575d70e9693SJohannes Berg 6576d70e9693SJohannes Berg /** 65777f6990c8SJohannes Berg * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 65787f6990c8SJohannes Berg * @skb: the 802.11 data frame 65797f6990c8SJohannes Berg * @ehdr: pointer to a &struct ethhdr that will get the header, instead 65807f6990c8SJohannes Berg * of it being pushed into the SKB 65817f6990c8SJohannes Berg * @addr: the device MAC address 65827f6990c8SJohannes Berg * @iftype: the virtual interface type 658324bba078SFelix Fietkau * @data_offset: offset of payload after the 802.11 header 65842d8b08feSMauro Carvalho Chehab * @is_amsdu: true if the 802.11 header is A-MSDU 65857f6990c8SJohannes Berg * Return: 0 on success. Non-zero on error. 65867f6990c8SJohannes Berg */ 65877f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 658824bba078SFelix Fietkau const u8 *addr, enum nl80211_iftype iftype, 6589a1d5ff56SMathy Vanhoef u8 data_offset, bool is_amsdu); 65907f6990c8SJohannes Berg 65917f6990c8SJohannes Berg /** 6592e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 6593e31a16d6SZhu Yi * @skb: the 802.11 data frame 6594e31a16d6SZhu Yi * @addr: the device MAC address 6595e31a16d6SZhu Yi * @iftype: the virtual interface type 65960ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 6597e31a16d6SZhu Yi */ 65987f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 65997f6990c8SJohannes Berg enum nl80211_iftype iftype) 66007f6990c8SJohannes Berg { 6601a1d5ff56SMathy Vanhoef return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false); 66027f6990c8SJohannes Berg } 6603e31a16d6SZhu Yi 6604e31a16d6SZhu Yi /** 66056e4c0d04SFelix Fietkau * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid 66066e4c0d04SFelix Fietkau * 66076e4c0d04SFelix Fietkau * This is used to detect non-standard A-MSDU frames, e.g. the ones generated 66086e4c0d04SFelix Fietkau * by ath10k and ath11k, where the subframe length includes the length of the 66096e4c0d04SFelix Fietkau * mesh control field. 66106e4c0d04SFelix Fietkau * 66116e4c0d04SFelix Fietkau * @skb: The input A-MSDU frame without any headers. 6612fe4a6d2dSFelix Fietkau * @mesh_hdr: the type of mesh header to test 6613fe4a6d2dSFelix Fietkau * 0: non-mesh A-MSDU length field 6614fe4a6d2dSFelix Fietkau * 1: big-endian mesh A-MSDU length field 6615fe4a6d2dSFelix Fietkau * 2: little-endian mesh A-MSDU length field 66166e4c0d04SFelix Fietkau * Returns: true if subframe header lengths are valid for the @mesh_hdr mode 66176e4c0d04SFelix Fietkau */ 6618fe4a6d2dSFelix Fietkau bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr); 66196e4c0d04SFelix Fietkau 66206e4c0d04SFelix Fietkau /** 6621eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 6622eaf85ca7SZhu Yi * 66237f6990c8SJohannes Berg * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 66247f6990c8SJohannes Berg * The @list will be empty if the decode fails. The @skb must be fully 66257f6990c8SJohannes Berg * header-less before being passed in here; it is freed in this function. 6626eaf85ca7SZhu Yi * 66277f6990c8SJohannes Berg * @skb: The input A-MSDU frame without any headers. 6628eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 6629085a6c10SRandy Dunlap * initialized by the caller. 6630eaf85ca7SZhu Yi * @addr: The device MAC address. 6631eaf85ca7SZhu Yi * @iftype: The device interface type. 6632eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 66338b935ee2SJohannes Berg * @check_da: DA to check in the inner ethernet header, or NULL 66348b935ee2SJohannes Berg * @check_sa: SA to check in the inner ethernet header, or NULL 6635fe4a6d2dSFelix Fietkau * @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu 6636eaf85ca7SZhu Yi */ 6637eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 6638eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 66398b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 6640986e43b1SFelix Fietkau const u8 *check_da, const u8 *check_sa, 6641fe4a6d2dSFelix Fietkau u8 mesh_control); 6642986e43b1SFelix Fietkau 6643986e43b1SFelix Fietkau /** 6644986e43b1SFelix Fietkau * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol 6645986e43b1SFelix Fietkau * 6646986e43b1SFelix Fietkau * Check for RFC1042 or bridge tunnel header and fetch the encapsulated 6647986e43b1SFelix Fietkau * protocol. 6648986e43b1SFelix Fietkau * 6649986e43b1SFelix Fietkau * @hdr: pointer to the MSDU payload 6650986e43b1SFelix Fietkau * @proto: destination pointer to store the protocol 6651986e43b1SFelix Fietkau * Return: true if encapsulation was found 6652986e43b1SFelix Fietkau */ 6653986e43b1SFelix Fietkau bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto); 6654986e43b1SFelix Fietkau 6655986e43b1SFelix Fietkau /** 6656986e43b1SFelix Fietkau * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames 6657986e43b1SFelix Fietkau * 6658986e43b1SFelix Fietkau * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part 6659986e43b1SFelix Fietkau * of the MSDU data. Also move any source/destination addresses from the mesh 6660986e43b1SFelix Fietkau * header to the ethernet header (if present). 6661986e43b1SFelix Fietkau * 6662986e43b1SFelix Fietkau * @skb: The 802.3 frame with embedded mesh header 6663986e43b1SFelix Fietkau */ 6664986e43b1SFelix Fietkau int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb); 6665eaf85ca7SZhu Yi 6666eaf85ca7SZhu Yi /** 6667e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 6668e31a16d6SZhu Yi * @skb: the data frame 6669fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 66700ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 6671e31a16d6SZhu Yi */ 6672fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 6673fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 6674e31a16d6SZhu Yi 6675c21dbf92SJohannes Berg /** 667649a68e0dSJohannes Berg * cfg80211_find_elem_match - match information element and byte array in data 667749a68e0dSJohannes Berg * 667849a68e0dSJohannes Berg * @eid: element ID 667949a68e0dSJohannes Berg * @ies: data consisting of IEs 668049a68e0dSJohannes Berg * @len: length of data 668149a68e0dSJohannes Berg * @match: byte array to match 668249a68e0dSJohannes Berg * @match_len: number of bytes in the match array 668349a68e0dSJohannes Berg * @match_offset: offset in the IE data where the byte array should match. 668449a68e0dSJohannes Berg * Note the difference to cfg80211_find_ie_match() which considers 668549a68e0dSJohannes Berg * the offset to start from the element ID byte, but here we take 668649a68e0dSJohannes Berg * the data portion instead. 668749a68e0dSJohannes Berg * 668849a68e0dSJohannes Berg * Return: %NULL if the element ID could not be found or if 668949a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 669049a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 669149a68e0dSJohannes Berg * requested element struct. 669249a68e0dSJohannes Berg * 669349a68e0dSJohannes Berg * Note: There are no checks on the element length other than 669449a68e0dSJohannes Berg * having to fit into the given data and being large enough for the 669549a68e0dSJohannes Berg * byte array to match. 669649a68e0dSJohannes Berg */ 669749a68e0dSJohannes Berg const struct element * 669849a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len, 669949a68e0dSJohannes Berg const u8 *match, unsigned int match_len, 670049a68e0dSJohannes Berg unsigned int match_offset); 670149a68e0dSJohannes Berg 670249a68e0dSJohannes Berg /** 6703fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 6704fbd05e4aSLuca Coelho * 6705fbd05e4aSLuca Coelho * @eid: element ID 6706fbd05e4aSLuca Coelho * @ies: data consisting of IEs 6707fbd05e4aSLuca Coelho * @len: length of data 6708fbd05e4aSLuca Coelho * @match: byte array to match 6709fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 6710fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 6711fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 6712fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 6713fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 6714fbd05e4aSLuca Coelho * the second byte is the IE length. 6715fbd05e4aSLuca Coelho * 6716fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 6717fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 6718fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 6719fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 6720fbd05e4aSLuca Coelho * element ID. 6721fbd05e4aSLuca Coelho * 6722fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 6723fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 6724fbd05e4aSLuca Coelho * byte array to match. 6725fbd05e4aSLuca Coelho */ 672649a68e0dSJohannes Berg static inline const u8 * 672749a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len, 672849a68e0dSJohannes Berg const u8 *match, unsigned int match_len, 672949a68e0dSJohannes Berg unsigned int match_offset) 673049a68e0dSJohannes Berg { 673149a68e0dSJohannes Berg /* match_offset can't be smaller than 2, unless match_len is 673249a68e0dSJohannes Berg * zero, in which case match_offset must be zero as well. 673349a68e0dSJohannes Berg */ 673449a68e0dSJohannes Berg if (WARN_ON((match_len && match_offset < 2) || 673549a68e0dSJohannes Berg (!match_len && match_offset))) 673649a68e0dSJohannes Berg return NULL; 673749a68e0dSJohannes Berg 67387e367b06SJohannes Berg return (const void *)cfg80211_find_elem_match(eid, ies, len, 673949a68e0dSJohannes Berg match, match_len, 674049a68e0dSJohannes Berg match_offset ? 674149a68e0dSJohannes Berg match_offset - 2 : 0); 674249a68e0dSJohannes Berg } 674349a68e0dSJohannes Berg 674449a68e0dSJohannes Berg /** 674549a68e0dSJohannes Berg * cfg80211_find_elem - find information element in data 674649a68e0dSJohannes Berg * 674749a68e0dSJohannes Berg * @eid: element ID 674849a68e0dSJohannes Berg * @ies: data consisting of IEs 674949a68e0dSJohannes Berg * @len: length of data 675049a68e0dSJohannes Berg * 675149a68e0dSJohannes Berg * Return: %NULL if the element ID could not be found or if 675249a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 675349a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 675449a68e0dSJohannes Berg * requested element struct. 675549a68e0dSJohannes Berg * 675649a68e0dSJohannes Berg * Note: There are no checks on the element length other than 675749a68e0dSJohannes Berg * having to fit into the given data. 675849a68e0dSJohannes Berg */ 675949a68e0dSJohannes Berg static inline const struct element * 676049a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len) 676149a68e0dSJohannes Berg { 676249a68e0dSJohannes Berg return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0); 676349a68e0dSJohannes Berg } 6764fbd05e4aSLuca Coelho 6765fbd05e4aSLuca Coelho /** 6766c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 6767c21dbf92SJohannes Berg * 6768c21dbf92SJohannes Berg * @eid: element ID 6769c21dbf92SJohannes Berg * @ies: data consisting of IEs 6770c21dbf92SJohannes Berg * @len: length of data 6771c21dbf92SJohannes Berg * 67720ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 67730ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 67740ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 67750ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 67760ae997dcSYacine Belkadi * 67770ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 67780ae997dcSYacine Belkadi * having to fit into the given data. 6779c21dbf92SJohannes Berg */ 6780fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 6781fbd05e4aSLuca Coelho { 6782fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 6783fbd05e4aSLuca Coelho } 6784c21dbf92SJohannes Berg 6785d70e9693SJohannes Berg /** 678649a68e0dSJohannes Berg * cfg80211_find_ext_elem - find information element with EID Extension in data 678749a68e0dSJohannes Berg * 678849a68e0dSJohannes Berg * @ext_eid: element ID Extension 678949a68e0dSJohannes Berg * @ies: data consisting of IEs 679049a68e0dSJohannes Berg * @len: length of data 679149a68e0dSJohannes Berg * 679298e0c7f8SRandy Dunlap * Return: %NULL if the extended element could not be found or if 679349a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 679449a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 679549a68e0dSJohannes Berg * requested element struct. 679649a68e0dSJohannes Berg * 679749a68e0dSJohannes Berg * Note: There are no checks on the element length other than 679849a68e0dSJohannes Berg * having to fit into the given data. 679949a68e0dSJohannes Berg */ 680049a68e0dSJohannes Berg static inline const struct element * 680149a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len) 680249a68e0dSJohannes Berg { 680349a68e0dSJohannes Berg return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len, 680449a68e0dSJohannes Berg &ext_eid, 1, 0); 680549a68e0dSJohannes Berg } 680649a68e0dSJohannes Berg 680749a68e0dSJohannes Berg /** 68083f817fe7SJouni Malinen * cfg80211_find_ext_ie - find information element with EID Extension in data 68093f817fe7SJouni Malinen * 68103f817fe7SJouni Malinen * @ext_eid: element ID Extension 68113f817fe7SJouni Malinen * @ies: data consisting of IEs 68123f817fe7SJouni Malinen * @len: length of data 68133f817fe7SJouni Malinen * 68143f817fe7SJouni Malinen * Return: %NULL if the extended element ID could not be found or if 68153f817fe7SJouni Malinen * the element is invalid (claims to be longer than the given 68163f817fe7SJouni Malinen * data), or a pointer to the first byte of the requested 68173f817fe7SJouni Malinen * element, that is the byte containing the element ID. 68183f817fe7SJouni Malinen * 68193f817fe7SJouni Malinen * Note: There are no checks on the element length other than 68203f817fe7SJouni Malinen * having to fit into the given data. 68213f817fe7SJouni Malinen */ 68223f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 68233f817fe7SJouni Malinen { 68243f817fe7SJouni Malinen return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 68253f817fe7SJouni Malinen &ext_eid, 1, 2); 68263f817fe7SJouni Malinen } 68273f817fe7SJouni Malinen 68283f817fe7SJouni Malinen /** 682949a68e0dSJohannes Berg * cfg80211_find_vendor_elem - find vendor specific information element in data 683049a68e0dSJohannes Berg * 683149a68e0dSJohannes Berg * @oui: vendor OUI 683249a68e0dSJohannes Berg * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 683349a68e0dSJohannes Berg * @ies: data consisting of IEs 683449a68e0dSJohannes Berg * @len: length of data 683549a68e0dSJohannes Berg * 683649a68e0dSJohannes Berg * Return: %NULL if the vendor specific element ID could not be found or if the 683749a68e0dSJohannes Berg * element is invalid (claims to be longer than the given data); otherwise 683849a68e0dSJohannes Berg * return the element structure for the requested element. 683949a68e0dSJohannes Berg * 684049a68e0dSJohannes Berg * Note: There are no checks on the element length other than having to fit into 684149a68e0dSJohannes Berg * the given data. 684249a68e0dSJohannes Berg */ 684349a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type, 684449a68e0dSJohannes Berg const u8 *ies, 684549a68e0dSJohannes Berg unsigned int len); 684649a68e0dSJohannes Berg 684749a68e0dSJohannes Berg /** 68480c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 68490c28ec58SEliad Peller * 68500c28ec58SEliad Peller * @oui: vendor OUI 68519e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 68520c28ec58SEliad Peller * @ies: data consisting of IEs 68530c28ec58SEliad Peller * @len: length of data 68540c28ec58SEliad Peller * 68550ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 68560ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 68570ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 68580ae997dcSYacine Belkadi * element ID. 68590ae997dcSYacine Belkadi * 68600ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 68610ae997dcSYacine Belkadi * the given data. 68620c28ec58SEliad Peller */ 686349a68e0dSJohannes Berg static inline const u8 * 686449a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 686549a68e0dSJohannes Berg const u8 *ies, unsigned int len) 686649a68e0dSJohannes Berg { 68677e367b06SJohannes Berg return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len); 686849a68e0dSJohannes Berg } 68690c28ec58SEliad Peller 68700c28ec58SEliad Peller /** 6871f837a653SBenjamin Berg * cfg80211_defragment_element - Defrag the given element data into a buffer 6872f837a653SBenjamin Berg * 6873f837a653SBenjamin Berg * @elem: the element to defragment 6874f837a653SBenjamin Berg * @ies: elements where @elem is contained 6875f837a653SBenjamin Berg * @ieslen: length of @ies 6876f837a653SBenjamin Berg * @data: buffer to store element data 6877f837a653SBenjamin Berg * @data_len: length of @data 6878f837a653SBenjamin Berg * @frag_id: the element ID of fragments 6879f837a653SBenjamin Berg * 6880f837a653SBenjamin Berg * Return: length of @data, or -EINVAL on error 6881f837a653SBenjamin Berg * 6882f837a653SBenjamin Berg * Copy out all data from an element that may be fragmented into @data, while 6883f837a653SBenjamin Berg * skipping all headers. 6884f837a653SBenjamin Berg * 6885f837a653SBenjamin Berg * The function uses memmove() internally. It is acceptable to defragment an 6886f837a653SBenjamin Berg * element in-place. 6887f837a653SBenjamin Berg */ 6888f837a653SBenjamin Berg ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies, 6889f837a653SBenjamin Berg size_t ieslen, u8 *data, size_t data_len, 6890f837a653SBenjamin Berg u8 frag_id); 6891f837a653SBenjamin Berg 6892f837a653SBenjamin Berg /** 689330ca1aa5SDedy Lansky * cfg80211_send_layer2_update - send layer 2 update frame 689430ca1aa5SDedy Lansky * 689530ca1aa5SDedy Lansky * @dev: network device 689630ca1aa5SDedy Lansky * @addr: STA MAC address 689730ca1aa5SDedy Lansky * 689830ca1aa5SDedy Lansky * Wireless drivers can use this function to update forwarding tables in bridge 689930ca1aa5SDedy Lansky * devices upon STA association. 690030ca1aa5SDedy Lansky */ 690130ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); 690230ca1aa5SDedy Lansky 690330ca1aa5SDedy Lansky /** 6904d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 6905d70e9693SJohannes Berg * 6906d70e9693SJohannes Berg * TODO 6907d3236553SJohannes Berg */ 6908d3236553SJohannes Berg 6909d3236553SJohannes Berg /** 6910d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 6911d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 6912d3236553SJohannes Berg * conflicts) 6913d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 6914d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 6915d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 6916d3236553SJohannes Berg * alpha2. 6917d3236553SJohannes Berg * 6918d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 6919d3236553SJohannes Berg * what it believes should be the current regulatory domain by 6920d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 6921d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 6922d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 6923d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 6924d3236553SJohannes Berg * 6925d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 6926d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 6927d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 6928d3236553SJohannes Berg * 6929d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 6930d3236553SJohannes Berg * an -ENOMEM. 69310ae997dcSYacine Belkadi * 69320ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 6933d3236553SJohannes Berg */ 693410dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 6935d3236553SJohannes Berg 6936d3236553SJohannes Berg /** 6937b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 6938b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 693998e0c7f8SRandy Dunlap * @rd: the regulatory domain information to use for this wiphy 6940b0d7aa59SJonathan Doron * 6941b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 6942b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 6943b0d7aa59SJonathan Doron * information. 6944b0d7aa59SJonathan Doron * 6945b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 6946b0d7aa59SJonathan Doron */ 6947b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 6948b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 6949b0d7aa59SJonathan Doron 6950b0d7aa59SJonathan Doron /** 6951a05829a7SJohannes Berg * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers 69522c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 69532c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 69542c3e861cSArik Nemtsov * 6955a05829a7SJohannes Berg * This functions requires the RTNL and the wiphy mutex to be held and 6956a05829a7SJohannes Berg * applies the new regdomain synchronously to this wiphy. For more details 6957a05829a7SJohannes Berg * see regulatory_set_wiphy_regd(). 69582c3e861cSArik Nemtsov * 69592c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 69602c3e861cSArik Nemtsov */ 6961a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 69622c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 69632c3e861cSArik Nemtsov 69642c3e861cSArik Nemtsov /** 6965d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 6966d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 6967d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 6968d3236553SJohannes Berg * 6969d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 6970d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 6971d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 6972d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 6973d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 6974d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 6975222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 6976ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 6977222ea581SLuis R. Rodriguez * that called this helper. 6978d3236553SJohannes Berg */ 697910dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 6980d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 6981d3236553SJohannes Berg 6982d3236553SJohannes Berg /** 6983d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 6984d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 6985d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 6986d3236553SJohannes Berg * 6987d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 6988d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 6989d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 6990d3236553SJohannes Berg * and processed already. 6991d3236553SJohannes Berg * 69920ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 69930ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 69940ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 69950ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 69960ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 69970ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 69980ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 6999d3236553SJohannes Berg */ 7000361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 7001361c9c8bSJohannes Berg u32 center_freq); 7002d3236553SJohannes Berg 7003034c6d6eSLuis R. Rodriguez /** 7004034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 7005034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 7006034c6d6eSLuis R. Rodriguez * 7007034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 7008034c6d6eSLuis R. Rodriguez * proper string representation. 7009034c6d6eSLuis R. Rodriguez */ 7010034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 7011034c6d6eSLuis R. Rodriguez 701219d3577eSHaim Dreyfuss /** 7013dc0c18edSAaron Komisar * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom 7014dc0c18edSAaron Komisar * @wiphy: wiphy for which pre-CAC capability is checked. 7015dc0c18edSAaron Komisar * 7016dc0c18edSAaron Komisar * Pre-CAC is allowed only in some regdomains (notable ETSI). 7017dc0c18edSAaron Komisar */ 7018dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 7019dc0c18edSAaron Komisar 7020dc0c18edSAaron Komisar /** 702119d3577eSHaim Dreyfuss * DOC: Internal regulatory db functions 702219d3577eSHaim Dreyfuss * 702319d3577eSHaim Dreyfuss */ 702419d3577eSHaim Dreyfuss 702519d3577eSHaim Dreyfuss /** 702619d3577eSHaim Dreyfuss * reg_query_regdb_wmm - Query internal regulatory db for wmm rule 702719d3577eSHaim Dreyfuss * Regulatory self-managed driver can use it to proactively 702819d3577eSHaim Dreyfuss * 702919d3577eSHaim Dreyfuss * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 703098e0c7f8SRandy Dunlap * @freq: the frequency (in MHz) to be queried. 703119d3577eSHaim Dreyfuss * @rule: pointer to store the wmm rule from the regulatory db. 703219d3577eSHaim Dreyfuss * 703319d3577eSHaim Dreyfuss * Self-managed wireless drivers can use this function to query 703419d3577eSHaim Dreyfuss * the internal regulatory database to check whether the given 703519d3577eSHaim Dreyfuss * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations. 703619d3577eSHaim Dreyfuss * 703719d3577eSHaim Dreyfuss * Drivers should check the return value, its possible you can get 703819d3577eSHaim Dreyfuss * an -ENODATA. 703919d3577eSHaim Dreyfuss * 704019d3577eSHaim Dreyfuss * Return: 0 on success. -ENODATA. 704119d3577eSHaim Dreyfuss */ 704238cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq, 704338cb87eeSStanislaw Gruszka struct ieee80211_reg_rule *rule); 704419d3577eSHaim Dreyfuss 7045d3236553SJohannes Berg /* 7046d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 7047d3236553SJohannes Berg * functions and BSS handling helpers 7048d3236553SJohannes Berg */ 7049d3236553SJohannes Berg 70502a519311SJohannes Berg /** 70512a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 70522a519311SJohannes Berg * 70532a519311SJohannes Berg * @request: the corresponding scan request 70541d76250bSAvraham Stern * @info: information about the completed scan 70552a519311SJohannes Berg */ 70561d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 70571d76250bSAvraham Stern struct cfg80211_scan_info *info); 70582a519311SJohannes Berg 70592a519311SJohannes Berg /** 7060807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 7061807f8a8cSLuciano Coelho * 7062807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 7063b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 7064807f8a8cSLuciano Coelho */ 7065b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 7066807f8a8cSLuciano Coelho 7067807f8a8cSLuciano Coelho /** 7068807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 7069807f8a8cSLuciano Coelho * 7070807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 7071b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 7072807f8a8cSLuciano Coelho * 7073807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 7074807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 7075807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 7076807f8a8cSLuciano Coelho */ 7077b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 7078807f8a8cSLuciano Coelho 7079807f8a8cSLuciano Coelho /** 7080a05829a7SJohannes Berg * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped 7081792e6aa7SEliad Peller * 7082792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 7083b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 7084792e6aa7SEliad Peller * 7085792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 7086792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 7087792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 7088a05829a7SJohannes Berg * This function should be called with the wiphy mutex held. 7089792e6aa7SEliad Peller */ 7090a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid); 7091792e6aa7SEliad Peller 7092792e6aa7SEliad Peller /** 70936e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 70942a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 70956e19bc4bSDmitry Shmidt * @data: the BSS metadata 7096abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 7097abe37c4bSJohannes Berg * @len: length of the management frame 70982a519311SJohannes Berg * @gfp: context flags 70992a519311SJohannes Berg * 71002a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 71012a519311SJohannes Berg * the BSS should be updated/added. 7102ef100682SJohannes Berg * 71030ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 71040ae997dcSYacine Belkadi * Or %NULL on error. 71052a519311SJohannes Berg */ 7106ef100682SJohannes Berg struct cfg80211_bss * __must_check 71076e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 71086e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 71096e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 71106e19bc4bSDmitry Shmidt gfp_t gfp); 71116e19bc4bSDmitry Shmidt 71126e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 71132a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 71143afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 71152a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 7116dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 7117dcd6eac1SSimon Wunderlich { 71186e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 71196e19bc4bSDmitry Shmidt .chan = rx_channel, 71206e19bc4bSDmitry Shmidt .signal = signal, 71216e19bc4bSDmitry Shmidt }; 71226e19bc4bSDmitry Shmidt 71236e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 7124dcd6eac1SSimon Wunderlich } 71252a519311SJohannes Berg 7126abe37c4bSJohannes Berg /** 71277ece9c37SSara Sharon * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID 71287ece9c37SSara Sharon * @bssid: transmitter BSSID 71297ece9c37SSara Sharon * @max_bssid: max BSSID indicator, taken from Multiple BSSID element 71307ece9c37SSara Sharon * @mbssid_index: BSSID index, taken from Multiple BSSID index element 71315d4071abSJohannes Berg * @new_bssid: calculated nontransmitted BSSID 71327ece9c37SSara Sharon */ 71337ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid, 71345d4071abSJohannes Berg u8 mbssid_index, u8 *new_bssid) 71357ece9c37SSara Sharon { 71365d4071abSJohannes Berg u64 bssid_u64 = ether_addr_to_u64(bssid); 71375d4071abSJohannes Berg u64 mask = GENMASK_ULL(max_bssid - 1, 0); 71385d4071abSJohannes Berg u64 new_bssid_u64; 71397ece9c37SSara Sharon 71405d4071abSJohannes Berg new_bssid_u64 = bssid_u64 & ~mask; 71417ece9c37SSara Sharon 71425d4071abSJohannes Berg new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask; 71437ece9c37SSara Sharon 71445d4071abSJohannes Berg u64_to_ether_addr(new_bssid_u64, new_bssid); 71457ece9c37SSara Sharon } 71467ece9c37SSara Sharon 71477ece9c37SSara Sharon /** 7148f7dacfb1SSara Sharon * cfg80211_is_element_inherited - returns if element ID should be inherited 7149f7dacfb1SSara Sharon * @element: element to check 7150f7dacfb1SSara Sharon * @non_inherit_element: non inheritance element 7151f7dacfb1SSara Sharon */ 7152f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element, 7153f7dacfb1SSara Sharon const struct element *non_inherit_element); 7154f7dacfb1SSara Sharon 7155f7dacfb1SSara Sharon /** 7156fe806e49SSara Sharon * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs 7157fe806e49SSara Sharon * @ie: ies 7158fe806e49SSara Sharon * @ielen: length of IEs 7159fe806e49SSara Sharon * @mbssid_elem: current MBSSID element 7160fe806e49SSara Sharon * @sub_elem: current MBSSID subelement (profile) 7161fe806e49SSara Sharon * @merged_ie: location of the merged profile 7162fe806e49SSara Sharon * @max_copy_len: max merged profile length 7163fe806e49SSara Sharon */ 7164fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen, 7165fe806e49SSara Sharon const struct element *mbssid_elem, 7166fe806e49SSara Sharon const struct element *sub_elem, 71675809a5d5SDan Carpenter u8 *merged_ie, size_t max_copy_len); 7168fe806e49SSara Sharon 7169fe806e49SSara Sharon /** 71705bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 71715bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 71725bc8c1f2SJohannes Berg * from a beacon or probe response 71735bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 71745bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 71755bc8c1f2SJohannes Berg */ 71765bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 71775bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 71785bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 71795bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 71805bc8c1f2SJohannes Berg }; 71815bc8c1f2SJohannes Berg 71825bc8c1f2SJohannes Berg /** 71837f599aecSAyala Beker * cfg80211_get_ies_channel_number - returns the channel number from ies 71847f599aecSAyala Beker * @ie: IEs 71857f599aecSAyala Beker * @ielen: length of IEs 71867f599aecSAyala Beker * @band: enum nl80211_band of the channel 71877f599aecSAyala Beker * 71887f599aecSAyala Beker * Returns the channel number, or -1 if none could be determined. 71897f599aecSAyala Beker */ 71907f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen, 71916ff9efcfSMordechay Goodstein enum nl80211_band band); 71927f599aecSAyala Beker 71937f599aecSAyala Beker /** 71941c1c2b37SDmitry Antipov * cfg80211_ssid_eq - compare two SSIDs 71951c1c2b37SDmitry Antipov * @a: first SSID 71961c1c2b37SDmitry Antipov * @b: second SSID 71971c1c2b37SDmitry Antipov * 71981c1c2b37SDmitry Antipov * Return: %true if SSIDs are equal, %false otherwise. 71991c1c2b37SDmitry Antipov */ 72001c1c2b37SDmitry Antipov static inline bool 72011c1c2b37SDmitry Antipov cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b) 72021c1c2b37SDmitry Antipov { 72031c1c2b37SDmitry Antipov if (WARN_ON(!a || !b)) 72041c1c2b37SDmitry Antipov return false; 72051c1c2b37SDmitry Antipov if (a->ssid_len != b->ssid_len) 72061c1c2b37SDmitry Antipov return false; 72071c1c2b37SDmitry Antipov return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true; 72081c1c2b37SDmitry Antipov } 72091c1c2b37SDmitry Antipov 72101c1c2b37SDmitry Antipov /** 72116e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 7212abe37c4bSJohannes Berg * 7213abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 72146e19bc4bSDmitry Shmidt * @data: the BSS metadata 72155bc8c1f2SJohannes Berg * @ftype: frame type (if known) 7216abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 72177b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 7218abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 7219abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 7220abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 7221abe37c4bSJohannes Berg * @ielen: length of the additional IEs 7222abe37c4bSJohannes Berg * @gfp: context flags 7223abe37c4bSJohannes Berg * 7224abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 7225abe37c4bSJohannes Berg * the BSS should be updated/added. 7226ef100682SJohannes Berg * 72270ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 72280ae997dcSYacine Belkadi * Or %NULL on error. 7229abe37c4bSJohannes Berg */ 7230ef100682SJohannes Berg struct cfg80211_bss * __must_check 72316e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 72326e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 72336e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 72346e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 72356e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 72366e19bc4bSDmitry Shmidt gfp_t gfp); 72376e19bc4bSDmitry Shmidt 72386e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 723906aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 72403afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 72415bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 72427b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 72437b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 7244dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 7245dcd6eac1SSimon Wunderlich { 72466e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 72476e19bc4bSDmitry Shmidt .chan = rx_channel, 72486e19bc4bSDmitry Shmidt .signal = signal, 72496e19bc4bSDmitry Shmidt }; 72506e19bc4bSDmitry Shmidt 72516e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 72526e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 7253dcd6eac1SSimon Wunderlich gfp); 7254dcd6eac1SSimon Wunderlich } 725506aa7afaSJussi Kivilinna 725627548677SJohannes Berg /** 7257d02a12b8SJohannes Berg * __cfg80211_get_bss - get a BSS reference 7258d02a12b8SJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 7259d02a12b8SJohannes Berg * @channel: the channel to search on (or %NULL) 7260d02a12b8SJohannes Berg * @bssid: the desired BSSID (or %NULL) 7261d02a12b8SJohannes Berg * @ssid: the desired SSID (or %NULL) 7262d02a12b8SJohannes Berg * @ssid_len: length of the SSID (or 0) 7263d02a12b8SJohannes Berg * @bss_type: type of BSS, see &enum ieee80211_bss_type 7264d02a12b8SJohannes Berg * @privacy: privacy filter, see &enum ieee80211_privacy 7265d02a12b8SJohannes Berg * @use_for: indicates which use is intended 7266d02a12b8SJohannes Berg */ 7267d02a12b8SJohannes Berg struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy, 7268d02a12b8SJohannes Berg struct ieee80211_channel *channel, 7269d02a12b8SJohannes Berg const u8 *bssid, 7270d02a12b8SJohannes Berg const u8 *ssid, size_t ssid_len, 7271d02a12b8SJohannes Berg enum ieee80211_bss_type bss_type, 7272d02a12b8SJohannes Berg enum ieee80211_privacy privacy, 7273d02a12b8SJohannes Berg u32 use_for); 7274d02a12b8SJohannes Berg 7275d02a12b8SJohannes Berg /** 727627548677SJohannes Berg * cfg80211_get_bss - get a BSS reference 727727548677SJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 727827548677SJohannes Berg * @channel: the channel to search on (or %NULL) 727927548677SJohannes Berg * @bssid: the desired BSSID (or %NULL) 728027548677SJohannes Berg * @ssid: the desired SSID (or %NULL) 728127548677SJohannes Berg * @ssid_len: length of the SSID (or 0) 728227548677SJohannes Berg * @bss_type: type of BSS, see &enum ieee80211_bss_type 728327548677SJohannes Berg * @privacy: privacy filter, see &enum ieee80211_privacy 7284d02a12b8SJohannes Berg * 7285d02a12b8SJohannes Berg * This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL. 728627548677SJohannes Berg */ 7287d02a12b8SJohannes Berg static inline struct cfg80211_bss * 7288d02a12b8SJohannes Berg cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel, 7289d02a12b8SJohannes Berg const u8 *bssid, const u8 *ssid, size_t ssid_len, 72906eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 7291d02a12b8SJohannes Berg enum ieee80211_privacy privacy) 7292d02a12b8SJohannes Berg { 7293d02a12b8SJohannes Berg return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, 7294d02a12b8SJohannes Berg bss_type, privacy, 7295d02a12b8SJohannes Berg NL80211_BSS_USE_FOR_NORMAL); 7296d02a12b8SJohannes Berg } 7297d02a12b8SJohannes Berg 729879420f09SJohannes Berg static inline struct cfg80211_bss * 729979420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 730079420f09SJohannes Berg struct ieee80211_channel *channel, 730179420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 730279420f09SJohannes Berg { 730379420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 73046eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 73056eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 730679420f09SJohannes Berg } 730779420f09SJohannes Berg 73084c0c0b75SJohannes Berg /** 73094c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 73105b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 73114c0c0b75SJohannes Berg * @bss: the BSS struct to reference 73124c0c0b75SJohannes Berg * 73134c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 73144c0c0b75SJohannes Berg */ 73155b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 73164c0c0b75SJohannes Berg 73174c0c0b75SJohannes Berg /** 73184c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 73195b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 73204c0c0b75SJohannes Berg * @bss: the BSS struct 73214c0c0b75SJohannes Berg * 73224c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 73234c0c0b75SJohannes Berg */ 73245b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 7325d3236553SJohannes Berg 7326d491af19SJohannes Berg /** 7327d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 7328d491af19SJohannes Berg * @wiphy: the wiphy 7329d491af19SJohannes Berg * @bss: the bss to remove 7330d491af19SJohannes Berg * 7331d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 7332d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 7333d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 7334d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 7335d491af19SJohannes Berg */ 7336d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 7337fee52678SJohannes Berg 73384770c8f9SIlan Peer /** 73394770c8f9SIlan Peer * cfg80211_bss_iter - iterate all BSS entries 73404770c8f9SIlan Peer * 73414770c8f9SIlan Peer * This function iterates over the BSS entries associated with the given wiphy 73424770c8f9SIlan Peer * and calls the callback for the iterated BSS. The iterator function is not 73434770c8f9SIlan Peer * allowed to call functions that might modify the internal state of the BSS DB. 73444770c8f9SIlan Peer * 73454770c8f9SIlan Peer * @wiphy: the wiphy 73464770c8f9SIlan Peer * @chandef: if given, the iterator function will be called only if the channel 73474770c8f9SIlan Peer * of the currently iterated BSS is a subset of the given channel. 73484770c8f9SIlan Peer * @iter: the iterator function to call 73494770c8f9SIlan Peer * @iter_data: an argument to the iterator function 73504770c8f9SIlan Peer */ 73514770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy, 73524770c8f9SIlan Peer struct cfg80211_chan_def *chandef, 73534770c8f9SIlan Peer void (*iter)(struct wiphy *wiphy, 73544770c8f9SIlan Peer struct cfg80211_bss *bss, 73554770c8f9SIlan Peer void *data), 73564770c8f9SIlan Peer void *iter_data); 73574770c8f9SIlan Peer 73586039f6d2SJouni Malinen /** 73596ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 73606039f6d2SJouni Malinen * @dev: network device 73616039f6d2SJouni Malinen * @buf: authentication frame (header + body) 73626039f6d2SJouni Malinen * @len: length of the frame data 73636039f6d2SJouni Malinen * 73646ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 73656ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 73666ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 73676ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 73686ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 73696ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 73706ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 73716ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 73726ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 73736ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 73746ff57cf8SJohannes Berg * 73756ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 73766039f6d2SJouni Malinen */ 73776ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 73786039f6d2SJouni Malinen 73796039f6d2SJouni Malinen /** 73806ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 73811965c853SJouni Malinen * @dev: network device 73821965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 7383cb0b4bebSJohannes Berg * 73848d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 73858d61ffa5SJohannes Berg * mutex. 73861965c853SJouni Malinen */ 73876ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 73881965c853SJouni Malinen 73891965c853SJouni Malinen /** 73908e4687f6SKalle Valo * struct cfg80211_rx_assoc_resp_data - association response data 73914d9ec73dSJouni Malinen * @buf: (Re)Association Response frame (header + body) 73926039f6d2SJouni Malinen * @len: length of the frame data 7393f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 7394f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 73954d9ec73dSJouni Malinen * @req_ies: information elements from the (Re)Association Request frame 73964d9ec73dSJouni Malinen * @req_ies_len: length of req_ies data 73975cd212cbSJohannes Berg * @ap_mld_addr: AP MLD address (in case of MLO) 73985cd212cbSJohannes Berg * @links: per-link information indexed by link ID, use links[0] for 73995cd212cbSJohannes Berg * non-MLO connections 740033615978SJonathan Corbet * @links.bss: the BSS that association was requested with, ownership of the 740133615978SJonathan Corbet * pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp() 740253ad07e9SJohannes Berg * @links.status: Set this (along with a BSS pointer) for links that 740353ad07e9SJohannes Berg * were rejected by the AP. 7404cd47c0f5SJohannes Berg */ 74058e4687f6SKalle Valo struct cfg80211_rx_assoc_resp_data { 7406cd47c0f5SJohannes Berg const u8 *buf; 7407cd47c0f5SJohannes Berg size_t len; 7408cd47c0f5SJohannes Berg const u8 *req_ies; 7409cd47c0f5SJohannes Berg size_t req_ies_len; 7410cd47c0f5SJohannes Berg int uapsd_queues; 74115cd212cbSJohannes Berg const u8 *ap_mld_addr; 74125cd212cbSJohannes Berg struct { 7413234249d8SWen Gong u8 addr[ETH_ALEN] __aligned(2); 74145cd212cbSJohannes Berg struct cfg80211_bss *bss; 741553ad07e9SJohannes Berg u16 status; 74165cd212cbSJohannes Berg } links[IEEE80211_MLD_MAX_NUM_LINKS]; 7417cd47c0f5SJohannes Berg }; 7418cd47c0f5SJohannes Berg 7419cd47c0f5SJohannes Berg /** 7420cd47c0f5SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 7421cd47c0f5SJohannes Berg * @dev: network device 74228e4687f6SKalle Valo * @data: association response data, &struct cfg80211_rx_assoc_resp_data 74236039f6d2SJouni Malinen * 74246ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 74256ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 74266ff57cf8SJohannes Berg * 74276ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 74286039f6d2SJouni Malinen */ 74296ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 743088f29324SJohannes Berg const struct cfg80211_rx_assoc_resp_data *data); 74316039f6d2SJouni Malinen 74326039f6d2SJouni Malinen /** 7433f662d2f4SJohannes Berg * struct cfg80211_assoc_failure - association failure data 7434f662d2f4SJohannes Berg * @ap_mld_addr: AP MLD address, or %NULL 7435f662d2f4SJohannes Berg * @bss: list of BSSes, must use entry 0 for non-MLO connections 7436f662d2f4SJohannes Berg * (@ap_mld_addr is %NULL) 7437f662d2f4SJohannes Berg * @timeout: indicates the association failed due to timeout, otherwise 7438f662d2f4SJohannes Berg * the association was abandoned for a reason reported through some 7439f662d2f4SJohannes Berg * other API (e.g. deauth RX) 74401965c853SJouni Malinen */ 7441f662d2f4SJohannes Berg struct cfg80211_assoc_failure { 7442f662d2f4SJohannes Berg const u8 *ap_mld_addr; 7443f662d2f4SJohannes Berg struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS]; 7444f662d2f4SJohannes Berg bool timeout; 7445f662d2f4SJohannes Berg }; 74461965c853SJouni Malinen 74471965c853SJouni Malinen /** 7448f662d2f4SJohannes Berg * cfg80211_assoc_failure - notification of association failure 7449e6f462dfSJohannes Berg * @dev: network device 7450f662d2f4SJohannes Berg * @data: data describing the association failure 7451e6f462dfSJohannes Berg * 7452e6f462dfSJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 7453e6f462dfSJohannes Berg */ 7454f662d2f4SJohannes Berg void cfg80211_assoc_failure(struct net_device *dev, 7455f662d2f4SJohannes Berg struct cfg80211_assoc_failure *data); 7456e6f462dfSJohannes Berg 7457e6f462dfSJohannes Berg /** 74586ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 74596039f6d2SJouni Malinen * @dev: network device 74606ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 74616039f6d2SJouni Malinen * @len: length of the frame data 74623bb02143SJohannes Berg * @reconnect: immediate reconnect is desired (include the nl80211 attribute) 74636039f6d2SJouni Malinen * 74646039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 746553b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 74668d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 74678d61ffa5SJohannes Berg * corresponding wdev's mutex. 74686039f6d2SJouni Malinen */ 74693bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, 74703bb02143SJohannes Berg bool reconnect); 7471ce470613SHolger Schurig 7472ce470613SHolger Schurig /** 74736ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 7474cf4e594eSJouni Malinen * @dev: network device 74754d797fceSJouni Malinen * @buf: received management frame (header + body) 7476cf4e594eSJouni Malinen * @len: length of the frame data 7477cf4e594eSJouni Malinen * 74786ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 74796ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 74804d797fceSJouni Malinen * frame was not protected. This is also used to notify reception of a Beacon 74814d797fceSJouni Malinen * frame that was dropped because it did not include a valid MME MIC while 74824d797fceSJouni Malinen * beacon protection was enabled (BIGTK configured in station mode). 74834d797fceSJouni Malinen * 74844d797fceSJouni Malinen * This function may sleep. 7485cf4e594eSJouni Malinen */ 74866ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 74876ff57cf8SJohannes Berg const u8 *buf, size_t len); 7488cf4e594eSJouni Malinen 7489cf4e594eSJouni Malinen /** 7490a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 7491a3b8b056SJouni Malinen * @dev: network device 7492a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 7493a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 7494a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 7495a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 7496e6d6e342SJohannes Berg * @gfp: allocation flags 7497a3b8b056SJouni Malinen * 7498a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 7499a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 7500a3b8b056SJouni Malinen * primitive. 7501a3b8b056SJouni Malinen */ 7502a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 7503a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 7504e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 7505a3b8b056SJouni Malinen 750604a773adSJohannes Berg /** 750704a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 750804a773adSJohannes Berg * 750904a773adSJohannes Berg * @dev: network device 751004a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 7511fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 751204a773adSJohannes Berg * @gfp: allocation flags 751304a773adSJohannes Berg * 751404a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 751504a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 751604a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 751704a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 751804a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 751904a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 752004a773adSJohannes Berg */ 7521fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 7522fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 752304a773adSJohannes Berg 75241f87f7d3SJohannes Berg /** 7525b1e8eb11SMauro Carvalho Chehab * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer 7526b1e8eb11SMauro Carvalho Chehab * candidate 7527c93b5e71SJavier Cardona * 7528c93b5e71SJavier Cardona * @dev: network device 7529c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 7530c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 75315ac4a12dSMatteo Croce * @ie_len: length of the information elements buffer 75322d8b08feSMauro Carvalho Chehab * @sig_dbm: signal level in dBm 7533c93b5e71SJavier Cardona * @gfp: allocation flags 7534c93b5e71SJavier Cardona * 7535c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 7536c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 7537c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 7538c93b5e71SJavier Cardona */ 7539c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 7540ecbc12adSBob Copeland const u8 *macaddr, const u8 *ie, u8 ie_len, 7541ecbc12adSBob Copeland int sig_dbm, gfp_t gfp); 7542c93b5e71SJavier Cardona 7543c93b5e71SJavier Cardona /** 7544d70e9693SJohannes Berg * DOC: RFkill integration 7545d70e9693SJohannes Berg * 7546d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 7547d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 7548d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 754905b23456SRandy Dunlap * into disconnecting and turning all interfaces off. Drivers are 7550d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 7551d70e9693SJohannes Berg * 7552d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 7553d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 7554d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 7555d70e9693SJohannes Berg */ 7556d70e9693SJohannes Berg 7557d70e9693SJohannes Berg /** 7558810344edSEmmanuel Grumbach * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state 75591f87f7d3SJohannes Berg * @wiphy: the wiphy 75601f87f7d3SJohannes Berg * @blocked: block status 75616f779a66SEmmanuel Grumbach * @reason: one of reasons in &enum rfkill_hard_block_reasons 75621f87f7d3SJohannes Berg */ 75636f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, 75646f779a66SEmmanuel Grumbach enum rfkill_hard_block_reasons reason); 75656f779a66SEmmanuel Grumbach 75666f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) 75676f779a66SEmmanuel Grumbach { 75686f779a66SEmmanuel Grumbach wiphy_rfkill_set_hw_state_reason(wiphy, blocked, 75696f779a66SEmmanuel Grumbach RFKILL_HARD_BLOCK_SIGNAL); 75706f779a66SEmmanuel Grumbach } 75711f87f7d3SJohannes Berg 75721f87f7d3SJohannes Berg /** 75731f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 75741f87f7d3SJohannes Berg * @wiphy: the wiphy 75751f87f7d3SJohannes Berg */ 75761f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 75771f87f7d3SJohannes Berg 75781f87f7d3SJohannes Berg /** 75791f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 75801f87f7d3SJohannes Berg * @wiphy: the wiphy 75811f87f7d3SJohannes Berg */ 7582358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy) 7583358ae888SEmmanuel Grumbach { 7584358ae888SEmmanuel Grumbach rfkill_pause_polling(wiphy->rfkill); 7585358ae888SEmmanuel Grumbach } 75861f87f7d3SJohannes Berg 7587ad7e718cSJohannes Berg /** 7588ad7e718cSJohannes Berg * DOC: Vendor commands 7589ad7e718cSJohannes Berg * 7590ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 7591ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 7592ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 7593ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 7594ad7e718cSJohannes Berg * the configuration mechanism. 7595ad7e718cSJohannes Berg * 7596ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 759705b23456SRandy Dunlap * in struct wiphy, with handlers for each one. Each command has an 7598ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 7599ad7e718cSJohannes Berg * 7600ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 7601ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 7602ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 7603ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 7604ad7e718cSJohannes Berg * managers etc. need. 7605ad7e718cSJohannes Berg */ 7606ad7e718cSJohannes Berg 7607ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 7608ad7e718cSJohannes Berg enum nl80211_commands cmd, 7609ad7e718cSJohannes Berg enum nl80211_attrs attr, 7610ad7e718cSJohannes Berg int approxlen); 7611ad7e718cSJohannes Berg 7612567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 76136c09e791SAhmad Kholaif struct wireless_dev *wdev, 7614567ffc35SJohannes Berg enum nl80211_commands cmd, 7615567ffc35SJohannes Berg enum nl80211_attrs attr, 761655c1fdf0SJohannes Berg unsigned int portid, 7617567ffc35SJohannes Berg int vendor_event_idx, 7618567ffc35SJohannes Berg int approxlen, gfp_t gfp); 7619567ffc35SJohannes Berg 7620567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 7621567ffc35SJohannes Berg 7622ad7e718cSJohannes Berg /** 7623ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 7624ad7e718cSJohannes Berg * @wiphy: the wiphy 7625ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 7626ad7e718cSJohannes Berg * be put into the skb 7627ad7e718cSJohannes Berg * 7628ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 7629ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 7630ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 7631ad7e718cSJohannes Berg * 7632ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 7633ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 7634ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 7635ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 7636ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 7637ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 7638ad7e718cSJohannes Berg * You must not modify the skb in any other way. 7639ad7e718cSJohannes Berg * 7640ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 7641ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 7642ad7e718cSJohannes Berg * 7643ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7644ad7e718cSJohannes Berg */ 7645ad7e718cSJohannes Berg static inline struct sk_buff * 7646ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 7647ad7e718cSJohannes Berg { 7648ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 7649ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 7650ad7e718cSJohannes Berg } 7651ad7e718cSJohannes Berg 7652ad7e718cSJohannes Berg /** 7653ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 7654ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 7655ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 7656ad7e718cSJohannes Berg * 7657ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 7658ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 7659ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 7660ad7e718cSJohannes Berg * skb regardless of the return value. 7661ad7e718cSJohannes Berg * 7662ad7e718cSJohannes Berg * Return: An error code or 0 on success. 7663ad7e718cSJohannes Berg */ 7664ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 7665ad7e718cSJohannes Berg 7666567ffc35SJohannes Berg /** 76675d9c358dSRandy Dunlap * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID 766855c1fdf0SJohannes Berg * @wiphy: the wiphy 766955c1fdf0SJohannes Berg * 767055c1fdf0SJohannes Berg * Return the current netlink port ID in a vendor command handler. 767155c1fdf0SJohannes Berg * Valid to call only there. 767255c1fdf0SJohannes Berg */ 767355c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy); 767455c1fdf0SJohannes Berg 767555c1fdf0SJohannes Berg /** 7676567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 7677567ffc35SJohannes Berg * @wiphy: the wiphy 76786c09e791SAhmad Kholaif * @wdev: the wireless device 7679567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 7680567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 7681567ffc35SJohannes Berg * be put into the skb 7682567ffc35SJohannes Berg * @gfp: allocation flags 7683567ffc35SJohannes Berg * 7684567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 7685567ffc35SJohannes Berg * vendor-specific multicast group. 7686567ffc35SJohannes Berg * 76876c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 76886c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 76896c09e791SAhmad Kholaif * attribute. 76906c09e791SAhmad Kholaif * 7691567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 7692567ffc35SJohannes Berg * skb to send the event. 7693567ffc35SJohannes Berg * 7694567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7695567ffc35SJohannes Berg */ 7696567ffc35SJohannes Berg static inline struct sk_buff * 76976c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 76986c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 7699567ffc35SJohannes Berg { 77006c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 7701567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 770255c1fdf0SJohannes Berg 0, event_idx, approxlen, gfp); 770355c1fdf0SJohannes Berg } 770455c1fdf0SJohannes Berg 770555c1fdf0SJohannes Berg /** 770655c1fdf0SJohannes Berg * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb 770755c1fdf0SJohannes Berg * @wiphy: the wiphy 770855c1fdf0SJohannes Berg * @wdev: the wireless device 770955c1fdf0SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 771055c1fdf0SJohannes Berg * @portid: port ID of the receiver 771155c1fdf0SJohannes Berg * @approxlen: an upper bound of the length of the data that will 771255c1fdf0SJohannes Berg * be put into the skb 771355c1fdf0SJohannes Berg * @gfp: allocation flags 771455c1fdf0SJohannes Berg * 771555c1fdf0SJohannes Berg * This function allocates and pre-fills an skb for an event to send to 771655c1fdf0SJohannes Berg * a specific (userland) socket. This socket would previously have been 771755c1fdf0SJohannes Berg * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take 771855c1fdf0SJohannes Berg * care to register a netlink notifier to see when the socket closes. 771955c1fdf0SJohannes Berg * 772055c1fdf0SJohannes Berg * If wdev != NULL, both the ifindex and identifier of the specified 772155c1fdf0SJohannes Berg * wireless device are added to the event message before the vendor data 772255c1fdf0SJohannes Berg * attribute. 772355c1fdf0SJohannes Berg * 772455c1fdf0SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 772555c1fdf0SJohannes Berg * skb to send the event. 772655c1fdf0SJohannes Berg * 772755c1fdf0SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 772855c1fdf0SJohannes Berg */ 772955c1fdf0SJohannes Berg static inline struct sk_buff * 773055c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy, 773155c1fdf0SJohannes Berg struct wireless_dev *wdev, 773255c1fdf0SJohannes Berg unsigned int portid, int approxlen, 773355c1fdf0SJohannes Berg int event_idx, gfp_t gfp) 773455c1fdf0SJohannes Berg { 773555c1fdf0SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 773655c1fdf0SJohannes Berg NL80211_ATTR_VENDOR_DATA, 773755c1fdf0SJohannes Berg portid, event_idx, approxlen, gfp); 7738567ffc35SJohannes Berg } 7739567ffc35SJohannes Berg 7740567ffc35SJohannes Berg /** 7741567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 7742567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 7743567ffc35SJohannes Berg * @gfp: allocation flags 7744567ffc35SJohannes Berg * 7745567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 7746567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 7747567ffc35SJohannes Berg */ 7748567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 7749567ffc35SJohannes Berg { 7750567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 7751567ffc35SJohannes Berg } 7752567ffc35SJohannes Berg 7753aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 7754aff89a9bSJohannes Berg /** 7755d70e9693SJohannes Berg * DOC: Test mode 7756d70e9693SJohannes Berg * 7757d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 7758d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 7759d70e9693SJohannes Berg * factory programming. 7760d70e9693SJohannes Berg * 776105b23456SRandy Dunlap * This chapter describes how drivers interact with it. For more 7762d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 7763d70e9693SJohannes Berg */ 7764d70e9693SJohannes Berg 7765d70e9693SJohannes Berg /** 7766aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 7767aff89a9bSJohannes Berg * @wiphy: the wiphy 7768aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 7769aff89a9bSJohannes Berg * be put into the skb 7770aff89a9bSJohannes Berg * 7771aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 7772aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 7773aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 7774aff89a9bSJohannes Berg * 77750ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 77760ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 77770ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 77780ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 77790ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 77800ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 77810ae997dcSYacine Belkadi * must not modify the skb in any other way. 7782aff89a9bSJohannes Berg * 7783aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 7784aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 77850ae997dcSYacine Belkadi * 77860ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7787aff89a9bSJohannes Berg */ 7788ad7e718cSJohannes Berg static inline struct sk_buff * 7789ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 7790ad7e718cSJohannes Berg { 7791ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 7792ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 7793ad7e718cSJohannes Berg } 7794aff89a9bSJohannes Berg 7795aff89a9bSJohannes Berg /** 7796aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 7797aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 7798aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 7799aff89a9bSJohannes Berg * 78000ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 78010ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 78020ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 78030ae997dcSYacine Belkadi * regardless of the return value. 78040ae997dcSYacine Belkadi * 78050ae997dcSYacine Belkadi * Return: An error code or 0 on success. 7806aff89a9bSJohannes Berg */ 7807ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 7808ad7e718cSJohannes Berg { 7809ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 7810ad7e718cSJohannes Berg } 7811aff89a9bSJohannes Berg 7812aff89a9bSJohannes Berg /** 7813aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 7814aff89a9bSJohannes Berg * @wiphy: the wiphy 7815aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 7816aff89a9bSJohannes Berg * be put into the skb 7817aff89a9bSJohannes Berg * @gfp: allocation flags 7818aff89a9bSJohannes Berg * 7819aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 7820aff89a9bSJohannes Berg * testmode multicast group. 7821aff89a9bSJohannes Berg * 78220ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 78230ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 78240ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 78250ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 78260ae997dcSYacine Belkadi * in any other way. 7827aff89a9bSJohannes Berg * 7828aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 7829aff89a9bSJohannes Berg * skb to send the event. 78300ae997dcSYacine Belkadi * 78310ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7832aff89a9bSJohannes Berg */ 7833567ffc35SJohannes Berg static inline struct sk_buff * 7834567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 7835567ffc35SJohannes Berg { 78366c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 783755c1fdf0SJohannes Berg NL80211_ATTR_TESTDATA, 0, -1, 7838567ffc35SJohannes Berg approxlen, gfp); 7839567ffc35SJohannes Berg } 7840aff89a9bSJohannes Berg 7841aff89a9bSJohannes Berg /** 7842aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 7843aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 7844aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 7845aff89a9bSJohannes Berg * @gfp: allocation flags 7846aff89a9bSJohannes Berg * 7847aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 7848aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 7849aff89a9bSJohannes Berg * consumes it. 7850aff89a9bSJohannes Berg */ 7851567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 7852567ffc35SJohannes Berg { 7853567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 7854567ffc35SJohannes Berg } 7855aff89a9bSJohannes Berg 7856aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 785771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 7858aff89a9bSJohannes Berg #else 7859aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 786071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 7861aff89a9bSJohannes Berg #endif 7862aff89a9bSJohannes Berg 7863b23aa676SSamuel Ortiz /** 786476804d28SArend Van Spriel * struct cfg80211_fils_resp_params - FILS connection response params 786576804d28SArend Van Spriel * @kek: KEK derived from a successful FILS connection (may be %NULL) 786676804d28SArend Van Spriel * @kek_len: Length of @fils_kek in octets 786776804d28SArend Van Spriel * @update_erp_next_seq_num: Boolean value to specify whether the value in 786876804d28SArend Van Spriel * @erp_next_seq_num is valid. 786976804d28SArend Van Spriel * @erp_next_seq_num: The next sequence number to use in ERP message in 787076804d28SArend Van Spriel * FILS Authentication. This value should be specified irrespective of the 787176804d28SArend Van Spriel * status for a FILS connection. 787276804d28SArend Van Spriel * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 787376804d28SArend Van Spriel * @pmk_len: Length of @pmk in octets 787476804d28SArend Van Spriel * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 787576804d28SArend Van Spriel * used for this FILS connection (may be %NULL). 787676804d28SArend Van Spriel */ 787776804d28SArend Van Spriel struct cfg80211_fils_resp_params { 787876804d28SArend Van Spriel const u8 *kek; 787976804d28SArend Van Spriel size_t kek_len; 788076804d28SArend Van Spriel bool update_erp_next_seq_num; 788176804d28SArend Van Spriel u16 erp_next_seq_num; 788276804d28SArend Van Spriel const u8 *pmk; 788376804d28SArend Van Spriel size_t pmk_len; 788476804d28SArend Van Spriel const u8 *pmkid; 788576804d28SArend Van Spriel }; 788676804d28SArend Van Spriel 788776804d28SArend Van Spriel /** 78885349a0f7SVidyullatha Kanchanapally * struct cfg80211_connect_resp_params - Connection response params 78895349a0f7SVidyullatha Kanchanapally * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 78905349a0f7SVidyullatha Kanchanapally * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 78915349a0f7SVidyullatha Kanchanapally * the real status code for failures. If this call is used to report a 78925349a0f7SVidyullatha Kanchanapally * failure due to a timeout (e.g., not receiving an Authentication frame 78935349a0f7SVidyullatha Kanchanapally * from the AP) instead of an explicit rejection by the AP, -1 is used to 78945349a0f7SVidyullatha Kanchanapally * indicate that this is a failure, but without a status code. 78955349a0f7SVidyullatha Kanchanapally * @timeout_reason is used to report the reason for the timeout in that 78965349a0f7SVidyullatha Kanchanapally * case. 78975349a0f7SVidyullatha Kanchanapally * @req_ie: Association request IEs (may be %NULL) 78985349a0f7SVidyullatha Kanchanapally * @req_ie_len: Association request IEs length 78995349a0f7SVidyullatha Kanchanapally * @resp_ie: Association response IEs (may be %NULL) 79005349a0f7SVidyullatha Kanchanapally * @resp_ie_len: Association response IEs length 790176804d28SArend Van Spriel * @fils: FILS connection response parameters. 79025349a0f7SVidyullatha Kanchanapally * @timeout_reason: Reason for connection timeout. This is used when the 79035349a0f7SVidyullatha Kanchanapally * connection fails due to a timeout instead of an explicit rejection from 79045349a0f7SVidyullatha Kanchanapally * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 79055349a0f7SVidyullatha Kanchanapally * not known. This value is used only if @status < 0 to indicate that the 79065349a0f7SVidyullatha Kanchanapally * failure is due to a timeout and not due to explicit rejection by the AP. 79075349a0f7SVidyullatha Kanchanapally * This value is ignored in other cases (@status >= 0). 7908efbabc11SVeerendranath Jakkam * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise 7909efbabc11SVeerendranath Jakkam * zero. 7910efbabc11SVeerendranath Jakkam * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL. 7911efbabc11SVeerendranath Jakkam * @links : For MLO connection, contains link info for the valid links indicated 7912efbabc11SVeerendranath Jakkam * using @valid_links. For non-MLO connection, links[0] contains the 7913efbabc11SVeerendranath Jakkam * connected AP info. 7914efbabc11SVeerendranath Jakkam * @links.addr: For MLO connection, MAC address of the STA link. Otherwise 7915efbabc11SVeerendranath Jakkam * %NULL. 7916efbabc11SVeerendranath Jakkam * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO 7917efbabc11SVeerendranath Jakkam * connection, links[0].bssid points to the BSSID of the AP (may be %NULL). 7918efbabc11SVeerendranath Jakkam * @links.bss: For MLO connection, entry of bss to which STA link is connected. 7919efbabc11SVeerendranath Jakkam * For non-MLO connection, links[0].bss points to entry of bss to which STA 7920efbabc11SVeerendranath Jakkam * is connected. It can be obtained through cfg80211_get_bss() (may be 7921efbabc11SVeerendranath Jakkam * %NULL). It is recommended to store the bss from the connect_request and 7922efbabc11SVeerendranath Jakkam * hold a reference to it and return through this param to avoid a warning 7923efbabc11SVeerendranath Jakkam * if the bss is expired during the connection, esp. for those drivers 7924efbabc11SVeerendranath Jakkam * implementing connect op. Only one parameter among @bssid and @bss needs 7925efbabc11SVeerendranath Jakkam * to be specified. 792653ad07e9SJohannes Berg * @links.status: per-link status code, to report a status code that's not 792753ad07e9SJohannes Berg * %WLAN_STATUS_SUCCESS for a given link, it must also be in the 792853ad07e9SJohannes Berg * @valid_links bitmap and may have a BSS pointer (which is then released) 79295349a0f7SVidyullatha Kanchanapally */ 79305349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params { 79315349a0f7SVidyullatha Kanchanapally int status; 79325349a0f7SVidyullatha Kanchanapally const u8 *req_ie; 79335349a0f7SVidyullatha Kanchanapally size_t req_ie_len; 79345349a0f7SVidyullatha Kanchanapally const u8 *resp_ie; 79355349a0f7SVidyullatha Kanchanapally size_t resp_ie_len; 793676804d28SArend Van Spriel struct cfg80211_fils_resp_params fils; 79375349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason; 7938efbabc11SVeerendranath Jakkam 7939efbabc11SVeerendranath Jakkam const u8 *ap_mld_addr; 7940efbabc11SVeerendranath Jakkam u16 valid_links; 7941efbabc11SVeerendranath Jakkam struct { 7942efbabc11SVeerendranath Jakkam const u8 *addr; 7943efbabc11SVeerendranath Jakkam const u8 *bssid; 7944efbabc11SVeerendranath Jakkam struct cfg80211_bss *bss; 794553ad07e9SJohannes Berg u16 status; 7946efbabc11SVeerendranath Jakkam } links[IEEE80211_MLD_MAX_NUM_LINKS]; 79475349a0f7SVidyullatha Kanchanapally }; 79485349a0f7SVidyullatha Kanchanapally 79495349a0f7SVidyullatha Kanchanapally /** 79505349a0f7SVidyullatha Kanchanapally * cfg80211_connect_done - notify cfg80211 of connection result 79515349a0f7SVidyullatha Kanchanapally * 79525349a0f7SVidyullatha Kanchanapally * @dev: network device 79535349a0f7SVidyullatha Kanchanapally * @params: connection response parameters 79545349a0f7SVidyullatha Kanchanapally * @gfp: allocation flags 79555349a0f7SVidyullatha Kanchanapally * 79565349a0f7SVidyullatha Kanchanapally * It should be called by the underlying driver once execution of the connection 79575349a0f7SVidyullatha Kanchanapally * request from connect() has been completed. This is similar to 79585349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), but takes a structure pointer for connection response 79595349a0f7SVidyullatha Kanchanapally * parameters. Only one of the functions among cfg80211_connect_bss(), 79605349a0f7SVidyullatha Kanchanapally * cfg80211_connect_result(), cfg80211_connect_timeout(), 79615349a0f7SVidyullatha Kanchanapally * and cfg80211_connect_done() should be called. 79625349a0f7SVidyullatha Kanchanapally */ 79635349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev, 79645349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params *params, 79655349a0f7SVidyullatha Kanchanapally gfp_t gfp); 79665349a0f7SVidyullatha Kanchanapally 79675349a0f7SVidyullatha Kanchanapally /** 7968e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 7969e7054989SKanchanapally, Vidyullatha * 7970e7054989SKanchanapally, Vidyullatha * @dev: network device 7971e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 7972a3ce17d1SChaitanya Tata * @bss: Entry of bss to which STA got connected to, can be obtained through 7973a3ce17d1SChaitanya Tata * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 7974a3ce17d1SChaitanya Tata * bss from the connect_request and hold a reference to it and return 7975a3ce17d1SChaitanya Tata * through this param to avoid a warning if the bss is expired during the 7976a3ce17d1SChaitanya Tata * connection, esp. for those drivers implementing connect op. 7977a3ce17d1SChaitanya Tata * Only one parameter among @bssid and @bss needs to be specified. 7978e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 7979e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 7980e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 7981e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 7982c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 7983e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 7984c88215d7SJouni Malinen * the real status code for failures. If this call is used to report a 7985c88215d7SJouni Malinen * failure due to a timeout (e.g., not receiving an Authentication frame 7986c88215d7SJouni Malinen * from the AP) instead of an explicit rejection by the AP, -1 is used to 7987c88215d7SJouni Malinen * indicate that this is a failure, but without a status code. 7988c88215d7SJouni Malinen * @timeout_reason is used to report the reason for the timeout in that 7989c88215d7SJouni Malinen * case. 7990e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 79913093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. This is used when the 79923093ebbeSPurushottam Kushwaha * connection fails due to a timeout instead of an explicit rejection from 79933093ebbeSPurushottam Kushwaha * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 79943093ebbeSPurushottam Kushwaha * not known. This value is used only if @status < 0 to indicate that the 79953093ebbeSPurushottam Kushwaha * failure is due to a timeout and not due to explicit rejection by the AP. 79963093ebbeSPurushottam Kushwaha * This value is ignored in other cases (@status >= 0). 7997e7054989SKanchanapally, Vidyullatha * 7998c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 7999c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 8000c88215d7SJouni Malinen * cfg80211_connect_result(), but with the option of identifying the exact bss 80015349a0f7SVidyullatha Kanchanapally * entry for the connection. Only one of the functions among 80025349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 80035349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 8004e7054989SKanchanapally, Vidyullatha */ 80055349a0f7SVidyullatha Kanchanapally static inline void 80065349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 8007e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 8008e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 80093093ebbeSPurushottam Kushwaha size_t resp_ie_len, int status, gfp_t gfp, 80105349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason) 80115349a0f7SVidyullatha Kanchanapally { 80125349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params params; 80135349a0f7SVidyullatha Kanchanapally 80145349a0f7SVidyullatha Kanchanapally memset(¶ms, 0, sizeof(params)); 80155349a0f7SVidyullatha Kanchanapally params.status = status; 8016efbabc11SVeerendranath Jakkam params.links[0].bssid = bssid; 8017efbabc11SVeerendranath Jakkam params.links[0].bss = bss; 80185349a0f7SVidyullatha Kanchanapally params.req_ie = req_ie; 80195349a0f7SVidyullatha Kanchanapally params.req_ie_len = req_ie_len; 80205349a0f7SVidyullatha Kanchanapally params.resp_ie = resp_ie; 80215349a0f7SVidyullatha Kanchanapally params.resp_ie_len = resp_ie_len; 80225349a0f7SVidyullatha Kanchanapally params.timeout_reason = timeout_reason; 80235349a0f7SVidyullatha Kanchanapally 80245349a0f7SVidyullatha Kanchanapally cfg80211_connect_done(dev, ¶ms, gfp); 80255349a0f7SVidyullatha Kanchanapally } 8026e7054989SKanchanapally, Vidyullatha 8027e7054989SKanchanapally, Vidyullatha /** 8028b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 8029b23aa676SSamuel Ortiz * 8030b23aa676SSamuel Ortiz * @dev: network device 8031b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 8032b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 8033b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 8034b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 8035b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 8036c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 8037b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 8038b23aa676SSamuel Ortiz * the real status code for failures. 8039b23aa676SSamuel Ortiz * @gfp: allocation flags 8040b23aa676SSamuel Ortiz * 8041c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 8042c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 8043c88215d7SJouni Malinen * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 80445349a0f7SVidyullatha Kanchanapally * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 80455349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 8046b23aa676SSamuel Ortiz */ 8047e7054989SKanchanapally, Vidyullatha static inline void 8048e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 8049b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 8050b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 8051e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 8052e7054989SKanchanapally, Vidyullatha { 8053e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 80543093ebbeSPurushottam Kushwaha resp_ie_len, status, gfp, 80553093ebbeSPurushottam Kushwaha NL80211_TIMEOUT_UNSPECIFIED); 8056e7054989SKanchanapally, Vidyullatha } 8057b23aa676SSamuel Ortiz 8058b23aa676SSamuel Ortiz /** 8059bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 8060bf1ecd21SJouni Malinen * 8061bf1ecd21SJouni Malinen * @dev: network device 8062bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 8063bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 8064bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 8065bf1ecd21SJouni Malinen * @gfp: allocation flags 80663093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. 8067bf1ecd21SJouni Malinen * 8068bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 8069bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 8070bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 8071bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 80725349a0f7SVidyullatha Kanchanapally * waiting for the response. Only one of the functions among 80735349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 80745349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 8075bf1ecd21SJouni Malinen */ 8076bf1ecd21SJouni Malinen static inline void 8077bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 80783093ebbeSPurushottam Kushwaha const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 80793093ebbeSPurushottam Kushwaha enum nl80211_timeout_reason timeout_reason) 8080bf1ecd21SJouni Malinen { 8081bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 80823093ebbeSPurushottam Kushwaha gfp, timeout_reason); 8083bf1ecd21SJouni Malinen } 8084bf1ecd21SJouni Malinen 8085bf1ecd21SJouni Malinen /** 808629ce6ecbSAvraham Stern * struct cfg80211_roam_info - driver initiated roaming information 808729ce6ecbSAvraham Stern * 808829ce6ecbSAvraham Stern * @req_ie: association request IEs (maybe be %NULL) 808929ce6ecbSAvraham Stern * @req_ie_len: association request IEs length 809029ce6ecbSAvraham Stern * @resp_ie: association response IEs (may be %NULL) 809129ce6ecbSAvraham Stern * @resp_ie_len: assoc response IEs length 8092e841b7b1SArend Van Spriel * @fils: FILS related roaming information. 8093efbabc11SVeerendranath Jakkam * @valid_links: For MLO roaming, BIT mask of the new valid links is set. 8094efbabc11SVeerendranath Jakkam * Otherwise zero. 8095efbabc11SVeerendranath Jakkam * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL. 8096efbabc11SVeerendranath Jakkam * @links : For MLO roaming, contains new link info for the valid links set in 8097efbabc11SVeerendranath Jakkam * @valid_links. For non-MLO roaming, links[0] contains the new AP info. 8098efbabc11SVeerendranath Jakkam * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL. 8099efbabc11SVeerendranath Jakkam * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO 8100efbabc11SVeerendranath Jakkam * roaming, links[0].bssid points to the BSSID of the new AP. May be 8101efbabc11SVeerendranath Jakkam * %NULL if %links.bss is set. 8102efbabc11SVeerendranath Jakkam * @links.channel: the channel of the new AP. 8103efbabc11SVeerendranath Jakkam * @links.bss: For MLO roaming, entry of new bss to which STA link got 8104efbabc11SVeerendranath Jakkam * roamed. For non-MLO roaming, links[0].bss points to entry of bss to 8105efbabc11SVeerendranath Jakkam * which STA got roamed (may be %NULL if %links.bssid is set) 810629ce6ecbSAvraham Stern */ 810729ce6ecbSAvraham Stern struct cfg80211_roam_info { 810829ce6ecbSAvraham Stern const u8 *req_ie; 810929ce6ecbSAvraham Stern size_t req_ie_len; 811029ce6ecbSAvraham Stern const u8 *resp_ie; 811129ce6ecbSAvraham Stern size_t resp_ie_len; 8112e841b7b1SArend Van Spriel struct cfg80211_fils_resp_params fils; 8113efbabc11SVeerendranath Jakkam 8114efbabc11SVeerendranath Jakkam const u8 *ap_mld_addr; 8115efbabc11SVeerendranath Jakkam u16 valid_links; 8116efbabc11SVeerendranath Jakkam struct { 8117efbabc11SVeerendranath Jakkam const u8 *addr; 8118efbabc11SVeerendranath Jakkam const u8 *bssid; 8119efbabc11SVeerendranath Jakkam struct ieee80211_channel *channel; 8120efbabc11SVeerendranath Jakkam struct cfg80211_bss *bss; 8121efbabc11SVeerendranath Jakkam } links[IEEE80211_MLD_MAX_NUM_LINKS]; 812229ce6ecbSAvraham Stern }; 812329ce6ecbSAvraham Stern 812429ce6ecbSAvraham Stern /** 8125b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 8126b23aa676SSamuel Ortiz * 8127b23aa676SSamuel Ortiz * @dev: network device 812829ce6ecbSAvraham Stern * @info: information about the new BSS. struct &cfg80211_roam_info. 8129b23aa676SSamuel Ortiz * @gfp: allocation flags 8130b23aa676SSamuel Ortiz * 813129ce6ecbSAvraham Stern * This function may be called with the driver passing either the BSSID of the 813229ce6ecbSAvraham Stern * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 813329ce6ecbSAvraham Stern * It should be called by the underlying driver whenever it roamed from one AP 813429ce6ecbSAvraham Stern * to another while connected. Drivers which have roaming implemented in 813529ce6ecbSAvraham Stern * firmware should pass the bss entry to avoid a race in bss entry timeout where 813629ce6ecbSAvraham Stern * the bss entry of the new AP is seen in the driver, but gets timed out by the 813729ce6ecbSAvraham Stern * time it is accessed in __cfg80211_roamed() due to delay in scheduling 8138adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 813929ce6ecbSAvraham Stern * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 8140e1b18549SGeert Uytterhoeven * released while disconnecting from the current bss. 8141adbde344SVasanthakumar Thiagarajan */ 814229ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 814329ce6ecbSAvraham Stern gfp_t gfp); 8144adbde344SVasanthakumar Thiagarajan 8145adbde344SVasanthakumar Thiagarajan /** 8146503c1fb9SAvraham Stern * cfg80211_port_authorized - notify cfg80211 of successful security association 8147503c1fb9SAvraham Stern * 8148503c1fb9SAvraham Stern * @dev: network device 8149e4e7e3afSVinayak Yadawad * @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address 8150e4e7e3afSVinayak Yadawad * in case of AP/P2P GO 81510ff57171SVinayak Yadawad * @td_bitmap: transition disable policy 81520ff57171SVinayak Yadawad * @td_bitmap_len: Length of transition disable policy 8153503c1fb9SAvraham Stern * @gfp: allocation flags 8154503c1fb9SAvraham Stern * 8155503c1fb9SAvraham Stern * This function should be called by a driver that supports 4 way handshake 8156503c1fb9SAvraham Stern * offload after a security association was successfully established (i.e., 8157503c1fb9SAvraham Stern * the 4 way handshake was completed successfully). The call to this function 8158503c1fb9SAvraham Stern * should be preceded with a call to cfg80211_connect_result(), 8159503c1fb9SAvraham Stern * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 8160503c1fb9SAvraham Stern * indicate the 802.11 association. 8161e4e7e3afSVinayak Yadawad * This function can also be called by AP/P2P GO driver that supports 8162e4e7e3afSVinayak Yadawad * authentication offload. In this case the peer_mac passed is that of 8163e4e7e3afSVinayak Yadawad * associated STA/GC. 8164503c1fb9SAvraham Stern */ 8165e4e7e3afSVinayak Yadawad void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr, 81660ff57171SVinayak Yadawad const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp); 8167503c1fb9SAvraham Stern 8168503c1fb9SAvraham Stern /** 8169b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 8170b23aa676SSamuel Ortiz * 8171b23aa676SSamuel Ortiz * @dev: network device 8172b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 8173b23aa676SSamuel Ortiz * @ie_len: length of IEs 8174b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 817580279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 8176b23aa676SSamuel Ortiz * @gfp: allocation flags 8177b23aa676SSamuel Ortiz * 8178b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 8179b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 8180b23aa676SSamuel Ortiz */ 8181b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 818280279fb7SJohannes Berg const u8 *ie, size_t ie_len, 818380279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 8184b23aa676SSamuel Ortiz 81859588bbd5SJouni Malinen /** 81869588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 818771bbc994SJohannes Berg * @wdev: wireless device 81889588bbd5SJouni Malinen * @cookie: the request cookie 81899588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 81909588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 81919588bbd5SJouni Malinen * channel 81929588bbd5SJouni Malinen * @gfp: allocation flags 81939588bbd5SJouni Malinen */ 819471bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 81959588bbd5SJouni Malinen struct ieee80211_channel *chan, 81969588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 81979588bbd5SJouni Malinen 81989588bbd5SJouni Malinen /** 81999588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 820071bbc994SJohannes Berg * @wdev: wireless device 82019588bbd5SJouni Malinen * @cookie: the request cookie 82029588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 82039588bbd5SJouni Malinen * @gfp: allocation flags 82049588bbd5SJouni Malinen */ 820571bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 82069588bbd5SJouni Malinen struct ieee80211_channel *chan, 82079588bbd5SJouni Malinen gfp_t gfp); 8208b23aa676SSamuel Ortiz 82098689c051SArend van Spriel /** 82101c38c7f2SJames Prestwood * cfg80211_tx_mgmt_expired - tx_mgmt duration expired 82111c38c7f2SJames Prestwood * @wdev: wireless device 82121c38c7f2SJames Prestwood * @cookie: the requested cookie 82131c38c7f2SJames Prestwood * @chan: The current channel (from tx_mgmt request) 82141c38c7f2SJames Prestwood * @gfp: allocation flags 82151c38c7f2SJames Prestwood */ 82161c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, 82171c38c7f2SJames Prestwood struct ieee80211_channel *chan, gfp_t gfp); 82181c38c7f2SJames Prestwood 82191c38c7f2SJames Prestwood /** 82208689c051SArend van Spriel * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. 82218689c051SArend van Spriel * 82228689c051SArend van Spriel * @sinfo: the station information 82238689c051SArend van Spriel * @gfp: allocation flags 82248689c051SArend van Spriel */ 82258689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); 822698b62183SJohannes Berg 822798b62183SJohannes Berg /** 82287ea3e110SJohannes Berg * cfg80211_sinfo_release_content - release contents of station info 82297ea3e110SJohannes Berg * @sinfo: the station information 82307ea3e110SJohannes Berg * 82317ea3e110SJohannes Berg * Releases any potentially allocated sub-information of the station 82327ea3e110SJohannes Berg * information, but not the struct itself (since it's typically on 82337ea3e110SJohannes Berg * the stack.) 82347ea3e110SJohannes Berg */ 82357ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) 82367ea3e110SJohannes Berg { 82377ea3e110SJohannes Berg kfree(sinfo->pertid); 82387ea3e110SJohannes Berg } 82397ea3e110SJohannes Berg 82407ea3e110SJohannes Berg /** 824198b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 824298b62183SJohannes Berg * 824398b62183SJohannes Berg * @dev: the netdev 824498b62183SJohannes Berg * @mac_addr: the station's address 824598b62183SJohannes Berg * @sinfo: the station information 824698b62183SJohannes Berg * @gfp: allocation flags 824798b62183SJohannes Berg */ 824898b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 824998b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 825098b62183SJohannes Berg 8251026331c4SJouni Malinen /** 8252cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 8253cf5ead82SJohannes Berg * @dev: the netdev 8254bfc55167SVeerendranath Jakkam * @mac_addr: the station's address. For MLD station, MLD address is used. 8255cf5ead82SJohannes Berg * @sinfo: the station information/statistics 8256cf5ead82SJohannes Berg * @gfp: allocation flags 8257cf5ead82SJohannes Berg */ 8258cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 8259cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 8260cf5ead82SJohannes Berg 8261cf5ead82SJohannes Berg /** 8262ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 8263ec15e68bSJouni Malinen * 8264ec15e68bSJouni Malinen * @dev: the netdev 8265bfc55167SVeerendranath Jakkam * @mac_addr: the station's address. For MLD station, MLD address is used. 8266ec15e68bSJouni Malinen * @gfp: allocation flags 8267ec15e68bSJouni Malinen */ 8268cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 8269cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 8270cf5ead82SJohannes Berg { 8271cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 8272cf5ead82SJohannes Berg } 8273ec15e68bSJouni Malinen 8274ec15e68bSJouni Malinen /** 8275ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 8276ed44a951SPandiyarajan Pitchaimuthu * 8277ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 8278ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 8279ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 8280ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 8281ed44a951SPandiyarajan Pitchaimuthu * 8282ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 8283ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 8284ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 8285ed44a951SPandiyarajan Pitchaimuthu * 8286ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 8287ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 8288ed44a951SPandiyarajan Pitchaimuthu */ 8289ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 8290ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 8291ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 8292ed44a951SPandiyarajan Pitchaimuthu 8293ed44a951SPandiyarajan Pitchaimuthu /** 829400b3d840SAvraham Stern * struct cfg80211_rx_info - received management frame info 829500b3d840SAvraham Stern * 829600b3d840SAvraham Stern * @freq: Frequency on which the frame was received in kHz 829700b3d840SAvraham Stern * @sig_dbm: signal strength in dBm, or 0 if unknown 82986074c9e5SJohannes Berg * @have_link_id: indicates the frame was received on a link of 82996074c9e5SJohannes Berg * an MLD, i.e. the @link_id field is valid 83006074c9e5SJohannes Berg * @link_id: the ID of the link the frame was received on 830100b3d840SAvraham Stern * @buf: Management frame (header + body) 830200b3d840SAvraham Stern * @len: length of the frame data 83031dcf396bSDmitry Antipov * @flags: flags, as defined in &enum nl80211_rxmgmt_flags 83041ff715ffSAvraham Stern * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds 83051ff715ffSAvraham Stern * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds 830600b3d840SAvraham Stern */ 830700b3d840SAvraham Stern struct cfg80211_rx_info { 830800b3d840SAvraham Stern int freq; 830900b3d840SAvraham Stern int sig_dbm; 83106074c9e5SJohannes Berg bool have_link_id; 83116074c9e5SJohannes Berg u8 link_id; 831200b3d840SAvraham Stern const u8 *buf; 831300b3d840SAvraham Stern size_t len; 831400b3d840SAvraham Stern u32 flags; 83151ff715ffSAvraham Stern u64 rx_tstamp; 83161ff715ffSAvraham Stern u64 ack_tstamp; 831700b3d840SAvraham Stern }; 831800b3d840SAvraham Stern 831900b3d840SAvraham Stern /** 832000b3d840SAvraham Stern * cfg80211_rx_mgmt_ext - management frame notification with extended info 832100b3d840SAvraham Stern * @wdev: wireless device receiving the frame 832200b3d840SAvraham Stern * @info: RX info as defined in struct cfg80211_rx_info 832300b3d840SAvraham Stern * 832400b3d840SAvraham Stern * This function is called whenever an Action frame is received for a station 832500b3d840SAvraham Stern * mode interface, but is not processed in kernel. 832600b3d840SAvraham Stern * 832700b3d840SAvraham Stern * Return: %true if a user space application has registered for this frame. 832800b3d840SAvraham Stern * For action frames, that makes it responsible for rejecting unrecognized 832900b3d840SAvraham Stern * action frames; %false otherwise, in which case for action frames the 833000b3d840SAvraham Stern * driver is responsible for rejecting the frame. 833100b3d840SAvraham Stern */ 833200b3d840SAvraham Stern bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev, 833300b3d840SAvraham Stern struct cfg80211_rx_info *info); 833400b3d840SAvraham Stern 833500b3d840SAvraham Stern /** 8336e76fede8SThomas Pedersen * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame 8337e76fede8SThomas Pedersen * @wdev: wireless device receiving the frame 8338e76fede8SThomas Pedersen * @freq: Frequency on which the frame was received in KHz 8339e76fede8SThomas Pedersen * @sig_dbm: signal strength in dBm, or 0 if unknown 8340e76fede8SThomas Pedersen * @buf: Management frame (header + body) 8341e76fede8SThomas Pedersen * @len: length of the frame data 8342e76fede8SThomas Pedersen * @flags: flags, as defined in enum nl80211_rxmgmt_flags 8343e76fede8SThomas Pedersen * 8344e76fede8SThomas Pedersen * This function is called whenever an Action frame is received for a station 8345e76fede8SThomas Pedersen * mode interface, but is not processed in kernel. 8346e76fede8SThomas Pedersen * 8347e76fede8SThomas Pedersen * Return: %true if a user space application has registered for this frame. 8348e76fede8SThomas Pedersen * For action frames, that makes it responsible for rejecting unrecognized 8349e76fede8SThomas Pedersen * action frames; %false otherwise, in which case for action frames the 8350e76fede8SThomas Pedersen * driver is responsible for rejecting the frame. 8351e76fede8SThomas Pedersen */ 835200b3d840SAvraham Stern static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, 835300b3d840SAvraham Stern int sig_dbm, const u8 *buf, size_t len, 835400b3d840SAvraham Stern u32 flags) 835500b3d840SAvraham Stern { 835600b3d840SAvraham Stern struct cfg80211_rx_info info = { 835700b3d840SAvraham Stern .freq = freq, 835800b3d840SAvraham Stern .sig_dbm = sig_dbm, 835900b3d840SAvraham Stern .buf = buf, 836000b3d840SAvraham Stern .len = len, 836100b3d840SAvraham Stern .flags = flags 836200b3d840SAvraham Stern }; 836300b3d840SAvraham Stern 836400b3d840SAvraham Stern return cfg80211_rx_mgmt_ext(wdev, &info); 836500b3d840SAvraham Stern } 8366e76fede8SThomas Pedersen 8367e76fede8SThomas Pedersen /** 83682e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 836971bbc994SJohannes Berg * @wdev: wireless device receiving the frame 8370026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 83716c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 83722e161f78SJohannes Berg * @buf: Management frame (header + body) 8373026331c4SJouni Malinen * @len: length of the frame data 837419504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 83752e161f78SJohannes Berg * 83760ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 83770ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 83780ae997dcSYacine Belkadi * 83790ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 83802e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 83812e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 83822e161f78SJohannes Berg * driver is responsible for rejecting the frame. 8383026331c4SJouni Malinen */ 8384e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, 8385e76fede8SThomas Pedersen int sig_dbm, const u8 *buf, size_t len, 8386e76fede8SThomas Pedersen u32 flags) 8387e76fede8SThomas Pedersen { 838800b3d840SAvraham Stern struct cfg80211_rx_info info = { 838900b3d840SAvraham Stern .freq = MHZ_TO_KHZ(freq), 839000b3d840SAvraham Stern .sig_dbm = sig_dbm, 839100b3d840SAvraham Stern .buf = buf, 839200b3d840SAvraham Stern .len = len, 839300b3d840SAvraham Stern .flags = flags 839400b3d840SAvraham Stern }; 839500b3d840SAvraham Stern 839600b3d840SAvraham Stern return cfg80211_rx_mgmt_ext(wdev, &info); 8397e76fede8SThomas Pedersen } 8398026331c4SJouni Malinen 8399026331c4SJouni Malinen /** 8400ea7d50c9SAvraham Stern * struct cfg80211_tx_status - TX status for management frame information 8401ea7d50c9SAvraham Stern * 8402ea7d50c9SAvraham Stern * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 8403ea7d50c9SAvraham Stern * @tx_tstamp: hardware TX timestamp in nanoseconds 8404ea7d50c9SAvraham Stern * @ack_tstamp: hardware ack RX timestamp in nanoseconds 8405ea7d50c9SAvraham Stern * @buf: Management frame (header + body) 8406ea7d50c9SAvraham Stern * @len: length of the frame data 8407ea7d50c9SAvraham Stern * @ack: Whether frame was acknowledged 8408ea7d50c9SAvraham Stern */ 8409ea7d50c9SAvraham Stern struct cfg80211_tx_status { 8410ea7d50c9SAvraham Stern u64 cookie; 8411ea7d50c9SAvraham Stern u64 tx_tstamp; 8412ea7d50c9SAvraham Stern u64 ack_tstamp; 8413ea7d50c9SAvraham Stern const u8 *buf; 8414ea7d50c9SAvraham Stern size_t len; 8415ea7d50c9SAvraham Stern bool ack; 8416ea7d50c9SAvraham Stern }; 8417ea7d50c9SAvraham Stern 8418ea7d50c9SAvraham Stern /** 8419ea7d50c9SAvraham Stern * cfg80211_mgmt_tx_status_ext - TX status notification with extended info 8420ea7d50c9SAvraham Stern * @wdev: wireless device receiving the frame 8421ea7d50c9SAvraham Stern * @status: TX status data 8422ea7d50c9SAvraham Stern * @gfp: context flags 8423ea7d50c9SAvraham Stern * 8424ea7d50c9SAvraham Stern * This function is called whenever a management frame was requested to be 8425ea7d50c9SAvraham Stern * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 8426ea7d50c9SAvraham Stern * transmission attempt with extended info. 8427ea7d50c9SAvraham Stern */ 8428ea7d50c9SAvraham Stern void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev, 8429ea7d50c9SAvraham Stern struct cfg80211_tx_status *status, gfp_t gfp); 8430ea7d50c9SAvraham Stern 8431ea7d50c9SAvraham Stern /** 84322e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 843371bbc994SJohannes Berg * @wdev: wireless device receiving the frame 84342e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 84352e161f78SJohannes Berg * @buf: Management frame (header + body) 8436026331c4SJouni Malinen * @len: length of the frame data 8437026331c4SJouni Malinen * @ack: Whether frame was acknowledged 8438026331c4SJouni Malinen * @gfp: context flags 8439026331c4SJouni Malinen * 84402e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 84412e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 8442026331c4SJouni Malinen * transmission attempt. 8443026331c4SJouni Malinen */ 8444ea7d50c9SAvraham Stern static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, 8445ea7d50c9SAvraham Stern u64 cookie, const u8 *buf, 8446ea7d50c9SAvraham Stern size_t len, bool ack, gfp_t gfp) 8447ea7d50c9SAvraham Stern { 8448ea7d50c9SAvraham Stern struct cfg80211_tx_status status = { 8449ea7d50c9SAvraham Stern .cookie = cookie, 8450ea7d50c9SAvraham Stern .buf = buf, 8451ea7d50c9SAvraham Stern .len = len, 8452ea7d50c9SAvraham Stern .ack = ack 8453ea7d50c9SAvraham Stern }; 8454ea7d50c9SAvraham Stern 8455ea7d50c9SAvraham Stern cfg80211_mgmt_tx_status_ext(wdev, &status, gfp); 8456ea7d50c9SAvraham Stern } 8457026331c4SJouni Malinen 8458dca9ca2dSMarkus Theil /** 8459dca9ca2dSMarkus Theil * cfg80211_control_port_tx_status - notification of TX status for control 8460dca9ca2dSMarkus Theil * port frames 8461dca9ca2dSMarkus Theil * @wdev: wireless device receiving the frame 8462dca9ca2dSMarkus Theil * @cookie: Cookie returned by cfg80211_ops::tx_control_port() 8463dca9ca2dSMarkus Theil * @buf: Data frame (header + body) 8464dca9ca2dSMarkus Theil * @len: length of the frame data 8465dca9ca2dSMarkus Theil * @ack: Whether frame was acknowledged 8466dca9ca2dSMarkus Theil * @gfp: context flags 8467dca9ca2dSMarkus Theil * 8468dca9ca2dSMarkus Theil * This function is called whenever a control port frame was requested to be 8469dca9ca2dSMarkus Theil * transmitted with cfg80211_ops::tx_control_port() to report the TX status of 8470dca9ca2dSMarkus Theil * the transmission attempt. 8471dca9ca2dSMarkus Theil */ 8472dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, 8473dca9ca2dSMarkus Theil const u8 *buf, size_t len, bool ack, 8474dca9ca2dSMarkus Theil gfp_t gfp); 8475d6dc1a38SJuuso Oikarinen 8476d6dc1a38SJuuso Oikarinen /** 84776a671a50SDenis Kenzior * cfg80211_rx_control_port - notification about a received control port frame 84786a671a50SDenis Kenzior * @dev: The device the frame matched to 8479a948f713SDenis Kenzior * @skb: The skbuf with the control port frame. It is assumed that the skbuf 8480a948f713SDenis Kenzior * is 802.3 formatted (with 802.3 header). The skb can be non-linear. 8481a948f713SDenis Kenzior * This function does not take ownership of the skb, so the caller is 8482a948f713SDenis Kenzior * responsible for any cleanup. The caller must also ensure that 8483a948f713SDenis Kenzior * skb->protocol is set appropriately. 84846a671a50SDenis Kenzior * @unencrypted: Whether the frame was received unencrypted 84854c532321SJohannes Berg * @link_id: the link the frame was received on, -1 if not applicable or unknown 84866a671a50SDenis Kenzior * 84876a671a50SDenis Kenzior * This function is used to inform userspace about a received control port 84886a671a50SDenis Kenzior * frame. It should only be used if userspace indicated it wants to receive 84896a671a50SDenis Kenzior * control port frames over nl80211. 84906a671a50SDenis Kenzior * 84916a671a50SDenis Kenzior * The frame is the data portion of the 802.3 or 802.11 data frame with all 84926a671a50SDenis Kenzior * network layer headers removed (e.g. the raw EAPoL frame). 84936a671a50SDenis Kenzior * 84946a671a50SDenis Kenzior * Return: %true if the frame was passed to userspace 84956a671a50SDenis Kenzior */ 84964c532321SJohannes Berg bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb, 84974c532321SJohannes Berg bool unencrypted, int link_id); 84986a671a50SDenis Kenzior 84996a671a50SDenis Kenzior /** 8500d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 8501d6dc1a38SJuuso Oikarinen * @dev: network device 8502d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 8503bee427b8SAndrzej Zaborowski * @rssi_level: new RSSI level value or 0 if not available 8504d6dc1a38SJuuso Oikarinen * @gfp: context flags 8505d6dc1a38SJuuso Oikarinen * 8506d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 8507d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 8508d6dc1a38SJuuso Oikarinen */ 8509d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 8510d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 8511bee427b8SAndrzej Zaborowski s32 rssi_level, gfp_t gfp); 8512d6dc1a38SJuuso Oikarinen 8513c063dbf5SJohannes Berg /** 8514c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 8515c063dbf5SJohannes Berg * @dev: network device 8516c063dbf5SJohannes Berg * @peer: peer's MAC address 8517c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 8518c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 8519c063dbf5SJohannes Berg * threshold (to account for temporary interference) 8520c063dbf5SJohannes Berg * @gfp: context flags 8521c063dbf5SJohannes Berg */ 8522c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 8523c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 8524c063dbf5SJohannes Berg 8525e5497d76SJohannes Berg /** 852684f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 852784f10708SThomas Pedersen * @dev: network device 852884f10708SThomas Pedersen * @peer: peer's MAC address 852984f10708SThomas Pedersen * @num_packets: how many packets were lost 853084f10708SThomas Pedersen * @rate: % of packets which failed transmission 853184f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 853284f10708SThomas Pedersen * @gfp: context flags 853384f10708SThomas Pedersen * 853484f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 853584f10708SThomas Pedersen * given interval is exceeded. 853684f10708SThomas Pedersen */ 853784f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 853884f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 853984f10708SThomas Pedersen 854084f10708SThomas Pedersen /** 854198f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 854298f03342SJohannes Berg * @dev: network device 854398f03342SJohannes Berg * @gfp: context flags 854498f03342SJohannes Berg * 854598f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 854698f03342SJohannes Berg */ 854798f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 854898f03342SJohannes Berg 854998f03342SJohannes Berg /** 8550c47240cbSLorenzo Bianconi * __cfg80211_radar_event - radar detection event 85515b97f49dSJohannes Berg * @wiphy: the wiphy 85525b97f49dSJohannes Berg * @chandef: chandef for the current channel 8553c47240cbSLorenzo Bianconi * @offchan: the radar has been detected on the offchannel chain 85545b97f49dSJohannes Berg * @gfp: context flags 85555b97f49dSJohannes Berg * 85565b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 85575b97f49dSJohannes Berg */ 8558c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy, 8559c47240cbSLorenzo Bianconi struct cfg80211_chan_def *chandef, 8560c47240cbSLorenzo Bianconi bool offchan, gfp_t gfp); 8561c47240cbSLorenzo Bianconi 8562c47240cbSLorenzo Bianconi static inline void 8563c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy, 8564c47240cbSLorenzo Bianconi struct cfg80211_chan_def *chandef, 8565c47240cbSLorenzo Bianconi gfp_t gfp) 8566c47240cbSLorenzo Bianconi { 8567c47240cbSLorenzo Bianconi __cfg80211_radar_event(wiphy, chandef, false, gfp); 8568c47240cbSLorenzo Bianconi } 8569c47240cbSLorenzo Bianconi 8570c47240cbSLorenzo Bianconi static inline void 8571a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy, 8572c47240cbSLorenzo Bianconi struct cfg80211_chan_def *chandef, 8573c47240cbSLorenzo Bianconi gfp_t gfp) 8574c47240cbSLorenzo Bianconi { 8575c47240cbSLorenzo Bianconi __cfg80211_radar_event(wiphy, chandef, true, gfp); 8576c47240cbSLorenzo Bianconi } 85775b97f49dSJohannes Berg 85785b97f49dSJohannes Berg /** 8579466b9936Stamizhr@codeaurora.org * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event 8580466b9936Stamizhr@codeaurora.org * @dev: network device 8581466b9936Stamizhr@codeaurora.org * @mac: MAC address of a station which opmode got modified 8582466b9936Stamizhr@codeaurora.org * @sta_opmode: station's current opmode value 8583466b9936Stamizhr@codeaurora.org * @gfp: context flags 8584466b9936Stamizhr@codeaurora.org * 8585466b9936Stamizhr@codeaurora.org * Driver should call this function when station's opmode modified via action 8586466b9936Stamizhr@codeaurora.org * frame. 8587466b9936Stamizhr@codeaurora.org */ 8588466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, 8589466b9936Stamizhr@codeaurora.org struct sta_opmode_info *sta_opmode, 8590466b9936Stamizhr@codeaurora.org gfp_t gfp); 8591466b9936Stamizhr@codeaurora.org 8592466b9936Stamizhr@codeaurora.org /** 85935b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 85945b97f49dSJohannes Berg * @netdev: network device 85955b97f49dSJohannes Berg * @chandef: chandef for the current channel 85965b97f49dSJohannes Berg * @event: type of event 85975b97f49dSJohannes Berg * @gfp: context flags 85985b97f49dSJohannes Berg * 85995b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 86005b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 86015b97f49dSJohannes Berg * also by full-MAC drivers. 86025b97f49dSJohannes Berg */ 86035b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 86045b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 86055b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 86065b97f49dSJohannes Berg 8607bc2dfc02SLorenzo Bianconi /** 8608a95bfb87SLorenzo Bianconi * cfg80211_background_cac_abort - Channel Availability Check offchan abort event 8609bc2dfc02SLorenzo Bianconi * @wiphy: the wiphy 8610bc2dfc02SLorenzo Bianconi * 86111507b153SLorenzo Bianconi * This function is called by the driver when a Channel Availability Check 86121507b153SLorenzo Bianconi * (CAC) is aborted by a offchannel dedicated chain. 8613bc2dfc02SLorenzo Bianconi */ 8614a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy); 86155b97f49dSJohannes Berg 86165b97f49dSJohannes Berg /** 8617e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 8618e5497d76SJohannes Berg * @dev: network device 8619e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 8620e5497d76SJohannes Berg * @replay_ctr: new replay counter 8621af71ff85SJohannes Berg * @gfp: allocation flags 8622e5497d76SJohannes Berg */ 8623e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 8624e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 8625e5497d76SJohannes Berg 8626c9df56b4SJouni Malinen /** 8627c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 8628c9df56b4SJouni Malinen * @dev: network device 8629c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 8630c9df56b4SJouni Malinen * @bssid: BSSID of AP 8631c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 8632c9df56b4SJouni Malinen * @gfp: allocation flags 8633c9df56b4SJouni Malinen */ 8634c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 8635c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 8636c9df56b4SJouni Malinen 863728946da7SJohannes Berg /** 863828946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 863928946da7SJohannes Berg * @dev: The device the frame matched to 864028946da7SJohannes Berg * @addr: the transmitter address 864128946da7SJohannes Berg * @gfp: context flags 864228946da7SJohannes Berg * 864328946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 864428946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 864528946da7SJohannes Berg * sender. 86460ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 864728946da7SJohannes Berg * for a reason other than not having a subscription.) 864828946da7SJohannes Berg */ 864928946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 865028946da7SJohannes Berg const u8 *addr, gfp_t gfp); 865128946da7SJohannes Berg 86527f6cf311SJohannes Berg /** 8653b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 8654b92ab5d8SJohannes Berg * @dev: The device the frame matched to 8655b92ab5d8SJohannes Berg * @addr: the transmitter address 8656b92ab5d8SJohannes Berg * @gfp: context flags 8657b92ab5d8SJohannes Berg * 8658b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 8659b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 8660b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 8661b92ab5d8SJohannes Berg * station to avoid event flooding. 86620ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 8663b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 8664b92ab5d8SJohannes Berg */ 8665b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 8666b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 8667b92ab5d8SJohannes Berg 8668b92ab5d8SJohannes Berg /** 86697f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 86707f6cf311SJohannes Berg * @dev: the device the probe was sent on 86717f6cf311SJohannes Berg * @addr: the address of the peer 86727f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 86737f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 8674c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the ACK frame. 8675c4b50cd3SVenkateswara Naralasetty * @is_valid_ack_signal: indicates the ack_signal is valid or not. 86767f6cf311SJohannes Berg * @gfp: allocation flags 86777f6cf311SJohannes Berg */ 86787f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 8679c4b50cd3SVenkateswara Naralasetty u64 cookie, bool acked, s32 ack_signal, 8680c4b50cd3SVenkateswara Naralasetty bool is_valid_ack_signal, gfp_t gfp); 86817f6cf311SJohannes Berg 86825e760230SJohannes Berg /** 8683e76fede8SThomas Pedersen * cfg80211_report_obss_beacon_khz - report beacon from other APs 8684e76fede8SThomas Pedersen * @wiphy: The wiphy that received the beacon 8685e76fede8SThomas Pedersen * @frame: the frame 8686e76fede8SThomas Pedersen * @len: length of the frame 8687e76fede8SThomas Pedersen * @freq: frequency the frame was received on in KHz 8688e76fede8SThomas Pedersen * @sig_dbm: signal strength in dBm, or 0 if unknown 8689e76fede8SThomas Pedersen * 8690e76fede8SThomas Pedersen * Use this function to report to userspace when a beacon was 8691e76fede8SThomas Pedersen * received. It is not useful to call this when there is no 8692e76fede8SThomas Pedersen * netdev that is in AP/GO mode. 8693e76fede8SThomas Pedersen */ 8694e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame, 8695e76fede8SThomas Pedersen size_t len, int freq, int sig_dbm); 8696e76fede8SThomas Pedersen 8697e76fede8SThomas Pedersen /** 86985e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 86995e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 87005e760230SJohannes Berg * @frame: the frame 87015e760230SJohannes Berg * @len: length of the frame 87025e760230SJohannes Berg * @freq: frequency the frame was received on 87036c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 87045e760230SJohannes Berg * 87055e760230SJohannes Berg * Use this function to report to userspace when a beacon was 87065e760230SJohannes Berg * received. It is not useful to call this when there is no 87075e760230SJohannes Berg * netdev that is in AP/GO mode. 87085e760230SJohannes Berg */ 8709e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy, 87105e760230SJohannes Berg const u8 *frame, size_t len, 8711e76fede8SThomas Pedersen int freq, int sig_dbm) 8712e76fede8SThomas Pedersen { 8713e76fede8SThomas Pedersen cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq), 8714e76fede8SThomas Pedersen sig_dbm); 8715e76fede8SThomas Pedersen } 87165e760230SJohannes Berg 8717d58e7e37SJohannes Berg /** 8718683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 871954858ee5SAlexander Simon * @wiphy: the wiphy 8720683b6d3bSJohannes Berg * @chandef: the channel definition 8721174e0cd2SIlan Peer * @iftype: interface type 8722d58e7e37SJohannes Berg * 87230ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 87240ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 872554858ee5SAlexander Simon */ 8726683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 8727174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 8728174e0cd2SIlan Peer enum nl80211_iftype iftype); 872954858ee5SAlexander Simon 8730923b352fSArik Nemtsov /** 8731923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 8732923b352fSArik Nemtsov * @wiphy: the wiphy 8733923b352fSArik Nemtsov * @chandef: the channel definition 8734923b352fSArik Nemtsov * @iftype: interface type 8735923b352fSArik Nemtsov * 8736923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 8737923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 8738923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 8739923b352fSArik Nemtsov * more permissive conditions. 8740923b352fSArik Nemtsov * 8741a05829a7SJohannes Berg * Requires the wiphy mutex to be held. 8742923b352fSArik Nemtsov */ 8743923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 8744923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 8745923b352fSArik Nemtsov enum nl80211_iftype iftype); 8746923b352fSArik Nemtsov 87478097e149SThomas Pedersen /* 87485314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 87495314526bSThomas Pedersen * @dev: the device which switched channels 8750683b6d3bSJohannes Berg * @chandef: the new channel definition 87517b0a0e3cSJohannes Berg * @link_id: the link ID for MLO, must be 0 for non-MLO 87525314526bSThomas Pedersen * 8753076fc877SJohannes Berg * Caller must hold wiphy mutex, therefore must only be called from sleepable 8754e487eaebSSimon Wunderlich * driver context! 87555314526bSThomas Pedersen */ 8756683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 87577b0a0e3cSJohannes Berg struct cfg80211_chan_def *chandef, 8758b82730bfSJohannes Berg unsigned int link_id); 87595314526bSThomas Pedersen 8760f8d7552eSLuciano Coelho /* 8761f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 8762f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 8763f8d7552eSLuciano Coelho * @chandef: the future channel definition 8764b8c9024eSVeerendranath Jakkam * @link_id: the link ID for MLO, must be 0 for non-MLO 8765f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 8766669b8413SJohannes Berg * @quiet: whether or not immediate quiet was requested by the AP 8767f8d7552eSLuciano Coelho * 8768f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 8769f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 8770f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 8771f8d7552eSLuciano Coelho */ 8772f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 8773f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 8774b8c9024eSVeerendranath Jakkam unsigned int link_id, u8 count, 8775b82730bfSJohannes Berg bool quiet); 8776f8d7552eSLuciano Coelho 87771ce3e82bSJohannes Berg /** 87781ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 87791ce3e82bSJohannes Berg * 87801ce3e82bSJohannes Berg * @operating_class: the operating class to convert 87811ce3e82bSJohannes Berg * @band: band pointer to fill 87821ce3e82bSJohannes Berg * 87831ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 87841ce3e82bSJohannes Berg */ 87851ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 878657fbcce3SJohannes Berg enum nl80211_band *band); 87871ce3e82bSJohannes Berg 8788a38700ddSArik Nemtsov /** 878968de1302SMichael-CY Lee * ieee80211_operating_class_to_chandef - convert operating class to chandef 879068de1302SMichael-CY Lee * 879168de1302SMichael-CY Lee * @operating_class: the operating class to convert 879268de1302SMichael-CY Lee * @chan: the ieee80211_channel to convert 879368de1302SMichael-CY Lee * @chandef: a pointer to the resulting chandef 879468de1302SMichael-CY Lee * 879568de1302SMichael-CY Lee * Returns %true if the conversion was successful, %false otherwise. 879668de1302SMichael-CY Lee */ 879768de1302SMichael-CY Lee bool ieee80211_operating_class_to_chandef(u8 operating_class, 879868de1302SMichael-CY Lee struct ieee80211_channel *chan, 879968de1302SMichael-CY Lee struct cfg80211_chan_def *chandef); 880068de1302SMichael-CY Lee 880168de1302SMichael-CY Lee /** 8802a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 8803a38700ddSArik Nemtsov * 8804a38700ddSArik Nemtsov * @chandef: the chandef to convert 8805a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 8806a38700ddSArik Nemtsov * 8807a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 8808a38700ddSArik Nemtsov */ 8809a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 8810a38700ddSArik Nemtsov u8 *op_class); 8811a38700ddSArik Nemtsov 8812934f4c7dSThomas Pedersen /** 8813934f4c7dSThomas Pedersen * ieee80211_chandef_to_khz - convert chandef to frequency in KHz 8814934f4c7dSThomas Pedersen * 8815934f4c7dSThomas Pedersen * @chandef: the chandef to convert 8816934f4c7dSThomas Pedersen * 8817934f4c7dSThomas Pedersen * Returns the center frequency of chandef (1st segment) in KHz. 8818934f4c7dSThomas Pedersen */ 8819934f4c7dSThomas Pedersen static inline u32 8820934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef) 8821934f4c7dSThomas Pedersen { 8822934f4c7dSThomas Pedersen return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 8823934f4c7dSThomas Pedersen } 8824934f4c7dSThomas Pedersen 88255314526bSThomas Pedersen /* 88263475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 88273475b094SJouni Malinen * @dev: the device on which the operation is requested 88283475b094SJouni Malinen * @peer: the MAC address of the peer device 88293475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 88303475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 88313475b094SJouni Malinen * @reason_code: the reason code for teardown request 88323475b094SJouni Malinen * @gfp: allocation flags 88333475b094SJouni Malinen * 88343475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 88353475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 88363475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 88373475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 88383475b094SJouni Malinen * based on traffic and signal strength for a peer). 88393475b094SJouni Malinen */ 88403475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 88413475b094SJouni Malinen enum nl80211_tdls_operation oper, 88423475b094SJouni Malinen u16 reason_code, gfp_t gfp); 88433475b094SJouni Malinen 88443475b094SJouni Malinen /* 88458097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 88468097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 88478097e149SThomas Pedersen * 88488097e149SThomas Pedersen * return 0 if MCS index >= 32 88498097e149SThomas Pedersen */ 88508eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 88518097e149SThomas Pedersen 885298104fdeSJohannes Berg /** 885398104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 885498104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 885598104fdeSJohannes Berg * 88562fe8ef10SJohannes Berg * This function removes the device so it can no longer be used. It is necessary 88572fe8ef10SJohannes Berg * to call this function even when cfg80211 requests the removal of the device 88582fe8ef10SJohannes Berg * by calling the del_virtual_intf() callback. The function must also be called 88592fe8ef10SJohannes Berg * when the driver wishes to unregister the wdev, e.g. when the hardware device 88602fe8ef10SJohannes Berg * is unbound from the driver. 886198104fdeSJohannes Berg * 8862a05829a7SJohannes Berg * Requires the RTNL and wiphy mutex to be held. 886398104fdeSJohannes Berg */ 886498104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 886598104fdeSJohannes Berg 88660ee45355SJohannes Berg /** 88672fe8ef10SJohannes Berg * cfg80211_register_netdevice - register the given netdev 88682fe8ef10SJohannes Berg * @dev: the netdev to register 88692fe8ef10SJohannes Berg * 88702fe8ef10SJohannes Berg * Note: In contexts coming from cfg80211 callbacks, you must call this rather 88712fe8ef10SJohannes Berg * than register_netdevice(), unregister_netdev() is impossible as the RTNL is 88722fe8ef10SJohannes Berg * held. Otherwise, both register_netdevice() and register_netdev() are usable 88732fe8ef10SJohannes Berg * instead as well. 8874a05829a7SJohannes Berg * 8875a05829a7SJohannes Berg * Requires the RTNL and wiphy mutex to be held. 88762fe8ef10SJohannes Berg */ 88772fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev); 88782fe8ef10SJohannes Berg 88792fe8ef10SJohannes Berg /** 88802fe8ef10SJohannes Berg * cfg80211_unregister_netdevice - unregister the given netdev 88812fe8ef10SJohannes Berg * @dev: the netdev to register 88822fe8ef10SJohannes Berg * 88832fe8ef10SJohannes Berg * Note: In contexts coming from cfg80211 callbacks, you must call this rather 88842fe8ef10SJohannes Berg * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL 88852fe8ef10SJohannes Berg * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are 88862fe8ef10SJohannes Berg * usable instead as well. 8887a05829a7SJohannes Berg * 8888a05829a7SJohannes Berg * Requires the RTNL and wiphy mutex to be held. 88892fe8ef10SJohannes Berg */ 88902fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev) 88912fe8ef10SJohannes Berg { 8892c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211) 88932fe8ef10SJohannes Berg cfg80211_unregister_wdev(dev->ieee80211_ptr); 8894c304eddcSJakub Kicinski #endif 88952fe8ef10SJohannes Berg } 88962fe8ef10SJohannes Berg 88972fe8ef10SJohannes Berg /** 8898b1e8eb11SMauro Carvalho Chehab * struct cfg80211_ft_event_params - FT Information Elements 8899355199e0SJouni Malinen * @ies: FT IEs 8900355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 8901355199e0SJouni Malinen * @target_ap: target AP's MAC address 8902355199e0SJouni Malinen * @ric_ies: RIC IE 8903355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 8904355199e0SJouni Malinen */ 8905355199e0SJouni Malinen struct cfg80211_ft_event_params { 8906355199e0SJouni Malinen const u8 *ies; 8907355199e0SJouni Malinen size_t ies_len; 8908355199e0SJouni Malinen const u8 *target_ap; 8909355199e0SJouni Malinen const u8 *ric_ies; 8910355199e0SJouni Malinen size_t ric_ies_len; 8911355199e0SJouni Malinen }; 8912355199e0SJouni Malinen 8913355199e0SJouni Malinen /** 8914355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 8915355199e0SJouni Malinen * @netdev: network device 8916355199e0SJouni Malinen * @ft_event: IE information 8917355199e0SJouni Malinen */ 8918355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 8919355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 8920355199e0SJouni Malinen 8921355199e0SJouni Malinen /** 89220ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 89230ee45355SJohannes Berg * @ies: the input IE buffer 89240ee45355SJohannes Berg * @len: the input length 89250ee45355SJohannes Berg * @attr: the attribute ID to find 89260ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 89270ee45355SJohannes Berg * if the function is only called to get the needed buffer size 89280ee45355SJohannes Berg * @bufsize: size of the output buffer 89290ee45355SJohannes Berg * 89300ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 89310ee45355SJohannes Berg * copies its contents to the given buffer. 89320ee45355SJohannes Berg * 89330ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 89340ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 89350ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 89360ee45355SJohannes Berg */ 8937c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 8938c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 8939c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 89400ee45355SJohannes Berg 8941cd8f7cb4SJohannes Berg /** 894229464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 894329464cccSJohannes Berg * @ies: the IE buffer 894429464cccSJohannes Berg * @ielen: the length of the IE buffer 894529464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 89462512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 89472512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 894829464cccSJohannes Berg * @n_ids: the size of the element ID array 894929464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 895029464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 895129464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 895229464cccSJohannes Berg * 895329464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 895429464cccSJohannes Berg * variable to point to the location where the buffer should be 895529464cccSJohannes Berg * split. 895629464cccSJohannes Berg * 895729464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 895829464cccSJohannes Berg * has to be guaranteed by the caller! 895929464cccSJohannes Berg * 896029464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 896129464cccSJohannes Berg * correctly, if not the result of using this function will not 896229464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 896329464cccSJohannes Berg * 896429464cccSJohannes Berg * The function returns the offset where the next part of the 896529464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 896629464cccSJohannes Berg * of the buffer should be used. 896729464cccSJohannes Berg */ 896829464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 896929464cccSJohannes Berg const u8 *ids, int n_ids, 897029464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 897129464cccSJohannes Berg size_t offset); 897229464cccSJohannes Berg 897329464cccSJohannes Berg /** 897429464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 897529464cccSJohannes Berg * @ies: the IE buffer 897629464cccSJohannes Berg * @ielen: the length of the IE buffer 897729464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 89782512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 89792512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 898029464cccSJohannes Berg * @n_ids: the size of the element ID array 898129464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 898229464cccSJohannes Berg * 898329464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 898429464cccSJohannes Berg * variable to point to the location where the buffer should be 898529464cccSJohannes Berg * split. 898629464cccSJohannes Berg * 898729464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 898829464cccSJohannes Berg * has to be guaranteed by the caller! 898929464cccSJohannes Berg * 899029464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 899129464cccSJohannes Berg * correctly, if not the result of using this function will not 899229464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 899329464cccSJohannes Berg * 899429464cccSJohannes Berg * The function returns the offset where the next part of the 899529464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 899629464cccSJohannes Berg * of the buffer should be used. 899729464cccSJohannes Berg */ 89980483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 89990483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 90000483eeacSJohannes Berg { 90010483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 90020483eeacSJohannes Berg } 900329464cccSJohannes Berg 900429464cccSJohannes Berg /** 90055806ef25SBenjamin Berg * ieee80211_fragment_element - fragment the last element in skb 90065806ef25SBenjamin Berg * @skb: The skbuf that the element was added to 90075806ef25SBenjamin Berg * @len_pos: Pointer to length of the element to fragment 90085806ef25SBenjamin Berg * @frag_id: The element ID to use for fragments 90095806ef25SBenjamin Berg * 90105806ef25SBenjamin Berg * This function fragments all data after @len_pos, adding fragmentation 90115806ef25SBenjamin Berg * elements with the given ID as appropriate. The SKB will grow in size 90125806ef25SBenjamin Berg * accordingly. 90135806ef25SBenjamin Berg */ 90145806ef25SBenjamin Berg void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id); 90155806ef25SBenjamin Berg 90165806ef25SBenjamin Berg /** 9017cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 9018cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 9019cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 9020cd8f7cb4SJohannes Berg * @gfp: allocation flags 9021cd8f7cb4SJohannes Berg * 9022cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 9023cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 9024cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 9025cd8f7cb4SJohannes Berg * else caused the wakeup. 9026cd8f7cb4SJohannes Berg */ 9027cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 9028cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 9029cd8f7cb4SJohannes Berg gfp_t gfp); 9030cd8f7cb4SJohannes Berg 90315de17984SArend van Spriel /** 90325de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 90335de17984SArend van Spriel * 90345de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 903503f831a6SRobert P. J. Day * @gfp: allocation flags 90365de17984SArend van Spriel * 90375de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 90385de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 90395de17984SArend van Spriel * by .crit_proto_start() has expired. 90405de17984SArend van Spriel */ 90415de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 90425de17984SArend van Spriel 9043bdfbec2dSIlan Peer /** 9044bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 9045bdfbec2dSIlan Peer * @wiphy: the wiphy 9046bdfbec2dSIlan Peer * 9047bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 9048bdfbec2dSIlan Peer */ 9049bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 9050bdfbec2dSIlan Peer 9051cb2d956dSLuciano Coelho /** 9052cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 9053cb2d956dSLuciano Coelho * 9054cb2d956dSLuciano Coelho * @wiphy: the wiphy 9055e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 9056cb2d956dSLuciano Coelho * 9057cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 9058cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 9059cb2d956dSLuciano Coelho * the interface combinations. 9060cb2d956dSLuciano Coelho */ 9061cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 9062e227300cSPurushottam Kushwaha struct iface_combination_params *params); 9063cb2d956dSLuciano Coelho 906465a124ddSMichal Kazior /** 906565a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 906665a124ddSMichal Kazior * 906765a124ddSMichal Kazior * @wiphy: the wiphy 9068e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 906965a124ddSMichal Kazior * @iter: function to call for each matching combination 907065a124ddSMichal Kazior * @data: pointer to pass to iter function 907165a124ddSMichal Kazior * 907265a124ddSMichal Kazior * This function can be called by the driver to check what possible 907365a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 907465a124ddSMichal Kazior * purposes. 907565a124ddSMichal Kazior */ 907665a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 9077e227300cSPurushottam Kushwaha struct iface_combination_params *params, 907865a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 907965a124ddSMichal Kazior void *data), 908065a124ddSMichal Kazior void *data); 908165a124ddSMichal Kazior 9082f04c2203SMichal Kazior /* 9083f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 9084f04c2203SMichal Kazior * 9085f04c2203SMichal Kazior * @wiphy: the wiphy 9086f04c2203SMichal Kazior * @wdev: wireless device 9087f04c2203SMichal Kazior * @gfp: context flags 9088f04c2203SMichal Kazior * 9089f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 9090f04c2203SMichal Kazior * disconnected. 9091f04c2203SMichal Kazior * 9092f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 9093f04c2203SMichal Kazior */ 9094f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 9095f04c2203SMichal Kazior gfp_t gfp); 9096f04c2203SMichal Kazior 9097f6837ba8SJohannes Berg /** 9098f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 9099f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 9100f6837ba8SJohannes Berg * 9101f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 9102f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 9103f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 9104f6837ba8SJohannes Berg * that really can't be recovered in any other way. 9105f6837ba8SJohannes Berg * 9106f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 9107f6837ba8SJohannes Berg * the driver while the function is running. 9108f6837ba8SJohannes Berg */ 9109f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 9110f6837ba8SJohannes Berg 9111d75bb06bSGautam Kumar Shukla /** 9112d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 9113d75bb06bSGautam Kumar Shukla * 9114d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 9115d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 9116d75bb06bSGautam Kumar Shukla * 9117d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 9118d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 9119d75bb06bSGautam Kumar Shukla */ 9120d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 9121d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 9122d75bb06bSGautam Kumar Shukla { 9123d75bb06bSGautam Kumar Shukla u8 *ft_byte; 9124d75bb06bSGautam Kumar Shukla 9125d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 9126d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 9127d75bb06bSGautam Kumar Shukla } 9128d75bb06bSGautam Kumar Shukla 9129d75bb06bSGautam Kumar Shukla /** 9130d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 9131d75bb06bSGautam Kumar Shukla * 9132d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 9133d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 9134d75bb06bSGautam Kumar Shukla * 9135d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 9136d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 9137d75bb06bSGautam Kumar Shukla */ 9138d75bb06bSGautam Kumar Shukla static inline bool 9139d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 9140d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 9141d75bb06bSGautam Kumar Shukla { 9142d75bb06bSGautam Kumar Shukla u8 ft_byte; 9143d75bb06bSGautam Kumar Shukla 9144d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 9145d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 9146d75bb06bSGautam Kumar Shukla } 9147b7ffbd7eSJohannes Berg 9148a442b761SAyala Beker /** 9149a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 9150a442b761SAyala Beker * @f: NAN function that should be freed 9151a442b761SAyala Beker * 9152a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 9153a442b761SAyala Beker */ 9154a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 9155a442b761SAyala Beker 915650bcd31dSAyala Beker /** 915750bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 915850bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 915950bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 916050bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 916150bcd31dSAyala Beker * result. 916250bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 916350bcd31dSAyala Beker * @inst_id: the local instance id 916450bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 916550bcd31dSAyala Beker * @addr: the MAC address of the peer 916650bcd31dSAyala Beker * @info_len: the length of the &info 916750bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 916850bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 916950bcd31dSAyala Beker */ 917050bcd31dSAyala Beker struct cfg80211_nan_match_params { 917150bcd31dSAyala Beker enum nl80211_nan_function_type type; 917250bcd31dSAyala Beker u8 inst_id; 917350bcd31dSAyala Beker u8 peer_inst_id; 917450bcd31dSAyala Beker const u8 *addr; 917550bcd31dSAyala Beker u8 info_len; 917650bcd31dSAyala Beker const u8 *info; 917750bcd31dSAyala Beker u64 cookie; 917850bcd31dSAyala Beker }; 917950bcd31dSAyala Beker 918050bcd31dSAyala Beker /** 918150bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 918250bcd31dSAyala Beker * @wdev: the wireless device reporting the match 918350bcd31dSAyala Beker * @match: match notification parameters 918450bcd31dSAyala Beker * @gfp: allocation flags 918550bcd31dSAyala Beker * 918650bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 918750bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 918850bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 918950bcd31dSAyala Beker */ 919050bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 919150bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 919250bcd31dSAyala Beker 9193368e5a7bSAyala Beker /** 9194368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 9195368e5a7bSAyala Beker * 9196368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 9197368e5a7bSAyala Beker * @inst_id: the local instance id 9198368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 9199368e5a7bSAyala Beker * @cookie: unique NAN function identifier 9200368e5a7bSAyala Beker * @gfp: allocation flags 9201368e5a7bSAyala Beker * 9202368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 9203368e5a7bSAyala Beker */ 9204368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 9205368e5a7bSAyala Beker u8 inst_id, 9206368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 9207368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 9208368e5a7bSAyala Beker 9209b7ffbd7eSJohannes Berg /* ethtool helper */ 9210b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 9211b7ffbd7eSJohannes Berg 921240cbfa90SSrinivas Dasari /** 921340cbfa90SSrinivas Dasari * cfg80211_external_auth_request - userspace request for authentication 921440cbfa90SSrinivas Dasari * @netdev: network device 921540cbfa90SSrinivas Dasari * @params: External authentication parameters 921640cbfa90SSrinivas Dasari * @gfp: allocation flags 921740cbfa90SSrinivas Dasari * Returns: 0 on success, < 0 on error 921840cbfa90SSrinivas Dasari */ 921940cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev, 922040cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params, 922140cbfa90SSrinivas Dasari gfp_t gfp); 922240cbfa90SSrinivas Dasari 92239bb7e0f2SJohannes Berg /** 92249bb7e0f2SJohannes Berg * cfg80211_pmsr_report - report peer measurement result data 92259bb7e0f2SJohannes Berg * @wdev: the wireless device reporting the measurement 92269bb7e0f2SJohannes Berg * @req: the original measurement request 92279bb7e0f2SJohannes Berg * @result: the result data 92289bb7e0f2SJohannes Berg * @gfp: allocation flags 92299bb7e0f2SJohannes Berg */ 92309bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev, 92319bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *req, 92329bb7e0f2SJohannes Berg struct cfg80211_pmsr_result *result, 92339bb7e0f2SJohannes Berg gfp_t gfp); 92349bb7e0f2SJohannes Berg 92359bb7e0f2SJohannes Berg /** 92369bb7e0f2SJohannes Berg * cfg80211_pmsr_complete - report peer measurement completed 92379bb7e0f2SJohannes Berg * @wdev: the wireless device reporting the measurement 92389bb7e0f2SJohannes Berg * @req: the original measurement request 92399bb7e0f2SJohannes Berg * @gfp: allocation flags 92409bb7e0f2SJohannes Berg * 92419bb7e0f2SJohannes Berg * Report that the entire measurement completed, after this 92429bb7e0f2SJohannes Berg * the request pointer will no longer be valid. 92439bb7e0f2SJohannes Berg */ 92449bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev, 92459bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *req, 92469bb7e0f2SJohannes Berg gfp_t gfp); 92479bb7e0f2SJohannes Berg 9248e6f40511SManikanta Pubbisetty /** 9249e6f40511SManikanta Pubbisetty * cfg80211_iftype_allowed - check whether the interface can be allowed 9250e6f40511SManikanta Pubbisetty * @wiphy: the wiphy 9251e6f40511SManikanta Pubbisetty * @iftype: interface type 9252e6f40511SManikanta Pubbisetty * @is_4addr: use_4addr flag, must be '0' when check_swif is '1' 9253e6f40511SManikanta Pubbisetty * @check_swif: check iftype against software interfaces 9254e6f40511SManikanta Pubbisetty * 9255e6f40511SManikanta Pubbisetty * Check whether the interface is allowed to operate; additionally, this API 9256e6f40511SManikanta Pubbisetty * can be used to check iftype against the software interfaces when 9257e6f40511SManikanta Pubbisetty * check_swif is '1'. 9258e6f40511SManikanta Pubbisetty */ 9259e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 9260e6f40511SManikanta Pubbisetty bool is_4addr, u8 check_swif); 9261e6f40511SManikanta Pubbisetty 9262e6f40511SManikanta Pubbisetty 9263a083ee8aSIlan Peer /** 9264a083ee8aSIlan Peer * cfg80211_assoc_comeback - notification of association that was 926598e0c7f8SRandy Dunlap * temporarily rejected with a comeback 9266a083ee8aSIlan Peer * @netdev: network device 926798e0c7f8SRandy Dunlap * @ap_addr: AP (MLD) address that rejected the association 9268a083ee8aSIlan Peer * @timeout: timeout interval value TUs. 9269a083ee8aSIlan Peer * 9270a083ee8aSIlan Peer * this function may sleep. the caller must hold the corresponding wdev's mutex. 9271a083ee8aSIlan Peer */ 9272a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev, 9273e69dac88SJohannes Berg const u8 *ap_addr, u32 timeout); 9274a083ee8aSIlan Peer 9275e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 9276e1db74fcSJoe Perches 9277e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 9278e1db74fcSJoe Perches 9279e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 92809c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 9281e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 92829c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 9283e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 92849c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 9285e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 92869c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 9287e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 92889c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 9289e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 92909c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 9291e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 92929c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 9293e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 92949c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 9295761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...) \ 9296761025b5SDmitry Osipenko dev_info_once(&(wiphy)->dev, format, ##args) 9297073730d7SJoe Perches 9298a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...) \ 9299a58d7525SStanislaw Gruszka dev_err_ratelimited(&(wiphy)->dev, format, ##args) 9300a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...) \ 9301a58d7525SStanislaw Gruszka dev_warn_ratelimited(&(wiphy)->dev, format, ##args) 9302a58d7525SStanislaw Gruszka 93039c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 9304e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 93059c376639SJoe Perches 9306e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 93079c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 9308e1db74fcSJoe Perches 9309e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 9310e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 9311e1db74fcSJoe Perches #else 9312e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 9313e1db74fcSJoe Perches ({ \ 9314e1db74fcSJoe Perches if (0) \ 9315e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 9316e1db74fcSJoe Perches 0; \ 9317e1db74fcSJoe Perches }) 9318e1db74fcSJoe Perches #endif 9319e1db74fcSJoe Perches 9320e1db74fcSJoe Perches /* 9321e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 9322e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 9323e1db74fcSJoe Perches * file/line information and a backtrace. 9324e1db74fcSJoe Perches */ 9325e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 9326e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 9327e1db74fcSJoe Perches 9328cb74e977SSunil Dutt /** 9329cb74e977SSunil Dutt * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space 9330cb74e977SSunil Dutt * @netdev: network device 9331cb74e977SSunil Dutt * @owe_info: peer's owe info 9332cb74e977SSunil Dutt * @gfp: allocation flags 9333cb74e977SSunil Dutt */ 9334cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev, 9335cb74e977SSunil Dutt struct cfg80211_update_owe_info *owe_info, 9336cb74e977SSunil Dutt gfp_t gfp); 9337cb74e977SSunil Dutt 93382f1805eaSEmmanuel Grumbach /** 93392f1805eaSEmmanuel Grumbach * cfg80211_bss_flush - resets all the scan entries 93402f1805eaSEmmanuel Grumbach * @wiphy: the wiphy 93412f1805eaSEmmanuel Grumbach */ 93422f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy); 93432f1805eaSEmmanuel Grumbach 93440d2ab3aeSJohn Crispin /** 93450d2ab3aeSJohn Crispin * cfg80211_bss_color_notify - notify about bss color event 93460d2ab3aeSJohn Crispin * @dev: network device 93470d2ab3aeSJohn Crispin * @cmd: the actual event we want to notify 93480d2ab3aeSJohn Crispin * @count: the number of TBTTs until the color change happens 93490d2ab3aeSJohn Crispin * @color_bitmap: representations of the colors that the local BSS is aware of 93500d2ab3aeSJohn Crispin */ 9351935ef47bSLorenzo Bianconi int cfg80211_bss_color_notify(struct net_device *dev, 93520d2ab3aeSJohn Crispin enum nl80211_commands cmd, u8 count, 93530d2ab3aeSJohn Crispin u64 color_bitmap); 93540d2ab3aeSJohn Crispin 93550d2ab3aeSJohn Crispin /** 93560d2ab3aeSJohn Crispin * cfg80211_obss_color_collision_notify - notify about bss color collision 93570d2ab3aeSJohn Crispin * @dev: network device 93580d2ab3aeSJohn Crispin * @color_bitmap: representations of the colors that the local BSS is aware of 93590d2ab3aeSJohn Crispin */ 93600d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev, 9361935ef47bSLorenzo Bianconi u64 color_bitmap) 93620d2ab3aeSJohn Crispin { 9363935ef47bSLorenzo Bianconi return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION, 93640d2ab3aeSJohn Crispin 0, color_bitmap); 93650d2ab3aeSJohn Crispin } 93660d2ab3aeSJohn Crispin 93670d2ab3aeSJohn Crispin /** 93680d2ab3aeSJohn Crispin * cfg80211_color_change_started_notify - notify color change start 93690d2ab3aeSJohn Crispin * @dev: the device on which the color is switched 93700d2ab3aeSJohn Crispin * @count: the number of TBTTs until the color change happens 93710d2ab3aeSJohn Crispin * 93720d2ab3aeSJohn Crispin * Inform the userspace about the color change that has started. 93730d2ab3aeSJohn Crispin */ 93740d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev, 93750d2ab3aeSJohn Crispin u8 count) 93760d2ab3aeSJohn Crispin { 9377935ef47bSLorenzo Bianconi return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED, 93780d2ab3aeSJohn Crispin count, 0); 93790d2ab3aeSJohn Crispin } 93800d2ab3aeSJohn Crispin 93810d2ab3aeSJohn Crispin /** 93820d2ab3aeSJohn Crispin * cfg80211_color_change_aborted_notify - notify color change abort 93830d2ab3aeSJohn Crispin * @dev: the device on which the color is switched 93840d2ab3aeSJohn Crispin * 93850d2ab3aeSJohn Crispin * Inform the userspace about the color change that has aborted. 93860d2ab3aeSJohn Crispin */ 93870d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev) 93880d2ab3aeSJohn Crispin { 9389935ef47bSLorenzo Bianconi return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED, 93900d2ab3aeSJohn Crispin 0, 0); 93910d2ab3aeSJohn Crispin } 93920d2ab3aeSJohn Crispin 93930d2ab3aeSJohn Crispin /** 93940d2ab3aeSJohn Crispin * cfg80211_color_change_notify - notify color change completion 93950d2ab3aeSJohn Crispin * @dev: the device on which the color was switched 93960d2ab3aeSJohn Crispin * 93970d2ab3aeSJohn Crispin * Inform the userspace about the color change that has completed. 93980d2ab3aeSJohn Crispin */ 93990d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev) 94000d2ab3aeSJohn Crispin { 9401935ef47bSLorenzo Bianconi return cfg80211_bss_color_notify(dev, 94020d2ab3aeSJohn Crispin NL80211_CMD_COLOR_CHANGE_COMPLETED, 94030d2ab3aeSJohn Crispin 0, 0); 94040d2ab3aeSJohn Crispin } 94050d2ab3aeSJohn Crispin 9406b25413feSAloka Dixit /** 9407065563b2SVeerendranath Jakkam * cfg80211_links_removed - Notify about removed STA MLD setup links. 9408065563b2SVeerendranath Jakkam * @dev: network device. 9409065563b2SVeerendranath Jakkam * @link_mask: BIT mask of removed STA MLD setup link IDs. 9410065563b2SVeerendranath Jakkam * 9411065563b2SVeerendranath Jakkam * Inform cfg80211 and the userspace about removed STA MLD setup links due to 9412065563b2SVeerendranath Jakkam * AP MLD removing the corresponding affiliated APs with Multi-Link 9413065563b2SVeerendranath Jakkam * reconfiguration. Note that it's not valid to remove all links, in this 9414065563b2SVeerendranath Jakkam * case disconnect instead. 9415065563b2SVeerendranath Jakkam * Also note that the wdev mutex must be held. 9416065563b2SVeerendranath Jakkam */ 9417065563b2SVeerendranath Jakkam void cfg80211_links_removed(struct net_device *dev, u16 link_mask); 9418065563b2SVeerendranath Jakkam 94199be61558SAndrei Otcheretianski /** 94209be61558SAndrei Otcheretianski * cfg80211_schedule_channels_check - schedule regulatory check if needed 94219be61558SAndrei Otcheretianski * @wdev: the wireless device to check 94229be61558SAndrei Otcheretianski * 94239be61558SAndrei Otcheretianski * In case the device supports NO_IR or DFS relaxations, schedule regulatory 94249be61558SAndrei Otcheretianski * channels check, as previous concurrent operation conditions may not 94259be61558SAndrei Otcheretianski * hold anymore. 94269be61558SAndrei Otcheretianski */ 94279be61558SAndrei Otcheretianski void cfg80211_schedule_channels_check(struct wireless_dev *wdev); 94289be61558SAndrei Otcheretianski 9429b590b9aeSJohannes Berg #ifdef CONFIG_CFG80211_DEBUGFS 9430b590b9aeSJohannes Berg /** 9431b590b9aeSJohannes Berg * wiphy_locked_debugfs_read - do a locked read in debugfs 9432b590b9aeSJohannes Berg * @wiphy: the wiphy to use 9433b590b9aeSJohannes Berg * @file: the file being read 9434b590b9aeSJohannes Berg * @buf: the buffer to fill and then read from 9435b590b9aeSJohannes Berg * @bufsize: size of the buffer 9436b590b9aeSJohannes Berg * @userbuf: the user buffer to copy to 9437b590b9aeSJohannes Berg * @count: read count 9438b590b9aeSJohannes Berg * @ppos: read position 9439b590b9aeSJohannes Berg * @handler: the read handler to call (under wiphy lock) 9440b590b9aeSJohannes Berg * @data: additional data to pass to the read handler 9441b590b9aeSJohannes Berg */ 9442b590b9aeSJohannes Berg ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file, 9443b590b9aeSJohannes Berg char *buf, size_t bufsize, 9444b590b9aeSJohannes Berg char __user *userbuf, size_t count, 9445b590b9aeSJohannes Berg loff_t *ppos, 9446b590b9aeSJohannes Berg ssize_t (*handler)(struct wiphy *wiphy, 9447b590b9aeSJohannes Berg struct file *file, 9448b590b9aeSJohannes Berg char *buf, 9449b590b9aeSJohannes Berg size_t bufsize, 9450b590b9aeSJohannes Berg void *data), 9451b590b9aeSJohannes Berg void *data); 9452b590b9aeSJohannes Berg 9453b590b9aeSJohannes Berg /** 9454b590b9aeSJohannes Berg * wiphy_locked_debugfs_write - do a locked write in debugfs 9455b590b9aeSJohannes Berg * @wiphy: the wiphy to use 9456b590b9aeSJohannes Berg * @file: the file being written to 9457b590b9aeSJohannes Berg * @buf: the buffer to copy the user data to 9458b590b9aeSJohannes Berg * @bufsize: size of the buffer 9459b590b9aeSJohannes Berg * @userbuf: the user buffer to copy from 9460b590b9aeSJohannes Berg * @count: read count 9461b590b9aeSJohannes Berg * @handler: the write handler to call (under wiphy lock) 9462b590b9aeSJohannes Berg * @data: additional data to pass to the write handler 9463b590b9aeSJohannes Berg */ 9464b590b9aeSJohannes Berg ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file, 9465b590b9aeSJohannes Berg char *buf, size_t bufsize, 9466b590b9aeSJohannes Berg const char __user *userbuf, size_t count, 9467b590b9aeSJohannes Berg ssize_t (*handler)(struct wiphy *wiphy, 9468b590b9aeSJohannes Berg struct file *file, 9469b590b9aeSJohannes Berg char *buf, 9470b590b9aeSJohannes Berg size_t count, 9471b590b9aeSJohannes Berg void *data), 9472b590b9aeSJohannes Berg void *data); 9473b590b9aeSJohannes Berg #endif 9474b590b9aeSJohannes Berg 9475704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 9476