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 10dd3e4fc7SAvraham Stern * Copyright (C) 2018-2021 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 55d70e9693SJohannes Berg * 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. 79d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 80689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 81d3236553SJohannes Berg * is not permitted. 82689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 83d3236553SJohannes Berg * is not permitted. 8403f6b084SSeth Forshee * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel. 85c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band, 86c7a6ee27SJohannes Berg * this flag indicates that an 80 MHz channel cannot use this 87c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 88c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 89c7a6ee27SJohannes Berg * restrictions. 90c7a6ee27SJohannes Berg * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band, 91c7a6ee27SJohannes Berg * this flag indicates that an 160 MHz channel cannot use this 92c7a6ee27SJohannes Berg * channel as the control or any of the secondary channels. 93c7a6ee27SJohannes Berg * This may be due to the driver or due to regulatory bandwidth 94c7a6ee27SJohannes Berg * restrictions. 95570dbde1SDavid Spinadel * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY 9606f207fcSArik Nemtsov * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 97ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted 98ea077c1cSRostislav Lisovy * on this channel. 99ea077c1cSRostislav Lisovy * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted 100ea077c1cSRostislav Lisovy * on this channel. 1011e61d82cSHaim Dreyfuss * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel. 102d65a9770SThomas Pedersen * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted 103d65a9770SThomas Pedersen * on this channel. 104d65a9770SThomas Pedersen * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted 105d65a9770SThomas Pedersen * on this channel. 106d65a9770SThomas Pedersen * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted 107d65a9770SThomas Pedersen * on this channel. 108d65a9770SThomas Pedersen * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted 109d65a9770SThomas Pedersen * on this channel. 110d65a9770SThomas Pedersen * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted 111d65a9770SThomas Pedersen * on this channel. 1123743bec6SJia Ding * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band, 1133743bec6SJia Ding * this flag indicates that a 320 MHz channel cannot use this 1143743bec6SJia Ding * channel as the control or any of the secondary channels. 1153743bec6SJia Ding * This may be due to the driver or due to regulatory bandwidth 1163743bec6SJia Ding * restrictions. 11731846b65SIlan Peer * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel. 118d3236553SJohannes Berg */ 119d3236553SJohannes Berg enum ieee80211_channel_flags { 120d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 1218fe02e16SLuis R. Rodriguez IEEE80211_CHAN_NO_IR = 1<<1, 1228fe02e16SLuis R. Rodriguez /* hole at 1<<2 */ 123d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 124689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 125689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 12603f6b084SSeth Forshee IEEE80211_CHAN_NO_OFDM = 1<<6, 127c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_80MHZ = 1<<7, 128c7a6ee27SJohannes Berg IEEE80211_CHAN_NO_160MHZ = 1<<8, 129570dbde1SDavid Spinadel IEEE80211_CHAN_INDOOR_ONLY = 1<<9, 13006f207fcSArik Nemtsov IEEE80211_CHAN_IR_CONCURRENT = 1<<10, 131ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_20MHZ = 1<<11, 132ea077c1cSRostislav Lisovy IEEE80211_CHAN_NO_10MHZ = 1<<12, 1331e61d82cSHaim Dreyfuss IEEE80211_CHAN_NO_HE = 1<<13, 134d65a9770SThomas Pedersen IEEE80211_CHAN_1MHZ = 1<<14, 135d65a9770SThomas Pedersen IEEE80211_CHAN_2MHZ = 1<<15, 136d65a9770SThomas Pedersen IEEE80211_CHAN_4MHZ = 1<<16, 137d65a9770SThomas Pedersen IEEE80211_CHAN_8MHZ = 1<<17, 138d65a9770SThomas Pedersen IEEE80211_CHAN_16MHZ = 1<<18, 1393743bec6SJia Ding IEEE80211_CHAN_NO_320MHZ = 1<<19, 14031846b65SIlan Peer IEEE80211_CHAN_NO_EHT = 1<<20, 141d3236553SJohannes Berg }; 142d3236553SJohannes Berg 143038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 144689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 145038659e7SLuis R. Rodriguez 14604f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 14704f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) 14804f39047SSimon Wunderlich 149d3236553SJohannes Berg /** 150d3236553SJohannes Berg * struct ieee80211_channel - channel definition 151d3236553SJohannes Berg * 152d3236553SJohannes Berg * This structure describes a single channel for use 153d3236553SJohannes Berg * with cfg80211. 154d3236553SJohannes Berg * 155d3236553SJohannes Berg * @center_freq: center frequency in MHz 156934f4c7dSThomas Pedersen * @freq_offset: offset from @center_freq, in KHz 157d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 158d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 159d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 160d3236553SJohannes Berg * code to support devices with additional restrictions 161d3236553SJohannes Berg * @band: band this channel belongs to. 162d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 163d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 164eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 165d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 166d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 16777c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 168d3236553SJohannes Berg * @orig_mag: internal use 169d3236553SJohannes Berg * @orig_mpwr: internal use 17004f39047SSimon Wunderlich * @dfs_state: current state of this channel. Only relevant if radar is required 17104f39047SSimon Wunderlich * on this channel. 17204f39047SSimon Wunderlich * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 173089027e5SJanusz Dziedzic * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. 174d3236553SJohannes Berg */ 175d3236553SJohannes Berg struct ieee80211_channel { 17657fbcce3SJohannes Berg enum nl80211_band band; 1779cf0a0b4SAlexei Avshalom Lazar u32 center_freq; 178934f4c7dSThomas Pedersen u16 freq_offset; 179d3236553SJohannes Berg u16 hw_value; 180d3236553SJohannes Berg u32 flags; 181d3236553SJohannes Berg int max_antenna_gain; 182d3236553SJohannes Berg int max_power; 183eccc068eSHong Wu int max_reg_power; 184d3236553SJohannes Berg bool beacon_found; 185d3236553SJohannes Berg u32 orig_flags; 186d3236553SJohannes Berg int orig_mag, orig_mpwr; 18704f39047SSimon Wunderlich enum nl80211_dfs_state dfs_state; 18804f39047SSimon Wunderlich unsigned long dfs_state_entered; 189089027e5SJanusz Dziedzic unsigned int dfs_cac_ms; 190d3236553SJohannes Berg }; 191d3236553SJohannes Berg 192d3236553SJohannes Berg /** 193d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 194d3236553SJohannes Berg * 195d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 196d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 197d3236553SJohannes Berg * different bands/PHY modes. 198d3236553SJohannes Berg * 199d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 200d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 201d3236553SJohannes Berg * with CCK rates. 202d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 203d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 204d3236553SJohannes Berg * core code when registering the wiphy. 205d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 206d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 207d3236553SJohannes Berg * core code when registering the wiphy. 208d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 209d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 210d3236553SJohannes Berg * core code when registering the wiphy. 211d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 21230e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode 21330e74732SSimon Wunderlich * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode 214d3236553SJohannes Berg */ 215d3236553SJohannes Berg enum ieee80211_rate_flags { 216d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 217d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 218d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 219d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 220d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 22130e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5, 22230e74732SSimon Wunderlich IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6, 223d3236553SJohannes Berg }; 224d3236553SJohannes Berg 225d3236553SJohannes Berg /** 2266eb18137SDedy Lansky * enum ieee80211_bss_type - BSS type filter 2276eb18137SDedy Lansky * 2286eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS 2296eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_PBSS: Personal BSS 2306eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_IBSS: Independent BSS 2316eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS 2326eb18137SDedy Lansky * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type 2336eb18137SDedy Lansky */ 2346eb18137SDedy Lansky enum ieee80211_bss_type { 2356eb18137SDedy Lansky IEEE80211_BSS_TYPE_ESS, 2366eb18137SDedy Lansky IEEE80211_BSS_TYPE_PBSS, 2376eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 2386eb18137SDedy Lansky IEEE80211_BSS_TYPE_MBSS, 2396eb18137SDedy Lansky IEEE80211_BSS_TYPE_ANY 2406eb18137SDedy Lansky }; 2416eb18137SDedy Lansky 2426eb18137SDedy Lansky /** 2436eb18137SDedy Lansky * enum ieee80211_privacy - BSS privacy filter 2446eb18137SDedy Lansky * 2456eb18137SDedy Lansky * @IEEE80211_PRIVACY_ON: privacy bit set 2466eb18137SDedy Lansky * @IEEE80211_PRIVACY_OFF: privacy bit clear 2476eb18137SDedy Lansky * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting 2486eb18137SDedy Lansky */ 2496eb18137SDedy Lansky enum ieee80211_privacy { 2506eb18137SDedy Lansky IEEE80211_PRIVACY_ON, 2516eb18137SDedy Lansky IEEE80211_PRIVACY_OFF, 2526eb18137SDedy Lansky IEEE80211_PRIVACY_ANY 2536eb18137SDedy Lansky }; 2546eb18137SDedy Lansky 2556eb18137SDedy Lansky #define IEEE80211_PRIVACY(x) \ 2566eb18137SDedy Lansky ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF) 2576eb18137SDedy Lansky 2586eb18137SDedy Lansky /** 259d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 260d3236553SJohannes Berg * 261d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 262d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 263d3236553SJohannes Berg * are only for driver use when pointers to this structure are 264d3236553SJohannes Berg * passed around. 265d3236553SJohannes Berg * 266d3236553SJohannes Berg * @flags: rate-specific flags 267d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 268d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 269d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 270d3236553SJohannes Berg * short preamble is used 271d3236553SJohannes Berg */ 272d3236553SJohannes Berg struct ieee80211_rate { 273d3236553SJohannes Berg u32 flags; 274d3236553SJohannes Berg u16 bitrate; 275d3236553SJohannes Berg u16 hw_value, hw_value_short; 276d3236553SJohannes Berg }; 277d3236553SJohannes Berg 278d3236553SJohannes Berg /** 279796e90f4SJohn Crispin * struct ieee80211_he_obss_pd - AP settings for spatial reuse 280796e90f4SJohn Crispin * 281796e90f4SJohn Crispin * @enable: is the feature enabled. 282f5bec330SRajkumar Manoharan * @sr_ctrl: The SR Control field of SRP element. 283f5bec330SRajkumar Manoharan * @non_srg_max_offset: non-SRG maximum tx power offset 284796e90f4SJohn Crispin * @min_offset: minimal tx power offset an associated station shall use 285796e90f4SJohn Crispin * @max_offset: maximum tx power offset an associated station shall use 286f5bec330SRajkumar Manoharan * @bss_color_bitmap: bitmap that indicates the BSS color values used by 287f5bec330SRajkumar Manoharan * members of the SRG 288f5bec330SRajkumar Manoharan * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values 289f5bec330SRajkumar Manoharan * used by members of the SRG 290796e90f4SJohn Crispin */ 291796e90f4SJohn Crispin struct ieee80211_he_obss_pd { 292796e90f4SJohn Crispin bool enable; 293f5bec330SRajkumar Manoharan u8 sr_ctrl; 294f5bec330SRajkumar Manoharan u8 non_srg_max_offset; 295796e90f4SJohn Crispin u8 min_offset; 296796e90f4SJohn Crispin u8 max_offset; 297f5bec330SRajkumar Manoharan u8 bss_color_bitmap[8]; 298f5bec330SRajkumar Manoharan u8 partial_bssid_bitmap[8]; 299796e90f4SJohn Crispin }; 300796e90f4SJohn Crispin 301796e90f4SJohn Crispin /** 3025c5e52d1SJohn Crispin * struct cfg80211_he_bss_color - AP settings for BSS coloring 3035c5e52d1SJohn Crispin * 3045c5e52d1SJohn Crispin * @color: the current color. 30575e6b594SJohannes Berg * @enabled: HE BSS color is used 3065c5e52d1SJohn Crispin * @partial: define the AID equation. 3075c5e52d1SJohn Crispin */ 3085c5e52d1SJohn Crispin struct cfg80211_he_bss_color { 3095c5e52d1SJohn Crispin u8 color; 31075e6b594SJohannes Berg bool enabled; 3115c5e52d1SJohn Crispin bool partial; 3125c5e52d1SJohn Crispin }; 3135c5e52d1SJohn Crispin 3145c5e52d1SJohn Crispin /** 315d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 316d3236553SJohannes Berg * 317d3236553SJohannes Berg * This structure describes most essential parameters needed 318d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 319d3236553SJohannes Berg * 320d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 321d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 322d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 323d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 324d3236553SJohannes Berg * @mcs: Supported MCS rates 325d3236553SJohannes Berg */ 326d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 327d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 328d3236553SJohannes Berg bool ht_supported; 329d3236553SJohannes Berg u8 ampdu_factor; 330d3236553SJohannes Berg u8 ampdu_density; 331d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 332d3236553SJohannes Berg }; 333d3236553SJohannes Berg 334d3236553SJohannes Berg /** 335bf0c111eSMahesh Palivela * struct ieee80211_sta_vht_cap - STA's VHT capabilities 336bf0c111eSMahesh Palivela * 337bf0c111eSMahesh Palivela * This structure describes most essential parameters needed 338bf0c111eSMahesh Palivela * to describe 802.11ac VHT capabilities for an STA. 339bf0c111eSMahesh Palivela * 340bf0c111eSMahesh Palivela * @vht_supported: is VHT supported by the STA 341bf0c111eSMahesh Palivela * @cap: VHT capabilities map as described in 802.11ac spec 342bf0c111eSMahesh Palivela * @vht_mcs: Supported VHT MCS rates 343bf0c111eSMahesh Palivela */ 344bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap { 345bf0c111eSMahesh Palivela bool vht_supported; 346bf0c111eSMahesh Palivela u32 cap; /* use IEEE80211_VHT_CAP_ */ 347bf0c111eSMahesh Palivela struct ieee80211_vht_mcs_info vht_mcs; 348bf0c111eSMahesh Palivela }; 349bf0c111eSMahesh Palivela 350c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN 25 351c4cbaf79SLuca Coelho 352c4cbaf79SLuca Coelho /** 353c4cbaf79SLuca Coelho * struct ieee80211_sta_he_cap - STA's HE capabilities 354c4cbaf79SLuca Coelho * 355c4cbaf79SLuca Coelho * This structure describes most essential parameters needed 356c4cbaf79SLuca Coelho * to describe 802.11ax HE capabilities for a STA. 357c4cbaf79SLuca Coelho * 358c4cbaf79SLuca Coelho * @has_he: true iff HE data is valid. 359c4cbaf79SLuca Coelho * @he_cap_elem: Fixed portion of the HE capabilities element. 360c4cbaf79SLuca Coelho * @he_mcs_nss_supp: The supported NSS/MCS combinations. 361c4cbaf79SLuca Coelho * @ppe_thres: Holds the PPE Thresholds data. 362c4cbaf79SLuca Coelho */ 363c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap { 364c4cbaf79SLuca Coelho bool has_he; 365c4cbaf79SLuca Coelho struct ieee80211_he_cap_elem he_cap_elem; 366c4cbaf79SLuca Coelho struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 367c4cbaf79SLuca Coelho u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; 368c4cbaf79SLuca Coelho }; 369c4cbaf79SLuca Coelho 370c4cbaf79SLuca Coelho /** 3715cd5a8a3SIlan Peer * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS 3725cd5a8a3SIlan Peer * 3735cd5a8a3SIlan Peer * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS 3745cd5a8a3SIlan Peer * and NSS Set field" 3755cd5a8a3SIlan Peer * 3765cd5a8a3SIlan Peer * @only_20mhz: MCS/NSS support for 20 MHz-only STA. 3772d8b08feSMauro Carvalho Chehab * @bw: MCS/NSS support for 80, 160 and 320 MHz 3785cd5a8a3SIlan Peer * @bw._80: MCS/NSS support for BW <= 80 MHz 3795cd5a8a3SIlan Peer * @bw._160: MCS/NSS support for BW = 160 MHz 3805cd5a8a3SIlan Peer * @bw._320: MCS/NSS support for BW = 320 MHz 3815cd5a8a3SIlan Peer */ 3825cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp { 3835cd5a8a3SIlan Peer union { 3845cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz; 3855cd5a8a3SIlan Peer struct { 3865cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_bw _80; 3875cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_bw _160; 3885cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp_bw _320; 3895cd5a8a3SIlan Peer } __packed bw; 3905cd5a8a3SIlan Peer } __packed; 3915cd5a8a3SIlan Peer } __packed; 3925cd5a8a3SIlan Peer 3935cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN 32 3945cd5a8a3SIlan Peer 3955cd5a8a3SIlan Peer /** 3965cd5a8a3SIlan Peer * struct ieee80211_sta_eht_cap - STA's EHT capabilities 3975cd5a8a3SIlan Peer * 3985cd5a8a3SIlan Peer * This structure describes most essential parameters needed 3995cd5a8a3SIlan Peer * to describe 802.11be EHT capabilities for a STA. 4005cd5a8a3SIlan Peer * 4015cd5a8a3SIlan Peer * @has_eht: true iff EHT data is valid. 4025cd5a8a3SIlan Peer * @eht_cap_elem: Fixed portion of the eht capabilities element. 4035cd5a8a3SIlan Peer * @eht_mcs_nss_supp: The supported NSS/MCS combinations. 4045cd5a8a3SIlan Peer * @eht_ppe_thres: Holds the PPE Thresholds data. 4055cd5a8a3SIlan Peer */ 4065cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap { 4075cd5a8a3SIlan Peer bool has_eht; 4085cd5a8a3SIlan Peer struct ieee80211_eht_cap_elem_fixed eht_cap_elem; 4095cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp; 4105cd5a8a3SIlan Peer u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN]; 4115cd5a8a3SIlan Peer }; 4125cd5a8a3SIlan Peer 4135cd5a8a3SIlan Peer /** 4145d9c358dSRandy Dunlap * struct ieee80211_sband_iftype_data - sband data per interface type 415c4cbaf79SLuca Coelho * 416c4cbaf79SLuca Coelho * This structure encapsulates sband data that is relevant for the 417c4cbaf79SLuca Coelho * interface types defined in @types_mask. Each type in the 418c4cbaf79SLuca Coelho * @types_mask must be unique across all instances of iftype_data. 419c4cbaf79SLuca Coelho * 420c4cbaf79SLuca Coelho * @types_mask: interface types mask 421c4cbaf79SLuca Coelho * @he_cap: holds the HE capabilities 42222395217SJohannes Berg * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a 42322395217SJohannes Berg * 6 GHz band channel (and 0 may be valid value). 4242d8b08feSMauro Carvalho Chehab * @eht_cap: STA's EHT capabilities 425f4f86505SJohannes Berg * @vendor_elems: vendor element(s) to advertise 426f4f86505SJohannes Berg * @vendor_elems.data: vendor element(s) data 427f4f86505SJohannes Berg * @vendor_elems.len: vendor element(s) length 428c4cbaf79SLuca Coelho */ 429c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data { 430c4cbaf79SLuca Coelho u16 types_mask; 431c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap he_cap; 43222395217SJohannes Berg struct ieee80211_he_6ghz_capa he_6ghz_capa; 4335cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap eht_cap; 434f4f86505SJohannes Berg struct { 435f4f86505SJohannes Berg const u8 *data; 436f4f86505SJohannes Berg unsigned int len; 437f4f86505SJohannes Berg } vendor_elems; 438c4cbaf79SLuca Coelho }; 439c4cbaf79SLuca Coelho 440bf0c111eSMahesh Palivela /** 4412a38075cSAlexei Avshalom Lazar * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations 4422a38075cSAlexei Avshalom Lazar * 4432a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz 4442a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz 4452a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz 4462a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz 4472a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz 4482a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz 4492a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz 4502a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and 4512a38075cSAlexei Avshalom Lazar * 2.16GHz+2.16GHz 4522a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and 4532a38075cSAlexei Avshalom Lazar * 4.32GHz + 4.32GHz 4542a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and 4552a38075cSAlexei Avshalom Lazar * 4.32GHz + 4.32GHz 4562a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz 4572a38075cSAlexei Avshalom Lazar * and 4.32GHz + 4.32GHz 4582a38075cSAlexei Avshalom Lazar * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz, 4592a38075cSAlexei Avshalom Lazar * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz 4602a38075cSAlexei Avshalom Lazar */ 4612a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config { 4622a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_4 = 4, 4632a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_5 = 5, 4642a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_6 = 6, 4652a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_7 = 7, 4662a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_8 = 8, 4672a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_9 = 9, 4682a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_10 = 10, 4692a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_11 = 11, 4702a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_12 = 12, 4712a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_13 = 13, 4722a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_14 = 14, 4732a38075cSAlexei Avshalom Lazar IEEE80211_EDMG_BW_CONFIG_15 = 15, 4742a38075cSAlexei Avshalom Lazar }; 4752a38075cSAlexei Avshalom Lazar 4762a38075cSAlexei Avshalom Lazar /** 4772a38075cSAlexei Avshalom Lazar * struct ieee80211_edmg - EDMG configuration 4782a38075cSAlexei Avshalom Lazar * 4792a38075cSAlexei Avshalom Lazar * This structure describes most essential parameters needed 4802a38075cSAlexei Avshalom Lazar * to describe 802.11ay EDMG configuration 4812a38075cSAlexei Avshalom Lazar * 4822a38075cSAlexei Avshalom Lazar * @channels: bitmap that indicates the 2.16 GHz channel(s) 4832a38075cSAlexei Avshalom Lazar * that are allowed to be used for transmissions. 4842a38075cSAlexei Avshalom Lazar * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc. 4852a38075cSAlexei Avshalom Lazar * Set to 0 indicate EDMG not supported. 4862a38075cSAlexei Avshalom Lazar * @bw_config: Channel BW Configuration subfield encodes 4872a38075cSAlexei Avshalom Lazar * the allowed channel bandwidth configurations 4882a38075cSAlexei Avshalom Lazar */ 4892a38075cSAlexei Avshalom Lazar struct ieee80211_edmg { 4902a38075cSAlexei Avshalom Lazar u8 channels; 4912a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config bw_config; 4922a38075cSAlexei Avshalom Lazar }; 4932a38075cSAlexei Avshalom Lazar 4942a38075cSAlexei Avshalom Lazar /** 495df78a0c0SThomas Pedersen * struct ieee80211_sta_s1g_cap - STA's S1G capabilities 496df78a0c0SThomas Pedersen * 497df78a0c0SThomas Pedersen * This structure describes most essential parameters needed 498df78a0c0SThomas Pedersen * to describe 802.11ah S1G capabilities for a STA. 499df78a0c0SThomas Pedersen * 5002d8b08feSMauro Carvalho Chehab * @s1g: is STA an S1G STA 501df78a0c0SThomas Pedersen * @cap: S1G capabilities information 502df78a0c0SThomas Pedersen * @nss_mcs: Supported NSS MCS set 503df78a0c0SThomas Pedersen */ 504df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap { 505df78a0c0SThomas Pedersen bool s1g; 506df78a0c0SThomas Pedersen u8 cap[10]; /* use S1G_CAPAB_ */ 507df78a0c0SThomas Pedersen u8 nss_mcs[5]; 508df78a0c0SThomas Pedersen }; 509df78a0c0SThomas Pedersen 510df78a0c0SThomas Pedersen /** 511d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 512d3236553SJohannes Berg * 513d3236553SJohannes Berg * This structure describes a frequency band a wiphy 514d3236553SJohannes Berg * is able to operate in. 515d3236553SJohannes Berg * 516085a6c10SRandy Dunlap * @channels: Array of channels the hardware can operate with 517d3236553SJohannes Berg * in this band. 518d3236553SJohannes Berg * @band: the band this structure represents 519d3236553SJohannes Berg * @n_channels: Number of channels in @channels 520d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 521d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 522d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 523d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 524abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 525c9a0a302SRobert P. J. Day * @vht_cap: VHT capabilities in this band 5268a50c057SMauro Carvalho Chehab * @s1g_cap: S1G capabilities in this band 5272a38075cSAlexei Avshalom Lazar * @edmg_cap: EDMG capabilities in this band 5289ff167e1SJohannes Berg * @s1g_cap: S1G capabilities in this band (S1B band only, of course) 529c4cbaf79SLuca Coelho * @n_iftype_data: number of iftype data entries 530c4cbaf79SLuca Coelho * @iftype_data: interface type data entries. Note that the bits in 531c4cbaf79SLuca Coelho * @types_mask inside this structure cannot overlap (i.e. only 532c4cbaf79SLuca Coelho * one occurrence of each type is allowed across all instances of 533c4cbaf79SLuca Coelho * iftype_data). 534d3236553SJohannes Berg */ 535d3236553SJohannes Berg struct ieee80211_supported_band { 536d3236553SJohannes Berg struct ieee80211_channel *channels; 537d3236553SJohannes Berg struct ieee80211_rate *bitrates; 53857fbcce3SJohannes Berg enum nl80211_band band; 539d3236553SJohannes Berg int n_channels; 540d3236553SJohannes Berg int n_bitrates; 541d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 542bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap vht_cap; 543df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap s1g_cap; 5442a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg_cap; 545c4cbaf79SLuca Coelho u16 n_iftype_data; 546c4cbaf79SLuca Coelho const struct ieee80211_sband_iftype_data *iftype_data; 547d3236553SJohannes Berg }; 548d3236553SJohannes Berg 549e691ac2fSRafał Miłecki /** 550c4cbaf79SLuca Coelho * ieee80211_get_sband_iftype_data - return sband data for a given iftype 551c4cbaf79SLuca Coelho * @sband: the sband to search for the STA on 552c4cbaf79SLuca Coelho * @iftype: enum nl80211_iftype 553c4cbaf79SLuca Coelho * 554c4cbaf79SLuca Coelho * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found 555c4cbaf79SLuca Coelho */ 556c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data * 557c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, 558c4cbaf79SLuca Coelho u8 iftype) 559c4cbaf79SLuca Coelho { 560c4cbaf79SLuca Coelho int i; 561c4cbaf79SLuca Coelho 562c4cbaf79SLuca Coelho if (WARN_ON(iftype >= NL80211_IFTYPE_MAX)) 563c4cbaf79SLuca Coelho return NULL; 564c4cbaf79SLuca Coelho 565c4cbaf79SLuca Coelho for (i = 0; i < sband->n_iftype_data; i++) { 566c4cbaf79SLuca Coelho const struct ieee80211_sband_iftype_data *data = 567c4cbaf79SLuca Coelho &sband->iftype_data[i]; 568c4cbaf79SLuca Coelho 569c4cbaf79SLuca Coelho if (data->types_mask & BIT(iftype)) 570c4cbaf79SLuca Coelho return data; 571c4cbaf79SLuca Coelho } 572c4cbaf79SLuca Coelho 573c4cbaf79SLuca Coelho return NULL; 574c4cbaf79SLuca Coelho } 575c4cbaf79SLuca Coelho 576c4cbaf79SLuca Coelho /** 577d7edf40cSJohn Crispin * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype 578d7edf40cSJohn Crispin * @sband: the sband to search for the iftype on 579d7edf40cSJohn Crispin * @iftype: enum nl80211_iftype 580d7edf40cSJohn Crispin * 581d7edf40cSJohn Crispin * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found 582d7edf40cSJohn Crispin */ 583d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap * 584d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband, 585d7edf40cSJohn Crispin u8 iftype) 586d7edf40cSJohn Crispin { 587d7edf40cSJohn Crispin const struct ieee80211_sband_iftype_data *data = 588d7edf40cSJohn Crispin ieee80211_get_sband_iftype_data(sband, iftype); 589d7edf40cSJohn Crispin 590d7edf40cSJohn Crispin if (data && data->he_cap.has_he) 591d7edf40cSJohn Crispin return &data->he_cap; 592d7edf40cSJohn Crispin 593d7edf40cSJohn Crispin return NULL; 594d7edf40cSJohn Crispin } 595d7edf40cSJohn Crispin 596d7edf40cSJohn Crispin /** 5972ad2274cSIlan Peer * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities 5982ad2274cSIlan Peer * @sband: the sband to search for the STA on 5992ad2274cSIlan Peer * @iftype: the iftype to search for 6002ad2274cSIlan Peer * 6012ad2274cSIlan Peer * Return: the 6GHz capabilities 6022ad2274cSIlan Peer */ 6032ad2274cSIlan Peer static inline __le16 6042ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband, 6052ad2274cSIlan Peer enum nl80211_iftype iftype) 6062ad2274cSIlan Peer { 6072ad2274cSIlan Peer const struct ieee80211_sband_iftype_data *data = 6082ad2274cSIlan Peer ieee80211_get_sband_iftype_data(sband, iftype); 6092ad2274cSIlan Peer 6102ad2274cSIlan Peer if (WARN_ON(!data || !data->he_cap.has_he)) 6112ad2274cSIlan Peer return 0; 6122ad2274cSIlan Peer 6132ad2274cSIlan Peer return data->he_6ghz_capa.capa; 6142ad2274cSIlan Peer } 6152ad2274cSIlan Peer 6162ad2274cSIlan Peer /** 6175cd5a8a3SIlan Peer * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype 6185cd5a8a3SIlan Peer * @sband: the sband to search for the iftype on 6195cd5a8a3SIlan Peer * @iftype: enum nl80211_iftype 6205cd5a8a3SIlan Peer * 6215cd5a8a3SIlan Peer * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found 6225cd5a8a3SIlan Peer */ 6235cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap * 6245cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband, 6255cd5a8a3SIlan Peer enum nl80211_iftype iftype) 6265cd5a8a3SIlan Peer { 6275cd5a8a3SIlan Peer const struct ieee80211_sband_iftype_data *data = 6285cd5a8a3SIlan Peer ieee80211_get_sband_iftype_data(sband, iftype); 6295cd5a8a3SIlan Peer 6305cd5a8a3SIlan Peer if (data && data->eht_cap.has_eht) 6315cd5a8a3SIlan Peer return &data->eht_cap; 6325cd5a8a3SIlan Peer 6335cd5a8a3SIlan Peer return NULL; 6345cd5a8a3SIlan Peer } 6355cd5a8a3SIlan Peer 6365cd5a8a3SIlan Peer /** 637e691ac2fSRafał Miłecki * wiphy_read_of_freq_limits - read frequency limits from device tree 638e691ac2fSRafał Miłecki * 639e691ac2fSRafał Miłecki * @wiphy: the wireless device to get extra limits for 640e691ac2fSRafał Miłecki * 641e691ac2fSRafał Miłecki * Some devices may have extra limitations specified in DT. This may be useful 642e691ac2fSRafał Miłecki * for chipsets that normally support more bands but are limited due to board 643e691ac2fSRafał Miłecki * design (e.g. by antennas or external power amplifier). 644e691ac2fSRafał Miłecki * 645e691ac2fSRafał Miłecki * This function reads info from DT and uses it to *modify* channels (disable 646e691ac2fSRafał Miłecki * unavailable ones). It's usually a *bad* idea to use it in drivers with 647e691ac2fSRafał Miłecki * shared channel data as DT limitations are device specific. You should make 648e691ac2fSRafał Miłecki * sure to call it only if channels in wiphy are copied and can be modified 649e691ac2fSRafał Miłecki * without affecting other devices. 650e691ac2fSRafał Miłecki * 651e691ac2fSRafał Miłecki * As this function access device node it has to be called after set_wiphy_dev. 652e691ac2fSRafał Miłecki * It also modifies channels so they have to be set first. 653e691ac2fSRafał Miłecki * If using this helper, call it before wiphy_register(). 654e691ac2fSRafał Miłecki */ 655e691ac2fSRafał Miłecki #ifdef CONFIG_OF 656e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy); 657e691ac2fSRafał Miłecki #else /* CONFIG_OF */ 658e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy) 659e691ac2fSRafał Miłecki { 660e691ac2fSRafał Miłecki } 661e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */ 662e691ac2fSRafał Miłecki 663e691ac2fSRafał Miłecki 664d3236553SJohannes Berg /* 665d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 666704232c2SJohannes Berg */ 667704232c2SJohannes Berg 6682ec600d6SLuis Carlos Cobo /** 669d70e9693SJohannes Berg * DOC: Actions and configuration 670d70e9693SJohannes Berg * 671d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 672d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 673d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 674d70e9693SJohannes Berg * operations use are described separately. 675d70e9693SJohannes Berg * 676d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 677d70e9693SJohannes Berg * information via some functions that drivers need to call. 678d70e9693SJohannes Berg * 679d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 680d70e9693SJohannes Berg * in a separate chapter. 681d70e9693SJohannes Berg */ 682d70e9693SJohannes Berg 683c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ 684c6e6a0c8SAviya Erenfeld WLAN_USER_POSITION_LEN) 685c6e6a0c8SAviya Erenfeld 686d70e9693SJohannes Berg /** 6872ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 688818a986eSJohannes Berg * @flags: monitor interface flags, unchanged if 0, otherwise 689818a986eSJohannes Berg * %MONITOR_FLAG_CHANGED will be set 6908b787643SFelix Fietkau * @use_4addr: use 4-address frames 691e8f479b1SBen Greear * @macaddr: address to use for this virtual interface. 692e8f479b1SBen Greear * If this parameter is set to zero address the driver may 693e8f479b1SBen Greear * determine the address as needed. 694e8f479b1SBen Greear * This feature is only fully supported by drivers that enable the 695e8f479b1SBen Greear * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating 696e8f479b1SBen Greear ** only p2p devices with specified MAC. 697b0265024SJohannes Berg * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets 698b0265024SJohannes Berg * belonging to that MU-MIMO groupID; %NULL if not changed 699b0265024SJohannes Berg * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring 700b0265024SJohannes Berg * MU-MIMO packets going to the specified station; %NULL if not changed 7012ec600d6SLuis Carlos Cobo */ 7022ec600d6SLuis Carlos Cobo struct vif_params { 703818a986eSJohannes Berg u32 flags; 7048b787643SFelix Fietkau int use_4addr; 7051c18f145SArend van Spriel u8 macaddr[ETH_ALEN]; 706b0265024SJohannes Berg const u8 *vht_mumimo_groups; 707b0265024SJohannes Berg const u8 *vht_mumimo_follow_addr; 7082ec600d6SLuis Carlos Cobo }; 7092ec600d6SLuis Carlos Cobo 71041ade00fSJohannes Berg /** 71141ade00fSJohannes Berg * struct key_params - key information 71241ade00fSJohannes Berg * 71341ade00fSJohannes Berg * Information about a key 71441ade00fSJohannes Berg * 71541ade00fSJohannes Berg * @key: key material 71641ade00fSJohannes Berg * @key_len: length of key material 71741ade00fSJohannes Berg * @cipher: cipher suite selector 71841ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 71941ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 72041ade00fSJohannes Berg * length given by @seq_len. 721abe37c4bSJohannes Berg * @seq_len: length of @seq. 72214f34e36SGurumoorthi Gnanasambandhan * @vlan_id: vlan_id for VLAN group key (if nonzero) 7236cdd3979SAlexander Wetzel * @mode: key install mode (RX_TX, NO_TX or SET_TX) 72441ade00fSJohannes Berg */ 72541ade00fSJohannes Berg struct key_params { 726c1e5f471SJohannes Berg const u8 *key; 727c1e5f471SJohannes Berg const u8 *seq; 72841ade00fSJohannes Berg int key_len; 72941ade00fSJohannes Berg int seq_len; 73014f34e36SGurumoorthi Gnanasambandhan u16 vlan_id; 73141ade00fSJohannes Berg u32 cipher; 7326cdd3979SAlexander Wetzel enum nl80211_key_mode mode; 73341ade00fSJohannes Berg }; 73441ade00fSJohannes Berg 735ed1b6cc7SJohannes Berg /** 736683b6d3bSJohannes Berg * struct cfg80211_chan_def - channel definition 737683b6d3bSJohannes Berg * @chan: the (control) channel 7383d9d1d66SJohannes Berg * @width: channel width 7393d9d1d66SJohannes Berg * @center_freq1: center frequency of first segment 7403d9d1d66SJohannes Berg * @center_freq2: center frequency of second segment 7413d9d1d66SJohannes Berg * (only with 80+80 MHz) 7422a38075cSAlexei Avshalom Lazar * @edmg: define the EDMG channels configuration. 7432a38075cSAlexei Avshalom Lazar * If edmg is requested (i.e. the .channels member is non-zero), 7442a38075cSAlexei Avshalom Lazar * chan will define the primary channel and all other 7452a38075cSAlexei Avshalom Lazar * parameters are ignored. 746934f4c7dSThomas Pedersen * @freq1_offset: offset from @center_freq1, in KHz 747683b6d3bSJohannes Berg */ 748683b6d3bSJohannes Berg struct cfg80211_chan_def { 749683b6d3bSJohannes Berg struct ieee80211_channel *chan; 7503d9d1d66SJohannes Berg enum nl80211_chan_width width; 7513d9d1d66SJohannes Berg u32 center_freq1; 7523d9d1d66SJohannes Berg u32 center_freq2; 7532a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg; 754934f4c7dSThomas Pedersen u16 freq1_offset; 755683b6d3bSJohannes Berg }; 756683b6d3bSJohannes Berg 7579a5f6488STamizh Chelvam /* 7589a5f6488STamizh Chelvam * cfg80211_bitrate_mask - masks for bitrate control 7599a5f6488STamizh Chelvam */ 7609a5f6488STamizh Chelvam struct cfg80211_bitrate_mask { 7619a5f6488STamizh Chelvam struct { 7629a5f6488STamizh Chelvam u32 legacy; 7639a5f6488STamizh Chelvam u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 7649a5f6488STamizh Chelvam u16 vht_mcs[NL80211_VHT_NSS_MAX]; 765eb89a6a6SMiles Hu u16 he_mcs[NL80211_HE_NSS_MAX]; 7669a5f6488STamizh Chelvam enum nl80211_txrate_gi gi; 767eb89a6a6SMiles Hu enum nl80211_he_gi he_gi; 768eb89a6a6SMiles Hu enum nl80211_he_ltf he_ltf; 7699a5f6488STamizh Chelvam } control[NUM_NL80211_BANDS]; 7709a5f6488STamizh Chelvam }; 7719a5f6488STamizh Chelvam 7729a5f6488STamizh Chelvam 77377f576deSTamizh chelvam /** 7743710a8a6SJohannes Berg * struct cfg80211_tid_cfg - TID specific configuration 77577f576deSTamizh chelvam * @config_override: Flag to notify driver to reset TID configuration 77677f576deSTamizh chelvam * of the peer. 7773710a8a6SJohannes Berg * @tids: bitmap of TIDs to modify 7783710a8a6SJohannes Berg * @mask: bitmap of attributes indicating which parameter changed, 7793710a8a6SJohannes Berg * similar to &nl80211_tid_config_supp. 78077f576deSTamizh chelvam * @noack: noack configuration value for the TID 7816a21d16cSTamizh chelvam * @retry_long: retry count value 7826a21d16cSTamizh chelvam * @retry_short: retry count value 78333462e68SSergey Matyukevich * @ampdu: Enable/Disable MPDU aggregation 78404f7d142STamizh chelvam * @rtscts: Enable/Disable RTS/CTS 78533462e68SSergey Matyukevich * @amsdu: Enable/Disable MSDU aggregation 7869a5f6488STamizh Chelvam * @txrate_type: Tx bitrate mask type 7879a5f6488STamizh Chelvam * @txrate_mask: Tx bitrate to be applied for the TID 78877f576deSTamizh chelvam */ 7893710a8a6SJohannes Berg struct cfg80211_tid_cfg { 79077f576deSTamizh chelvam bool config_override; 7913710a8a6SJohannes Berg u8 tids; 7922d5d9b7fSSergey Matyukevich u64 mask; 79377f576deSTamizh chelvam enum nl80211_tid_config noack; 7946a21d16cSTamizh chelvam u8 retry_long, retry_short; 795ade274b2STamizh chelvam enum nl80211_tid_config ampdu; 79604f7d142STamizh chelvam enum nl80211_tid_config rtscts; 79733462e68SSergey Matyukevich enum nl80211_tid_config amsdu; 7989a5f6488STamizh Chelvam enum nl80211_tx_rate_setting txrate_type; 7999a5f6488STamizh Chelvam struct cfg80211_bitrate_mask txrate_mask; 80077f576deSTamizh chelvam }; 80177f576deSTamizh chelvam 80277f576deSTamizh chelvam /** 8033710a8a6SJohannes Berg * struct cfg80211_tid_config - TID configuration 80477f576deSTamizh chelvam * @peer: Station's MAC address 80577f576deSTamizh chelvam * @n_tid_conf: Number of TID specific configurations to be applied 80677f576deSTamizh chelvam * @tid_conf: Configuration change info 80777f576deSTamizh chelvam */ 8083710a8a6SJohannes Berg struct cfg80211_tid_config { 80977f576deSTamizh chelvam const u8 *peer; 81077f576deSTamizh chelvam u32 n_tid_conf; 8113710a8a6SJohannes Berg struct cfg80211_tid_cfg tid_conf[]; 81277f576deSTamizh chelvam }; 81377f576deSTamizh chelvam 8143d9d1d66SJohannes Berg /** 815e306784aSSubrat Mishra * struct cfg80211_fils_aad - FILS AAD data 816e306784aSSubrat Mishra * @macaddr: STA MAC address 817e306784aSSubrat Mishra * @kek: FILS KEK 818e306784aSSubrat Mishra * @kek_len: FILS KEK length 819e306784aSSubrat Mishra * @snonce: STA Nonce 820e306784aSSubrat Mishra * @anonce: AP Nonce 821e306784aSSubrat Mishra */ 822e306784aSSubrat Mishra struct cfg80211_fils_aad { 823e306784aSSubrat Mishra const u8 *macaddr; 824e306784aSSubrat Mishra const u8 *kek; 825e306784aSSubrat Mishra u8 kek_len; 826e306784aSSubrat Mishra const u8 *snonce; 827e306784aSSubrat Mishra const u8 *anonce; 828e306784aSSubrat Mishra }; 829e306784aSSubrat Mishra 830e306784aSSubrat Mishra /** 8313d9d1d66SJohannes Berg * cfg80211_get_chandef_type - return old channel type from chandef 8323d9d1d66SJohannes Berg * @chandef: the channel definition 8333d9d1d66SJohannes Berg * 8340ae997dcSYacine Belkadi * Return: The old channel type (NOHT, HT20, HT40+/-) from a given 8353d9d1d66SJohannes Berg * chandef, which must have a bandwidth allowing this conversion. 8363d9d1d66SJohannes Berg */ 837683b6d3bSJohannes Berg static inline enum nl80211_channel_type 838683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 839683b6d3bSJohannes Berg { 8403d9d1d66SJohannes Berg switch (chandef->width) { 8413d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20_NOHT: 8423d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 8433d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_20: 8443d9d1d66SJohannes Berg return NL80211_CHAN_HT20; 8453d9d1d66SJohannes Berg case NL80211_CHAN_WIDTH_40: 8463d9d1d66SJohannes Berg if (chandef->center_freq1 > chandef->chan->center_freq) 8473d9d1d66SJohannes Berg return NL80211_CHAN_HT40PLUS; 8483d9d1d66SJohannes Berg return NL80211_CHAN_HT40MINUS; 8493d9d1d66SJohannes Berg default: 8503d9d1d66SJohannes Berg WARN_ON(1); 8513d9d1d66SJohannes Berg return NL80211_CHAN_NO_HT; 852683b6d3bSJohannes Berg } 8533d9d1d66SJohannes Berg } 8543d9d1d66SJohannes Berg 8553d9d1d66SJohannes Berg /** 8563d9d1d66SJohannes Berg * cfg80211_chandef_create - create channel definition using channel type 8573d9d1d66SJohannes Berg * @chandef: the channel definition struct to fill 8583d9d1d66SJohannes Berg * @channel: the control channel 8593d9d1d66SJohannes Berg * @chantype: the channel type 8603d9d1d66SJohannes Berg * 8613d9d1d66SJohannes Berg * Given a channel type, create a channel definition. 8623d9d1d66SJohannes Berg */ 8633d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 8643d9d1d66SJohannes Berg struct ieee80211_channel *channel, 8653d9d1d66SJohannes Berg enum nl80211_channel_type chantype); 8663d9d1d66SJohannes Berg 8673d9d1d66SJohannes Berg /** 8683d9d1d66SJohannes Berg * cfg80211_chandef_identical - check if two channel definitions are identical 8693d9d1d66SJohannes Berg * @chandef1: first channel definition 8703d9d1d66SJohannes Berg * @chandef2: second channel definition 8713d9d1d66SJohannes Berg * 8720ae997dcSYacine Belkadi * Return: %true if the channels defined by the channel definitions are 8733d9d1d66SJohannes Berg * identical, %false otherwise. 8743d9d1d66SJohannes Berg */ 8753d9d1d66SJohannes Berg static inline bool 8763d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, 8773d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2) 8783d9d1d66SJohannes Berg { 8793d9d1d66SJohannes Berg return (chandef1->chan == chandef2->chan && 8803d9d1d66SJohannes Berg chandef1->width == chandef2->width && 8813d9d1d66SJohannes Berg chandef1->center_freq1 == chandef2->center_freq1 && 882934f4c7dSThomas Pedersen chandef1->freq1_offset == chandef2->freq1_offset && 8833d9d1d66SJohannes Berg chandef1->center_freq2 == chandef2->center_freq2); 8843d9d1d66SJohannes Berg } 8853d9d1d66SJohannes Berg 8863d9d1d66SJohannes Berg /** 8872a38075cSAlexei Avshalom Lazar * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel 8882a38075cSAlexei Avshalom Lazar * 8892a38075cSAlexei Avshalom Lazar * @chandef: the channel definition 8902a38075cSAlexei Avshalom Lazar * 8912a38075cSAlexei Avshalom Lazar * Return: %true if EDMG defined, %false otherwise. 8922a38075cSAlexei Avshalom Lazar */ 8932a38075cSAlexei Avshalom Lazar static inline bool 8942a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef) 8952a38075cSAlexei Avshalom Lazar { 8962a38075cSAlexei Avshalom Lazar return chandef->edmg.channels || chandef->edmg.bw_config; 8972a38075cSAlexei Avshalom Lazar } 8982a38075cSAlexei Avshalom Lazar 8992a38075cSAlexei Avshalom Lazar /** 9003d9d1d66SJohannes Berg * cfg80211_chandef_compatible - check if two channel definitions are compatible 9013d9d1d66SJohannes Berg * @chandef1: first channel definition 9023d9d1d66SJohannes Berg * @chandef2: second channel definition 9033d9d1d66SJohannes Berg * 9040ae997dcSYacine Belkadi * Return: %NULL if the given channel definitions are incompatible, 9053d9d1d66SJohannes Berg * chandef1 or chandef2 otherwise. 9063d9d1d66SJohannes Berg */ 9073d9d1d66SJohannes Berg const struct cfg80211_chan_def * 9083d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, 9093d9d1d66SJohannes Berg const struct cfg80211_chan_def *chandef2); 910683b6d3bSJohannes Berg 911683b6d3bSJohannes Berg /** 9129f5e8f6eSJohannes Berg * cfg80211_chandef_valid - check if a channel definition is valid 9139f5e8f6eSJohannes Berg * @chandef: the channel definition to check 9140ae997dcSYacine Belkadi * Return: %true if the channel definition is valid. %false otherwise. 9159f5e8f6eSJohannes Berg */ 9169f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef); 9179f5e8f6eSJohannes Berg 9189f5e8f6eSJohannes Berg /** 9199f5e8f6eSJohannes Berg * cfg80211_chandef_usable - check if secondary channels can be used 9209f5e8f6eSJohannes Berg * @wiphy: the wiphy to validate against 9219f5e8f6eSJohannes Berg * @chandef: the channel definition to check 9220ae997dcSYacine Belkadi * @prohibited_flags: the regulatory channel flags that must not be set 9230ae997dcSYacine Belkadi * Return: %true if secondary channels are usable. %false otherwise. 9249f5e8f6eSJohannes Berg */ 9259f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy, 9269f5e8f6eSJohannes Berg const struct cfg80211_chan_def *chandef, 9279f5e8f6eSJohannes Berg u32 prohibited_flags); 9289f5e8f6eSJohannes Berg 9299f5e8f6eSJohannes Berg /** 930774f0734SSimon Wunderlich * cfg80211_chandef_dfs_required - checks if radar detection is required 931774f0734SSimon Wunderlich * @wiphy: the wiphy to validate against 932774f0734SSimon Wunderlich * @chandef: the channel definition to check 9332beb6dabSLuciano Coelho * @iftype: the interface type as specified in &enum nl80211_iftype 9342beb6dabSLuciano Coelho * Returns: 9352beb6dabSLuciano Coelho * 1 if radar detection is required, 0 if it is not, < 0 on error 936774f0734SSimon Wunderlich */ 937774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 9382beb6dabSLuciano Coelho const struct cfg80211_chan_def *chandef, 939c3d62036SLuciano Coelho enum nl80211_iftype iftype); 940774f0734SSimon Wunderlich 941774f0734SSimon Wunderlich /** 94230e74732SSimon Wunderlich * ieee80211_chandef_rate_flags - returns rate flags for a channel 94330e74732SSimon Wunderlich * 94430e74732SSimon Wunderlich * In some channel types, not all rates may be used - for example CCK 94530e74732SSimon Wunderlich * rates may not be used in 5/10 MHz channels. 94630e74732SSimon Wunderlich * 94730e74732SSimon Wunderlich * @chandef: channel definition for the channel 94830e74732SSimon Wunderlich * 94930e74732SSimon Wunderlich * Returns: rate flags which apply for this channel 95030e74732SSimon Wunderlich */ 95130e74732SSimon Wunderlich static inline enum ieee80211_rate_flags 95230e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef) 95330e74732SSimon Wunderlich { 95430e74732SSimon Wunderlich switch (chandef->width) { 95530e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 95630e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_5MHZ; 95730e74732SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 95830e74732SSimon Wunderlich return IEEE80211_RATE_SUPPORTS_10MHZ; 95930e74732SSimon Wunderlich default: 96030e74732SSimon Wunderlich break; 96130e74732SSimon Wunderlich } 96230e74732SSimon Wunderlich return 0; 96330e74732SSimon Wunderlich } 96430e74732SSimon Wunderlich 96530e74732SSimon Wunderlich /** 9660430c883SSimon Wunderlich * ieee80211_chandef_max_power - maximum transmission power for the chandef 9670430c883SSimon Wunderlich * 9680430c883SSimon Wunderlich * In some regulations, the transmit power may depend on the configured channel 9690430c883SSimon Wunderlich * bandwidth which may be defined as dBm/MHz. This function returns the actual 9700430c883SSimon Wunderlich * max_power for non-standard (20 MHz) channels. 9710430c883SSimon Wunderlich * 9720430c883SSimon Wunderlich * @chandef: channel definition for the channel 9730430c883SSimon Wunderlich * 9740430c883SSimon Wunderlich * Returns: maximum allowed transmission power in dBm for the chandef 9750430c883SSimon Wunderlich */ 9760430c883SSimon Wunderlich static inline int 9770430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef) 9780430c883SSimon Wunderlich { 9790430c883SSimon Wunderlich switch (chandef->width) { 9800430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 9810430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 6, 9820430c883SSimon Wunderlich chandef->chan->max_power); 9830430c883SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 9840430c883SSimon Wunderlich return min(chandef->chan->max_reg_power - 3, 9850430c883SSimon Wunderlich chandef->chan->max_power); 9860430c883SSimon Wunderlich default: 9870430c883SSimon Wunderlich break; 9880430c883SSimon Wunderlich } 9890430c883SSimon Wunderlich return chandef->chan->max_power; 9900430c883SSimon Wunderlich } 9910430c883SSimon Wunderlich 9920430c883SSimon Wunderlich /** 993be989891SJohannes Berg * cfg80211_any_usable_channels - check for usable channels 994be989891SJohannes Berg * @wiphy: the wiphy to check for 995be989891SJohannes Berg * @band_mask: which bands to check on 996be989891SJohannes Berg * @prohibited_flags: which channels to not consider usable, 997be989891SJohannes Berg * %IEEE80211_CHAN_DISABLED is always taken into account 998be989891SJohannes Berg */ 999be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy, 1000be989891SJohannes Berg unsigned long band_mask, 1001be989891SJohannes Berg u32 prohibited_flags); 1002be989891SJohannes Berg 1003be989891SJohannes Berg /** 100461fa713cSHolger Schurig * enum survey_info_flags - survey information flags 100561fa713cSHolger Schurig * 1006abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 100717e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 10084ed20bebSJohannes Berg * @SURVEY_INFO_TIME: active time (in ms) was filled in 10094ed20bebSJohannes Berg * @SURVEY_INFO_TIME_BUSY: busy time was filled in 10104ed20bebSJohannes Berg * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in 10114ed20bebSJohannes Berg * @SURVEY_INFO_TIME_RX: receive time was filled in 10124ed20bebSJohannes Berg * @SURVEY_INFO_TIME_TX: transmit time was filled in 1013052536abSJohannes Berg * @SURVEY_INFO_TIME_SCAN: scan time was filled in 1014c8cd6e7fSFelix Fietkau * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in 1015abe37c4bSJohannes Berg * 101661fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 101761fa713cSHolger Schurig * it has filled in during the get_survey(). 101861fa713cSHolger Schurig */ 101961fa713cSHolger Schurig enum survey_info_flags { 10204ed20bebSJohannes Berg SURVEY_INFO_NOISE_DBM = BIT(0), 10214ed20bebSJohannes Berg SURVEY_INFO_IN_USE = BIT(1), 10224ed20bebSJohannes Berg SURVEY_INFO_TIME = BIT(2), 10234ed20bebSJohannes Berg SURVEY_INFO_TIME_BUSY = BIT(3), 10244ed20bebSJohannes Berg SURVEY_INFO_TIME_EXT_BUSY = BIT(4), 10254ed20bebSJohannes Berg SURVEY_INFO_TIME_RX = BIT(5), 10264ed20bebSJohannes Berg SURVEY_INFO_TIME_TX = BIT(6), 1027052536abSJohannes Berg SURVEY_INFO_TIME_SCAN = BIT(7), 1028c8cd6e7fSFelix Fietkau SURVEY_INFO_TIME_BSS_RX = BIT(8), 102961fa713cSHolger Schurig }; 103061fa713cSHolger Schurig 103161fa713cSHolger Schurig /** 103261fa713cSHolger Schurig * struct survey_info - channel survey response 103361fa713cSHolger Schurig * 103411f78ac3SJohannes Berg * @channel: the channel this survey record reports, may be %NULL for a single 103511f78ac3SJohannes Berg * record to report global statistics 103661fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 103761fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 103861fa713cSHolger Schurig * optional 10394ed20bebSJohannes Berg * @time: amount of time in ms the radio was turn on (on the channel) 10404ed20bebSJohannes Berg * @time_busy: amount of time the primary channel was sensed busy 10414ed20bebSJohannes Berg * @time_ext_busy: amount of time the extension channel was sensed busy 10424ed20bebSJohannes Berg * @time_rx: amount of time the radio spent receiving data 10434ed20bebSJohannes Berg * @time_tx: amount of time the radio spent transmitting data 1044052536abSJohannes Berg * @time_scan: amount of time the radio spent for scanning 1045c8cd6e7fSFelix Fietkau * @time_bss_rx: amount of time the radio spent receiving data on a local BSS 104661fa713cSHolger Schurig * 1047abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 1048abe37c4bSJohannes Berg * 104961fa713cSHolger Schurig * This structure can later be expanded with things like 105061fa713cSHolger Schurig * channel duty cycle etc. 105161fa713cSHolger Schurig */ 105261fa713cSHolger Schurig struct survey_info { 105361fa713cSHolger Schurig struct ieee80211_channel *channel; 10544ed20bebSJohannes Berg u64 time; 10554ed20bebSJohannes Berg u64 time_busy; 10564ed20bebSJohannes Berg u64 time_ext_busy; 10574ed20bebSJohannes Berg u64 time_rx; 10584ed20bebSJohannes Berg u64 time_tx; 1059052536abSJohannes Berg u64 time_scan; 1060c8cd6e7fSFelix Fietkau u64 time_bss_rx; 106161fa713cSHolger Schurig u32 filled; 106261fa713cSHolger Schurig s8 noise; 106361fa713cSHolger Schurig }; 106461fa713cSHolger Schurig 1065b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS 4 1066ecad3b0bSVeerendranath Jakkam #define CFG80211_MAX_NUM_AKM_SUITES 10 1067b8676221SDavid Spinadel 106861fa713cSHolger Schurig /** 10695fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 10705fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 10715fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 10725fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 10735fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 10745fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 10755fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 10765fb628e9SJouni Malinen * @akm_suites: AKM suites 10775fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 10785fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 10795fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 10805fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 10815fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 10825fb628e9SJouni Malinen * allowed through even on unauthorized ports 10835fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 10845fb628e9SJouni Malinen * protocol frames. 108564bf3d4bSDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 108664bf3d4bSDenis Kenzior * port frames over NL80211 instead of the network interface. 1087a710d214SLothar Rubusch * @control_port_no_preauth: disables pre-auth rx over the nl80211 control 1088a710d214SLothar Rubusch * port for mac80211 1089b8676221SDavid Spinadel * @wep_keys: static WEP keys, if not NULL points to an array of 1090b8676221SDavid Spinadel * CFG80211_MAX_WEP_KEYS WEP keys 1091b8676221SDavid Spinadel * @wep_tx_key: key index (0..3) of the default TX static WEP key 109291b5ab62SEliad Peller * @psk: PSK (for devices supporting 4-way-handshake offload) 109326f7044eSChung-Hsien Hsu * @sae_pwd: password for SAE authentication (for devices supporting SAE 109426f7044eSChung-Hsien Hsu * offload) 109526f7044eSChung-Hsien Hsu * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) 1096da1e9dd3SJohannes Berg * @sae_pwe: The mechanisms allowed for SAE PWE derivation: 1097da1e9dd3SJohannes Berg * 1098da1e9dd3SJohannes Berg * NL80211_SAE_PWE_UNSPECIFIED 1099da1e9dd3SJohannes Berg * Not-specified, used to indicate userspace did not specify any 1100da1e9dd3SJohannes Berg * preference. The driver should follow its internal policy in 1101da1e9dd3SJohannes Berg * such a scenario. 1102da1e9dd3SJohannes Berg * 1103da1e9dd3SJohannes Berg * NL80211_SAE_PWE_HUNT_AND_PECK 1104da1e9dd3SJohannes Berg * Allow hunting-and-pecking loop only 1105da1e9dd3SJohannes Berg * 1106da1e9dd3SJohannes Berg * NL80211_SAE_PWE_HASH_TO_ELEMENT 1107da1e9dd3SJohannes Berg * Allow hash-to-element only 1108da1e9dd3SJohannes Berg * 1109da1e9dd3SJohannes Berg * NL80211_SAE_PWE_BOTH 1110da1e9dd3SJohannes Berg * Allow either hunting-and-pecking loop or hash-to-element 11115fb628e9SJouni Malinen */ 11125fb628e9SJouni Malinen struct cfg80211_crypto_settings { 11135fb628e9SJouni Malinen u32 wpa_versions; 11145fb628e9SJouni Malinen u32 cipher_group; 11155fb628e9SJouni Malinen int n_ciphers_pairwise; 11165fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 11175fb628e9SJouni Malinen int n_akm_suites; 1118ecad3b0bSVeerendranath Jakkam u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES]; 11195fb628e9SJouni Malinen bool control_port; 11205fb628e9SJouni Malinen __be16 control_port_ethertype; 11215fb628e9SJouni Malinen bool control_port_no_encrypt; 112264bf3d4bSDenis Kenzior bool control_port_over_nl80211; 11237f3f96ceSMarkus Theil bool control_port_no_preauth; 1124b8676221SDavid Spinadel struct key_params *wep_keys; 1125b8676221SDavid Spinadel int wep_tx_key; 112691b5ab62SEliad Peller const u8 *psk; 112726f7044eSChung-Hsien Hsu const u8 *sae_pwd; 112826f7044eSChung-Hsien Hsu u8 sae_pwd_len; 11299f0ffa41SRohan Dutta enum nl80211_sae_pwe_mechanism sae_pwe; 11305fb628e9SJouni Malinen }; 11315fb628e9SJouni Malinen 11325fb628e9SJouni Malinen /** 1133dc1e3cb8SJohn Crispin * struct cfg80211_mbssid_config - AP settings for multi bssid 1134dc1e3cb8SJohn Crispin * 1135dc1e3cb8SJohn Crispin * @tx_wdev: pointer to the transmitted interface in the MBSSID set 1136dc1e3cb8SJohn Crispin * @index: index of this AP in the multi bssid group. 1137dc1e3cb8SJohn Crispin * @ema: set to true if the beacons should be sent out in EMA mode. 1138dc1e3cb8SJohn Crispin */ 1139dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config { 1140dc1e3cb8SJohn Crispin struct wireless_dev *tx_wdev; 1141dc1e3cb8SJohn Crispin u8 index; 1142dc1e3cb8SJohn Crispin bool ema; 1143dc1e3cb8SJohn Crispin }; 1144dc1e3cb8SJohn Crispin 1145dc1e3cb8SJohn Crispin /** 1146dc1e3cb8SJohn Crispin * struct cfg80211_mbssid_elems - Multiple BSSID elements 1147dc1e3cb8SJohn Crispin * 1148dc1e3cb8SJohn Crispin * @cnt: Number of elements in array %elems. 1149dc1e3cb8SJohn Crispin * 1150dc1e3cb8SJohn Crispin * @elem: Array of multiple BSSID element(s) to be added into Beacon frames. 1151dc1e3cb8SJohn Crispin * @elem.data: Data for multiple BSSID elements. 1152dc1e3cb8SJohn Crispin * @elem.len: Length of data. 1153dc1e3cb8SJohn Crispin */ 1154dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems { 1155dc1e3cb8SJohn Crispin u8 cnt; 1156dc1e3cb8SJohn Crispin struct { 1157dc1e3cb8SJohn Crispin const u8 *data; 1158dc1e3cb8SJohn Crispin size_t len; 1159dc1e3cb8SJohn Crispin } elem[]; 1160dc1e3cb8SJohn Crispin }; 1161dc1e3cb8SJohn Crispin 1162dc1e3cb8SJohn Crispin /** 11638860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 11647b0a0e3cSJohannes Berg * @link_id: the link ID for the AP MLD link sending this beacon 1165ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 1166ed1b6cc7SJohannes Berg * or %NULL if not changed 1167ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 1168ed1b6cc7SJohannes Berg * or %NULL if not changed 1169ed1b6cc7SJohannes Berg * @head_len: length of @head 1170ed1b6cc7SJohannes Berg * @tail_len: length of @tail 11719946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 11729946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 11739946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 11749946ecfbSJouni Malinen * frames or %NULL 11759946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 11769946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 11779946ecfbSJouni Malinen * Response frames or %NULL 11789946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 117900f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 118000f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 1181dc1e3cb8SJohn Crispin * @mbssid_ies: multiple BSSID elements 118281e54d08SPradeep Kumar Chitrapu * @ftm_responder: enable FTM responder functionality; -1 for no change 118381e54d08SPradeep Kumar Chitrapu * (which also implies no change in LCI/civic location data) 118430db641eSJohannes Berg * @lci: Measurement Report element content, starting with Measurement Token 118530db641eSJohannes Berg * (measurement type 8) 118630db641eSJohannes Berg * @civicloc: Measurement Report element content, starting with Measurement 118730db641eSJohannes Berg * Token (measurement type 11) 118881e54d08SPradeep Kumar Chitrapu * @lci_len: LCI data length 118981e54d08SPradeep Kumar Chitrapu * @civicloc_len: Civic location data length 11903d48cb74SRameshkumar Sundaram * @he_bss_color: BSS Color settings 11913d48cb74SRameshkumar Sundaram * @he_bss_color_valid: indicates whether bss color 1192ee0e2f51SJohannes Berg * attribute is present in beacon data or not. 1193ed1b6cc7SJohannes Berg */ 11948860020eSJohannes Berg struct cfg80211_beacon_data { 11957b0a0e3cSJohannes Berg unsigned int link_id; 11967b0a0e3cSJohannes Berg 11978860020eSJohannes Berg const u8 *head, *tail; 11988860020eSJohannes Berg const u8 *beacon_ies; 11998860020eSJohannes Berg const u8 *proberesp_ies; 12008860020eSJohannes Berg const u8 *assocresp_ies; 12018860020eSJohannes Berg const u8 *probe_resp; 120281e54d08SPradeep Kumar Chitrapu const u8 *lci; 120381e54d08SPradeep Kumar Chitrapu const u8 *civicloc; 1204dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems *mbssid_ies; 120581e54d08SPradeep Kumar Chitrapu s8 ftm_responder; 12068860020eSJohannes Berg 12078860020eSJohannes Berg size_t head_len, tail_len; 12088860020eSJohannes Berg size_t beacon_ies_len; 12098860020eSJohannes Berg size_t proberesp_ies_len; 12108860020eSJohannes Berg size_t assocresp_ies_len; 12118860020eSJohannes Berg size_t probe_resp_len; 121281e54d08SPradeep Kumar Chitrapu size_t lci_len; 121381e54d08SPradeep Kumar Chitrapu size_t civicloc_len; 12143d48cb74SRameshkumar Sundaram struct cfg80211_he_bss_color he_bss_color; 12153d48cb74SRameshkumar Sundaram bool he_bss_color_valid; 12168860020eSJohannes Berg }; 12178860020eSJohannes Berg 12186d45a74bSVasanthakumar Thiagarajan struct mac_address { 12196d45a74bSVasanthakumar Thiagarajan u8 addr[ETH_ALEN]; 12206d45a74bSVasanthakumar Thiagarajan }; 12216d45a74bSVasanthakumar Thiagarajan 12228860020eSJohannes Berg /** 122377765eafSVasanthakumar Thiagarajan * struct cfg80211_acl_data - Access control list data 122477765eafSVasanthakumar Thiagarajan * 122577765eafSVasanthakumar Thiagarajan * @acl_policy: ACL policy to be applied on the station's 1226077f897aSJohannes Berg * entry specified by mac_addr 122777765eafSVasanthakumar Thiagarajan * @n_acl_entries: Number of MAC address entries passed 122877765eafSVasanthakumar Thiagarajan * @mac_addrs: List of MAC addresses of stations to be used for ACL 122977765eafSVasanthakumar Thiagarajan */ 123077765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data { 123177765eafSVasanthakumar Thiagarajan enum nl80211_acl_policy acl_policy; 123277765eafSVasanthakumar Thiagarajan int n_acl_entries; 123377765eafSVasanthakumar Thiagarajan 123477765eafSVasanthakumar Thiagarajan /* Keep it last */ 123577765eafSVasanthakumar Thiagarajan struct mac_address mac_addrs[]; 123677765eafSVasanthakumar Thiagarajan }; 123777765eafSVasanthakumar Thiagarajan 12388860020eSJohannes Berg /** 1239291c49deSAloka Dixit * struct cfg80211_fils_discovery - FILS discovery parameters from 1240291c49deSAloka Dixit * IEEE Std 802.11ai-2016, Annex C.3 MIB detail. 1241291c49deSAloka Dixit * 1242291c49deSAloka Dixit * @min_interval: Minimum packet interval in TUs (0 - 10000) 1243291c49deSAloka Dixit * @max_interval: Maximum packet interval in TUs (0 - 10000) 1244291c49deSAloka Dixit * @tmpl_len: Template length 1245291c49deSAloka Dixit * @tmpl: Template data for FILS discovery frame including the action 1246291c49deSAloka Dixit * frame headers. 1247291c49deSAloka Dixit */ 1248291c49deSAloka Dixit struct cfg80211_fils_discovery { 1249291c49deSAloka Dixit u32 min_interval; 1250291c49deSAloka Dixit u32 max_interval; 1251291c49deSAloka Dixit size_t tmpl_len; 1252291c49deSAloka Dixit const u8 *tmpl; 1253291c49deSAloka Dixit }; 1254291c49deSAloka Dixit 1255291c49deSAloka Dixit /** 12567443dcd1SAloka Dixit * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe 12577443dcd1SAloka Dixit * response parameters in 6GHz. 12587443dcd1SAloka Dixit * 12597443dcd1SAloka Dixit * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned 12607443dcd1SAloka Dixit * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive 12617443dcd1SAloka Dixit * scanning 12627443dcd1SAloka Dixit * @tmpl_len: Template length 12637443dcd1SAloka Dixit * @tmpl: Template data for probe response 12647443dcd1SAloka Dixit */ 12657443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp { 12667443dcd1SAloka Dixit u32 interval; 12677443dcd1SAloka Dixit size_t tmpl_len; 12687443dcd1SAloka Dixit const u8 *tmpl; 12697443dcd1SAloka Dixit }; 12707443dcd1SAloka Dixit 12717443dcd1SAloka Dixit /** 12728860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 12738860020eSJohannes Berg * 12748860020eSJohannes Berg * Used to configure an AP interface. 12758860020eSJohannes Berg * 1276683b6d3bSJohannes Berg * @chandef: defines the channel to use 12778860020eSJohannes Berg * @beacon: beacon data 12788860020eSJohannes Berg * @beacon_interval: beacon interval 12798860020eSJohannes Berg * @dtim_period: DTIM period 12808860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 12818860020eSJohannes Berg * user space) 12828860020eSJohannes Berg * @ssid_len: length of @ssid 12838860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 12848860020eSJohannes Berg * @crypto: crypto settings 12858860020eSJohannes Berg * @privacy: the BSS uses privacy 12868860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 128718998c38SEliad Peller * @smps_mode: SMPS mode 12881b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 128953cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window 129053cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS 129177765eafSVasanthakumar Thiagarajan * @acl: ACL configuration used by the drivers which has support for 129277765eafSVasanthakumar Thiagarajan * MAC address based access control 129334d50519SLior David * @pbss: If set, start as a PCP instead of AP. Relevant for DMG 129434d50519SLior David * networks. 12958564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 129666cd794eSJohannes Berg * @ht_cap: HT capabilities (or %NULL if HT isn't enabled) 129766cd794eSJohannes Berg * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled) 1298244eb9aeSShaul Triebitz * @he_cap: HE capabilities (or %NULL if HE isn't enabled) 12998bc65d38SAloka Dixit * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled) 13008bc65d38SAloka Dixit * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled) 130166cd794eSJohannes Berg * @ht_required: stations must support HT 130266cd794eSJohannes Berg * @vht_required: stations must support VHT 1303a0de1ca3SJohn Crispin * @twt_responder: Enable Target Wait Time 13042a392596SIlan Peer * @he_required: stations must support HE 1305d6587602SIlan Peer * @sae_h2e_required: stations must support direct H2E technique in SAE 1306fe494370SSrinivas Dasari * @flags: flags, as defined in enum cfg80211_ap_settings_flags 1307796e90f4SJohn Crispin * @he_obss_pd: OBSS Packet Detection settings 13087e8d6f12SShaul Triebitz * @he_oper: HE operation IE (or %NULL if HE isn't enabled) 1309291c49deSAloka Dixit * @fils_discovery: FILS discovery transmission parameters 13107443dcd1SAloka Dixit * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters 1311dc1e3cb8SJohn Crispin * @mbssid_config: AP settings for multiple bssid 13128860020eSJohannes Berg */ 13138860020eSJohannes Berg struct cfg80211_ap_settings { 1314683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 1315aa430da4SJohannes Berg 13168860020eSJohannes Berg struct cfg80211_beacon_data beacon; 13178860020eSJohannes Berg 13188860020eSJohannes Berg int beacon_interval, dtim_period; 131932e9de84SJouni Malinen const u8 *ssid; 132032e9de84SJouni Malinen size_t ssid_len; 132132e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 13225fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 13235fb628e9SJouni Malinen bool privacy; 13245fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 132518998c38SEliad Peller enum nl80211_smps_mode smps_mode; 13261b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 132753cabad7SJohannes Berg u8 p2p_ctwindow; 132853cabad7SJohannes Berg bool p2p_opp_ps; 132977765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *acl; 133034d50519SLior David bool pbss; 1331a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask beacon_rate; 133266cd794eSJohannes Berg 133366cd794eSJohannes Berg const struct ieee80211_ht_cap *ht_cap; 133466cd794eSJohannes Berg const struct ieee80211_vht_cap *vht_cap; 1335244eb9aeSShaul Triebitz const struct ieee80211_he_cap_elem *he_cap; 13367e8d6f12SShaul Triebitz const struct ieee80211_he_operation *he_oper; 13378bc65d38SAloka Dixit const struct ieee80211_eht_cap_elem *eht_cap; 13388bc65d38SAloka Dixit const struct ieee80211_eht_operation *eht_oper; 1339d6587602SIlan Peer bool ht_required, vht_required, he_required, sae_h2e_required; 1340a0de1ca3SJohn Crispin bool twt_responder; 1341fe494370SSrinivas Dasari u32 flags; 1342796e90f4SJohn Crispin struct ieee80211_he_obss_pd he_obss_pd; 1343291c49deSAloka Dixit struct cfg80211_fils_discovery fils_discovery; 13447443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; 1345dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config mbssid_config; 1346ed1b6cc7SJohannes Berg }; 1347ed1b6cc7SJohannes Berg 13485727ef1bSJohannes Berg /** 134916ef1fe2SSimon Wunderlich * struct cfg80211_csa_settings - channel switch settings 135016ef1fe2SSimon Wunderlich * 135116ef1fe2SSimon Wunderlich * Used for channel switch 135216ef1fe2SSimon Wunderlich * 135316ef1fe2SSimon Wunderlich * @chandef: defines the channel to use after the switch 135416ef1fe2SSimon Wunderlich * @beacon_csa: beacon data while performing the switch 13559a774c78SAndrei Otcheretianski * @counter_offsets_beacon: offsets of the counters within the beacon (tail) 13569a774c78SAndrei Otcheretianski * @counter_offsets_presp: offsets of the counters within the probe response 13579a774c78SAndrei Otcheretianski * @n_counter_offsets_beacon: number of csa counters the beacon (tail) 13589a774c78SAndrei Otcheretianski * @n_counter_offsets_presp: number of csa counters in the probe response 135916ef1fe2SSimon Wunderlich * @beacon_after: beacon data to be used on the new channel 136016ef1fe2SSimon Wunderlich * @radar_required: whether radar detection is required on the new channel 136116ef1fe2SSimon Wunderlich * @block_tx: whether transmissions should be blocked while changing 136216ef1fe2SSimon Wunderlich * @count: number of beacons until switch 136316ef1fe2SSimon Wunderlich */ 136416ef1fe2SSimon Wunderlich struct cfg80211_csa_settings { 136516ef1fe2SSimon Wunderlich struct cfg80211_chan_def chandef; 136616ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_csa; 13679a774c78SAndrei Otcheretianski const u16 *counter_offsets_beacon; 13689a774c78SAndrei Otcheretianski const u16 *counter_offsets_presp; 13699a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_beacon; 13709a774c78SAndrei Otcheretianski unsigned int n_counter_offsets_presp; 137116ef1fe2SSimon Wunderlich struct cfg80211_beacon_data beacon_after; 137216ef1fe2SSimon Wunderlich bool radar_required; 137316ef1fe2SSimon Wunderlich bool block_tx; 137416ef1fe2SSimon Wunderlich u8 count; 137516ef1fe2SSimon Wunderlich }; 137616ef1fe2SSimon Wunderlich 137716ef1fe2SSimon Wunderlich /** 13780d2ab3aeSJohn Crispin * struct cfg80211_color_change_settings - color change settings 13790d2ab3aeSJohn Crispin * 13800d2ab3aeSJohn Crispin * Used for bss color change 13810d2ab3aeSJohn Crispin * 13820d2ab3aeSJohn Crispin * @beacon_color_change: beacon data while performing the color countdown 13832d8b08feSMauro Carvalho Chehab * @counter_offset_beacon: offsets of the counters within the beacon (tail) 13842d8b08feSMauro Carvalho Chehab * @counter_offset_presp: offsets of the counters within the probe response 13850d2ab3aeSJohn Crispin * @beacon_next: beacon data to be used after the color change 13860d2ab3aeSJohn Crispin * @count: number of beacons until the color change 13870d2ab3aeSJohn Crispin * @color: the color used after the change 13880d2ab3aeSJohn Crispin */ 13890d2ab3aeSJohn Crispin struct cfg80211_color_change_settings { 13900d2ab3aeSJohn Crispin struct cfg80211_beacon_data beacon_color_change; 13910d2ab3aeSJohn Crispin u16 counter_offset_beacon; 13920d2ab3aeSJohn Crispin u16 counter_offset_presp; 13930d2ab3aeSJohn Crispin struct cfg80211_beacon_data beacon_next; 13940d2ab3aeSJohn Crispin u8 count; 13950d2ab3aeSJohn Crispin u8 color; 13960d2ab3aeSJohn Crispin }; 13970d2ab3aeSJohn Crispin 13980d2ab3aeSJohn Crispin /** 1399e227300cSPurushottam Kushwaha * struct iface_combination_params - input parameters for interface combinations 1400e227300cSPurushottam Kushwaha * 1401e227300cSPurushottam Kushwaha * Used to pass interface combination parameters 1402e227300cSPurushottam Kushwaha * 1403e227300cSPurushottam Kushwaha * @num_different_channels: the number of different channels we want 1404e227300cSPurushottam Kushwaha * to use for verification 1405e227300cSPurushottam Kushwaha * @radar_detect: a bitmap where each bit corresponds to a channel 1406e227300cSPurushottam Kushwaha * width where radar detection is needed, as in the definition of 1407e227300cSPurushottam Kushwaha * &struct ieee80211_iface_combination.@radar_detect_widths 1408e227300cSPurushottam Kushwaha * @iftype_num: array with the number of interfaces of each interface 1409e227300cSPurushottam Kushwaha * type. The index is the interface type as specified in &enum 1410e227300cSPurushottam Kushwaha * nl80211_iftype. 14114c8dea63SJohannes Berg * @new_beacon_int: set this to the beacon interval of a new interface 14124c8dea63SJohannes Berg * that's not operating yet, if such is to be checked as part of 14134c8dea63SJohannes Berg * the verification 1414e227300cSPurushottam Kushwaha */ 1415e227300cSPurushottam Kushwaha struct iface_combination_params { 1416e227300cSPurushottam Kushwaha int num_different_channels; 1417e227300cSPurushottam Kushwaha u8 radar_detect; 1418e227300cSPurushottam Kushwaha int iftype_num[NUM_NL80211_IFTYPES]; 14194c8dea63SJohannes Berg u32 new_beacon_int; 1420e227300cSPurushottam Kushwaha }; 1421e227300cSPurushottam Kushwaha 1422e227300cSPurushottam Kushwaha /** 14233b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 14243b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 14259d62a986SJouni Malinen * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 1426f8bacc21SJohannes Berg * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state 14272d8b08feSMauro Carvalho Chehab * @STATION_PARAM_APPLY_STA_TXPOWER: apply tx power for STA 14283b9ce80cSJohannes Berg * 14293b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 14303b9ce80cSJohannes Berg * for those that don't these flags will are used. 14313b9ce80cSJohannes Berg */ 14323b9ce80cSJohannes Berg enum station_parameters_apply_mask { 14333b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 14349d62a986SJouni Malinen STATION_PARAM_APPLY_CAPABILITY = BIT(1), 1435f8bacc21SJohannes Berg STATION_PARAM_APPLY_PLINK_STATE = BIT(2), 1436e96d1cd2SAshok Raj Nagarajan }; 1437e96d1cd2SAshok Raj Nagarajan 1438e96d1cd2SAshok Raj Nagarajan /** 1439e96d1cd2SAshok Raj Nagarajan * struct sta_txpwr - station txpower configuration 1440e96d1cd2SAshok Raj Nagarajan * 1441e96d1cd2SAshok Raj Nagarajan * Used to configure txpower for station. 1442e96d1cd2SAshok Raj Nagarajan * 1443e96d1cd2SAshok Raj Nagarajan * @power: tx power (in dBm) to be used for sending data traffic. If tx power 1444e96d1cd2SAshok Raj Nagarajan * is not provided, the default per-interface tx power setting will be 1445e96d1cd2SAshok Raj Nagarajan * overriding. Driver should be picking up the lowest tx power, either tx 1446e96d1cd2SAshok Raj Nagarajan * power per-interface or per-station. 1447e96d1cd2SAshok Raj Nagarajan * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power 1448e96d1cd2SAshok Raj Nagarajan * will be less than or equal to specified from userspace, whereas if TPC 1449e96d1cd2SAshok Raj Nagarajan * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power. 1450e96d1cd2SAshok Raj Nagarajan * NL80211_TX_POWER_FIXED is not a valid configuration option for 1451e96d1cd2SAshok Raj Nagarajan * per peer TPC. 1452e96d1cd2SAshok Raj Nagarajan */ 1453e96d1cd2SAshok Raj Nagarajan struct sta_txpwr { 1454e96d1cd2SAshok Raj Nagarajan s16 power; 1455e96d1cd2SAshok Raj Nagarajan enum nl80211_tx_power_setting type; 14563b9ce80cSJohannes Berg }; 14573b9ce80cSJohannes Berg 14583b9ce80cSJohannes Berg /** 1459577e5b8cSShaul Triebitz * struct link_station_parameters - link station parameters 1460577e5b8cSShaul Triebitz * 1461577e5b8cSShaul Triebitz * Used to change and create a new link station. 1462577e5b8cSShaul Triebitz * 1463577e5b8cSShaul Triebitz * @mld_mac: MAC address of the station 1464577e5b8cSShaul Triebitz * @link_id: the link id (-1 for non-MLD station) 1465577e5b8cSShaul Triebitz * @link_mac: MAC address of the link 1466577e5b8cSShaul Triebitz * @supported_rates: supported rates in IEEE 802.11 format 1467577e5b8cSShaul Triebitz * (or NULL for no change) 1468577e5b8cSShaul Triebitz * @supported_rates_len: number of supported rates 1469577e5b8cSShaul Triebitz * @ht_capa: HT capabilities of station 1470577e5b8cSShaul Triebitz * @vht_capa: VHT capabilities of station 1471577e5b8cSShaul Triebitz * @opmode_notif: operating mode field from Operating Mode Notification 1472577e5b8cSShaul Triebitz * @opmode_notif_used: information if operating mode field is used 1473577e5b8cSShaul Triebitz * @he_capa: HE capabilities of station 1474577e5b8cSShaul Triebitz * @he_capa_len: the length of the HE capabilities 1475577e5b8cSShaul Triebitz * @txpwr: transmit power for an associated station 1476577e5b8cSShaul Triebitz * @txpwr_set: txpwr field is set 1477577e5b8cSShaul Triebitz * @he_6ghz_capa: HE 6 GHz Band capabilities of station 1478577e5b8cSShaul Triebitz * @eht_capa: EHT capabilities of station 1479577e5b8cSShaul Triebitz * @eht_capa_len: the length of the EHT capabilities 1480577e5b8cSShaul Triebitz */ 1481577e5b8cSShaul Triebitz struct link_station_parameters { 1482577e5b8cSShaul Triebitz const u8 *mld_mac; 1483577e5b8cSShaul Triebitz int link_id; 1484577e5b8cSShaul Triebitz const u8 *link_mac; 1485577e5b8cSShaul Triebitz const u8 *supported_rates; 1486577e5b8cSShaul Triebitz u8 supported_rates_len; 1487577e5b8cSShaul Triebitz const struct ieee80211_ht_cap *ht_capa; 1488577e5b8cSShaul Triebitz const struct ieee80211_vht_cap *vht_capa; 1489577e5b8cSShaul Triebitz u8 opmode_notif; 1490577e5b8cSShaul Triebitz bool opmode_notif_used; 1491577e5b8cSShaul Triebitz const struct ieee80211_he_cap_elem *he_capa; 1492577e5b8cSShaul Triebitz u8 he_capa_len; 1493577e5b8cSShaul Triebitz struct sta_txpwr txpwr; 1494577e5b8cSShaul Triebitz bool txpwr_set; 1495577e5b8cSShaul Triebitz const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 1496577e5b8cSShaul Triebitz const struct ieee80211_eht_cap_elem *eht_capa; 1497577e5b8cSShaul Triebitz u8 eht_capa_len; 1498577e5b8cSShaul Triebitz }; 1499577e5b8cSShaul Triebitz 1500577e5b8cSShaul Triebitz /** 1501577e5b8cSShaul Triebitz * struct link_station_del_parameters - link station deletion parameters 1502577e5b8cSShaul Triebitz * 1503577e5b8cSShaul Triebitz * Used to delete a link station entry (or all stations). 1504577e5b8cSShaul Triebitz * 1505577e5b8cSShaul Triebitz * @mld_mac: MAC address of the station 1506577e5b8cSShaul Triebitz * @link_id: the link id 1507577e5b8cSShaul Triebitz */ 1508577e5b8cSShaul Triebitz struct link_station_del_parameters { 1509577e5b8cSShaul Triebitz const u8 *mld_mac; 1510577e5b8cSShaul Triebitz u32 link_id; 1511577e5b8cSShaul Triebitz }; 1512577e5b8cSShaul Triebitz 1513577e5b8cSShaul Triebitz /** 15145727ef1bSJohannes Berg * struct station_parameters - station parameters 15155727ef1bSJohannes Berg * 15165727ef1bSJohannes Berg * Used to change and create a new station. 15175727ef1bSJohannes Berg * 15185727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 1519eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 1520819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 1521eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 1522819bf593SJohannes Berg * (bitmask of BIT(%NL80211_STA_FLAG_...)) 15235727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 15245727ef1bSJohannes Berg * @aid: AID or zero for no change 152514f34e36SGurumoorthi Gnanasambandhan * @vlan_id: VLAN ID for station (if nonzero) 15267d27a0baSMasashi Honma * @peer_aid: mesh peer AID or zero for no change 1527abe37c4bSJohannes Berg * @plink_action: plink action to take 15289c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 1529910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 1530910868dbSEliad Peller * as the AC bitmap in the QoS info field 1531910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 1532910868dbSEliad Peller * QoS info field (but already shifted down) 1533c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 1534c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 1535c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 15363b1c5a53SMarco Porsch * @local_pm: local link-specific mesh power save mode (no change when set 15373b1c5a53SMarco Porsch * to unknown) 15389d62a986SJouni Malinen * @capability: station capability 15399d62a986SJouni Malinen * @ext_capab: extended capabilities of the station 15409d62a986SJouni Malinen * @ext_capab_len: number of extended capabilities 1541c01fc9adSSunil Dutt * @supported_channels: supported channels in IEEE 802.11 format 1542c01fc9adSSunil Dutt * @supported_channels_len: number of supported channels 1543c01fc9adSSunil Dutt * @supported_oper_classes: supported oper classes in IEEE 802.11 format 1544c01fc9adSSunil Dutt * @supported_oper_classes_len: number of supported operating classes 154517b94247SAyala Beker * @support_p2p_ps: information if station supports P2P PS mechanism 154636647055SToke Høiland-Jørgensen * @airtime_weight: airtime scheduler weight for this station 1547b95eb7f0SShaul Triebitz * @link_sta_params: link related params. 15485727ef1bSJohannes Berg */ 15495727ef1bSJohannes Berg struct station_parameters { 15505727ef1bSJohannes Berg struct net_device *vlan; 1551eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 15523b9ce80cSJohannes Berg u32 sta_modify_mask; 15535727ef1bSJohannes Berg int listen_interval; 15545727ef1bSJohannes Berg u16 aid; 155514f34e36SGurumoorthi Gnanasambandhan u16 vlan_id; 15567d27a0baSMasashi Honma u16 peer_aid; 15572ec600d6SLuis Carlos Cobo u8 plink_action; 15589c3990aaSJavier Cardona u8 plink_state; 1559c75786c9SEliad Peller u8 uapsd_queues; 1560c75786c9SEliad Peller u8 max_sp; 15613b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 15629d62a986SJouni Malinen u16 capability; 15632c1aabf3SJohannes Berg const u8 *ext_capab; 15649d62a986SJouni Malinen u8 ext_capab_len; 1565c01fc9adSSunil Dutt const u8 *supported_channels; 1566c01fc9adSSunil Dutt u8 supported_channels_len; 1567c01fc9adSSunil Dutt const u8 *supported_oper_classes; 1568c01fc9adSSunil Dutt u8 supported_oper_classes_len; 156917b94247SAyala Beker int support_p2p_ps; 157036647055SToke Høiland-Jørgensen u16 airtime_weight; 1571b95eb7f0SShaul Triebitz struct link_station_parameters link_sta_params; 15725727ef1bSJohannes Berg }; 15735727ef1bSJohannes Berg 1574fd5b74dcSJohannes Berg /** 157589c771e5SJouni Malinen * struct station_del_parameters - station deletion parameters 157689c771e5SJouni Malinen * 157789c771e5SJouni Malinen * Used to delete a station entry (or all stations). 157889c771e5SJouni Malinen * 157989c771e5SJouni Malinen * @mac: MAC address of the station to remove or NULL to remove all stations 158098856866SJouni Malinen * @subtype: Management frame subtype to use for indicating removal 158198856866SJouni Malinen * (10 = Disassociation, 12 = Deauthentication) 158298856866SJouni Malinen * @reason_code: Reason code for the Disassociation/Deauthentication frame 158389c771e5SJouni Malinen */ 158489c771e5SJouni Malinen struct station_del_parameters { 158589c771e5SJouni Malinen const u8 *mac; 158698856866SJouni Malinen u8 subtype; 158798856866SJouni Malinen u16 reason_code; 158889c771e5SJouni Malinen }; 158989c771e5SJouni Malinen 159089c771e5SJouni Malinen /** 159177ee7c89SJohannes Berg * enum cfg80211_station_type - the type of station being modified 159277ee7c89SJohannes Berg * @CFG80211_STA_AP_CLIENT: client of an AP interface 159347edb11bSAyala Beker * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still 159447edb11bSAyala Beker * unassociated (update properties for this type of client is permitted) 159577ee7c89SJohannes Berg * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 159677ee7c89SJohannes Berg * the AP MLME in the device 159777ee7c89SJohannes Berg * @CFG80211_STA_AP_STA: AP station on managed interface 159877ee7c89SJohannes Berg * @CFG80211_STA_IBSS: IBSS station 159977ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry 160077ee7c89SJohannes Berg * while TDLS setup is in progress, it moves out of this state when 160177ee7c89SJohannes Berg * being marked authorized; use this only if TDLS with external setup is 160277ee7c89SJohannes Berg * supported/used) 160377ee7c89SJohannes Berg * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active 160477ee7c89SJohannes Berg * entry that is operating, has been marked authorized by userspace) 1605eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) 1606eef941e6SThomas Pedersen * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) 160777ee7c89SJohannes Berg */ 160877ee7c89SJohannes Berg enum cfg80211_station_type { 160977ee7c89SJohannes Berg CFG80211_STA_AP_CLIENT, 161047edb11bSAyala Beker CFG80211_STA_AP_CLIENT_UNASSOC, 161177ee7c89SJohannes Berg CFG80211_STA_AP_MLME_CLIENT, 161277ee7c89SJohannes Berg CFG80211_STA_AP_STA, 161377ee7c89SJohannes Berg CFG80211_STA_IBSS, 161477ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_SETUP, 161577ee7c89SJohannes Berg CFG80211_STA_TDLS_PEER_ACTIVE, 1616eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_KERNEL, 1617eef941e6SThomas Pedersen CFG80211_STA_MESH_PEER_USER, 161877ee7c89SJohannes Berg }; 161977ee7c89SJohannes Berg 162077ee7c89SJohannes Berg /** 162177ee7c89SJohannes Berg * cfg80211_check_station_change - validate parameter changes 162277ee7c89SJohannes Berg * @wiphy: the wiphy this operates on 162377ee7c89SJohannes Berg * @params: the new parameters for a station 162477ee7c89SJohannes Berg * @statype: the type of station being modified 162577ee7c89SJohannes Berg * 162677ee7c89SJohannes Berg * Utility function for the @change_station driver method. Call this function 162777ee7c89SJohannes Berg * with the appropriate station type looking up the station (and checking that 162877ee7c89SJohannes Berg * it exists). It will verify whether the station change is acceptable, and if 162977ee7c89SJohannes Berg * not will return an error code. Note that it may modify the parameters for 163077ee7c89SJohannes Berg * backward compatibility reasons, so don't use them before calling this. 163177ee7c89SJohannes Berg */ 163277ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy, 163377ee7c89SJohannes Berg struct station_parameters *params, 163477ee7c89SJohannes Berg enum cfg80211_station_type statype); 163577ee7c89SJohannes Berg 163677ee7c89SJohannes Berg /** 1637b1e8eb11SMauro Carvalho Chehab * enum rate_info_flags - bitrate info flags 1638420e7fabSHenning Rogge * 1639420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 1640420e7fabSHenning Rogge * type for 802.11n transmissions. 1641420e7fabSHenning Rogge * 1642db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 1643db9c64cfSJohannes Berg * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 1644420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 16452a38075cSAlexei Avshalom Lazar * @RATE_INFO_FLAGS_DMG: 60GHz MCS 1646c4cbaf79SLuca Coelho * @RATE_INFO_FLAGS_HE_MCS: HE MCS information 16472a38075cSAlexei Avshalom Lazar * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode 1648d9c85e24SMax Chen * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS 1649cfb14110SVeerendranath Jakkam * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information 1650420e7fabSHenning Rogge */ 1651420e7fabSHenning Rogge enum rate_info_flags { 1652db9c64cfSJohannes Berg RATE_INFO_FLAGS_MCS = BIT(0), 1653db9c64cfSJohannes Berg RATE_INFO_FLAGS_VHT_MCS = BIT(1), 1654b51f3beeSJohannes Berg RATE_INFO_FLAGS_SHORT_GI = BIT(2), 16552a38075cSAlexei Avshalom Lazar RATE_INFO_FLAGS_DMG = BIT(3), 1656c4cbaf79SLuca Coelho RATE_INFO_FLAGS_HE_MCS = BIT(4), 16572a38075cSAlexei Avshalom Lazar RATE_INFO_FLAGS_EDMG = BIT(5), 1658d9c85e24SMax Chen RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6), 1659cfb14110SVeerendranath Jakkam RATE_INFO_FLAGS_EHT_MCS = BIT(7), 1660b51f3beeSJohannes Berg }; 1661b51f3beeSJohannes Berg 1662b51f3beeSJohannes Berg /** 1663b51f3beeSJohannes Berg * enum rate_info_bw - rate bandwidth information 1664b51f3beeSJohannes Berg * 1665b51f3beeSJohannes Berg * Used by the driver to indicate the rate bandwidth. 1666b51f3beeSJohannes Berg * 1667b51f3beeSJohannes Berg * @RATE_INFO_BW_5: 5 MHz bandwidth 1668b51f3beeSJohannes Berg * @RATE_INFO_BW_10: 10 MHz bandwidth 1669b51f3beeSJohannes Berg * @RATE_INFO_BW_20: 20 MHz bandwidth 1670b51f3beeSJohannes Berg * @RATE_INFO_BW_40: 40 MHz bandwidth 1671b51f3beeSJohannes Berg * @RATE_INFO_BW_80: 80 MHz bandwidth 1672b51f3beeSJohannes Berg * @RATE_INFO_BW_160: 160 MHz bandwidth 1673c4cbaf79SLuca Coelho * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation 1674cfb14110SVeerendranath Jakkam * @RATE_INFO_BW_320: 320 MHz bandwidth 1675cfb14110SVeerendranath Jakkam * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation 1676b51f3beeSJohannes Berg */ 1677b51f3beeSJohannes Berg enum rate_info_bw { 1678842be75cSJohannes Berg RATE_INFO_BW_20 = 0, 1679b51f3beeSJohannes Berg RATE_INFO_BW_5, 1680b51f3beeSJohannes Berg RATE_INFO_BW_10, 1681b51f3beeSJohannes Berg RATE_INFO_BW_40, 1682b51f3beeSJohannes Berg RATE_INFO_BW_80, 1683b51f3beeSJohannes Berg RATE_INFO_BW_160, 1684c4cbaf79SLuca Coelho RATE_INFO_BW_HE_RU, 1685cfb14110SVeerendranath Jakkam RATE_INFO_BW_320, 1686cfb14110SVeerendranath Jakkam RATE_INFO_BW_EHT_RU, 1687420e7fabSHenning Rogge }; 1688420e7fabSHenning Rogge 1689420e7fabSHenning Rogge /** 1690420e7fabSHenning Rogge * struct rate_info - bitrate information 1691420e7fabSHenning Rogge * 1692420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 1693420e7fabSHenning Rogge * 1694420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 1695c4cbaf79SLuca Coelho * @mcs: mcs index if struct describes an HT/VHT/HE rate 1696420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 1697c4cbaf79SLuca Coelho * @nss: number of streams (VHT & HE only) 1698b51f3beeSJohannes Berg * @bw: bandwidth (from &enum rate_info_bw) 1699c4cbaf79SLuca Coelho * @he_gi: HE guard interval (from &enum nl80211_he_gi) 1700c4cbaf79SLuca Coelho * @he_dcm: HE DCM value 1701c4cbaf79SLuca Coelho * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc, 1702c4cbaf79SLuca Coelho * only valid if bw is %RATE_INFO_BW_HE_RU) 17032a38075cSAlexei Avshalom Lazar * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4) 1704cfb14110SVeerendranath Jakkam * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi) 1705cfb14110SVeerendranath Jakkam * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc, 1706cfb14110SVeerendranath Jakkam * only valid if bw is %RATE_INFO_BW_EHT_RU) 1707420e7fabSHenning Rogge */ 1708420e7fabSHenning Rogge struct rate_info { 1709420e7fabSHenning Rogge u8 flags; 1710420e7fabSHenning Rogge u8 mcs; 1711420e7fabSHenning Rogge u16 legacy; 1712db9c64cfSJohannes Berg u8 nss; 1713b51f3beeSJohannes Berg u8 bw; 1714c4cbaf79SLuca Coelho u8 he_gi; 1715c4cbaf79SLuca Coelho u8 he_dcm; 1716c4cbaf79SLuca Coelho u8 he_ru_alloc; 17172a38075cSAlexei Avshalom Lazar u8 n_bonded_ch; 1718cfb14110SVeerendranath Jakkam u8 eht_gi; 1719cfb14110SVeerendranath Jakkam u8 eht_ru_alloc; 1720fd5b74dcSJohannes Berg }; 1721fd5b74dcSJohannes Berg 1722fd5b74dcSJohannes Berg /** 1723b1e8eb11SMauro Carvalho Chehab * enum bss_param_flags - bitrate info flags 1724f4263c98SPaul Stewart * 1725f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 1726f4263c98SPaul Stewart * type for 802.11n transmissions. 1727f4263c98SPaul Stewart * 1728f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 1729f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 1730f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 1731f4263c98SPaul Stewart */ 1732f4263c98SPaul Stewart enum bss_param_flags { 1733f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 1734f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 1735f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 1736f4263c98SPaul Stewart }; 1737f4263c98SPaul Stewart 1738f4263c98SPaul Stewart /** 1739f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 1740f4263c98SPaul Stewart * 1741f4263c98SPaul Stewart * Information about the currently associated BSS 1742f4263c98SPaul Stewart * 1743f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 1744f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 1745f4263c98SPaul Stewart * @beacon_interval: beacon interval 1746f4263c98SPaul Stewart */ 1747f4263c98SPaul Stewart struct sta_bss_parameters { 1748f4263c98SPaul Stewart u8 flags; 1749f4263c98SPaul Stewart u8 dtim_period; 1750f4263c98SPaul Stewart u16 beacon_interval; 1751f4263c98SPaul Stewart }; 1752f4263c98SPaul Stewart 17536de39808SJohannes Berg /** 175452539ca8SToke Høiland-Jørgensen * struct cfg80211_txq_stats - TXQ statistics for this TID 175552539ca8SToke Høiland-Jørgensen * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to 175652539ca8SToke Høiland-Jørgensen * indicate the relevant values in this struct are filled 175752539ca8SToke Høiland-Jørgensen * @backlog_bytes: total number of bytes currently backlogged 175852539ca8SToke Høiland-Jørgensen * @backlog_packets: total number of packets currently backlogged 175952539ca8SToke Høiland-Jørgensen * @flows: number of new flows seen 176052539ca8SToke Høiland-Jørgensen * @drops: total number of packets dropped 176152539ca8SToke Høiland-Jørgensen * @ecn_marks: total number of packets marked with ECN CE 176252539ca8SToke Høiland-Jørgensen * @overlimit: number of drops due to queue space overflow 176352539ca8SToke Høiland-Jørgensen * @overmemory: number of drops due to memory limit overflow 176452539ca8SToke Høiland-Jørgensen * @collisions: number of hash collisions 176552539ca8SToke Høiland-Jørgensen * @tx_bytes: total number of bytes dequeued 176652539ca8SToke Høiland-Jørgensen * @tx_packets: total number of packets dequeued 176752539ca8SToke Høiland-Jørgensen * @max_flows: maximum number of flows supported 176852539ca8SToke Høiland-Jørgensen */ 176952539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats { 177052539ca8SToke Høiland-Jørgensen u32 filled; 177152539ca8SToke Høiland-Jørgensen u32 backlog_bytes; 177252539ca8SToke Høiland-Jørgensen u32 backlog_packets; 177352539ca8SToke Høiland-Jørgensen u32 flows; 177452539ca8SToke Høiland-Jørgensen u32 drops; 177552539ca8SToke Høiland-Jørgensen u32 ecn_marks; 177652539ca8SToke Høiland-Jørgensen u32 overlimit; 177752539ca8SToke Høiland-Jørgensen u32 overmemory; 177852539ca8SToke Høiland-Jørgensen u32 collisions; 177952539ca8SToke Høiland-Jørgensen u32 tx_bytes; 178052539ca8SToke Høiland-Jørgensen u32 tx_packets; 178152539ca8SToke Høiland-Jørgensen u32 max_flows; 178252539ca8SToke Høiland-Jørgensen }; 178352539ca8SToke Høiland-Jørgensen 178452539ca8SToke Høiland-Jørgensen /** 17856de39808SJohannes Berg * struct cfg80211_tid_stats - per-TID statistics 17866de39808SJohannes Berg * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 17876de39808SJohannes Berg * indicate the relevant values in this struct are filled 17886de39808SJohannes Berg * @rx_msdu: number of received MSDUs 17896de39808SJohannes Berg * @tx_msdu: number of (attempted) transmitted MSDUs 17906de39808SJohannes Berg * @tx_msdu_retries: number of retries (not counting the first) for 17916de39808SJohannes Berg * transmitted MSDUs 17926de39808SJohannes Berg * @tx_msdu_failed: number of failed transmitted MSDUs 179352539ca8SToke Høiland-Jørgensen * @txq_stats: TXQ statistics 17946de39808SJohannes Berg */ 17956de39808SJohannes Berg struct cfg80211_tid_stats { 17966de39808SJohannes Berg u32 filled; 17976de39808SJohannes Berg u64 rx_msdu; 17986de39808SJohannes Berg u64 tx_msdu; 17996de39808SJohannes Berg u64 tx_msdu_retries; 18006de39808SJohannes Berg u64 tx_msdu_failed; 180152539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats txq_stats; 18026de39808SJohannes Berg }; 18036de39808SJohannes Berg 1804119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS 4 1805119363c7SFelix Fietkau 1806f4263c98SPaul Stewart /** 18072ec600d6SLuis Carlos Cobo * struct station_info - station information 1808fd5b74dcSJohannes Berg * 18092ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 1810fd5b74dcSJohannes Berg * 1811319090bfSJohannes Berg * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to 1812319090bfSJohannes Berg * indicate the relevant values in this struct for them 1813ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 1814fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 18156c7a0033SBen Greear * @assoc_at: bootime (ns) of the last association 18168d791361SJohannes Berg * @rx_bytes: bytes (size of MPDUs) received from this station 18178d791361SJohannes Berg * @tx_bytes: bytes (size of MPDUs) transmitted to this station 18182ec600d6SLuis Carlos Cobo * @llid: mesh local link id 18192ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 18202ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 182173c3df3bSJohannes Berg * @signal: The signal strength, type depends on the wiphy's signal_type. 182273c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 182373c3df3bSJohannes Berg * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 182473c3df3bSJohannes Berg * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 1825119363c7SFelix Fietkau * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg 1826119363c7SFelix Fietkau * @chain_signal: per-chain signal strength of last received packet in dBm 1827119363c7SFelix Fietkau * @chain_signal_avg: per-chain signal strength average in dBm 1828858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 1829858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 18308d791361SJohannes Berg * @rx_packets: packets (MSDUs & MMPDUs) received from this station 18318d791361SJohannes Berg * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station 18328d791361SJohannes Berg * @tx_retries: cumulative retry counts (MPDUs) 18338d791361SJohannes Berg * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) 18345a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 18351ba01458SRandy Dunlap * @bss_param: current BSS parameters 1836f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 1837f5ea9120SJohannes Berg * This number should increase every time the list of stations 1838f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 1839f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 184050d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 184150d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 184250d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 184350d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 184450d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 1845c26887d2SJohannes Berg * @sta_flags: station flags mask & values 1846a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 1847d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 18483b1c5a53SMarco Porsch * @local_pm: local mesh STA power save mode 18493b1c5a53SMarco Porsch * @peer_pm: peer mesh STA power save mode 18503b1c5a53SMarco Porsch * @nonpeer_pm: non-peer mesh STA power save mode 1851867d849fSAntonio Quartulli * @expected_throughput: expected throughput in kbps (including 802.11 headers) 1852867d849fSAntonio Quartulli * towards this station. 1853a76b1942SJohannes Berg * @rx_beacon: number of beacons received from this peer 1854a76b1942SJohannes Berg * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received 1855a76b1942SJohannes Berg * from this peer 1856dbdaee7aSBob Copeland * @connected_to_gate: true if mesh STA has a path to mesh gate 1857739960f1SMohammed Shafi Shajakhan * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 185836647055SToke Høiland-Jørgensen * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer 185936647055SToke Høiland-Jørgensen * @airtime_weight: current airtime scheduling weight 18606de39808SJohannes Berg * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 18616de39808SJohannes Berg * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 18628689c051SArend van Spriel * Note that this doesn't use the @filled bit, but is used if non-NULL. 1863c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the last ACK frame. 186481d5439dSBalaji Pothunoori * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has 186581d5439dSBalaji Pothunoori * been sent. 18660d4e14a3SAnkita Bajaj * @rx_mpdu_count: number of MPDUs received from this station 18670d4e14a3SAnkita Bajaj * @fcs_err_count: number of packets (MPDUs) received from this station with 18680d4e14a3SAnkita Bajaj * an FCS error. This counter should be incremented only when TA of the 18690d4e14a3SAnkita Bajaj * received packet with an FCS error matches the peer MAC address. 1870ab60633cSNarayanraddi Masti * @airtime_link_metric: mesh airtime link metric. 18711303a51cSMarkus Theil * @connected_to_as: true if mesh STA has a path to authentication server 1872fd5b74dcSJohannes Berg */ 18732ec600d6SLuis Carlos Cobo struct station_info { 1874739960f1SMohammed Shafi Shajakhan u64 filled; 1875ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 1876fd5b74dcSJohannes Berg u32 inactive_time; 18776c7a0033SBen Greear u64 assoc_at; 187842745e03SVladimir Kondratiev u64 rx_bytes; 187942745e03SVladimir Kondratiev u64 tx_bytes; 18802ec600d6SLuis Carlos Cobo u16 llid; 18812ec600d6SLuis Carlos Cobo u16 plid; 18822ec600d6SLuis Carlos Cobo u8 plink_state; 1883420e7fabSHenning Rogge s8 signal; 1884541a45a1SBruno Randolf s8 signal_avg; 1885119363c7SFelix Fietkau 1886119363c7SFelix Fietkau u8 chains; 1887119363c7SFelix Fietkau s8 chain_signal[IEEE80211_MAX_CHAINS]; 1888119363c7SFelix Fietkau s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; 1889119363c7SFelix Fietkau 1890420e7fabSHenning Rogge struct rate_info txrate; 1891c8dcfd8aSFelix Fietkau struct rate_info rxrate; 189298c8a60aSJouni Malinen u32 rx_packets; 189398c8a60aSJouni Malinen u32 tx_packets; 1894b206b4efSBruno Randolf u32 tx_retries; 1895b206b4efSBruno Randolf u32 tx_failed; 18965a5c731aSBen Greear u32 rx_dropped_misc; 1897f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 1898bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 1899f5ea9120SJohannes Berg 1900f5ea9120SJohannes Berg int generation; 190150d3dfb7SJouni Malinen 190250d3dfb7SJouni Malinen const u8 *assoc_req_ies; 190350d3dfb7SJouni Malinen size_t assoc_req_ies_len; 1904f612cedfSJouni Malinen 1905a85e1d55SPaul Stewart u32 beacon_loss_count; 1906d299a1f2SJavier Cardona s64 t_offset; 19073b1c5a53SMarco Porsch enum nl80211_mesh_power_mode local_pm; 19083b1c5a53SMarco Porsch enum nl80211_mesh_power_mode peer_pm; 19093b1c5a53SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 1910a85e1d55SPaul Stewart 1911867d849fSAntonio Quartulli u32 expected_throughput; 1912a76b1942SJohannes Berg 191336647055SToke Høiland-Jørgensen u64 tx_duration; 1914739960f1SMohammed Shafi Shajakhan u64 rx_duration; 191536647055SToke Høiland-Jørgensen u64 rx_beacon; 1916a76b1942SJohannes Berg u8 rx_beacon_signal_avg; 1917dbdaee7aSBob Copeland u8 connected_to_gate; 1918dbdaee7aSBob Copeland 19198689c051SArend van Spriel struct cfg80211_tid_stats *pertid; 1920c4b50cd3SVenkateswara Naralasetty s8 ack_signal; 192181d5439dSBalaji Pothunoori s8 avg_ack_signal; 19220d4e14a3SAnkita Bajaj 192336647055SToke Høiland-Jørgensen u16 airtime_weight; 192436647055SToke Høiland-Jørgensen 19250d4e14a3SAnkita Bajaj u32 rx_mpdu_count; 19260d4e14a3SAnkita Bajaj u32 fcs_err_count; 1927ab60633cSNarayanraddi Masti 1928ab60633cSNarayanraddi Masti u32 airtime_link_metric; 19291303a51cSMarkus Theil 19301303a51cSMarkus Theil u8 connected_to_as; 1931fd5b74dcSJohannes Berg }; 1932fd5b74dcSJohannes Berg 19336bdb68ceSCarl Huang /** 19346bdb68ceSCarl Huang * struct cfg80211_sar_sub_specs - sub specs limit 19356bdb68ceSCarl Huang * @power: power limitation in 0.25dbm 19366bdb68ceSCarl Huang * @freq_range_index: index the power limitation applies to 19376bdb68ceSCarl Huang */ 19386bdb68ceSCarl Huang struct cfg80211_sar_sub_specs { 19396bdb68ceSCarl Huang s32 power; 19406bdb68ceSCarl Huang u32 freq_range_index; 19416bdb68ceSCarl Huang }; 19426bdb68ceSCarl Huang 19436bdb68ceSCarl Huang /** 19446bdb68ceSCarl Huang * struct cfg80211_sar_specs - sar limit specs 19456bdb68ceSCarl Huang * @type: it's set with power in 0.25dbm or other types 19466bdb68ceSCarl Huang * @num_sub_specs: number of sar sub specs 19476bdb68ceSCarl Huang * @sub_specs: memory to hold the sar sub specs 19486bdb68ceSCarl Huang */ 19496bdb68ceSCarl Huang struct cfg80211_sar_specs { 19506bdb68ceSCarl Huang enum nl80211_sar_type type; 19516bdb68ceSCarl Huang u32 num_sub_specs; 19526bdb68ceSCarl Huang struct cfg80211_sar_sub_specs sub_specs[]; 19536bdb68ceSCarl Huang }; 19546bdb68ceSCarl Huang 19556bdb68ceSCarl Huang 19566bdb68ceSCarl Huang /** 1957c2083e28SMauro Carvalho Chehab * struct cfg80211_sar_freq_ranges - sar frequency ranges 19586bdb68ceSCarl Huang * @start_freq: start range edge frequency 19596bdb68ceSCarl Huang * @end_freq: end range edge frequency 19606bdb68ceSCarl Huang */ 19616bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges { 19626bdb68ceSCarl Huang u32 start_freq; 19636bdb68ceSCarl Huang u32 end_freq; 19646bdb68ceSCarl Huang }; 19656bdb68ceSCarl Huang 19666bdb68ceSCarl Huang /** 19676bdb68ceSCarl Huang * struct cfg80211_sar_capa - sar limit capability 19686bdb68ceSCarl Huang * @type: it's set via power in 0.25dbm or other types 19696bdb68ceSCarl Huang * @num_freq_ranges: number of frequency ranges 19706bdb68ceSCarl Huang * @freq_ranges: memory to hold the freq ranges. 19716bdb68ceSCarl Huang * 19726bdb68ceSCarl Huang * Note: WLAN driver may append new ranges or split an existing 19736bdb68ceSCarl Huang * range to small ones and then append them. 19746bdb68ceSCarl Huang */ 19756bdb68ceSCarl Huang struct cfg80211_sar_capa { 19766bdb68ceSCarl Huang enum nl80211_sar_type type; 19776bdb68ceSCarl Huang u32 num_freq_ranges; 19786bdb68ceSCarl Huang const struct cfg80211_sar_freq_ranges *freq_ranges; 19796bdb68ceSCarl Huang }; 19806bdb68ceSCarl Huang 198161aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211) 198266f7ac50SMichael Wu /** 19837406353dSAntonio Quartulli * cfg80211_get_station - retrieve information about a given station 19847406353dSAntonio Quartulli * @dev: the device where the station is supposed to be connected to 19857406353dSAntonio Quartulli * @mac_addr: the mac address of the station of interest 19867406353dSAntonio Quartulli * @sinfo: pointer to the structure to fill with the information 19877406353dSAntonio Quartulli * 19887406353dSAntonio Quartulli * Returns 0 on success and sinfo is filled with the available information 19897406353dSAntonio Quartulli * otherwise returns a negative error code and the content of sinfo has to be 19907406353dSAntonio Quartulli * considered undefined. 19917406353dSAntonio Quartulli */ 19927406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 19937406353dSAntonio Quartulli struct station_info *sinfo); 199461aaa0e8SLinus Lüssing #else 199561aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev, 199661aaa0e8SLinus Lüssing const u8 *mac_addr, 199761aaa0e8SLinus Lüssing struct station_info *sinfo) 199861aaa0e8SLinus Lüssing { 199961aaa0e8SLinus Lüssing return -ENOENT; 200061aaa0e8SLinus Lüssing } 200161aaa0e8SLinus Lüssing #endif 20027406353dSAntonio Quartulli 20037406353dSAntonio Quartulli /** 200466f7ac50SMichael Wu * enum monitor_flags - monitor flags 200566f7ac50SMichael Wu * 200666f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 200766f7ac50SMichael Wu * according to the nl80211 flags. 200866f7ac50SMichael Wu * 2009818a986eSJohannes Berg * @MONITOR_FLAG_CHANGED: set if the flags were changed 201066f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 201166f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 201266f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 201366f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 201466f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 2015e057d3c3SFelix Fietkau * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address 201666f7ac50SMichael Wu */ 201766f7ac50SMichael Wu enum monitor_flags { 2018818a986eSJohannes Berg MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID, 201966f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 202066f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 202166f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 202266f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 202366f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 2024e057d3c3SFelix Fietkau MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE, 202566f7ac50SMichael Wu }; 202666f7ac50SMichael Wu 20272ec600d6SLuis Carlos Cobo /** 20282ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 20292ec600d6SLuis Carlos Cobo * 20302ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 20312ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 20322ec600d6SLuis Carlos Cobo * 2033abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 2034abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 2035abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 2036abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 2037abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 2038abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 2039abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 2040cc241636SJulan Hsu * @MPATH_INFO_HOP_COUNT: @hop_count filled 20419874b71fSJohannes Berg * @MPATH_INFO_PATH_CHANGE: @path_change_count filled 20422ec600d6SLuis Carlos Cobo */ 20432ec600d6SLuis Carlos Cobo enum mpath_info_flags { 20442ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 2045d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 20462ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 20472ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 20482ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 20492ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 20502ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 2051540bbcb9SJulan Hsu MPATH_INFO_HOP_COUNT = BIT(7), 2052540bbcb9SJulan Hsu MPATH_INFO_PATH_CHANGE = BIT(8), 20532ec600d6SLuis Carlos Cobo }; 20542ec600d6SLuis Carlos Cobo 20552ec600d6SLuis Carlos Cobo /** 20562ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 20572ec600d6SLuis Carlos Cobo * 20582ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 20592ec600d6SLuis Carlos Cobo * 20602ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 20612ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 2062d19b3bf6SRui Paulo * @sn: target sequence number 20632ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 20642ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 20652ec600d6SLuis Carlos Cobo * @flags: mesh path flags 20662ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 20672ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 2068f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 2069f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 2070f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 2071f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 2072cc241636SJulan Hsu * @hop_count: hops to destination 2073540bbcb9SJulan Hsu * @path_change_count: total number of path changes to destination 20742ec600d6SLuis Carlos Cobo */ 20752ec600d6SLuis Carlos Cobo struct mpath_info { 20762ec600d6SLuis Carlos Cobo u32 filled; 20772ec600d6SLuis Carlos Cobo u32 frame_qlen; 2078d19b3bf6SRui Paulo u32 sn; 20792ec600d6SLuis Carlos Cobo u32 metric; 20802ec600d6SLuis Carlos Cobo u32 exptime; 20812ec600d6SLuis Carlos Cobo u32 discovery_timeout; 20822ec600d6SLuis Carlos Cobo u8 discovery_retries; 20832ec600d6SLuis Carlos Cobo u8 flags; 2084cc241636SJulan Hsu u8 hop_count; 2085540bbcb9SJulan Hsu u32 path_change_count; 2086f5ea9120SJohannes Berg 2087f5ea9120SJohannes Berg int generation; 20882ec600d6SLuis Carlos Cobo }; 20892ec600d6SLuis Carlos Cobo 20909f1ba906SJouni Malinen /** 20919f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 20929f1ba906SJouni Malinen * 20939f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 20949f1ba906SJouni Malinen * 20959f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 20969f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 20979f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 20989f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 20999f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 21009f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 210190c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 210290c97a04SJouni Malinen * (or NULL for no change) 210390c97a04SJouni Malinen * @basic_rates_len: number of basic rates 2104fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 21059d6e371dSWright Feng * (0 = no, 1 = yes, -1 = do not change) 210650b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 210750b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 210853cabad7SJohannes Berg * @p2p_ctwindow: P2P CT Window (-1 = no change) 210953cabad7SJohannes Berg * @p2p_opp_ps: P2P opportunistic PS (-1 = no change) 21109f1ba906SJouni Malinen */ 21119f1ba906SJouni Malinen struct bss_parameters { 21129f1ba906SJouni Malinen int use_cts_prot; 21139f1ba906SJouni Malinen int use_short_preamble; 21149f1ba906SJouni Malinen int use_short_slot_time; 2115c1e5f471SJohannes Berg const u8 *basic_rates; 211690c97a04SJouni Malinen u8 basic_rates_len; 2117fd8aaaf3SFelix Fietkau int ap_isolate; 211850b12f59SHelmut Schaa int ht_opmode; 211953cabad7SJohannes Berg s8 p2p_ctwindow, p2p_opp_ps; 21209f1ba906SJouni Malinen }; 21212ec600d6SLuis Carlos Cobo 21223ddd53f3SChun-Yeow Yeoh /** 212329cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 212429cbe68cSJohannes Berg * 212529cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 21263ddd53f3SChun-Yeow Yeoh * 21273ddd53f3SChun-Yeow Yeoh * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used 21283ddd53f3SChun-Yeow Yeoh * by the Mesh Peering Open message 21293ddd53f3SChun-Yeow Yeoh * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units 21303ddd53f3SChun-Yeow Yeoh * used by the Mesh Peering Open message 21313ddd53f3SChun-Yeow Yeoh * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by 21323ddd53f3SChun-Yeow Yeoh * the mesh peering management to close a mesh peering 21333ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this 21343ddd53f3SChun-Yeow Yeoh * mesh interface 21353ddd53f3SChun-Yeow Yeoh * @dot11MeshMaxRetries: the maximum number of peer link open retries that can 21363ddd53f3SChun-Yeow Yeoh * be sent to establish a new peer link instance in a mesh 21373ddd53f3SChun-Yeow Yeoh * @dot11MeshTTL: the value of TTL field set at a source mesh STA 21383ddd53f3SChun-Yeow Yeoh * @element_ttl: the value of TTL field set at a mesh STA for path selection 21393ddd53f3SChun-Yeow Yeoh * elements 21403ddd53f3SChun-Yeow Yeoh * @auto_open_plinks: whether we should automatically open peer links when we 21413ddd53f3SChun-Yeow Yeoh * detect compatible mesh peers 21423ddd53f3SChun-Yeow Yeoh * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to 21433ddd53f3SChun-Yeow Yeoh * synchronize to for 11s default synchronization method 21443ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ 21453ddd53f3SChun-Yeow Yeoh * that an originator mesh STA can send to a particular path target 21463ddd53f3SChun-Yeow Yeoh * @path_refresh_time: how frequently to refresh mesh paths in milliseconds 21473ddd53f3SChun-Yeow Yeoh * @min_discovery_timeout: the minimum length of time to wait until giving up on 21483ddd53f3SChun-Yeow Yeoh * a path discovery in milliseconds 21493ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs 21503ddd53f3SChun-Yeow Yeoh * receiving a PREQ shall consider the forwarding information from the 21513ddd53f3SChun-Yeow Yeoh * root to be valid. (TU = time unit) 21523ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during 21533ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one action frame containing a PREQ 21543ddd53f3SChun-Yeow Yeoh * element 21553ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during 21563ddd53f3SChun-Yeow Yeoh * which a mesh STA can send only one Action frame containing a PERR 21573ddd53f3SChun-Yeow Yeoh * element 21583ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that 21593ddd53f3SChun-Yeow Yeoh * it takes for an HWMP information element to propagate across the mesh 21603ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA 21613ddd53f3SChun-Yeow Yeoh * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root 21623ddd53f3SChun-Yeow Yeoh * announcements are transmitted 21633ddd53f3SChun-Yeow Yeoh * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh 21643ddd53f3SChun-Yeow Yeoh * station has access to a broader network beyond the MBSS. (This is 21653ddd53f3SChun-Yeow Yeoh * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true 21663ddd53f3SChun-Yeow Yeoh * only means that the station will announce others it's a mesh gate, but 21673ddd53f3SChun-Yeow Yeoh * not necessarily using the gate announcement protocol. Still keeping the 21683ddd53f3SChun-Yeow Yeoh * same nomenclature to be in sync with the spec) 21693ddd53f3SChun-Yeow Yeoh * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding 21703ddd53f3SChun-Yeow Yeoh * entity (default is TRUE - forwarding entity) 21713ddd53f3SChun-Yeow Yeoh * @rssi_threshold: the threshold for average signal strength of candidate 21723ddd53f3SChun-Yeow Yeoh * station to establish a peer link 21733ddd53f3SChun-Yeow Yeoh * @ht_opmode: mesh HT protection mode 2174ac1073a6SChun-Yeow Yeoh * 2175ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs 2176ac1073a6SChun-Yeow Yeoh * receiving a proactive PREQ shall consider the forwarding information to 2177ac1073a6SChun-Yeow Yeoh * the root mesh STA to be valid. 2178ac1073a6SChun-Yeow Yeoh * 2179ac1073a6SChun-Yeow Yeoh * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive 2180ac1073a6SChun-Yeow Yeoh * PREQs are transmitted. 2181728b19e5SChun-Yeow Yeoh * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs) 2182728b19e5SChun-Yeow Yeoh * during which a mesh STA can send only one Action frame containing 2183728b19e5SChun-Yeow Yeoh * a PREQ element for root path confirmation. 21843b1c5a53SMarco Porsch * @power_mode: The default mesh power save mode which will be the initial 21853b1c5a53SMarco Porsch * setting for new peer links. 21863b1c5a53SMarco Porsch * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 21873b1c5a53SMarco Porsch * after transmitting its beacon. 21888e7c0538SColleen Twitty * @plink_timeout: If no tx activity is seen from a STA we've established 21898e7c0538SColleen Twitty * peering with for longer than this time (in seconds), then remove it 21908e7c0538SColleen Twitty * from the STA's list of peers. Default is 30 minutes. 21912d8b08feSMauro Carvalho Chehab * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA 21922d8b08feSMauro Carvalho Chehab * will advertise that it is connected to a authentication server 21932d8b08feSMauro Carvalho Chehab * in the mesh formation field. 219401d66fbdSBob Copeland * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is 219501d66fbdSBob Copeland * connected to a mesh gate in mesh formation info. If false, the 219601d66fbdSBob Copeland * value in mesh formation is determined by the presence of root paths 219701d66fbdSBob Copeland * in the mesh path table 2198e3718a61SLinus Lüssing * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP 2199e3718a61SLinus Lüssing * for HWMP) if the destination is a direct neighbor. Note that this might 2200e3718a61SLinus Lüssing * not be the optimal decision as a multi-hop route might be better. So 2201e3718a61SLinus Lüssing * if using this setting you will likely also want to disable 2202e3718a61SLinus Lüssing * dot11MeshForwarding and use another mesh routing protocol on top. 220329cbe68cSJohannes Berg */ 220493da9cc1Scolin@cozybit.com struct mesh_config { 220593da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 220693da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 220793da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 220893da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 220993da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 221093da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 221145904f21SJavier Cardona u8 element_ttl; 221293da9cc1Scolin@cozybit.com bool auto_open_plinks; 2213d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 221493da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 221593da9cc1Scolin@cozybit.com u32 path_refresh_time; 221693da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 221793da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 221893da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 2219dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 222093da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 222163c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 222201d66fbdSBob Copeland bool dot11MeshConnectedToMeshGate; 2223184eebe6SMarkus Theil bool dot11MeshConnectedToAuthServer; 22240507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 222516dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 222694f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 222755335137SAshok Nagarajan s32 rssi_threshold; 222870c33eaaSAshok Nagarajan u16 ht_opmode; 2229ac1073a6SChun-Yeow Yeoh u32 dot11MeshHWMPactivePathToRootTimeout; 2230ac1073a6SChun-Yeow Yeoh u16 dot11MeshHWMProotInterval; 2231728b19e5SChun-Yeow Yeoh u16 dot11MeshHWMPconfirmationInterval; 22323b1c5a53SMarco Porsch enum nl80211_mesh_power_mode power_mode; 22333b1c5a53SMarco Porsch u16 dot11MeshAwakeWindowDuration; 22348e7c0538SColleen Twitty u32 plink_timeout; 2235e3718a61SLinus Lüssing bool dot11MeshNolearn; 223693da9cc1Scolin@cozybit.com }; 223793da9cc1Scolin@cozybit.com 223831888487SJouni Malinen /** 223929cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 2240683b6d3bSJohannes Berg * @chandef: defines the channel to use 224129cbe68cSJohannes Berg * @mesh_id: the mesh ID 224229cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 2243d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 2244c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 2245c80d545dSJavier Cardona * @path_metric: which metric to use 22466e16d90bSColleen Twitty * @auth_id: which authentication method this mesh is using 2247581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 2248581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 2249b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 2250b130e5ceSJavier Cardona * @is_secure: this mesh uses security 2251bb2798d4SThomas Pedersen * @user_mpm: userspace handles all MPM functions 22529bdbf04dSMarco Porsch * @dtim_period: DTIM period to use 22539bdbf04dSMarco Porsch * @beacon_interval: beacon interval to use 22544bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 2255ffb3cf30SAshok Nagarajan * @basic_rates: basic rates to use when creating the mesh 22568564e382SJohannes Berg * @beacon_rate: bitrate to be used for beacons 2257d37d49c2SBenjamin Berg * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 2258d37d49c2SBenjamin Berg * changes the channel when a radar is detected. This is required 2259d37d49c2SBenjamin Berg * to operate on DFS channels. 22601224f583SDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 22611224f583SDenis Kenzior * port frames over NL80211 instead of the network interface. 226229cbe68cSJohannes Berg * 226329cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 226429cbe68cSJohannes Berg */ 226529cbe68cSJohannes Berg struct mesh_setup { 2266683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 226729cbe68cSJohannes Berg const u8 *mesh_id; 226829cbe68cSJohannes Berg u8 mesh_id_len; 2269d299a1f2SJavier Cardona u8 sync_method; 2270c80d545dSJavier Cardona u8 path_sel_proto; 2271c80d545dSJavier Cardona u8 path_metric; 22726e16d90bSColleen Twitty u8 auth_id; 2273581a8b0fSJavier Cardona const u8 *ie; 2274581a8b0fSJavier Cardona u8 ie_len; 2275b130e5ceSJavier Cardona bool is_authenticated; 227615d5dda6SJavier Cardona bool is_secure; 2277bb2798d4SThomas Pedersen bool user_mpm; 22789bdbf04dSMarco Porsch u8 dtim_period; 22799bdbf04dSMarco Porsch u16 beacon_interval; 228057fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2281ffb3cf30SAshok Nagarajan u32 basic_rates; 22828564e382SJohannes Berg struct cfg80211_bitrate_mask beacon_rate; 2283d37d49c2SBenjamin Berg bool userspace_handles_dfs; 22841224f583SDenis Kenzior bool control_port_over_nl80211; 228529cbe68cSJohannes Berg }; 228629cbe68cSJohannes Berg 228729cbe68cSJohannes Berg /** 22886e0bd6c3SRostislav Lisovy * struct ocb_setup - 802.11p OCB mode setup configuration 22896e0bd6c3SRostislav Lisovy * @chandef: defines the channel to use 22906e0bd6c3SRostislav Lisovy * 22916e0bd6c3SRostislav Lisovy * These parameters are fixed when connecting to the network 22926e0bd6c3SRostislav Lisovy */ 22936e0bd6c3SRostislav Lisovy struct ocb_setup { 22946e0bd6c3SRostislav Lisovy struct cfg80211_chan_def chandef; 22956e0bd6c3SRostislav Lisovy }; 22966e0bd6c3SRostislav Lisovy 22976e0bd6c3SRostislav Lisovy /** 229831888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 2299a3304b0aSJohannes Berg * @ac: AC identifier 230031888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 230131888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 230231888487SJouni Malinen * 1..32767] 230331888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 230431888487SJouni Malinen * 1..32767] 230531888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 230631888487SJouni Malinen */ 230731888487SJouni Malinen struct ieee80211_txq_params { 2308a3304b0aSJohannes Berg enum nl80211_ac ac; 230931888487SJouni Malinen u16 txop; 231031888487SJouni Malinen u16 cwmin; 231131888487SJouni Malinen u16 cwmax; 231231888487SJouni Malinen u8 aifs; 231331888487SJouni Malinen }; 231431888487SJouni Malinen 2315d70e9693SJohannes Berg /** 2316d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 2317d70e9693SJohannes Berg * 2318d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 2319d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 2320d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 2321d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 2322d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 2323d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 2324d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 2325d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 2326d70e9693SJohannes Berg * in the wiphy structure. 2327d70e9693SJohannes Berg * 2328d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 2329d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 2330d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 2331d70e9693SJohannes Berg * 2332d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 2333d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 2334d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 2335d70e9693SJohannes Berg * to userspace. 2336d70e9693SJohannes Berg */ 233772bdcf34SJouni Malinen 2338704232c2SJohannes Berg /** 23392a519311SJohannes Berg * struct cfg80211_ssid - SSID description 23402a519311SJohannes Berg * @ssid: the SSID 23412a519311SJohannes Berg * @ssid_len: length of the ssid 23422a519311SJohannes Berg */ 23432a519311SJohannes Berg struct cfg80211_ssid { 23442a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 23452a519311SJohannes Berg u8 ssid_len; 23462a519311SJohannes Berg }; 23472a519311SJohannes Berg 23482a519311SJohannes Berg /** 23491d76250bSAvraham Stern * struct cfg80211_scan_info - information about completed scan 23501d76250bSAvraham Stern * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the 23511d76250bSAvraham Stern * wireless device that requested the scan is connected to. If this 23521d76250bSAvraham Stern * information is not available, this field is left zero. 23531d76250bSAvraham Stern * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. 23541d76250bSAvraham Stern * @aborted: set to true if the scan was aborted for any reason, 23551d76250bSAvraham Stern * userspace will be notified of that 23561d76250bSAvraham Stern */ 23571d76250bSAvraham Stern struct cfg80211_scan_info { 23581d76250bSAvraham Stern u64 scan_start_tsf; 23591d76250bSAvraham Stern u8 tsf_bssid[ETH_ALEN] __aligned(2); 23601d76250bSAvraham Stern bool aborted; 23611d76250bSAvraham Stern }; 23621d76250bSAvraham Stern 23631d76250bSAvraham Stern /** 2364c8cb5b85STova Mussai * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only 2365c8cb5b85STova Mussai * 23662d8b08feSMauro Carvalho Chehab * @short_ssid: short ssid to scan for 2367c8cb5b85STova Mussai * @bssid: bssid to scan for 2368c8cb5b85STova Mussai * @channel_idx: idx of the channel in the channel array in the scan request 2369c8cb5b85STova Mussai * which the above info relvant to 2370c8cb5b85STova Mussai * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU 23712d8b08feSMauro Carvalho Chehab * @short_ssid_valid: @short_ssid is valid and can be used 2372c8cb5b85STova Mussai * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait 2373c8cb5b85STova Mussai * 20 TUs before starting to send probe requests. 2374c8cb5b85STova Mussai */ 2375c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params { 2376c8cb5b85STova Mussai u32 short_ssid; 2377c8cb5b85STova Mussai u32 channel_idx; 2378c8cb5b85STova Mussai u8 bssid[ETH_ALEN]; 2379c8cb5b85STova Mussai bool unsolicited_probe; 2380c8cb5b85STova Mussai bool short_ssid_valid; 2381c8cb5b85STova Mussai bool psc_no_listen; 2382c8cb5b85STova Mussai }; 2383c8cb5b85STova Mussai 2384c8cb5b85STova Mussai /** 23852a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 23862a519311SJohannes Berg * 23872a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 23882a519311SJohannes Berg * @n_ssids: number of SSIDs 23892a519311SJohannes Berg * @channels: channels to scan on. 2390ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 2391dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 239270692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 239370692ad2SJouni Malinen * @ie_len: length of ie in octets 23941d76250bSAvraham Stern * @duration: how long to listen on each channel, in TUs. If 23951d76250bSAvraham Stern * %duration_mandatory is not set, this is the maximum dwell time and 23961d76250bSAvraham Stern * the actual dwell time may be shorter. 23971d76250bSAvraham Stern * @duration_mandatory: if set, the scan duration must be as specified by the 23981d76250bSAvraham Stern * %duration field. 2399ed473771SSam Leffler * @flags: bit field of flags controlling operation 240034850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 24012a519311SJohannes Berg * @wiphy: the wiphy this was for 240215d6030bSSam Leffler * @scan_start: time (in jiffies) when the scan started 2403fd014284SJohannes Berg * @wdev: the wireless device to scan for 24041d76250bSAvraham Stern * @info: (internal) information about completed scan 24055fe231e8SJohannes Berg * @notified: (internal) scan request was notified as done or aborted 2406e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 2407ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 2408ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 2409ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 2410ad2b26abSJohannes Berg * be taken from the @mac_addr 2411c8cb5b85STova Mussai * @scan_6ghz: relevant for split scan request only, 2412c8cb5b85STova Mussai * true if this is the second scan request 2413c8cb5b85STova Mussai * @n_6ghz_params: number of 6 GHz params 2414c8cb5b85STova Mussai * @scan_6ghz_params: 6 GHz params 2415818965d3SJouni Malinen * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) 24162a519311SJohannes Berg */ 24172a519311SJohannes Berg struct cfg80211_scan_request { 24182a519311SJohannes Berg struct cfg80211_ssid *ssids; 24192a519311SJohannes Berg int n_ssids; 24202a519311SJohannes Berg u32 n_channels; 2421dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 2422de95a54bSJohannes Berg const u8 *ie; 242370692ad2SJouni Malinen size_t ie_len; 24241d76250bSAvraham Stern u16 duration; 24251d76250bSAvraham Stern bool duration_mandatory; 2426ed473771SSam Leffler u32 flags; 24272a519311SJohannes Berg 242857fbcce3SJohannes Berg u32 rates[NUM_NL80211_BANDS]; 242934850ab2SJohannes Berg 2430fd014284SJohannes Berg struct wireless_dev *wdev; 2431fd014284SJohannes Berg 2432ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 2433ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2434818965d3SJouni Malinen u8 bssid[ETH_ALEN] __aligned(2); 2435ad2b26abSJohannes Berg 24362a519311SJohannes Berg /* internal */ 24372a519311SJohannes Berg struct wiphy *wiphy; 243815d6030bSSam Leffler unsigned long scan_start; 24391d76250bSAvraham Stern struct cfg80211_scan_info info; 24401d76250bSAvraham Stern bool notified; 2441e9f935e3SRajkumar Manoharan bool no_cck; 2442c8cb5b85STova Mussai bool scan_6ghz; 2443c8cb5b85STova Mussai u32 n_6ghz_params; 2444c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params *scan_6ghz_params; 24455ba63533SJohannes Berg 24465ba63533SJohannes Berg /* keep last */ 2447396fba0aSGustavo A. R. Silva struct ieee80211_channel *channels[]; 24482a519311SJohannes Berg }; 24492a519311SJohannes Berg 2450ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) 2451ad2b26abSJohannes Berg { 2452ad2b26abSJohannes Berg int i; 2453ad2b26abSJohannes Berg 2454ad2b26abSJohannes Berg get_random_bytes(buf, ETH_ALEN); 2455ad2b26abSJohannes Berg for (i = 0; i < ETH_ALEN; i++) { 2456ad2b26abSJohannes Berg buf[i] &= ~mask[i]; 2457ad2b26abSJohannes Berg buf[i] |= addr[i] & mask[i]; 2458ad2b26abSJohannes Berg } 2459ad2b26abSJohannes Berg } 2460ad2b26abSJohannes Berg 24612a519311SJohannes Berg /** 2462a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 2463a1f1c21cSLuciano Coelho * 24643007e352SArend Van Spriel * @ssid: SSID to be matched; may be zero-length in case of BSSID match 24653007e352SArend Van Spriel * or no match (RSSI only) 24663007e352SArend Van Spriel * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match 24673007e352SArend Van Spriel * or no match (RSSI only) 2468ea73cbceSJohannes Berg * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 24691e1b11b6Svamsi krishna * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied 24701e1b11b6Svamsi krishna * for filtering out scan results received. Drivers advertize this support 24711e1b11b6Svamsi krishna * of band specific rssi based filtering through the feature capability 24721e1b11b6Svamsi krishna * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band 24731e1b11b6Svamsi krishna * specific rssi thresholds take precedence over rssi_thold, if specified. 24741e1b11b6Svamsi krishna * If not specified for any band, it will be assigned with rssi_thold of 24751e1b11b6Svamsi krishna * corresponding matchset. 2476a1f1c21cSLuciano Coelho */ 2477a1f1c21cSLuciano Coelho struct cfg80211_match_set { 2478a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 24793007e352SArend Van Spriel u8 bssid[ETH_ALEN]; 2480ea73cbceSJohannes Berg s32 rssi_thold; 24811e1b11b6Svamsi krishna s32 per_band_rssi_thold[NUM_NL80211_BANDS]; 2482a1f1c21cSLuciano Coelho }; 2483a1f1c21cSLuciano Coelho 2484a1f1c21cSLuciano Coelho /** 24853b06d277SAvraham Stern * struct cfg80211_sched_scan_plan - scan plan for scheduled scan 24863b06d277SAvraham Stern * 24873b06d277SAvraham Stern * @interval: interval between scheduled scan iterations. In seconds. 24883b06d277SAvraham Stern * @iterations: number of scan iterations in this scan plan. Zero means 24893b06d277SAvraham Stern * infinite loop. 24903b06d277SAvraham Stern * The last scan plan will always have this parameter set to zero, 24913b06d277SAvraham Stern * all other scan plans will have a finite number of iterations. 24923b06d277SAvraham Stern */ 24933b06d277SAvraham Stern struct cfg80211_sched_scan_plan { 24943b06d277SAvraham Stern u32 interval; 24953b06d277SAvraham Stern u32 iterations; 24963b06d277SAvraham Stern }; 24973b06d277SAvraham Stern 24983b06d277SAvraham Stern /** 2499bf95ecdbSvamsi krishna * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment. 2500bf95ecdbSvamsi krishna * 2501bf95ecdbSvamsi krishna * @band: band of BSS which should match for RSSI level adjustment. 2502bf95ecdbSvamsi krishna * @delta: value of RSSI level adjustment. 2503bf95ecdbSvamsi krishna */ 2504bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust { 2505bf95ecdbSvamsi krishna enum nl80211_band band; 2506bf95ecdbSvamsi krishna s8 delta; 2507bf95ecdbSvamsi krishna }; 2508bf95ecdbSvamsi krishna 2509bf95ecdbSvamsi krishna /** 2510807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 2511807f8a8cSLuciano Coelho * 251296b08fd6SArend Van Spriel * @reqid: identifies this request. 2513807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 2514807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 2515807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 2516dcd6eac1SSimon Wunderlich * @scan_width: channel width for scanning 2517807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 2518807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 2519ed473771SSam Leffler * @flags: bit field of flags controlling operation 2520a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 2521a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 2522a1f1c21cSLuciano Coelho * (others are filtered out). 2523a1f1c21cSLuciano Coelho * If ommited, all results are passed. 2524a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 25256406c919SJohannes Berg * @report_results: indicates that results were reported for this request 2526807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 2527807f8a8cSLuciano Coelho * @dev: the interface 2528077f897aSJohannes Berg * @scan_start: start time of the scheduled scan 2529807f8a8cSLuciano Coelho * @channels: channels to scan 2530ea73cbceSJohannes Berg * @min_rssi_thold: for drivers only supporting a single threshold, this 2531ea73cbceSJohannes Berg * contains the minimum over all matchsets 2532ad2b26abSJohannes Berg * @mac_addr: MAC address used with randomisation 2533ad2b26abSJohannes Berg * @mac_addr_mask: MAC address mask used with randomisation, bits that 2534ad2b26abSJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 2535ad2b26abSJohannes Berg * be taken from the @mac_addr 25363b06d277SAvraham Stern * @scan_plans: scan plans to be executed in this scheduled scan. Lowest 25373b06d277SAvraham Stern * index must be executed first. 25383b06d277SAvraham Stern * @n_scan_plans: number of scan plans, at least 1. 253931a60ed1SJukka Rissanen * @rcu_head: RCU callback used to free the struct 254093a1e86cSJukka Rissanen * @owner_nlportid: netlink portid of owner (if this should is a request 254193a1e86cSJukka Rissanen * owned by a particular socket) 2542ca986ad9SArend Van Spriel * @nl_owner_dead: netlink owner socket was closed - this request be freed 2543ca986ad9SArend Van Spriel * @list: for keeping list of requests. 25449c748934SLuciano Coelho * @delay: delay in seconds to use before starting the first scan 25459c748934SLuciano Coelho * cycle. The driver may ignore this parameter and start 25469c748934SLuciano Coelho * immediately (or at any other time), if this feature is not 25479c748934SLuciano Coelho * supported. 2548bf95ecdbSvamsi krishna * @relative_rssi_set: Indicates whether @relative_rssi is set or not. 2549bf95ecdbSvamsi krishna * @relative_rssi: Relative RSSI threshold in dB to restrict scan result 2550bf95ecdbSvamsi krishna * reporting in connected state to cases where a matching BSS is determined 2551bf95ecdbSvamsi krishna * to have better or slightly worse RSSI than the current connected BSS. 2552bf95ecdbSvamsi krishna * The relative RSSI threshold values are ignored in disconnected state. 2553bf95ecdbSvamsi krishna * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong 2554bf95ecdbSvamsi krishna * to the specified band while deciding whether a better BSS is reported 2555bf95ecdbSvamsi krishna * using @relative_rssi. If delta is a negative number, the BSSs that 2556bf95ecdbSvamsi krishna * belong to the specified band will be penalized by delta dB in relative 2557bf95ecdbSvamsi krishna * comparisions. 2558807f8a8cSLuciano Coelho */ 2559807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 256096b08fd6SArend Van Spriel u64 reqid; 2561807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 2562807f8a8cSLuciano Coelho int n_ssids; 2563807f8a8cSLuciano Coelho u32 n_channels; 2564dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 2565807f8a8cSLuciano Coelho const u8 *ie; 2566807f8a8cSLuciano Coelho size_t ie_len; 2567ed473771SSam Leffler u32 flags; 2568a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 2569a1f1c21cSLuciano Coelho int n_match_sets; 2570ea73cbceSJohannes Berg s32 min_rssi_thold; 25719c748934SLuciano Coelho u32 delay; 25723b06d277SAvraham Stern struct cfg80211_sched_scan_plan *scan_plans; 25733b06d277SAvraham Stern int n_scan_plans; 2574807f8a8cSLuciano Coelho 2575ad2b26abSJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 2576ad2b26abSJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2577ad2b26abSJohannes Berg 2578bf95ecdbSvamsi krishna bool relative_rssi_set; 2579bf95ecdbSvamsi krishna s8 relative_rssi; 2580bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust rssi_adjust; 2581bf95ecdbSvamsi krishna 2582807f8a8cSLuciano Coelho /* internal */ 2583807f8a8cSLuciano Coelho struct wiphy *wiphy; 2584807f8a8cSLuciano Coelho struct net_device *dev; 258515d6030bSSam Leffler unsigned long scan_start; 2586b34939b9SArend Van Spriel bool report_results; 258731a60ed1SJukka Rissanen struct rcu_head rcu_head; 258893a1e86cSJukka Rissanen u32 owner_nlportid; 2589ca986ad9SArend Van Spriel bool nl_owner_dead; 2590ca986ad9SArend Van Spriel struct list_head list; 2591807f8a8cSLuciano Coelho 2592807f8a8cSLuciano Coelho /* keep last */ 2593396fba0aSGustavo A. R. Silva struct ieee80211_channel *channels[]; 2594807f8a8cSLuciano Coelho }; 2595807f8a8cSLuciano Coelho 2596807f8a8cSLuciano Coelho /** 25972a519311SJohannes Berg * enum cfg80211_signal_type - signal type 25982a519311SJohannes Berg * 25992a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 26002a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 26012a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 26022a519311SJohannes Berg */ 26032a519311SJohannes Berg enum cfg80211_signal_type { 26042a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 26052a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 26062a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 26072a519311SJohannes Berg }; 26082a519311SJohannes Berg 26092a519311SJohannes Berg /** 26106e19bc4bSDmitry Shmidt * struct cfg80211_inform_bss - BSS inform data 26116e19bc4bSDmitry Shmidt * @chan: channel the frame was received on 26126e19bc4bSDmitry Shmidt * @scan_width: scan width that was used 26136e19bc4bSDmitry Shmidt * @signal: signal strength value, according to the wiphy's 26146e19bc4bSDmitry Shmidt * signal type 26156e19bc4bSDmitry Shmidt * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was 26166e19bc4bSDmitry Shmidt * received; should match the time when the frame was actually 26176e19bc4bSDmitry Shmidt * received by the device (not just by the host, in case it was 26186e19bc4bSDmitry Shmidt * buffered on the device) and be accurate to about 10ms. 26196e19bc4bSDmitry Shmidt * If the frame isn't buffered, just passing the return value of 26209285ec4cSJason A. Donenfeld * ktime_get_boottime_ns() is likely appropriate. 26211d76250bSAvraham Stern * @parent_tsf: the time at the start of reception of the first octet of the 26221d76250bSAvraham Stern * timestamp field of the frame. The time is the TSF of the BSS specified 26231d76250bSAvraham Stern * by %parent_bssid. 26241d76250bSAvraham Stern * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 26251d76250bSAvraham Stern * the BSS that requested the scan in which the beacon/probe was received. 2626983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 2627983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 26286e19bc4bSDmitry Shmidt */ 26296e19bc4bSDmitry Shmidt struct cfg80211_inform_bss { 26306e19bc4bSDmitry Shmidt struct ieee80211_channel *chan; 26316e19bc4bSDmitry Shmidt enum nl80211_bss_scan_width scan_width; 26326e19bc4bSDmitry Shmidt s32 signal; 26336e19bc4bSDmitry Shmidt u64 boottime_ns; 26341d76250bSAvraham Stern u64 parent_tsf; 26351d76250bSAvraham Stern u8 parent_bssid[ETH_ALEN] __aligned(2); 2636983dafaaSSunil Dutt u8 chains; 2637983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 26386e19bc4bSDmitry Shmidt }; 26396e19bc4bSDmitry Shmidt 26406e19bc4bSDmitry Shmidt /** 26412aa4d456SAkira Moroo * struct cfg80211_bss_ies - BSS entry IE data 26428cef2c9dSJohannes Berg * @tsf: TSF contained in the frame that carried these IEs 26439caf0364SJohannes Berg * @rcu_head: internal use, for freeing 26449caf0364SJohannes Berg * @len: length of the IEs 26450e227084SJohannes Berg * @from_beacon: these IEs are known to come from a beacon 26469caf0364SJohannes Berg * @data: IE data 26479caf0364SJohannes Berg */ 26489caf0364SJohannes Berg struct cfg80211_bss_ies { 26498cef2c9dSJohannes Berg u64 tsf; 26509caf0364SJohannes Berg struct rcu_head rcu_head; 26519caf0364SJohannes Berg int len; 26520e227084SJohannes Berg bool from_beacon; 26539caf0364SJohannes Berg u8 data[]; 26549caf0364SJohannes Berg }; 26559caf0364SJohannes Berg 26569caf0364SJohannes Berg /** 26572a519311SJohannes Berg * struct cfg80211_bss - BSS description 26582a519311SJohannes Berg * 26592a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 26602a519311SJohannes Berg * for use in scan results and similar. 26612a519311SJohannes Berg * 2662abe37c4bSJohannes Berg * @channel: channel this BSS is on 2663dcd6eac1SSimon Wunderlich * @scan_width: width of the control channel 26642a519311SJohannes Berg * @bssid: BSSID of the BSS 26652a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 26662a519311SJohannes Berg * @capability: the capability field in host byte order 266783c7aa1aSJohannes Berg * @ies: the information elements (Note that there is no guarantee that these 266883c7aa1aSJohannes Berg * are well-formed!); this is a pointer to either the beacon_ies or 266983c7aa1aSJohannes Berg * proberesp_ies depending on whether Probe Response frame has been 267083c7aa1aSJohannes Berg * received. It is always non-%NULL. 267134a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 2672776b3580SJohannes Berg * (implementation note: if @hidden_beacon_bss is set this struct doesn't 2673776b3580SJohannes Berg * own the beacon_ies, but they're just pointers to the ones from the 2674776b3580SJohannes Berg * @hidden_beacon_bss struct) 267534a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 2676776b3580SJohannes Berg * @hidden_beacon_bss: in case this BSS struct represents a probe response from 2677776b3580SJohannes Berg * a BSS that hides the SSID in its beacon, this points to the BSS struct 2678776b3580SJohannes Berg * that holds the beacon data. @beacon_ies is still valid, of course, and 2679776b3580SJohannes Berg * points to the same data as hidden_beacon_bss->beacon_ies in that case. 2680851ae31dSJohannes Berg * @transmitted_bss: pointer to the transmitted BSS, if this is a 2681851ae31dSJohannes Berg * non-transmitted one (multi-BSSID support) 2682851ae31dSJohannes Berg * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one 2683851ae31dSJohannes Berg * (multi-BSSID support) 268477965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 2685983dafaaSSunil Dutt * @chains: bitmask for filled values in @chain_signal. 2686983dafaaSSunil Dutt * @chain_signal: per-chain signal strength of last received BSS in dBm. 26870cd01efbSSara Sharon * @bssid_index: index in the multiple BSS set 26880cd01efbSSara Sharon * @max_bssid_indicator: max number of members in the BSS set 26892a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 26902a519311SJohannes Berg */ 26912a519311SJohannes Berg struct cfg80211_bss { 26922a519311SJohannes Berg struct ieee80211_channel *channel; 2693dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width; 26942a519311SJohannes Berg 26959caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *ies; 26969caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *beacon_ies; 26979caf0364SJohannes Berg const struct cfg80211_bss_ies __rcu *proberesp_ies; 26989caf0364SJohannes Berg 2699776b3580SJohannes Berg struct cfg80211_bss *hidden_beacon_bss; 27007011ba58SSara Sharon struct cfg80211_bss *transmitted_bss; 27017011ba58SSara Sharon struct list_head nontrans_list; 27022a519311SJohannes Berg 27032a519311SJohannes Berg s32 signal; 27042a519311SJohannes Berg 27059caf0364SJohannes Berg u16 beacon_interval; 27069caf0364SJohannes Berg u16 capability; 27079caf0364SJohannes Berg 27089caf0364SJohannes Berg u8 bssid[ETH_ALEN]; 2709983dafaaSSunil Dutt u8 chains; 2710983dafaaSSunil Dutt s8 chain_signal[IEEE80211_MAX_CHAINS]; 27119caf0364SJohannes Berg 27120cd01efbSSara Sharon u8 bssid_index; 27130cd01efbSSara Sharon u8 max_bssid_indicator; 27140cd01efbSSara Sharon 2715396fba0aSGustavo A. R. Silva u8 priv[] __aligned(sizeof(void *)); 27162a519311SJohannes Berg }; 27172a519311SJohannes Berg 27182a519311SJohannes Berg /** 271949a68e0dSJohannes Berg * ieee80211_bss_get_elem - find element with given ID 2720517357c6SJohannes Berg * @bss: the bss to search 272149a68e0dSJohannes Berg * @id: the element ID 27229caf0364SJohannes Berg * 27239caf0364SJohannes Berg * Note that the return value is an RCU-protected pointer, so 27249caf0364SJohannes Berg * rcu_read_lock() must be held when calling this function. 27250ae997dcSYacine Belkadi * Return: %NULL if not found. 2726517357c6SJohannes Berg */ 272749a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id); 272849a68e0dSJohannes Berg 272949a68e0dSJohannes Berg /** 273049a68e0dSJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 273149a68e0dSJohannes Berg * @bss: the bss to search 273249a68e0dSJohannes Berg * @id: the element ID 273349a68e0dSJohannes Berg * 273449a68e0dSJohannes Berg * Note that the return value is an RCU-protected pointer, so 273549a68e0dSJohannes Berg * rcu_read_lock() must be held when calling this function. 273649a68e0dSJohannes Berg * Return: %NULL if not found. 273749a68e0dSJohannes Berg */ 273849a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id) 273949a68e0dSJohannes Berg { 27407e367b06SJohannes Berg return (const void *)ieee80211_bss_get_elem(bss, id); 274149a68e0dSJohannes Berg } 2742517357c6SJohannes Berg 2743517357c6SJohannes Berg 2744517357c6SJohannes Berg /** 2745636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 2746636a5d36SJouni Malinen * 2747636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 2748636a5d36SJouni Malinen * authentication. 2749636a5d36SJouni Malinen * 2750959867faSJohannes Berg * @bss: The BSS to authenticate with, the callee must obtain a reference 2751959867faSJohannes Berg * to it if it needs to keep it. 2752636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 2753636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 2754636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 2755fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 2756fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 2757fffd0934SJohannes Berg * @key: WEP key for shared key authentication 275811b6b5a4SJouni Malinen * @auth_data: Fields and elements in Authentication frames. This contains 275911b6b5a4SJouni Malinen * the authentication frame body (non-IE and IE data), excluding the 276011b6b5a4SJouni Malinen * Authentication algorithm number, i.e., starting at the Authentication 276111b6b5a4SJouni Malinen * transaction sequence number field. 276211b6b5a4SJouni Malinen * @auth_data_len: Length of auth_data buffer in octets 2763d648c230SJohannes Berg * @link_id: if >= 0, indicates authentication should be done as an MLD, 2764d648c230SJohannes Berg * the interface address is included as the MLD address and the 2765d648c230SJohannes Berg * necessary link (with the given link_id) will be created (and 2766d648c230SJohannes Berg * given an MLD address) by the driver 2767d648c230SJohannes Berg * @ap_mld_addr: AP MLD address in case of authentication request with 2768d648c230SJohannes Berg * an AP MLD, valid iff @link_id >= 0 2769636a5d36SJouni Malinen */ 2770636a5d36SJouni Malinen struct cfg80211_auth_request { 277119957bb3SJohannes Berg struct cfg80211_bss *bss; 2772636a5d36SJouni Malinen const u8 *ie; 2773636a5d36SJouni Malinen size_t ie_len; 277419957bb3SJohannes Berg enum nl80211_auth_type auth_type; 2775fffd0934SJohannes Berg const u8 *key; 277623cc6d8cSJohannes Berg u8 key_len; 277723cc6d8cSJohannes Berg s8 key_idx; 277811b6b5a4SJouni Malinen const u8 *auth_data; 277911b6b5a4SJouni Malinen size_t auth_data_len; 2780d648c230SJohannes Berg s8 link_id; 2781d648c230SJohannes Berg const u8 *ap_mld_addr; 2782d648c230SJohannes Berg }; 2783d648c230SJohannes Berg 2784d648c230SJohannes Berg /** 2785d648c230SJohannes Berg * struct cfg80211_assoc_link - per-link information for MLO association 2786d648c230SJohannes Berg * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss; 2787d648c230SJohannes Berg * if this is %NULL for a link, that link is not requested 2788d648c230SJohannes Berg * @elems: extra elements for the per-STA profile for this link 2789d648c230SJohannes Berg * @elems_len: length of the elements 2790d648c230SJohannes Berg */ 2791d648c230SJohannes Berg struct cfg80211_assoc_link { 2792d648c230SJohannes Berg struct cfg80211_bss *bss; 2793d648c230SJohannes Berg const u8 *elems; 2794d648c230SJohannes Berg size_t elems_len; 2795636a5d36SJouni Malinen }; 2796636a5d36SJouni Malinen 2797636a5d36SJouni Malinen /** 27987e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 27997e7c8926SBen Greear * 28007e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 2801ee2aca34SJohannes Berg * @ASSOC_REQ_DISABLE_VHT: Disable VHT 2802bab5ab7dSAssaf Krauss * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association 280340cbfa90SSrinivas Dasari * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external 280440cbfa90SSrinivas Dasari * authentication capability. Drivers can offload authentication to 280540cbfa90SSrinivas Dasari * userspace if this flag is set. Only applicable for cfg80211_connect() 280640cbfa90SSrinivas Dasari * request (connect callback). 2807b6db0f89SBen Greear * @ASSOC_REQ_DISABLE_HE: Disable HE 280836f84235SMuna Sinada * @ASSOC_REQ_DISABLE_EHT: Disable EHT 2809efbabc11SVeerendranath Jakkam * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links. 2810efbabc11SVeerendranath Jakkam * Drivers shall disable MLO features for the current association if this 2811efbabc11SVeerendranath Jakkam * flag is not set. 28127e7c8926SBen Greear */ 28137e7c8926SBen Greear enum cfg80211_assoc_req_flags { 28147e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 2815ee2aca34SJohannes Berg ASSOC_REQ_DISABLE_VHT = BIT(1), 2816bab5ab7dSAssaf Krauss ASSOC_REQ_USE_RRM = BIT(2), 281740cbfa90SSrinivas Dasari CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), 2818b6db0f89SBen Greear ASSOC_REQ_DISABLE_HE = BIT(4), 281936f84235SMuna Sinada ASSOC_REQ_DISABLE_EHT = BIT(5), 2820efbabc11SVeerendranath Jakkam CONNECT_REQ_MLO_SUPPORT = BIT(6), 28217e7c8926SBen Greear }; 28227e7c8926SBen Greear 28237e7c8926SBen Greear /** 2824636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 2825636a5d36SJouni Malinen * 2826636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 2827636a5d36SJouni Malinen * (re)association. 2828959867faSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver is 2829959867faSJohannes Berg * given a reference that it must give back to cfg80211_send_rx_assoc() 2830959867faSJohannes Berg * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new 2831959867faSJohannes Berg * association requests while already associating must be rejected. 2832d648c230SJohannes Berg * This also applies to the @links.bss parameter, which is used instead 2833d648c230SJohannes Berg * of this one (it is %NULL) for MLO associations. 2834636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 2835636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 2836dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 2837b23aa676SSamuel Ortiz * @crypto: crypto settings 283835eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 283935eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 284035eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 284135eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 284235eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 284335eb8f7bSJouni Malinen * frame. 28447e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 28457e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 28467e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 28477e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 2848ee2aca34SJohannes Berg * @vht_capa: VHT capability override 2849ee2aca34SJohannes Berg * @vht_capa_mask: VHT capability mask indicating which fields to use 2850348bd456SJouni Malinen * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or 2851348bd456SJouni Malinen * %NULL if FILS is not used. 2852348bd456SJouni Malinen * @fils_kek_len: Length of fils_kek in octets 2853348bd456SJouni Malinen * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association 2854348bd456SJouni Malinen * Request/Response frame or %NULL if FILS is not used. This field starts 2855348bd456SJouni Malinen * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. 2856d2b7588aSThomas Pedersen * @s1g_capa: S1G capability override 2857d2b7588aSThomas Pedersen * @s1g_capa_mask: S1G capability override mask 2858d648c230SJohannes Berg * @links: per-link information for MLO connections 2859d648c230SJohannes Berg * @link_id: >= 0 for MLO connections, where links are given, and indicates 2860d648c230SJohannes Berg * the link on which the association request should be sent 2861d648c230SJohannes Berg * @ap_mld_addr: AP MLD address in case of MLO association request, 2862d648c230SJohannes Berg * valid iff @link_id >= 0 2863636a5d36SJouni Malinen */ 2864636a5d36SJouni Malinen struct cfg80211_assoc_request { 286519957bb3SJohannes Berg struct cfg80211_bss *bss; 28663e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 2867636a5d36SJouni Malinen size_t ie_len; 2868b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 286919957bb3SJohannes Berg bool use_mfp; 28707e7c8926SBen Greear u32 flags; 28717e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 28727e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 2873ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa, vht_capa_mask; 2874348bd456SJouni Malinen const u8 *fils_kek; 2875348bd456SJouni Malinen size_t fils_kek_len; 2876348bd456SJouni Malinen const u8 *fils_nonces; 2877d2b7588aSThomas Pedersen struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask; 2878d648c230SJohannes Berg struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS]; 2879d648c230SJohannes Berg const u8 *ap_mld_addr; 2880d648c230SJohannes Berg s8 link_id; 2881636a5d36SJouni Malinen }; 2882636a5d36SJouni Malinen 2883636a5d36SJouni Malinen /** 2884636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 2885636a5d36SJouni Malinen * 2886636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 2887636a5d36SJouni Malinen * deauthentication. 2888636a5d36SJouni Malinen * 28898f6e0dfcSJohannes Berg * @bssid: the BSSID or AP MLD address to deauthenticate from 2890636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 2891636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 289219957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 2893077f897aSJohannes Berg * @local_state_change: if set, change local state only and 2894077f897aSJohannes Berg * do not set a deauth frame 2895636a5d36SJouni Malinen */ 2896636a5d36SJouni Malinen struct cfg80211_deauth_request { 289795de817bSJohannes Berg const u8 *bssid; 2898636a5d36SJouni Malinen const u8 *ie; 2899636a5d36SJouni Malinen size_t ie_len; 290019957bb3SJohannes Berg u16 reason_code; 29016863255bSStanislaw Gruszka bool local_state_change; 2902636a5d36SJouni Malinen }; 2903636a5d36SJouni Malinen 2904636a5d36SJouni Malinen /** 2905636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 2906636a5d36SJouni Malinen * 2907636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 290866f00449SMasahiro Yamada * disassociation. 2909636a5d36SJouni Malinen * 29108f6e0dfcSJohannes Berg * @ap_addr: the BSSID or AP MLD address to disassociate from 2911636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 2912636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 291319957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 2914d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 2915d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 2916636a5d36SJouni Malinen */ 2917636a5d36SJouni Malinen struct cfg80211_disassoc_request { 29188f6e0dfcSJohannes Berg const u8 *ap_addr; 2919636a5d36SJouni Malinen const u8 *ie; 2920636a5d36SJouni Malinen size_t ie_len; 292119957bb3SJohannes Berg u16 reason_code; 2922d5cdfacbSJouni Malinen bool local_state_change; 2923636a5d36SJouni Malinen }; 2924636a5d36SJouni Malinen 2925636a5d36SJouni Malinen /** 292604a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 292704a773adSJohannes Berg * 292804a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 292904a773adSJohannes Berg * method. 293004a773adSJohannes Berg * 293104a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 293204a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 293304a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 293404a773adSJohannes Berg * search for IBSSs with a different BSSID. 2935683b6d3bSJohannes Berg * @chandef: defines the channel to use if no other IBSS to join can be found 293604a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 293704a773adSJohannes Berg * IBSSs to join on other channels. 293804a773adSJohannes Berg * @ie: information element(s) to include in the beacon 293904a773adSJohannes Berg * @ie_len: length of that 29408e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 2941fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 2942fffd0934SJohannes Berg * after joining 2943267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 2944267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 2945267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 2946267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 2947c3bfe1f6SDenis Kenzior * @control_port_over_nl80211: TRUE if userspace expects to exchange control 2948c3bfe1f6SDenis Kenzior * port frames over NL80211 instead of the network interface. 29495336fa88SSimon Wunderlich * @userspace_handles_dfs: whether user space controls DFS operation, i.e. 29505336fa88SSimon Wunderlich * changes the channel when a radar is detected. This is required 29515336fa88SSimon Wunderlich * to operate on DFS channels. 2952fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 2953dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 2954803768f5SSimon Wunderlich * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 2955803768f5SSimon Wunderlich * will be used in ht_capa. Un-supported values will be ignored. 2956803768f5SSimon Wunderlich * @ht_capa_mask: The bits of ht_capa which are to be used. 29579ae3b172STova Mussai * @wep_keys: static WEP keys, if not NULL points to an array of 29589ae3b172STova Mussai * CFG80211_MAX_WEP_KEYS WEP keys 29599ae3b172STova Mussai * @wep_tx_key: key index (0..3) of the default TX static WEP key 296004a773adSJohannes Berg */ 296104a773adSJohannes Berg struct cfg80211_ibss_params { 2962c1e5f471SJohannes Berg const u8 *ssid; 2963c1e5f471SJohannes Berg const u8 *bssid; 2964683b6d3bSJohannes Berg struct cfg80211_chan_def chandef; 2965c1e5f471SJohannes Berg const u8 *ie; 296604a773adSJohannes Berg u8 ssid_len, ie_len; 29678e30bc55SJohannes Berg u16 beacon_interval; 2968fbd2c8dcSTeemu Paasikivi u32 basic_rates; 296904a773adSJohannes Berg bool channel_fixed; 2970fffd0934SJohannes Berg bool privacy; 2971267335d6SAntonio Quartulli bool control_port; 2972c3bfe1f6SDenis Kenzior bool control_port_over_nl80211; 29735336fa88SSimon Wunderlich bool userspace_handles_dfs; 297457fbcce3SJohannes Berg int mcast_rate[NUM_NL80211_BANDS]; 2975803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa; 2976803768f5SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; 29779ae3b172STova Mussai struct key_params *wep_keys; 29789ae3b172STova Mussai int wep_tx_key; 297904a773adSJohannes Berg }; 298004a773adSJohannes Berg 298104a773adSJohannes Berg /** 298238de03d2SArend van Spriel * struct cfg80211_bss_selection - connection parameters for BSS selection. 298338de03d2SArend van Spriel * 298438de03d2SArend van Spriel * @behaviour: requested BSS selection behaviour. 298538de03d2SArend van Spriel * @param: parameters for requestion behaviour. 298638de03d2SArend van Spriel * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF. 298738de03d2SArend van Spriel * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST. 298838de03d2SArend van Spriel */ 298938de03d2SArend van Spriel struct cfg80211_bss_selection { 299038de03d2SArend van Spriel enum nl80211_bss_select_attr behaviour; 299138de03d2SArend van Spriel union { 299257fbcce3SJohannes Berg enum nl80211_band band_pref; 299338de03d2SArend van Spriel struct cfg80211_bss_select_adjust adjust; 299438de03d2SArend van Spriel } param; 299538de03d2SArend van Spriel }; 299638de03d2SArend van Spriel 299738de03d2SArend van Spriel /** 2998b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 2999b23aa676SSamuel Ortiz * 3000b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 3001b23aa676SSamuel Ortiz * authentication and association. 3002b23aa676SSamuel Ortiz * 3003b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 3004b23aa676SSamuel Ortiz * on scan results) 30051df4a510SJouni Malinen * @channel_hint: The channel of the recommended BSS for initial connection or 30061df4a510SJouni Malinen * %NULL if not specified 3007b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 3008b23aa676SSamuel Ortiz * results) 30091df4a510SJouni Malinen * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or 30101df4a510SJouni Malinen * %NULL if not specified. Unlike the @bssid parameter, the driver is 30111df4a510SJouni Malinen * allowed to ignore this @bssid_hint if it has knowledge of a better BSS 30121df4a510SJouni Malinen * to use. 3013b23aa676SSamuel Ortiz * @ssid: SSID 3014b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 3015b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 3016abe37c4bSJohannes Berg * @ie: IEs for association request 3017abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 3018b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 3019cee00a95SJouni Malinen * @mfp: indicate whether management frame protection is used 3020b23aa676SSamuel Ortiz * @crypto: crypto settings 3021fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 3022fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 3023fffd0934SJohannes Berg * @key: WEP key for shared key authentication 30247e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 30254486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 30264486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 30277e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 30287e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 30297e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 3030ee2aca34SJohannes Berg * @vht_capa: VHT Capability overrides 3031ee2aca34SJohannes Berg * @vht_capa_mask: The bits of vht_capa which are to be used. 303234d50519SLior David * @pbss: if set, connect to a PCP instead of AP. Valid for DMG 303334d50519SLior David * networks. 303438de03d2SArend van Spriel * @bss_select: criteria to be used for BSS selection. 303535eb8f7bSJouni Malinen * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used 303635eb8f7bSJouni Malinen * to indicate a request to reassociate within the ESS instead of a request 303735eb8f7bSJouni Malinen * do the initial association with the ESS. When included, this is set to 303835eb8f7bSJouni Malinen * the BSSID of the current association, i.e., to the value that is 303935eb8f7bSJouni Malinen * included in the Current AP address field of the Reassociation Request 304035eb8f7bSJouni Malinen * frame. 3041a3caf744SVidyullatha Kanchanapally * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the 3042a3caf744SVidyullatha Kanchanapally * NAI or %NULL if not specified. This is used to construct FILS wrapped 3043a3caf744SVidyullatha Kanchanapally * data IE. 3044a3caf744SVidyullatha Kanchanapally * @fils_erp_username_len: Length of @fils_erp_username in octets. 3045a3caf744SVidyullatha Kanchanapally * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or 3046a3caf744SVidyullatha Kanchanapally * %NULL if not specified. This specifies the domain name of ER server and 3047a3caf744SVidyullatha Kanchanapally * is used to construct FILS wrapped data IE. 3048a3caf744SVidyullatha Kanchanapally * @fils_erp_realm_len: Length of @fils_erp_realm in octets. 3049a3caf744SVidyullatha Kanchanapally * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP 3050a3caf744SVidyullatha Kanchanapally * messages. This is also used to construct FILS wrapped data IE. 3051a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional 3052a3caf744SVidyullatha Kanchanapally * keys in FILS or %NULL if not specified. 3053a3caf744SVidyullatha Kanchanapally * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets. 30543a00df57SAvraham Stern * @want_1x: indicates user-space supports and wants to use 802.1X driver 30553a00df57SAvraham Stern * offload of 4-way handshake. 30562a38075cSAlexei Avshalom Lazar * @edmg: define the EDMG channels. 30572a38075cSAlexei Avshalom Lazar * This may specify multiple channels and bonding options for the driver 30582a38075cSAlexei Avshalom Lazar * to choose from, based on BSS configuration. 3059b23aa676SSamuel Ortiz */ 3060b23aa676SSamuel Ortiz struct cfg80211_connect_params { 3061b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 30621df4a510SJouni Malinen struct ieee80211_channel *channel_hint; 3063664834deSJouni Malinen const u8 *bssid; 30641df4a510SJouni Malinen const u8 *bssid_hint; 3065664834deSJouni Malinen const u8 *ssid; 3066b23aa676SSamuel Ortiz size_t ssid_len; 3067b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 30684b5800feSJohannes Berg const u8 *ie; 3069b23aa676SSamuel Ortiz size_t ie_len; 3070b23aa676SSamuel Ortiz bool privacy; 3071cee00a95SJouni Malinen enum nl80211_mfp mfp; 3072b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 3073fffd0934SJohannes Berg const u8 *key; 3074fffd0934SJohannes Berg u8 key_len, key_idx; 30757e7c8926SBen Greear u32 flags; 30764486ea98SBala Shanmugam int bg_scan_period; 30777e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 30787e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 3079ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa; 3080ee2aca34SJohannes Berg struct ieee80211_vht_cap vht_capa_mask; 308134d50519SLior David bool pbss; 308238de03d2SArend van Spriel struct cfg80211_bss_selection bss_select; 3083ba6fbacfSJouni Malinen const u8 *prev_bssid; 3084a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_username; 3085a3caf744SVidyullatha Kanchanapally size_t fils_erp_username_len; 3086a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_realm; 3087a3caf744SVidyullatha Kanchanapally size_t fils_erp_realm_len; 3088a3caf744SVidyullatha Kanchanapally u16 fils_erp_next_seq_num; 3089a3caf744SVidyullatha Kanchanapally const u8 *fils_erp_rrk; 3090a3caf744SVidyullatha Kanchanapally size_t fils_erp_rrk_len; 30913a00df57SAvraham Stern bool want_1x; 30922a38075cSAlexei Avshalom Lazar struct ieee80211_edmg edmg; 3093b23aa676SSamuel Ortiz }; 3094b23aa676SSamuel Ortiz 3095b23aa676SSamuel Ortiz /** 3096088e8df8Svamsi krishna * enum cfg80211_connect_params_changed - Connection parameters being updated 3097088e8df8Svamsi krishna * 3098088e8df8Svamsi krishna * This enum provides information of all connect parameters that 3099088e8df8Svamsi krishna * have to be updated as part of update_connect_params() call. 3100088e8df8Svamsi krishna * 3101088e8df8Svamsi krishna * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 31027f9a3e15SVidyullatha Kanchanapally * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm, 31037f9a3e15SVidyullatha Kanchanapally * username, erp sequence number and rrk) are updated 31047f9a3e15SVidyullatha Kanchanapally * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated 3105088e8df8Svamsi krishna */ 3106088e8df8Svamsi krishna enum cfg80211_connect_params_changed { 3107088e8df8Svamsi krishna UPDATE_ASSOC_IES = BIT(0), 31087f9a3e15SVidyullatha Kanchanapally UPDATE_FILS_ERP_INFO = BIT(1), 31097f9a3e15SVidyullatha Kanchanapally UPDATE_AUTH_TYPE = BIT(2), 3110088e8df8Svamsi krishna }; 3111088e8df8Svamsi krishna 3112088e8df8Svamsi krishna /** 3113b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 3114abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 3115abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 3116abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 3117abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 3118abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 31193057dbfdSLorenzo Bianconi * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 312052539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed 312152539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed 312252539ca8SToke Høiland-Jørgensen * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum 3123b9a5f8caSJouni Malinen */ 3124b9a5f8caSJouni Malinen enum wiphy_params_flags { 3125b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 3126b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 3127b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 3128b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 312981077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 31303057dbfdSLorenzo Bianconi WIPHY_PARAM_DYN_ACK = 1 << 5, 313152539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_LIMIT = 1 << 6, 313252539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7, 313352539ca8SToke Høiland-Jørgensen WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, 3134b9a5f8caSJouni Malinen }; 3135b9a5f8caSJouni Malinen 313636647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 313736647055SToke Høiland-Jørgensen 31383ace10f5SKan Yan /* The per TXQ device queue limit in airtime */ 31393ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 31403ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 31413ace10f5SKan Yan 31423ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */ 31433ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD 24000 31443ace10f5SKan Yan 314567fbb16bSSamuel Ortiz /** 314667fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 314767fbb16bSSamuel Ortiz * 314867fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 314967fbb16bSSamuel Ortiz * caching. 315067fbb16bSSamuel Ortiz * 3151a3caf744SVidyullatha Kanchanapally * @bssid: The AP's BSSID (may be %NULL). 3152a3caf744SVidyullatha Kanchanapally * @pmkid: The identifier to refer a PMKSA. 3153a3caf744SVidyullatha Kanchanapally * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key 3154a3caf744SVidyullatha Kanchanapally * derivation by a FILS STA. Otherwise, %NULL. 3155a3caf744SVidyullatha Kanchanapally * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on 3156a3caf744SVidyullatha Kanchanapally * the hash algorithm used to generate this. 3157a3caf744SVidyullatha Kanchanapally * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS 3158a3caf744SVidyullatha Kanchanapally * cache identifier (may be %NULL). 3159a3caf744SVidyullatha Kanchanapally * @ssid_len: Length of the @ssid in octets. 3160a3caf744SVidyullatha Kanchanapally * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the 3161a3caf744SVidyullatha Kanchanapally * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be 3162a3caf744SVidyullatha Kanchanapally * %NULL). 31637fc82af8SVeerendranath Jakkam * @pmk_lifetime: Maximum lifetime for PMKSA in seconds 31647fc82af8SVeerendranath Jakkam * (dot11RSNAConfigPMKLifetime) or 0 if not specified. 31657fc82af8SVeerendranath Jakkam * The configured PMKSA must not be used for PMKSA caching after 31667fc82af8SVeerendranath Jakkam * expiration and any keys derived from this PMK become invalid on 31677fc82af8SVeerendranath Jakkam * expiration, i.e., the current association must be dropped if the PMK 31687fc82af8SVeerendranath Jakkam * used for it expires. 31697fc82af8SVeerendranath Jakkam * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of 31707fc82af8SVeerendranath Jakkam * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified. 31717fc82af8SVeerendranath Jakkam * Drivers are expected to trigger a full authentication instead of using 31727fc82af8SVeerendranath Jakkam * this PMKSA for caching when reassociating to a new BSS after this 31737fc82af8SVeerendranath Jakkam * threshold to generate a new PMK before the current one expires. 317467fbb16bSSamuel Ortiz */ 317567fbb16bSSamuel Ortiz struct cfg80211_pmksa { 3176c1e5f471SJohannes Berg const u8 *bssid; 3177c1e5f471SJohannes Berg const u8 *pmkid; 3178a3caf744SVidyullatha Kanchanapally const u8 *pmk; 3179a3caf744SVidyullatha Kanchanapally size_t pmk_len; 3180a3caf744SVidyullatha Kanchanapally const u8 *ssid; 3181a3caf744SVidyullatha Kanchanapally size_t ssid_len; 3182a3caf744SVidyullatha Kanchanapally const u8 *cache_id; 31837fc82af8SVeerendranath Jakkam u32 pmk_lifetime; 31847fc82af8SVeerendranath Jakkam u8 pmk_reauth_threshold; 318567fbb16bSSamuel Ortiz }; 31869930380fSJohannes Berg 31877643a2c3SJohannes Berg /** 318850ac6607SAmitkumar Karwar * struct cfg80211_pkt_pattern - packet pattern 3189ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 3190ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 3191ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 3192ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 3193bb92d199SAmitkumar Karwar * @pkt_offset: packet offset (in bytes) 3194ff1b6e69SJohannes Berg * 3195ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 3196ff1b6e69SJohannes Berg * memory, free @mask only! 3197ff1b6e69SJohannes Berg */ 319850ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern { 3199922bd80fSJohannes Berg const u8 *mask, *pattern; 3200ff1b6e69SJohannes Berg int pattern_len; 3201bb92d199SAmitkumar Karwar int pkt_offset; 3202ff1b6e69SJohannes Berg }; 3203ff1b6e69SJohannes Berg 3204ff1b6e69SJohannes Berg /** 32052a0e047eSJohannes Berg * struct cfg80211_wowlan_tcp - TCP connection parameters 32062a0e047eSJohannes Berg * 32072a0e047eSJohannes Berg * @sock: (internal) socket for source port allocation 32082a0e047eSJohannes Berg * @src: source IP address 32092a0e047eSJohannes Berg * @dst: destination IP address 32102a0e047eSJohannes Berg * @dst_mac: destination MAC address 32112a0e047eSJohannes Berg * @src_port: source port 32122a0e047eSJohannes Berg * @dst_port: destination port 32132a0e047eSJohannes Berg * @payload_len: data payload length 32142a0e047eSJohannes Berg * @payload: data payload buffer 32152a0e047eSJohannes Berg * @payload_seq: payload sequence stamping configuration 32162a0e047eSJohannes Berg * @data_interval: interval at which to send data packets 32172a0e047eSJohannes Berg * @wake_len: wakeup payload match length 32182a0e047eSJohannes Berg * @wake_data: wakeup payload match data 32192a0e047eSJohannes Berg * @wake_mask: wakeup payload match mask 32202a0e047eSJohannes Berg * @tokens_size: length of the tokens buffer 32212a0e047eSJohannes Berg * @payload_tok: payload token usage configuration 32222a0e047eSJohannes Berg */ 32232a0e047eSJohannes Berg struct cfg80211_wowlan_tcp { 32242a0e047eSJohannes Berg struct socket *sock; 32252a0e047eSJohannes Berg __be32 src, dst; 32262a0e047eSJohannes Berg u16 src_port, dst_port; 32272a0e047eSJohannes Berg u8 dst_mac[ETH_ALEN]; 32282a0e047eSJohannes Berg int payload_len; 32292a0e047eSJohannes Berg const u8 *payload; 32302a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_seq payload_seq; 32312a0e047eSJohannes Berg u32 data_interval; 32322a0e047eSJohannes Berg u32 wake_len; 32332a0e047eSJohannes Berg const u8 *wake_data, *wake_mask; 32342a0e047eSJohannes Berg u32 tokens_size; 32352a0e047eSJohannes Berg /* must be last, variable member */ 32362a0e047eSJohannes Berg struct nl80211_wowlan_tcp_data_token payload_tok; 3237ff1b6e69SJohannes Berg }; 3238ff1b6e69SJohannes Berg 3239ff1b6e69SJohannes Berg /** 3240ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 3241ff1b6e69SJohannes Berg * 3242ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 3243ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 3244ff1b6e69SJohannes Berg * operating as normal during suspend 3245ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 3246ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 3247ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 3248ff1b6e69SJohannes Berg * @n_patterns: number of patterns 324977dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 325077dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 325177dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 325277dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 32532a0e047eSJohannes Berg * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 32542a0e047eSJohannes Berg * NULL if not configured. 32558cd4d456SLuciano Coelho * @nd_config: configuration for the scan to be used for net detect wake. 3256ff1b6e69SJohannes Berg */ 3257ff1b6e69SJohannes Berg struct cfg80211_wowlan { 325877dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 325977dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 326077dbbb13SJohannes Berg rfkill_release; 326150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 32622a0e047eSJohannes Berg struct cfg80211_wowlan_tcp *tcp; 3263ff1b6e69SJohannes Berg int n_patterns; 32648cd4d456SLuciano Coelho struct cfg80211_sched_scan_request *nd_config; 3265ff1b6e69SJohannes Berg }; 3266ff1b6e69SJohannes Berg 3267ff1b6e69SJohannes Berg /** 3268be29b99aSAmitkumar Karwar * struct cfg80211_coalesce_rules - Coalesce rule parameters 3269be29b99aSAmitkumar Karwar * 3270be29b99aSAmitkumar Karwar * This structure defines coalesce rule for the device. 3271be29b99aSAmitkumar Karwar * @delay: maximum coalescing delay in msecs. 3272be29b99aSAmitkumar Karwar * @condition: condition for packet coalescence. 3273be29b99aSAmitkumar Karwar * see &enum nl80211_coalesce_condition. 3274be29b99aSAmitkumar Karwar * @patterns: array of packet patterns 3275be29b99aSAmitkumar Karwar * @n_patterns: number of patterns 3276be29b99aSAmitkumar Karwar */ 3277be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules { 3278be29b99aSAmitkumar Karwar int delay; 3279be29b99aSAmitkumar Karwar enum nl80211_coalesce_condition condition; 3280be29b99aSAmitkumar Karwar struct cfg80211_pkt_pattern *patterns; 3281be29b99aSAmitkumar Karwar int n_patterns; 3282be29b99aSAmitkumar Karwar }; 3283be29b99aSAmitkumar Karwar 3284be29b99aSAmitkumar Karwar /** 3285be29b99aSAmitkumar Karwar * struct cfg80211_coalesce - Packet coalescing settings 3286be29b99aSAmitkumar Karwar * 3287be29b99aSAmitkumar Karwar * This structure defines coalescing settings. 3288be29b99aSAmitkumar Karwar * @rules: array of coalesce rules 3289be29b99aSAmitkumar Karwar * @n_rules: number of rules 3290be29b99aSAmitkumar Karwar */ 3291be29b99aSAmitkumar Karwar struct cfg80211_coalesce { 3292be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules *rules; 3293be29b99aSAmitkumar Karwar int n_rules; 3294be29b99aSAmitkumar Karwar }; 3295be29b99aSAmitkumar Karwar 3296be29b99aSAmitkumar Karwar /** 32978cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_match - information about the match 32988cd4d456SLuciano Coelho * 32998cd4d456SLuciano Coelho * @ssid: SSID of the match that triggered the wake up 33008cd4d456SLuciano Coelho * @n_channels: Number of channels where the match occurred. This 33018cd4d456SLuciano Coelho * value may be zero if the driver can't report the channels. 33028cd4d456SLuciano Coelho * @channels: center frequencies of the channels where a match 33038cd4d456SLuciano Coelho * occurred (in MHz) 33048cd4d456SLuciano Coelho */ 33058cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match { 33068cd4d456SLuciano Coelho struct cfg80211_ssid ssid; 33078cd4d456SLuciano Coelho int n_channels; 33088cd4d456SLuciano Coelho u32 channels[]; 33098cd4d456SLuciano Coelho }; 33108cd4d456SLuciano Coelho 33118cd4d456SLuciano Coelho /** 33128cd4d456SLuciano Coelho * struct cfg80211_wowlan_nd_info - net detect wake up information 33138cd4d456SLuciano Coelho * 33148cd4d456SLuciano Coelho * @n_matches: Number of match information instances provided in 33158cd4d456SLuciano Coelho * @matches. This value may be zero if the driver can't provide 33168cd4d456SLuciano Coelho * match information. 33178cd4d456SLuciano Coelho * @matches: Array of pointers to matches containing information about 33188cd4d456SLuciano Coelho * the matches that triggered the wake up. 33198cd4d456SLuciano Coelho */ 33208cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info { 33218cd4d456SLuciano Coelho int n_matches; 33228cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match *matches[]; 33238cd4d456SLuciano Coelho }; 33248cd4d456SLuciano Coelho 33258cd4d456SLuciano Coelho /** 3326cd8f7cb4SJohannes Berg * struct cfg80211_wowlan_wakeup - wakeup report 3327cd8f7cb4SJohannes Berg * @disconnect: woke up by getting disconnected 3328cd8f7cb4SJohannes Berg * @magic_pkt: woke up by receiving magic packet 3329cd8f7cb4SJohannes Berg * @gtk_rekey_failure: woke up by GTK rekey failure 3330cd8f7cb4SJohannes Berg * @eap_identity_req: woke up by EAP identity request packet 3331cd8f7cb4SJohannes Berg * @four_way_handshake: woke up by 4-way handshake 3332cd8f7cb4SJohannes Berg * @rfkill_release: woke up by rfkill being released 3333cd8f7cb4SJohannes Berg * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern 3334cd8f7cb4SJohannes Berg * @packet_present_len: copied wakeup packet data 3335cd8f7cb4SJohannes Berg * @packet_len: original wakeup packet length 3336cd8f7cb4SJohannes Berg * @packet: The packet causing the wakeup, if any. 3337cd8f7cb4SJohannes Berg * @packet_80211: For pattern match, magic packet and other data 3338cd8f7cb4SJohannes Berg * frame triggers an 802.3 frame should be reported, for 3339cd8f7cb4SJohannes Berg * disconnect due to deauth 802.11 frame. This indicates which 3340cd8f7cb4SJohannes Berg * it is. 33412a0e047eSJohannes Berg * @tcp_match: TCP wakeup packet received 33422a0e047eSJohannes Berg * @tcp_connlost: TCP connection lost or failed to establish 33432a0e047eSJohannes Berg * @tcp_nomoretokens: TCP data ran out of tokens 33448cd4d456SLuciano Coelho * @net_detect: if not %NULL, woke up because of net detect 3345cd8f7cb4SJohannes Berg */ 3346cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup { 3347cd8f7cb4SJohannes Berg bool disconnect, magic_pkt, gtk_rekey_failure, 3348cd8f7cb4SJohannes Berg eap_identity_req, four_way_handshake, 33492a0e047eSJohannes Berg rfkill_release, packet_80211, 33502a0e047eSJohannes Berg tcp_match, tcp_connlost, tcp_nomoretokens; 3351cd8f7cb4SJohannes Berg s32 pattern_idx; 3352cd8f7cb4SJohannes Berg u32 packet_present_len, packet_len; 3353cd8f7cb4SJohannes Berg const void *packet; 33548cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info *net_detect; 3355cd8f7cb4SJohannes Berg }; 3356cd8f7cb4SJohannes Berg 3357cd8f7cb4SJohannes Berg /** 3358e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 3359093a48d2SNathan Errera * @kek: key encryption key (@kek_len bytes) 3360093a48d2SNathan Errera * @kck: key confirmation key (@kck_len bytes) 336178f686caSJohannes Berg * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes) 3362093a48d2SNathan Errera * @kek_len: length of kek 33632d8b08feSMauro Carvalho Chehab * @kck_len: length of kck 3364093a48d2SNathan Errera * @akm: akm (oui, id) 3365e5497d76SJohannes Berg */ 3366e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 336778f686caSJohannes Berg const u8 *kek, *kck, *replay_ctr; 3368093a48d2SNathan Errera u32 akm; 3369093a48d2SNathan Errera u8 kek_len, kck_len; 3370e5497d76SJohannes Berg }; 3371e5497d76SJohannes Berg 3372e5497d76SJohannes Berg /** 3373355199e0SJouni Malinen * struct cfg80211_update_ft_ies_params - FT IE Information 3374355199e0SJouni Malinen * 3375355199e0SJouni Malinen * This structure provides information needed to update the fast transition IE 3376355199e0SJouni Malinen * 3377355199e0SJouni Malinen * @md: The Mobility Domain ID, 2 Octet value 3378355199e0SJouni Malinen * @ie: Fast Transition IEs 3379355199e0SJouni Malinen * @ie_len: Length of ft_ie in octets 3380355199e0SJouni Malinen */ 3381355199e0SJouni Malinen struct cfg80211_update_ft_ies_params { 3382355199e0SJouni Malinen u16 md; 3383355199e0SJouni Malinen const u8 *ie; 3384355199e0SJouni Malinen size_t ie_len; 3385355199e0SJouni Malinen }; 3386355199e0SJouni Malinen 3387355199e0SJouni Malinen /** 3388b176e629SAndrei Otcheretianski * struct cfg80211_mgmt_tx_params - mgmt tx parameters 3389b176e629SAndrei Otcheretianski * 3390b176e629SAndrei Otcheretianski * This structure provides information needed to transmit a mgmt frame 3391b176e629SAndrei Otcheretianski * 3392b176e629SAndrei Otcheretianski * @chan: channel to use 3393b176e629SAndrei Otcheretianski * @offchan: indicates wether off channel operation is required 3394b176e629SAndrei Otcheretianski * @wait: duration for ROC 3395b176e629SAndrei Otcheretianski * @buf: buffer to transmit 3396b176e629SAndrei Otcheretianski * @len: buffer length 3397b176e629SAndrei Otcheretianski * @no_cck: don't use cck rates for this frame 3398b176e629SAndrei Otcheretianski * @dont_wait_for_ack: tells the low level not to wait for an ack 339934d22ce2SAndrei Otcheretianski * @n_csa_offsets: length of csa_offsets array 340034d22ce2SAndrei Otcheretianski * @csa_offsets: array of all the csa offsets in the frame 3401b176e629SAndrei Otcheretianski */ 3402b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params { 3403b176e629SAndrei Otcheretianski struct ieee80211_channel *chan; 3404b176e629SAndrei Otcheretianski bool offchan; 3405b176e629SAndrei Otcheretianski unsigned int wait; 3406b176e629SAndrei Otcheretianski const u8 *buf; 3407b176e629SAndrei Otcheretianski size_t len; 3408b176e629SAndrei Otcheretianski bool no_cck; 3409b176e629SAndrei Otcheretianski bool dont_wait_for_ack; 341034d22ce2SAndrei Otcheretianski int n_csa_offsets; 341134d22ce2SAndrei Otcheretianski const u16 *csa_offsets; 3412b176e629SAndrei Otcheretianski }; 3413b176e629SAndrei Otcheretianski 3414b176e629SAndrei Otcheretianski /** 3415fa9ffc74SKyeyoon Park * struct cfg80211_dscp_exception - DSCP exception 3416fa9ffc74SKyeyoon Park * 3417fa9ffc74SKyeyoon Park * @dscp: DSCP value that does not adhere to the user priority range definition 3418fa9ffc74SKyeyoon Park * @up: user priority value to which the corresponding DSCP value belongs 3419fa9ffc74SKyeyoon Park */ 3420fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception { 3421fa9ffc74SKyeyoon Park u8 dscp; 3422fa9ffc74SKyeyoon Park u8 up; 3423fa9ffc74SKyeyoon Park }; 3424fa9ffc74SKyeyoon Park 3425fa9ffc74SKyeyoon Park /** 3426fa9ffc74SKyeyoon Park * struct cfg80211_dscp_range - DSCP range definition for user priority 3427fa9ffc74SKyeyoon Park * 3428fa9ffc74SKyeyoon Park * @low: lowest DSCP value of this user priority range, inclusive 3429fa9ffc74SKyeyoon Park * @high: highest DSCP value of this user priority range, inclusive 3430fa9ffc74SKyeyoon Park */ 3431fa9ffc74SKyeyoon Park struct cfg80211_dscp_range { 3432fa9ffc74SKyeyoon Park u8 low; 3433fa9ffc74SKyeyoon Park u8 high; 3434fa9ffc74SKyeyoon Park }; 3435fa9ffc74SKyeyoon Park 3436fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */ 3437fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX 21 3438fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN 16 3439fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \ 3440fa9ffc74SKyeyoon Park (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX) 3441fa9ffc74SKyeyoon Park 3442fa9ffc74SKyeyoon Park /** 3443fa9ffc74SKyeyoon Park * struct cfg80211_qos_map - QoS Map Information 3444fa9ffc74SKyeyoon Park * 3445fa9ffc74SKyeyoon Park * This struct defines the Interworking QoS map setting for DSCP values 3446fa9ffc74SKyeyoon Park * 3447fa9ffc74SKyeyoon Park * @num_des: number of DSCP exceptions (0..21) 3448fa9ffc74SKyeyoon Park * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from 3449fa9ffc74SKyeyoon Park * the user priority DSCP range definition 3450fa9ffc74SKyeyoon Park * @up: DSCP range definition for a particular user priority 3451fa9ffc74SKyeyoon Park */ 3452fa9ffc74SKyeyoon Park struct cfg80211_qos_map { 3453fa9ffc74SKyeyoon Park u8 num_des; 3454fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX]; 3455fa9ffc74SKyeyoon Park struct cfg80211_dscp_range up[8]; 3456fa9ffc74SKyeyoon Park }; 3457fa9ffc74SKyeyoon Park 3458fa9ffc74SKyeyoon Park /** 3459cb3b7d87SAyala Beker * struct cfg80211_nan_conf - NAN configuration 3460cb3b7d87SAyala Beker * 3461cb3b7d87SAyala Beker * This struct defines NAN configuration parameters 3462cb3b7d87SAyala Beker * 3463cb3b7d87SAyala Beker * @master_pref: master preference (1 - 255) 34648585989dSLuca Coelho * @bands: operating bands, a bitmap of &enum nl80211_band values. 34658585989dSLuca Coelho * For instance, for NL80211_BAND_2GHZ, bit 0 would be set 34668585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 3467cb3b7d87SAyala Beker */ 3468cb3b7d87SAyala Beker struct cfg80211_nan_conf { 3469cb3b7d87SAyala Beker u8 master_pref; 34708585989dSLuca Coelho u8 bands; 3471cb3b7d87SAyala Beker }; 3472cb3b7d87SAyala Beker 3473cb3b7d87SAyala Beker /** 3474a5a9dcf2SAyala Beker * enum cfg80211_nan_conf_changes - indicates changed fields in NAN 3475a5a9dcf2SAyala Beker * configuration 3476a5a9dcf2SAyala Beker * 3477a5a9dcf2SAyala Beker * @CFG80211_NAN_CONF_CHANGED_PREF: master preference 34788585989dSLuca Coelho * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands 3479a5a9dcf2SAyala Beker */ 3480a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes { 3481a5a9dcf2SAyala Beker CFG80211_NAN_CONF_CHANGED_PREF = BIT(0), 34828585989dSLuca Coelho CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1), 3483a5a9dcf2SAyala Beker }; 3484a5a9dcf2SAyala Beker 3485a5a9dcf2SAyala Beker /** 3486a442b761SAyala Beker * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter 3487a442b761SAyala Beker * 3488a442b761SAyala Beker * @filter: the content of the filter 3489a442b761SAyala Beker * @len: the length of the filter 3490a442b761SAyala Beker */ 3491a442b761SAyala Beker struct cfg80211_nan_func_filter { 3492a442b761SAyala Beker const u8 *filter; 3493a442b761SAyala Beker u8 len; 3494a442b761SAyala Beker }; 3495a442b761SAyala Beker 3496a442b761SAyala Beker /** 3497a442b761SAyala Beker * struct cfg80211_nan_func - a NAN function 3498a442b761SAyala Beker * 3499a442b761SAyala Beker * @type: &enum nl80211_nan_function_type 3500a442b761SAyala Beker * @service_id: the service ID of the function 3501a442b761SAyala Beker * @publish_type: &nl80211_nan_publish_type 3502a442b761SAyala Beker * @close_range: if true, the range should be limited. Threshold is 3503a442b761SAyala Beker * implementation specific. 3504a442b761SAyala Beker * @publish_bcast: if true, the solicited publish should be broadcasted 3505a442b761SAyala Beker * @subscribe_active: if true, the subscribe is active 3506a442b761SAyala Beker * @followup_id: the instance ID for follow up 3507a442b761SAyala Beker * @followup_reqid: the requestor instance ID for follow up 3508a442b761SAyala Beker * @followup_dest: MAC address of the recipient of the follow up 3509a442b761SAyala Beker * @ttl: time to live counter in DW. 3510a442b761SAyala Beker * @serv_spec_info: Service Specific Info 3511a442b761SAyala Beker * @serv_spec_info_len: Service Specific Info length 3512a442b761SAyala Beker * @srf_include: if true, SRF is inclusive 3513a442b761SAyala Beker * @srf_bf: Bloom Filter 3514a442b761SAyala Beker * @srf_bf_len: Bloom Filter length 3515a442b761SAyala Beker * @srf_bf_idx: Bloom Filter index 3516a442b761SAyala Beker * @srf_macs: SRF MAC addresses 3517a442b761SAyala Beker * @srf_num_macs: number of MAC addresses in SRF 3518a442b761SAyala Beker * @rx_filters: rx filters that are matched with corresponding peer's tx_filter 3519a442b761SAyala Beker * @tx_filters: filters that should be transmitted in the SDF. 3520a442b761SAyala Beker * @num_rx_filters: length of &rx_filters. 3521a442b761SAyala Beker * @num_tx_filters: length of &tx_filters. 3522a442b761SAyala Beker * @instance_id: driver allocated id of the function. 3523a442b761SAyala Beker * @cookie: unique NAN function identifier. 3524a442b761SAyala Beker */ 3525a442b761SAyala Beker struct cfg80211_nan_func { 3526a442b761SAyala Beker enum nl80211_nan_function_type type; 3527a442b761SAyala Beker u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; 3528a442b761SAyala Beker u8 publish_type; 3529a442b761SAyala Beker bool close_range; 3530a442b761SAyala Beker bool publish_bcast; 3531a442b761SAyala Beker bool subscribe_active; 3532a442b761SAyala Beker u8 followup_id; 3533a442b761SAyala Beker u8 followup_reqid; 3534a442b761SAyala Beker struct mac_address followup_dest; 3535a442b761SAyala Beker u32 ttl; 3536a442b761SAyala Beker const u8 *serv_spec_info; 3537a442b761SAyala Beker u8 serv_spec_info_len; 3538a442b761SAyala Beker bool srf_include; 3539a442b761SAyala Beker const u8 *srf_bf; 3540a442b761SAyala Beker u8 srf_bf_len; 3541a442b761SAyala Beker u8 srf_bf_idx; 3542a442b761SAyala Beker struct mac_address *srf_macs; 3543a442b761SAyala Beker int srf_num_macs; 3544a442b761SAyala Beker struct cfg80211_nan_func_filter *rx_filters; 3545a442b761SAyala Beker struct cfg80211_nan_func_filter *tx_filters; 3546a442b761SAyala Beker u8 num_tx_filters; 3547a442b761SAyala Beker u8 num_rx_filters; 3548a442b761SAyala Beker u8 instance_id; 3549a442b761SAyala Beker u64 cookie; 3550a442b761SAyala Beker }; 3551a442b761SAyala Beker 3552a442b761SAyala Beker /** 35533a00df57SAvraham Stern * struct cfg80211_pmk_conf - PMK configuration 35543a00df57SAvraham Stern * 35553a00df57SAvraham Stern * @aa: authenticator address 35563a00df57SAvraham Stern * @pmk_len: PMK length in bytes. 35573a00df57SAvraham Stern * @pmk: the PMK material 35583a00df57SAvraham Stern * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK 35593a00df57SAvraham Stern * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field 35603a00df57SAvraham Stern * holds PMK-R0. 35613a00df57SAvraham Stern */ 35623a00df57SAvraham Stern struct cfg80211_pmk_conf { 35633a00df57SAvraham Stern const u8 *aa; 35643a00df57SAvraham Stern u8 pmk_len; 35653a00df57SAvraham Stern const u8 *pmk; 35663a00df57SAvraham Stern const u8 *pmk_r0_name; 35673a00df57SAvraham Stern }; 35683a00df57SAvraham Stern 35693a00df57SAvraham Stern /** 357040cbfa90SSrinivas Dasari * struct cfg80211_external_auth_params - Trigger External authentication. 357140cbfa90SSrinivas Dasari * 357240cbfa90SSrinivas Dasari * Commonly used across the external auth request and event interfaces. 357340cbfa90SSrinivas Dasari * 357440cbfa90SSrinivas Dasari * @action: action type / trigger for external authentication. Only significant 357540cbfa90SSrinivas Dasari * for the authentication request event interface (driver to user space). 357640cbfa90SSrinivas Dasari * @bssid: BSSID of the peer with which the authentication has 357740cbfa90SSrinivas Dasari * to happen. Used by both the authentication request event and 357840cbfa90SSrinivas Dasari * authentication response command interface. 357940cbfa90SSrinivas Dasari * @ssid: SSID of the AP. Used by both the authentication request event and 358040cbfa90SSrinivas Dasari * authentication response command interface. 358140cbfa90SSrinivas Dasari * @key_mgmt_suite: AKM suite of the respective authentication. Used by the 358240cbfa90SSrinivas Dasari * authentication request event interface. 358340cbfa90SSrinivas Dasari * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication, 358440cbfa90SSrinivas Dasari * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you 358540cbfa90SSrinivas Dasari * the real status code for failures. Used only for the authentication 358640cbfa90SSrinivas Dasari * response command interface (user space to driver). 3587fe494370SSrinivas Dasari * @pmkid: The identifier to refer a PMKSA. 358840cbfa90SSrinivas Dasari */ 358940cbfa90SSrinivas Dasari struct cfg80211_external_auth_params { 359040cbfa90SSrinivas Dasari enum nl80211_external_auth_action action; 359140cbfa90SSrinivas Dasari u8 bssid[ETH_ALEN] __aligned(2); 359240cbfa90SSrinivas Dasari struct cfg80211_ssid ssid; 359340cbfa90SSrinivas Dasari unsigned int key_mgmt_suite; 359440cbfa90SSrinivas Dasari u16 status; 3595fe494370SSrinivas Dasari const u8 *pmkid; 359640cbfa90SSrinivas Dasari }; 359740cbfa90SSrinivas Dasari 359840cbfa90SSrinivas Dasari /** 35993453de98SRandy Dunlap * struct cfg80211_ftm_responder_stats - FTM responder statistics 360081e54d08SPradeep Kumar Chitrapu * 360181e54d08SPradeep Kumar Chitrapu * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to 360281e54d08SPradeep Kumar Chitrapu * indicate the relevant values in this struct for them 360381e54d08SPradeep Kumar Chitrapu * @success_num: number of FTM sessions in which all frames were successfully 360481e54d08SPradeep Kumar Chitrapu * answered 360581e54d08SPradeep Kumar Chitrapu * @partial_num: number of FTM sessions in which part of frames were 360681e54d08SPradeep Kumar Chitrapu * successfully answered 360781e54d08SPradeep Kumar Chitrapu * @failed_num: number of failed FTM sessions 360881e54d08SPradeep Kumar Chitrapu * @asap_num: number of ASAP FTM sessions 360981e54d08SPradeep Kumar Chitrapu * @non_asap_num: number of non-ASAP FTM sessions 361081e54d08SPradeep Kumar Chitrapu * @total_duration_ms: total sessions durations - gives an indication 361181e54d08SPradeep Kumar Chitrapu * of how much time the responder was busy 361281e54d08SPradeep Kumar Chitrapu * @unknown_triggers_num: number of unknown FTM triggers - triggers from 361381e54d08SPradeep Kumar Chitrapu * initiators that didn't finish successfully the negotiation phase with 361481e54d08SPradeep Kumar Chitrapu * the responder 361581e54d08SPradeep Kumar Chitrapu * @reschedule_requests_num: number of FTM reschedule requests - initiator asks 361681e54d08SPradeep Kumar Chitrapu * for a new scheduling although it already has scheduled FTM slot 361781e54d08SPradeep Kumar Chitrapu * @out_of_window_triggers_num: total FTM triggers out of scheduled window 361881e54d08SPradeep Kumar Chitrapu */ 361981e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats { 362081e54d08SPradeep Kumar Chitrapu u32 filled; 362181e54d08SPradeep Kumar Chitrapu u32 success_num; 362281e54d08SPradeep Kumar Chitrapu u32 partial_num; 362381e54d08SPradeep Kumar Chitrapu u32 failed_num; 362481e54d08SPradeep Kumar Chitrapu u32 asap_num; 362581e54d08SPradeep Kumar Chitrapu u32 non_asap_num; 362681e54d08SPradeep Kumar Chitrapu u64 total_duration_ms; 362781e54d08SPradeep Kumar Chitrapu u32 unknown_triggers_num; 362881e54d08SPradeep Kumar Chitrapu u32 reschedule_requests_num; 362981e54d08SPradeep Kumar Chitrapu u32 out_of_window_triggers_num; 363081e54d08SPradeep Kumar Chitrapu }; 363181e54d08SPradeep Kumar Chitrapu 363281e54d08SPradeep Kumar Chitrapu /** 36339bb7e0f2SJohannes Berg * struct cfg80211_pmsr_ftm_result - FTM result 36349bb7e0f2SJohannes Berg * @failure_reason: if this measurement failed (PMSR status is 36359bb7e0f2SJohannes Berg * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise 36369bb7e0f2SJohannes Berg * reason than just "failure" 36379bb7e0f2SJohannes Berg * @burst_index: if reporting partial results, this is the index 36389bb7e0f2SJohannes Berg * in [0 .. num_bursts-1] of the burst that's being reported 36399bb7e0f2SJohannes Berg * @num_ftmr_attempts: number of FTM request frames transmitted 36409bb7e0f2SJohannes Berg * @num_ftmr_successes: number of FTM request frames acked 36419bb7e0f2SJohannes Berg * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY, 36429bb7e0f2SJohannes Berg * fill this to indicate in how many seconds a retry is deemed possible 36439bb7e0f2SJohannes Berg * by the responder 36449bb7e0f2SJohannes Berg * @num_bursts_exp: actual number of bursts exponent negotiated 36459bb7e0f2SJohannes Berg * @burst_duration: actual burst duration negotiated 36469bb7e0f2SJohannes Berg * @ftms_per_burst: actual FTMs per burst negotiated 36479bb7e0f2SJohannes Berg * @lci_len: length of LCI information (if present) 36489bb7e0f2SJohannes Berg * @civicloc_len: length of civic location information (if present) 36499bb7e0f2SJohannes Berg * @lci: LCI data (may be %NULL) 36509bb7e0f2SJohannes Berg * @civicloc: civic location data (may be %NULL) 36519bb7e0f2SJohannes Berg * @rssi_avg: average RSSI over FTM action frames reported 36529bb7e0f2SJohannes Berg * @rssi_spread: spread of the RSSI over FTM action frames reported 36539bb7e0f2SJohannes Berg * @tx_rate: bitrate for transmitted FTM action frame response 36549bb7e0f2SJohannes Berg * @rx_rate: bitrate of received FTM action frame 36559bb7e0f2SJohannes Berg * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) 36569bb7e0f2SJohannes Berg * @rtt_variance: variance of RTTs measured (note that standard deviation is 36579bb7e0f2SJohannes Berg * the square root of the variance) 36589bb7e0f2SJohannes Berg * @rtt_spread: spread of the RTTs measured 36599bb7e0f2SJohannes Berg * @dist_avg: average of distances (mm) measured 36609bb7e0f2SJohannes Berg * (must have either this or @rtt_avg) 36619bb7e0f2SJohannes Berg * @dist_variance: variance of distances measured (see also @rtt_variance) 36629bb7e0f2SJohannes Berg * @dist_spread: spread of distances measured (see also @rtt_spread) 36639bb7e0f2SJohannes Berg * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid 36649bb7e0f2SJohannes Berg * @num_ftmr_successes_valid: @num_ftmr_successes is valid 36659bb7e0f2SJohannes Berg * @rssi_avg_valid: @rssi_avg is valid 36669bb7e0f2SJohannes Berg * @rssi_spread_valid: @rssi_spread is valid 36679bb7e0f2SJohannes Berg * @tx_rate_valid: @tx_rate is valid 36689bb7e0f2SJohannes Berg * @rx_rate_valid: @rx_rate is valid 36699bb7e0f2SJohannes Berg * @rtt_avg_valid: @rtt_avg is valid 36709bb7e0f2SJohannes Berg * @rtt_variance_valid: @rtt_variance is valid 36719bb7e0f2SJohannes Berg * @rtt_spread_valid: @rtt_spread is valid 36729bb7e0f2SJohannes Berg * @dist_avg_valid: @dist_avg is valid 36739bb7e0f2SJohannes Berg * @dist_variance_valid: @dist_variance is valid 36749bb7e0f2SJohannes Berg * @dist_spread_valid: @dist_spread is valid 36759bb7e0f2SJohannes Berg */ 36769bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result { 36779bb7e0f2SJohannes Berg const u8 *lci; 36789bb7e0f2SJohannes Berg const u8 *civicloc; 36799bb7e0f2SJohannes Berg unsigned int lci_len; 36809bb7e0f2SJohannes Berg unsigned int civicloc_len; 36819bb7e0f2SJohannes Berg enum nl80211_peer_measurement_ftm_failure_reasons failure_reason; 36829bb7e0f2SJohannes Berg u32 num_ftmr_attempts, num_ftmr_successes; 36839bb7e0f2SJohannes Berg s16 burst_index; 36849bb7e0f2SJohannes Berg u8 busy_retry_time; 36859bb7e0f2SJohannes Berg u8 num_bursts_exp; 36869bb7e0f2SJohannes Berg u8 burst_duration; 36879bb7e0f2SJohannes Berg u8 ftms_per_burst; 36889bb7e0f2SJohannes Berg s32 rssi_avg; 36899bb7e0f2SJohannes Berg s32 rssi_spread; 36909bb7e0f2SJohannes Berg struct rate_info tx_rate, rx_rate; 36919bb7e0f2SJohannes Berg s64 rtt_avg; 36929bb7e0f2SJohannes Berg s64 rtt_variance; 36939bb7e0f2SJohannes Berg s64 rtt_spread; 36949bb7e0f2SJohannes Berg s64 dist_avg; 36959bb7e0f2SJohannes Berg s64 dist_variance; 36969bb7e0f2SJohannes Berg s64 dist_spread; 36979bb7e0f2SJohannes Berg 36989bb7e0f2SJohannes Berg u16 num_ftmr_attempts_valid:1, 36999bb7e0f2SJohannes Berg num_ftmr_successes_valid:1, 37009bb7e0f2SJohannes Berg rssi_avg_valid:1, 37019bb7e0f2SJohannes Berg rssi_spread_valid:1, 37029bb7e0f2SJohannes Berg tx_rate_valid:1, 37039bb7e0f2SJohannes Berg rx_rate_valid:1, 37049bb7e0f2SJohannes Berg rtt_avg_valid:1, 37059bb7e0f2SJohannes Berg rtt_variance_valid:1, 37069bb7e0f2SJohannes Berg rtt_spread_valid:1, 37079bb7e0f2SJohannes Berg dist_avg_valid:1, 37089bb7e0f2SJohannes Berg dist_variance_valid:1, 37099bb7e0f2SJohannes Berg dist_spread_valid:1; 37109bb7e0f2SJohannes Berg }; 37119bb7e0f2SJohannes Berg 37129bb7e0f2SJohannes Berg /** 37139bb7e0f2SJohannes Berg * struct cfg80211_pmsr_result - peer measurement result 37149bb7e0f2SJohannes Berg * @addr: address of the peer 37159bb7e0f2SJohannes Berg * @host_time: host time (use ktime_get_boottime() adjust to the time when the 37169bb7e0f2SJohannes Berg * measurement was made) 37179bb7e0f2SJohannes Berg * @ap_tsf: AP's TSF at measurement time 37189bb7e0f2SJohannes Berg * @status: status of the measurement 37199bb7e0f2SJohannes Berg * @final: if reporting partial results, mark this as the last one; if not 37209bb7e0f2SJohannes Berg * reporting partial results always set this flag 37219bb7e0f2SJohannes Berg * @ap_tsf_valid: indicates the @ap_tsf value is valid 37229bb7e0f2SJohannes Berg * @type: type of the measurement reported, note that we only support reporting 37239bb7e0f2SJohannes Berg * one type at a time, but you can report multiple results separately and 37249bb7e0f2SJohannes Berg * they're all aggregated for userspace. 37252d8b08feSMauro Carvalho Chehab * @ftm: FTM result 37269bb7e0f2SJohannes Berg */ 37279bb7e0f2SJohannes Berg struct cfg80211_pmsr_result { 37289bb7e0f2SJohannes Berg u64 host_time, ap_tsf; 37299bb7e0f2SJohannes Berg enum nl80211_peer_measurement_status status; 37309bb7e0f2SJohannes Berg 37319bb7e0f2SJohannes Berg u8 addr[ETH_ALEN]; 37329bb7e0f2SJohannes Berg 37339bb7e0f2SJohannes Berg u8 final:1, 37349bb7e0f2SJohannes Berg ap_tsf_valid:1; 37359bb7e0f2SJohannes Berg 37369bb7e0f2SJohannes Berg enum nl80211_peer_measurement_type type; 37379bb7e0f2SJohannes Berg 37389bb7e0f2SJohannes Berg union { 37399bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result ftm; 37409bb7e0f2SJohannes Berg }; 37419bb7e0f2SJohannes Berg }; 37429bb7e0f2SJohannes Berg 37439bb7e0f2SJohannes Berg /** 37449bb7e0f2SJohannes Berg * struct cfg80211_pmsr_ftm_request_peer - FTM request data 37459bb7e0f2SJohannes Berg * @requested: indicates FTM is requested 37469bb7e0f2SJohannes Berg * @preamble: frame preamble to use 37479bb7e0f2SJohannes Berg * @burst_period: burst period to use 37489bb7e0f2SJohannes Berg * @asap: indicates to use ASAP mode 37499bb7e0f2SJohannes Berg * @num_bursts_exp: number of bursts exponent 37509bb7e0f2SJohannes Berg * @burst_duration: burst duration 37519bb7e0f2SJohannes Berg * @ftms_per_burst: number of FTMs per burst 37529bb7e0f2SJohannes Berg * @ftmr_retries: number of retries for FTM request 37539bb7e0f2SJohannes Berg * @request_lci: request LCI information 37549bb7e0f2SJohannes Berg * @request_civicloc: request civic location information 3755efb5520dSAvraham Stern * @trigger_based: use trigger based ranging for the measurement 3756efb5520dSAvraham Stern * If neither @trigger_based nor @non_trigger_based is set, 3757efb5520dSAvraham Stern * EDCA based ranging will be used. 3758efb5520dSAvraham Stern * @non_trigger_based: use non trigger based ranging for the measurement 3759efb5520dSAvraham Stern * If neither @trigger_based nor @non_trigger_based is set, 3760efb5520dSAvraham Stern * EDCA based ranging will be used. 376173807523SAvraham Stern * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either 376273807523SAvraham Stern * @trigger_based or @non_trigger_based is set. 3763dd3e4fc7SAvraham Stern * @bss_color: the bss color of the responder. Optional. Set to zero to 3764dd3e4fc7SAvraham Stern * indicate the driver should set the BSS color. Only valid if 3765dd3e4fc7SAvraham Stern * @non_trigger_based or @trigger_based is set. 37669bb7e0f2SJohannes Berg * 37679bb7e0f2SJohannes Berg * See also nl80211 for the respective attribute documentation. 37689bb7e0f2SJohannes Berg */ 37699bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer { 37709bb7e0f2SJohannes Berg enum nl80211_preamble preamble; 37719bb7e0f2SJohannes Berg u16 burst_period; 37729bb7e0f2SJohannes Berg u8 requested:1, 37739bb7e0f2SJohannes Berg asap:1, 37749bb7e0f2SJohannes Berg request_lci:1, 3775efb5520dSAvraham Stern request_civicloc:1, 3776efb5520dSAvraham Stern trigger_based:1, 377773807523SAvraham Stern non_trigger_based:1, 377873807523SAvraham Stern lmr_feedback:1; 37799bb7e0f2SJohannes Berg u8 num_bursts_exp; 37809bb7e0f2SJohannes Berg u8 burst_duration; 37819bb7e0f2SJohannes Berg u8 ftms_per_burst; 37829bb7e0f2SJohannes Berg u8 ftmr_retries; 3783dd3e4fc7SAvraham Stern u8 bss_color; 37849bb7e0f2SJohannes Berg }; 37859bb7e0f2SJohannes Berg 37869bb7e0f2SJohannes Berg /** 37879bb7e0f2SJohannes Berg * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request 37889bb7e0f2SJohannes Berg * @addr: MAC address 37899bb7e0f2SJohannes Berg * @chandef: channel to use 37909bb7e0f2SJohannes Berg * @report_ap_tsf: report the associated AP's TSF 37919bb7e0f2SJohannes Berg * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer 37929bb7e0f2SJohannes Berg */ 37939bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer { 37949bb7e0f2SJohannes Berg u8 addr[ETH_ALEN]; 37959bb7e0f2SJohannes Berg struct cfg80211_chan_def chandef; 37969bb7e0f2SJohannes Berg u8 report_ap_tsf:1; 37979bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer ftm; 37989bb7e0f2SJohannes Berg }; 37999bb7e0f2SJohannes Berg 38009bb7e0f2SJohannes Berg /** 38019bb7e0f2SJohannes Berg * struct cfg80211_pmsr_request - peer measurement request 38029bb7e0f2SJohannes Berg * @cookie: cookie, set by cfg80211 38039bb7e0f2SJohannes Berg * @nl_portid: netlink portid - used by cfg80211 38049bb7e0f2SJohannes Berg * @drv_data: driver data for this request, if required for aborting, 38059bb7e0f2SJohannes Berg * not otherwise freed or anything by cfg80211 38069bb7e0f2SJohannes Berg * @mac_addr: MAC address used for (randomised) request 38079bb7e0f2SJohannes Berg * @mac_addr_mask: MAC address mask used for randomisation, bits that 38089bb7e0f2SJohannes Berg * are 0 in the mask should be randomised, bits that are 1 should 38099bb7e0f2SJohannes Berg * be taken from the @mac_addr 38109bb7e0f2SJohannes Berg * @list: used by cfg80211 to hold on to the request 38119bb7e0f2SJohannes Berg * @timeout: timeout (in milliseconds) for the whole operation, if 38129bb7e0f2SJohannes Berg * zero it means there's no timeout 38139bb7e0f2SJohannes Berg * @n_peers: number of peers to do measurements with 38149bb7e0f2SJohannes Berg * @peers: per-peer measurement request data 38159bb7e0f2SJohannes Berg */ 38169bb7e0f2SJohannes Berg struct cfg80211_pmsr_request { 38179bb7e0f2SJohannes Berg u64 cookie; 38189bb7e0f2SJohannes Berg void *drv_data; 38199bb7e0f2SJohannes Berg u32 n_peers; 38209bb7e0f2SJohannes Berg u32 nl_portid; 38219bb7e0f2SJohannes Berg 38229bb7e0f2SJohannes Berg u32 timeout; 38239bb7e0f2SJohannes Berg 38249bb7e0f2SJohannes Berg u8 mac_addr[ETH_ALEN] __aligned(2); 38259bb7e0f2SJohannes Berg u8 mac_addr_mask[ETH_ALEN] __aligned(2); 38269bb7e0f2SJohannes Berg 38279bb7e0f2SJohannes Berg struct list_head list; 38289bb7e0f2SJohannes Berg 38299bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer peers[]; 38309bb7e0f2SJohannes Berg }; 38319bb7e0f2SJohannes Berg 38329bb7e0f2SJohannes Berg /** 3833cb74e977SSunil Dutt * struct cfg80211_update_owe_info - OWE Information 3834cb74e977SSunil Dutt * 3835cb74e977SSunil Dutt * This structure provides information needed for the drivers to offload OWE 3836cb74e977SSunil Dutt * (Opportunistic Wireless Encryption) processing to the user space. 3837cb74e977SSunil Dutt * 3838cb74e977SSunil Dutt * Commonly used across update_owe_info request and event interfaces. 3839cb74e977SSunil Dutt * 3840cb74e977SSunil Dutt * @peer: MAC address of the peer device for which the OWE processing 3841cb74e977SSunil Dutt * has to be done. 3842cb74e977SSunil Dutt * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info 3843cb74e977SSunil Dutt * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space 3844cb74e977SSunil Dutt * cannot give you the real status code for failures. Used only for 3845cb74e977SSunil Dutt * OWE update request command interface (user space to driver). 3846cb74e977SSunil Dutt * @ie: IEs obtained from the peer or constructed by the user space. These are 3847cb74e977SSunil Dutt * the IEs of the remote peer in the event from the host driver and 3848cb74e977SSunil Dutt * the constructed IEs by the user space in the request interface. 3849cb74e977SSunil Dutt * @ie_len: Length of IEs in octets. 3850cb74e977SSunil Dutt */ 3851cb74e977SSunil Dutt struct cfg80211_update_owe_info { 3852cb74e977SSunil Dutt u8 peer[ETH_ALEN] __aligned(2); 3853cb74e977SSunil Dutt u16 status; 3854cb74e977SSunil Dutt const u8 *ie; 3855cb74e977SSunil Dutt size_t ie_len; 3856cb74e977SSunil Dutt }; 3857cb74e977SSunil Dutt 3858cb74e977SSunil Dutt /** 38596cd536feSJohannes Berg * struct mgmt_frame_regs - management frame registrations data 38606cd536feSJohannes Berg * @global_stypes: bitmap of management frame subtypes registered 38616cd536feSJohannes Berg * for the entire device 38626cd536feSJohannes Berg * @interface_stypes: bitmap of management frame subtypes registered 38636cd536feSJohannes Berg * for the given interface 38642d8b08feSMauro Carvalho Chehab * @global_mcast_stypes: mcast RX is needed globally for these subtypes 38659dba48a6SJohannes Berg * @interface_mcast_stypes: mcast RX is needed on this interface 38669dba48a6SJohannes Berg * for these subtypes 38676cd536feSJohannes Berg */ 38686cd536feSJohannes Berg struct mgmt_frame_regs { 38696cd536feSJohannes Berg u32 global_stypes, interface_stypes; 38709dba48a6SJohannes Berg u32 global_mcast_stypes, interface_mcast_stypes; 38716cd536feSJohannes Berg }; 38726cd536feSJohannes Berg 38736cd536feSJohannes Berg /** 3874704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 3875704232c2SJohannes Berg * 3876704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 3877704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 3878704232c2SJohannes Berg * 3879704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 3880704232c2SJohannes Berg * on success or a negative error code. 3881704232c2SJohannes Berg * 3882a05829a7SJohannes Berg * All operations are invoked with the wiphy mutex held. The RTNL may be 3883a05829a7SJohannes Berg * held in addition (due to wireless extensions) but this cannot be relied 3884a05829a7SJohannes Berg * upon except in cases where documented below. Note that due to ordering, 3885a05829a7SJohannes Berg * the RTNL also cannot be acquired in any handlers. 388643fb45cbSJohannes Berg * 3887ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 3888ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 3889ff1b6e69SJohannes Berg * configured for the device. 38900378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 38916d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 38926d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 38936d52563fSJohannes Berg * the device. 38940378b3f1SJohannes Berg * 389560719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 3896463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 389784efbb84SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the struct 389898104fdeSJohannes Berg * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must 389998104fdeSJohannes Berg * also set the address member in the wdev. 3900a05829a7SJohannes Berg * This additionally holds the RTNL to be able to do netdev changes. 3901704232c2SJohannes Berg * 390284efbb84SJohannes Berg * @del_virtual_intf: remove the virtual interface 3903a05829a7SJohannes Berg * This additionally holds the RTNL to be able to do netdev changes. 390455682965SJohannes Berg * 390560719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 390660719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 3907a05829a7SJohannes Berg * This additionally holds the RTNL to be able to do netdev changes. 390855682965SJohannes Berg * 3909f2a0290bSJohannes Berg * @add_intf_link: Add a new MLO link to the given interface. Note that 3910f2a0290bSJohannes Berg * the wdev->link[] data structure has been updated, so the new link 3911f2a0290bSJohannes Berg * address is available. 3912f2a0290bSJohannes Berg * @del_intf_link: Remove an MLO link from the given interface. 3913f2a0290bSJohannes Berg * 391441ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 391541ade00fSJohannes Berg * when adding a group key. 391641ade00fSJohannes Berg * 391741ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 391841ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 391941ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 3920e3da574aSJohannes Berg * after it returns. This function should return an error if it is 3921e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 392241ade00fSJohannes Berg * 392341ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 3924e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 392541ade00fSJohannes Berg * 392641ade00fSJohannes Berg * @set_default_key: set the default key on an interface 3927ed1b6cc7SJohannes Berg * 39283cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 39291f7e9f46SJohannes Berg * 393056be393fSJouni Malinen * @set_default_beacon_key: set the default Beacon frame key on an interface 39313cfcf6acSJouni Malinen * 3932e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 3933e5497d76SJohannes Berg * 3934c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 3935c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 3936c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 3937c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 39385727ef1bSJohannes Berg * 39395727ef1bSJohannes Berg * @add_station: Add a new station. 394089c771e5SJouni Malinen * @del_station: Remove a station 3941bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 3942bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 3943bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 394477ee7c89SJohannes Berg * them, also against the existing state! Drivers must call 394577ee7c89SJohannes Berg * cfg80211_check_station_change() to validate the information. 3946abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 3947abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 3948abe37c4bSJohannes Berg * 3949abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 3950abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 3951abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 3952abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 3953abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 395466be7d2bSHenning Rogge * @get_mpp: get a mesh proxy path for the given parameters 395566be7d2bSHenning Rogge * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx 3956f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 39578d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3958f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 39598d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 39602ec600d6SLuis Carlos Cobo * 396124bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 396293da9cc1Scolin@cozybit.com * 396324bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 396493da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 396593da9cc1Scolin@cozybit.com * set, and which to leave alone. 396693da9cc1Scolin@cozybit.com * 39679f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 396831888487SJouni Malinen * 396931888487SJouni Malinen * @set_txq_params: Set TX queue parameters 397072bdcf34SJouni Malinen * 3971e8c9bd5bSJohannes Berg * @libertas_set_mesh_channel: Only for backward compatibility for libertas, 3972e8c9bd5bSJohannes Berg * as it doesn't implement join_mesh and needs to set the channel to 3973e8c9bd5bSJohannes Berg * join the mesh instead. 3974e8c9bd5bSJohannes Berg * 3975e8c9bd5bSJohannes Berg * @set_monitor_channel: Set the monitor mode channel for the device. If other 3976e8c9bd5bSJohannes Berg * interfaces are active this callback should reject the configuration. 3977e8c9bd5bSJohannes Berg * If no interfaces are active or the device is down, the channel should 3978e8c9bd5bSJohannes Berg * be stored for when a monitor interface becomes active. 39799aed3cc1SJouni Malinen * 39802a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 39812a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 39822a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 39832a519311SJohannes Berg * the scan/scan_done bracket too. 398491d3ab46SVidyullatha Kanchanapally * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall 398591d3ab46SVidyullatha Kanchanapally * indicate the status of the scan through cfg80211_scan_done(). 3986636a5d36SJouni Malinen * 3987636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 39888d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3989636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 39908d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3991636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 39928d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 3993636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 39948d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 399504a773adSJohannes Berg * 3996b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 3997bf1ecd21SJouni Malinen * call cfg80211_connect_result()/cfg80211_connect_bss() with status code 3998bf1ecd21SJouni Malinen * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call 3999bf1ecd21SJouni Malinen * cfg80211_connect_result()/cfg80211_connect_bss() with the status code 4000bf1ecd21SJouni Malinen * from the AP or cfg80211_connect_timeout() if no frame with status code 4001bf1ecd21SJouni Malinen * was received. 4002bf1ecd21SJouni Malinen * The driver is allowed to roam to other BSSes within the ESS when the 4003bf1ecd21SJouni Malinen * other BSS matches the connect parameters. When such roaming is initiated 4004bf1ecd21SJouni Malinen * by the driver, the driver is expected to verify that the target matches 4005bf1ecd21SJouni Malinen * the configured security parameters and to use Reassociation Request 4006bf1ecd21SJouni Malinen * frame instead of Association Request frame. 4007bf1ecd21SJouni Malinen * The connect function can also be used to request the driver to perform a 4008bf1ecd21SJouni Malinen * specific roam when connected to an ESS. In that case, the prev_bssid 400935eb8f7bSJouni Malinen * parameter is set to the BSSID of the currently associated BSS as an 4010bf1ecd21SJouni Malinen * indication of requesting reassociation. 4011bf1ecd21SJouni Malinen * In both the driver-initiated and new connect() call initiated roaming 4012bf1ecd21SJouni Malinen * cases, the result of roaming is indicated with a call to 401329ce6ecbSAvraham Stern * cfg80211_roamed(). (invoked with the wireless_dev mutex held) 4014088e8df8Svamsi krishna * @update_connect_params: Update the connect parameters while connected to a 4015088e8df8Svamsi krishna * BSS. The updated parameters can be used by driver/firmware for 4016088e8df8Svamsi krishna * subsequent BSS selection (roaming) decisions and to form the 4017088e8df8Svamsi krishna * Authentication/(Re)Association Request frames. This call does not 4018088e8df8Svamsi krishna * request an immediate disassociation or reassociation with the current 4019088e8df8Svamsi krishna * BSS, i.e., this impacts only subsequent (re)associations. The bits in 4020088e8df8Svamsi krishna * changed are defined in &enum cfg80211_connect_params_changed. 4021088e8df8Svamsi krishna * (invoked with the wireless_dev mutex held) 40220711d638SIlan Peer * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if 40230711d638SIlan Peer * connection is in progress. Once done, call cfg80211_disconnected() in 40240711d638SIlan Peer * case connection was already established (invoked with the 40250711d638SIlan Peer * wireless_dev mutex held), otherwise call cfg80211_connect_timeout(). 4026b23aa676SSamuel Ortiz * 402704a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 402804a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 402904a773adSJohannes Berg * to a merge. 40308d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 403104a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 40328d61ffa5SJohannes Berg * (invoked with the wireless_dev mutex held) 4033b9a5f8caSJouni Malinen * 4034f4e583c8SAntonio Quartulli * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 4035f4e583c8SAntonio Quartulli * MESH mode) 4036f4e583c8SAntonio Quartulli * 4037b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 4038b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 4039b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 4040b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 40417643a2c3SJohannes Berg * 40421432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 4043c8442118SJohannes Berg * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The 4044c8442118SJohannes Berg * wdev may be %NULL if power was set for the wiphy, and will 4045c8442118SJohannes Berg * always be %NULL unless the driver supports per-vif TX power 4046c8442118SJohannes Berg * (as advertised by the nl80211 feature flag.) 40477643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 40481f87f7d3SJohannes Berg * return 0 if successful 40491f87f7d3SJohannes Berg * 40501f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 40511f87f7d3SJohannes Berg * functions to adjust rfkill hw state 4052aff89a9bSJohannes Berg * 405361fa713cSHolger Schurig * @dump_survey: get site survey information. 405461fa713cSHolger Schurig * 40559588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 40569588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 40579588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 40589588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 40599588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 40609588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 40619588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 40629588bbd5SJouni Malinen * the duration value. 4063f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 4064f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 4065f7ca38dfSJohannes Berg * frame on another channel 40669588bbd5SJouni Malinen * 4067fc73f11fSDavid Spinadel * @testmode_cmd: run a test mode command; @wdev may be %NULL 406871063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 406971063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 407071063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 407171063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 407271063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 407371063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 407467fbb16bSSamuel Ortiz * 4075abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 4076abe37c4bSJohannes Berg * 407767fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 407867fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 407967fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 408067fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 408167fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 40829043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 40839043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 4084d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 4085e86abc68SJohannes Berg * After configuration, the driver should (soon) send an event indicating 4086e86abc68SJohannes Berg * the current level is above/below the configured threshold; this may 4087e86abc68SJohannes Berg * need some care when the configuration is changed (without first being 4088e86abc68SJohannes Berg * disabled.) 40894a4b8169SAndrew Zaborowski * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the 40904a4b8169SAndrew Zaborowski * connection quality monitor. An event is to be sent only when the 40914a4b8169SAndrew Zaborowski * signal level is found to be outside the two values. The driver should 40924a4b8169SAndrew Zaborowski * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented. 40934a4b8169SAndrew Zaborowski * If it is provided then there's no point providing @set_cqm_rssi_config. 409484f10708SThomas Pedersen * @set_cqm_txe_config: Configure connection quality monitor TX error 409584f10708SThomas Pedersen * thresholds. 4096807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 40973a3ecf1dSArend Van Spriel * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with 40983a3ecf1dSArend Van Spriel * given request id. This call must stop the scheduled scan and be ready 40993a3ecf1dSArend Van Spriel * for starting a new one before it returns, i.e. @sched_scan_start may be 41003a3ecf1dSArend Van Spriel * called immediately after that again and should not fail in that case. 41013a3ecf1dSArend Van Spriel * The driver should not call cfg80211_sched_scan_stopped() for a requested 41023a3ecf1dSArend Van Spriel * stop (when this method returns 0). 410367fbb16bSSamuel Ortiz * 41046cd536feSJohannes Berg * @update_mgmt_frame_registrations: Notify the driver that management frame 41056cd536feSJohannes Berg * registrations were updated. The callback is allowed to sleep. 4106547025d5SBruno Randolf * 4107547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 4108547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 4109547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 4110547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 4111547025d5SBruno Randolf * 4112547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 41133677713bSJohn W. Linville * 4114109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 4115109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 41167f6cf311SJohannes Berg * 41177f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 41187f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 41191d9d9213SSimon Wunderlich * 41201d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 4121d6199218SBen Greear * 41225b7ccaf3SJohannes Berg * @get_channel: Get the current operating channel for the virtual interface. 41235b7ccaf3SJohannes Berg * For monitor interfaces, it should return %NULL unless there's a single 41245b7ccaf3SJohannes Berg * current monitoring channel. 412598104fdeSJohannes Berg * 412698104fdeSJohannes Berg * @start_p2p_device: Start the given P2P device. 412798104fdeSJohannes Berg * @stop_p2p_device: Stop the given P2P device. 412877765eafSVasanthakumar Thiagarajan * 412977765eafSVasanthakumar Thiagarajan * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode. 413077765eafSVasanthakumar Thiagarajan * Parameters include ACL policy, an array of MAC address of stations 413177765eafSVasanthakumar Thiagarajan * and the number of MAC addresses. If there is already a list in driver 413277765eafSVasanthakumar Thiagarajan * this new list replaces the existing one. Driver has to clear its ACL 413377765eafSVasanthakumar Thiagarajan * when number of MAC addresses entries is passed as 0. Drivers which 413477765eafSVasanthakumar Thiagarajan * advertise the support for MAC based ACL have to implement this callback. 413504f39047SSimon Wunderlich * 413604f39047SSimon Wunderlich * @start_radar_detection: Start radar detection in the driver. 41378bf24293SJouni Malinen * 413826ec17a1SOrr Mazor * @end_cac: End running CAC, probably because a related CAC 413926ec17a1SOrr Mazor * was finished on another phy. 414026ec17a1SOrr Mazor * 41418bf24293SJouni Malinen * @update_ft_ies: Provide updated Fast BSS Transition information to the 41428bf24293SJouni Malinen * driver. If the SME is in the driver/firmware, this information can be 41438bf24293SJouni Malinen * used in building Authentication and Reassociation Request frames. 41445de17984SArend van Spriel * 41455de17984SArend van Spriel * @crit_proto_start: Indicates a critical protocol needs more link reliability 41465de17984SArend van Spriel * for a given duration (milliseconds). The protocol is provided so the 41475de17984SArend van Spriel * driver can take the most appropriate actions. 41485de17984SArend van Spriel * @crit_proto_stop: Indicates critical protocol no longer needs increased link 41495de17984SArend van Spriel * reliability. This operation can not fail. 4150be29b99aSAmitkumar Karwar * @set_coalesce: Set coalesce parameters. 415116ef1fe2SSimon Wunderlich * 415297dc94f1SMichal Kazior * @channel_switch: initiate channel-switch procedure (with CSA). Driver is 415397dc94f1SMichal Kazior * responsible for veryfing if the switch is possible. Since this is 415497dc94f1SMichal Kazior * inherently tricky driver may decide to disconnect an interface later 415597dc94f1SMichal Kazior * with cfg80211_stop_iface(). This doesn't mean driver can accept 415697dc94f1SMichal Kazior * everything. It should do it's best to verify requests and reject them 415797dc94f1SMichal Kazior * as soon as possible. 4158fa9ffc74SKyeyoon Park * 4159fa9ffc74SKyeyoon Park * @set_qos_map: Set QoS mapping information to the driver 4160e16821bcSJouni Malinen * 4161e16821bcSJouni Malinen * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 4162e16821bcSJouni Malinen * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 4163e16821bcSJouni Malinen * changes during the lifetime of the BSS. 4164960d01acSJohannes Berg * 4165960d01acSJohannes Berg * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device 4166960d01acSJohannes Berg * with the given parameters; action frame exchange has been handled by 4167960d01acSJohannes Berg * userspace so this just has to modify the TX path to take the TS into 4168960d01acSJohannes Berg * account. 4169960d01acSJohannes Berg * If the admitted time is 0 just validate the parameters to make sure 4170960d01acSJohannes Berg * the session can be created at all; it is valid to just always return 4171960d01acSJohannes Berg * success for that but that may result in inefficient behaviour (handshake 4172960d01acSJohannes Berg * with the peer followed by immediate teardown when the addition is later 4173960d01acSJohannes Berg * rejected) 4174960d01acSJohannes Berg * @del_tx_ts: remove an existing TX TS 41756e0bd6c3SRostislav Lisovy * 41766e0bd6c3SRostislav Lisovy * @join_ocb: join the OCB network with the specified parameters 41776e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 41786e0bd6c3SRostislav Lisovy * @leave_ocb: leave the current OCB network 41796e0bd6c3SRostislav Lisovy * (invoked with the wireless_dev mutex held) 41801057d35eSArik Nemtsov * 41811057d35eSArik Nemtsov * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver 41821057d35eSArik Nemtsov * is responsible for continually initiating channel-switching operations 41831057d35eSArik Nemtsov * and returning to the base channel for communication with the AP. 41841057d35eSArik Nemtsov * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both 41851057d35eSArik Nemtsov * peers must be on the base channel when the call completes. 4186cb3b7d87SAyala Beker * @start_nan: Start the NAN interface. 4187cb3b7d87SAyala Beker * @stop_nan: Stop the NAN interface. 4188a442b761SAyala Beker * @add_nan_func: Add a NAN function. Returns negative value on failure. 4189a442b761SAyala Beker * On success @nan_func ownership is transferred to the driver and 4190a442b761SAyala Beker * it may access it outside of the scope of this function. The driver 4191a442b761SAyala Beker * should free the @nan_func when no longer needed by calling 4192a442b761SAyala Beker * cfg80211_free_nan_func(). 4193a442b761SAyala Beker * On success the driver should assign an instance_id in the 4194a442b761SAyala Beker * provided @nan_func. 4195a442b761SAyala Beker * @del_nan_func: Delete a NAN function. 4196a5a9dcf2SAyala Beker * @nan_change_conf: changes NAN configuration. The changed parameters must 4197a5a9dcf2SAyala Beker * be specified in @changes (using &enum cfg80211_nan_conf_changes); 4198a5a9dcf2SAyala Beker * All other parameters must be ignored. 4199ce0ce13aSMichael Braun * 4200ce0ce13aSMichael Braun * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 42013a00df57SAvraham Stern * 420252539ca8SToke Høiland-Jørgensen * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this 420352539ca8SToke Høiland-Jørgensen * function should return phy stats, and interface stats otherwise. 420452539ca8SToke Høiland-Jørgensen * 42053a00df57SAvraham Stern * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 42063a00df57SAvraham Stern * If not deleted through @del_pmk the PMK remains valid until disconnect 42073a00df57SAvraham Stern * upon which the driver should clear it. 42083a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 42093a00df57SAvraham Stern * @del_pmk: delete the previously configured PMK for the given authenticator. 42103a00df57SAvraham Stern * (invoked with the wireless_dev mutex held) 421140cbfa90SSrinivas Dasari * 421240cbfa90SSrinivas Dasari * @external_auth: indicates result of offloaded authentication processing from 421340cbfa90SSrinivas Dasari * user space 42142576a9acSDenis Kenzior * 42152576a9acSDenis Kenzior * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter 42162576a9acSDenis Kenzior * tells the driver that the frame should not be encrypted. 421781e54d08SPradeep Kumar Chitrapu * 421881e54d08SPradeep Kumar Chitrapu * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. 421981e54d08SPradeep Kumar Chitrapu * Statistics should be cumulative, currently no way to reset is provided. 42209bb7e0f2SJohannes Berg * @start_pmsr: start peer measurement (e.g. FTM) 42219bb7e0f2SJohannes Berg * @abort_pmsr: abort peer measurement 4222cb74e977SSunil Dutt * 4223cb74e977SSunil Dutt * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME 4224cb74e977SSunil Dutt * but offloading OWE processing to the user space will get the updated 4225cb74e977SSunil Dutt * DH IE through this interface. 42265ab92e7fSRajkumar Manoharan * 42275ab92e7fSRajkumar Manoharan * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame 42285ab92e7fSRajkumar Manoharan * and overrule HWMP path selection algorithm. 422977f576deSTamizh chelvam * @set_tid_config: TID specific configuration, this can be peer or BSS specific 423077f576deSTamizh chelvam * This callback may sleep. 42313710a8a6SJohannes Berg * @reset_tid_config: Reset TID specific configuration for the peer, for the 42323710a8a6SJohannes Berg * given TIDs. This callback may sleep. 423370b6ff35SJohannes Berg * 423470b6ff35SJohannes Berg * @set_sar_specs: Update the SAR (TX power) settings. 42350d2ab3aeSJohn Crispin * 42360d2ab3aeSJohn Crispin * @color_change: Initiate a color change. 4237e306784aSSubrat Mishra * 4238e306784aSSubrat Mishra * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use 4239e306784aSSubrat Mishra * those to decrypt (Re)Association Request and encrypt (Re)Association 4240e306784aSSubrat Mishra * Response frame. 4241bc2dfc02SLorenzo Bianconi * 4242a95bfb87SLorenzo Bianconi * @set_radar_background: Configure dedicated offchannel chain available for 4243bc2dfc02SLorenzo Bianconi * radar/CAC detection on some hw. This chain can't be used to transmit 4244bc2dfc02SLorenzo Bianconi * or receive frames and it is bounded to a running wdev. 4245a95bfb87SLorenzo Bianconi * Background radar/CAC detection allows to avoid the CAC downtime 4246bc2dfc02SLorenzo Bianconi * switching to a different channel during CAC detection on the selected 4247bc2dfc02SLorenzo Bianconi * radar channel. 4248bc2dfc02SLorenzo Bianconi * The caller is expected to set chandef pointer to NULL in order to 4249a95bfb87SLorenzo Bianconi * disable background CAC/radar detection. 4250577e5b8cSShaul Triebitz * @add_link_station: Add a link to a station. 4251577e5b8cSShaul Triebitz * @mod_link_station: Modify a link of a station. 4252577e5b8cSShaul Triebitz * @del_link_station: Remove a link of a station. 4253704232c2SJohannes Berg */ 4254704232c2SJohannes Berg struct cfg80211_ops { 4255ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 42560378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 42576d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 42580378b3f1SJohannes Berg 425984efbb84SJohannes Berg struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 4260552bff0cSJohannes Berg const char *name, 42616bab2e19STom Gundersen unsigned char name_assign_type, 4262f9e10ce4SJohannes Berg enum nl80211_iftype type, 42632ec600d6SLuis Carlos Cobo struct vif_params *params); 426484efbb84SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, 426584efbb84SJohannes Berg struct wireless_dev *wdev); 4266e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 4267e36d56b6SJohannes Berg struct net_device *dev, 4268818a986eSJohannes Berg enum nl80211_iftype type, 42692ec600d6SLuis Carlos Cobo struct vif_params *params); 427041ade00fSJohannes Berg 4271f2a0290bSJohannes Berg int (*add_intf_link)(struct wiphy *wiphy, 4272f2a0290bSJohannes Berg struct wireless_dev *wdev, 4273f2a0290bSJohannes Berg unsigned int link_id); 4274f2a0290bSJohannes Berg void (*del_intf_link)(struct wiphy *wiphy, 4275f2a0290bSJohannes Berg struct wireless_dev *wdev, 4276f2a0290bSJohannes Berg unsigned int link_id); 4277f2a0290bSJohannes Berg 427841ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 4279e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 428041ade00fSJohannes Berg struct key_params *params); 428141ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 4282e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 4283e31b8213SJohannes Berg void *cookie, 428441ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 428541ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 4286e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 428741ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 428841ade00fSJohannes Berg struct net_device *netdev, 4289dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 42903cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 42913cfcf6acSJouni Malinen struct net_device *netdev, 42923cfcf6acSJouni Malinen u8 key_index); 429356be393fSJouni Malinen int (*set_default_beacon_key)(struct wiphy *wiphy, 429456be393fSJouni Malinen struct net_device *netdev, 429556be393fSJouni Malinen u8 key_index); 4296ed1b6cc7SJohannes Berg 42978860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 42988860020eSJohannes Berg struct cfg80211_ap_settings *settings); 42998860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 43008860020eSJohannes Berg struct cfg80211_beacon_data *info); 43017b0a0e3cSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev, 43027b0a0e3cSJohannes Berg unsigned int link_id); 43035727ef1bSJohannes Berg 43045727ef1bSJohannes Berg 43055727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 43063b3a0162SJohannes Berg const u8 *mac, 43073b3a0162SJohannes Berg struct station_parameters *params); 43085727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 430989c771e5SJouni Malinen struct station_del_parameters *params); 43105727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 43113b3a0162SJohannes Berg const u8 *mac, 43123b3a0162SJohannes Berg struct station_parameters *params); 4313fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 43143b3a0162SJohannes Berg const u8 *mac, struct station_info *sinfo); 43152ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 43162ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 43172ec600d6SLuis Carlos Cobo 43182ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 43193b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 43202ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 43213b3a0162SJohannes Berg const u8 *dst); 43222ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 43233b3a0162SJohannes Berg const u8 *dst, const u8 *next_hop); 43242ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 43253b3a0162SJohannes Berg u8 *dst, u8 *next_hop, struct mpath_info *pinfo); 43262ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 43272ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 43282ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 432966be7d2bSHenning Rogge int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, 433066be7d2bSHenning Rogge u8 *dst, u8 *mpp, struct mpath_info *pinfo); 433166be7d2bSHenning Rogge int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, 433266be7d2bSHenning Rogge int idx, u8 *dst, u8 *mpp, 433366be7d2bSHenning Rogge struct mpath_info *pinfo); 433424bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 433593da9cc1Scolin@cozybit.com struct net_device *dev, 433693da9cc1Scolin@cozybit.com struct mesh_config *conf); 433724bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 433829cbe68cSJohannes Berg struct net_device *dev, u32 mask, 433929cbe68cSJohannes Berg const struct mesh_config *nconf); 434029cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 434129cbe68cSJohannes Berg const struct mesh_config *conf, 434229cbe68cSJohannes Berg const struct mesh_setup *setup); 434329cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 434429cbe68cSJohannes Berg 43456e0bd6c3SRostislav Lisovy int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, 43466e0bd6c3SRostislav Lisovy struct ocb_setup *setup); 43476e0bd6c3SRostislav Lisovy int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); 43486e0bd6c3SRostislav Lisovy 43499f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 43509f1ba906SJouni Malinen struct bss_parameters *params); 435131888487SJouni Malinen 4352f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 435331888487SJouni Malinen struct ieee80211_txq_params *params); 435472bdcf34SJouni Malinen 4355e8c9bd5bSJohannes Berg int (*libertas_set_mesh_channel)(struct wiphy *wiphy, 4356e8c9bd5bSJohannes Berg struct net_device *dev, 4357e8c9bd5bSJohannes Berg struct ieee80211_channel *chan); 4358e8c9bd5bSJohannes Berg 4359e8c9bd5bSJohannes Berg int (*set_monitor_channel)(struct wiphy *wiphy, 4360683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 43619aed3cc1SJouni Malinen 4362fd014284SJohannes Berg int (*scan)(struct wiphy *wiphy, 43632a519311SJohannes Berg struct cfg80211_scan_request *request); 436491d3ab46SVidyullatha Kanchanapally void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4365636a5d36SJouni Malinen 4366636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 4367636a5d36SJouni Malinen struct cfg80211_auth_request *req); 4368636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 4369636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 4370636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 437163c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 4372636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 437363c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 437404a773adSJohannes Berg 4375b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 4376b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 4377088e8df8Svamsi krishna int (*update_connect_params)(struct wiphy *wiphy, 4378088e8df8Svamsi krishna struct net_device *dev, 4379088e8df8Svamsi krishna struct cfg80211_connect_params *sme, 4380088e8df8Svamsi krishna u32 changed); 4381b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 4382b23aa676SSamuel Ortiz u16 reason_code); 4383b23aa676SSamuel Ortiz 438404a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 438504a773adSJohannes Berg struct cfg80211_ibss_params *params); 438604a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 4387b9a5f8caSJouni Malinen 4388f4e583c8SAntonio Quartulli int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, 438957fbcce3SJohannes Berg int rate[NUM_NL80211_BANDS]); 4390f4e583c8SAntonio Quartulli 4391b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 43927643a2c3SJohannes Berg 4393c8442118SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 4394fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 4395c8442118SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 4396c8442118SJohannes Berg int *dbm); 43971f87f7d3SJohannes Berg 43981f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 4399aff89a9bSJohannes Berg 4400aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 4401fc73f11fSDavid Spinadel int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev, 4402fc73f11fSDavid Spinadel void *data, int len); 440371063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 440471063f0eSWey-Yi Guy struct netlink_callback *cb, 440571063f0eSWey-Yi Guy void *data, int len); 4406aff89a9bSJohannes Berg #endif 4407bc92afd9SJohannes Berg 44089930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 44099930380fSJohannes Berg struct net_device *dev, 44107b0a0e3cSJohannes Berg unsigned int link_id, 44119930380fSJohannes Berg const u8 *peer, 44129930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 44139930380fSJohannes Berg 441461fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 441561fa713cSHolger Schurig int idx, struct survey_info *info); 441661fa713cSHolger Schurig 441767fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 441867fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 441967fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 442067fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 442167fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 442267fbb16bSSamuel Ortiz 44239588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 442471bbc994SJohannes Berg struct wireless_dev *wdev, 44259588bbd5SJouni Malinen struct ieee80211_channel *chan, 44269588bbd5SJouni Malinen unsigned int duration, 44279588bbd5SJouni Malinen u64 *cookie); 44289588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 442971bbc994SJohannes Berg struct wireless_dev *wdev, 44309588bbd5SJouni Malinen u64 cookie); 44319588bbd5SJouni Malinen 443271bbc994SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 4433b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params *params, 4434b176e629SAndrei Otcheretianski u64 *cookie); 4435f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 443671bbc994SJohannes Berg struct wireless_dev *wdev, 4437f7ca38dfSJohannes Berg u64 cookie); 4438026331c4SJouni Malinen 4439bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 4440bc92afd9SJohannes Berg bool enabled, int timeout); 4441d6dc1a38SJuuso Oikarinen 4442d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 4443d6dc1a38SJuuso Oikarinen struct net_device *dev, 4444d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 4445271733cfSJohannes Berg 44464a4b8169SAndrew Zaborowski int (*set_cqm_rssi_range_config)(struct wiphy *wiphy, 44474a4b8169SAndrew Zaborowski struct net_device *dev, 44484a4b8169SAndrew Zaborowski s32 rssi_low, s32 rssi_high); 44494a4b8169SAndrew Zaborowski 445084f10708SThomas Pedersen int (*set_cqm_txe_config)(struct wiphy *wiphy, 445184f10708SThomas Pedersen struct net_device *dev, 445284f10708SThomas Pedersen u32 rate, u32 pkts, u32 intvl); 445384f10708SThomas Pedersen 44546cd536feSJohannes Berg void (*update_mgmt_frame_registrations)(struct wiphy *wiphy, 445571bbc994SJohannes Berg struct wireless_dev *wdev, 44566cd536feSJohannes Berg struct mgmt_frame_regs *upd); 4457afe0cbf8SBruno Randolf 4458afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 4459afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 44603677713bSJohn W. Linville 4461807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 4462807f8a8cSLuciano Coelho struct net_device *dev, 4463807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 44643a3ecf1dSArend Van Spriel int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev, 44653a3ecf1dSArend Van Spriel u64 reqid); 4466e5497d76SJohannes Berg 4467e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 4468e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 4469109086ceSArik Nemtsov 4470109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 44713b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 4472df942e7bSSunil Dutt Undekari u16 status_code, u32 peer_capability, 447331fa97c5SArik Nemtsov bool initiator, const u8 *buf, size_t len); 4474109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 44753b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 44767f6cf311SJohannes Berg 44777f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 44787f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 4479e999882aSJohannes Berg 44801d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 44811d9d9213SSimon Wunderlich struct net_device *dev, 44821d9d9213SSimon Wunderlich u16 noack_map); 44831d9d9213SSimon Wunderlich 4484683b6d3bSJohannes Berg int (*get_channel)(struct wiphy *wiphy, 44855b7ccaf3SJohannes Berg struct wireless_dev *wdev, 44867b0a0e3cSJohannes Berg unsigned int link_id, 4487683b6d3bSJohannes Berg struct cfg80211_chan_def *chandef); 448898104fdeSJohannes Berg 448998104fdeSJohannes Berg int (*start_p2p_device)(struct wiphy *wiphy, 449098104fdeSJohannes Berg struct wireless_dev *wdev); 449198104fdeSJohannes Berg void (*stop_p2p_device)(struct wiphy *wiphy, 449298104fdeSJohannes Berg struct wireless_dev *wdev); 449377765eafSVasanthakumar Thiagarajan 449477765eafSVasanthakumar Thiagarajan int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev, 449577765eafSVasanthakumar Thiagarajan const struct cfg80211_acl_data *params); 449604f39047SSimon Wunderlich 449704f39047SSimon Wunderlich int (*start_radar_detection)(struct wiphy *wiphy, 449804f39047SSimon Wunderlich struct net_device *dev, 449931559f35SJanusz Dziedzic struct cfg80211_chan_def *chandef, 450031559f35SJanusz Dziedzic u32 cac_time_ms); 450126ec17a1SOrr Mazor void (*end_cac)(struct wiphy *wiphy, 450226ec17a1SOrr Mazor struct net_device *dev); 4503355199e0SJouni Malinen int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 4504355199e0SJouni Malinen struct cfg80211_update_ft_ies_params *ftie); 45055de17984SArend van Spriel int (*crit_proto_start)(struct wiphy *wiphy, 45065de17984SArend van Spriel struct wireless_dev *wdev, 45075de17984SArend van Spriel enum nl80211_crit_proto_id protocol, 45085de17984SArend van Spriel u16 duration); 45095de17984SArend van Spriel void (*crit_proto_stop)(struct wiphy *wiphy, 45105de17984SArend van Spriel struct wireless_dev *wdev); 4511be29b99aSAmitkumar Karwar int (*set_coalesce)(struct wiphy *wiphy, 4512be29b99aSAmitkumar Karwar struct cfg80211_coalesce *coalesce); 451316ef1fe2SSimon Wunderlich 451416ef1fe2SSimon Wunderlich int (*channel_switch)(struct wiphy *wiphy, 451516ef1fe2SSimon Wunderlich struct net_device *dev, 451616ef1fe2SSimon Wunderlich struct cfg80211_csa_settings *params); 4517e16821bcSJouni Malinen 4518fa9ffc74SKyeyoon Park int (*set_qos_map)(struct wiphy *wiphy, 4519fa9ffc74SKyeyoon Park struct net_device *dev, 4520fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 4521e16821bcSJouni Malinen 4522e16821bcSJouni Malinen int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 45237b0a0e3cSJohannes Berg unsigned int link_id, 4524e16821bcSJouni Malinen struct cfg80211_chan_def *chandef); 4525960d01acSJohannes Berg 4526960d01acSJohannes Berg int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4527960d01acSJohannes Berg u8 tsid, const u8 *peer, u8 user_prio, 4528960d01acSJohannes Berg u16 admitted_time); 4529960d01acSJohannes Berg int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 4530960d01acSJohannes Berg u8 tsid, const u8 *peer); 45311057d35eSArik Nemtsov 45321057d35eSArik Nemtsov int (*tdls_channel_switch)(struct wiphy *wiphy, 45331057d35eSArik Nemtsov struct net_device *dev, 45341057d35eSArik Nemtsov const u8 *addr, u8 oper_class, 45351057d35eSArik Nemtsov struct cfg80211_chan_def *chandef); 45361057d35eSArik Nemtsov void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, 45371057d35eSArik Nemtsov struct net_device *dev, 45381057d35eSArik Nemtsov const u8 *addr); 4539cb3b7d87SAyala Beker int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, 4540cb3b7d87SAyala Beker struct cfg80211_nan_conf *conf); 4541cb3b7d87SAyala Beker void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); 4542a442b761SAyala Beker int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4543a442b761SAyala Beker struct cfg80211_nan_func *nan_func); 4544a442b761SAyala Beker void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, 4545a442b761SAyala Beker u64 cookie); 4546a5a9dcf2SAyala Beker int (*nan_change_conf)(struct wiphy *wiphy, 4547a5a9dcf2SAyala Beker struct wireless_dev *wdev, 4548a5a9dcf2SAyala Beker struct cfg80211_nan_conf *conf, 4549a5a9dcf2SAyala Beker u32 changes); 4550ce0ce13aSMichael Braun 4551ce0ce13aSMichael Braun int (*set_multicast_to_unicast)(struct wiphy *wiphy, 4552ce0ce13aSMichael Braun struct net_device *dev, 4553ce0ce13aSMichael Braun const bool enabled); 45543a00df57SAvraham Stern 455552539ca8SToke Høiland-Jørgensen int (*get_txq_stats)(struct wiphy *wiphy, 455652539ca8SToke Høiland-Jørgensen struct wireless_dev *wdev, 455752539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats *txqstats); 455852539ca8SToke Høiland-Jørgensen 45593a00df57SAvraham Stern int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 45603a00df57SAvraham Stern const struct cfg80211_pmk_conf *conf); 45613a00df57SAvraham Stern int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 45623a00df57SAvraham Stern const u8 *aa); 456340cbfa90SSrinivas Dasari int (*external_auth)(struct wiphy *wiphy, struct net_device *dev, 456440cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params); 45652576a9acSDenis Kenzior 45662576a9acSDenis Kenzior int (*tx_control_port)(struct wiphy *wiphy, 45672576a9acSDenis Kenzior struct net_device *dev, 45682576a9acSDenis Kenzior const u8 *buf, size_t len, 45698d74a623SJohannes Berg const u8 *dest, const __be16 proto, 4570dca9ca2dSMarkus Theil const bool noencrypt, 4571dca9ca2dSMarkus Theil u64 *cookie); 457281e54d08SPradeep Kumar Chitrapu 457381e54d08SPradeep Kumar Chitrapu int (*get_ftm_responder_stats)(struct wiphy *wiphy, 457481e54d08SPradeep Kumar Chitrapu struct net_device *dev, 457581e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats *ftm_stats); 45769bb7e0f2SJohannes Berg 45779bb7e0f2SJohannes Berg int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 45789bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *request); 45799bb7e0f2SJohannes Berg void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev, 45809bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *request); 4581cb74e977SSunil Dutt int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev, 4582cb74e977SSunil Dutt struct cfg80211_update_owe_info *owe_info); 45835ab92e7fSRajkumar Manoharan int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev, 45845ab92e7fSRajkumar Manoharan const u8 *buf, size_t len); 458577f576deSTamizh chelvam int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev, 45863710a8a6SJohannes Berg struct cfg80211_tid_config *tid_conf); 458777f576deSTamizh chelvam int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, 45883710a8a6SJohannes Berg const u8 *peer, u8 tids); 45896bdb68ceSCarl Huang int (*set_sar_specs)(struct wiphy *wiphy, 45906bdb68ceSCarl Huang struct cfg80211_sar_specs *sar); 45910d2ab3aeSJohn Crispin int (*color_change)(struct wiphy *wiphy, 45920d2ab3aeSJohn Crispin struct net_device *dev, 45930d2ab3aeSJohn Crispin struct cfg80211_color_change_settings *params); 4594e306784aSSubrat Mishra int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev, 4595e306784aSSubrat Mishra struct cfg80211_fils_aad *fils_aad); 4596a95bfb87SLorenzo Bianconi int (*set_radar_background)(struct wiphy *wiphy, 4597bc2dfc02SLorenzo Bianconi struct cfg80211_chan_def *chandef); 4598577e5b8cSShaul Triebitz int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev, 4599577e5b8cSShaul Triebitz struct link_station_parameters *params); 4600577e5b8cSShaul Triebitz int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev, 4601577e5b8cSShaul Triebitz struct link_station_parameters *params); 4602577e5b8cSShaul Triebitz int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev, 4603577e5b8cSShaul Triebitz struct link_station_del_parameters *params); 4604704232c2SJohannes Berg }; 4605704232c2SJohannes Berg 4606d3236553SJohannes Berg /* 4607d3236553SJohannes Berg * wireless hardware and networking interfaces structures 4608d3236553SJohannes Berg * and registration/helper functions 4609d3236553SJohannes Berg */ 4610d3236553SJohannes Berg 4611d3236553SJohannes Berg /** 46125be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 46135be83de5SJohannes Berg * 4614c8cb5b85STova Mussai * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split 4615c8cb5b85STova Mussai * into two, first for legacy bands and second for UHB. 46165be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 46175be83de5SJohannes Berg * wiphy at all 46185be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 46195be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 46205be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 46215be83de5SJohannes Berg * reason to override the default 46229bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 462333d915d9SManikanta Pubbisetty * on a VLAN interface). This flag also serves an extra purpose of 462433d915d9SManikanta Pubbisetty * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. 46259bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 4626c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 4627c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 4628c0692b8fSJohannes Berg * control_port_no_encrypt flag. 4629e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 463015d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 463115d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 4632f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 4633f4b34b55SVivek Natarajan * firmware. 4634cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 4635109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 4636109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 4637109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 4638109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 4639109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 4640109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 4641562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 46425e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 46435e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 46445e760230SJohannes Berg * cfg80211_report_obss_beacon(). 464587bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 464687bbbe22SArik Nemtsov * responds to probe-requests in hardware. 46477c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 46487c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 46492f301ab2SSimon Wunderlich * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 465016ef1fe2SSimon Wunderlich * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 465116ef1fe2SSimon Wunderlich * beaconing mode (AP, IBSS, Mesh, ...). 4652b8676221SDavid Spinadel * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation 4653b8676221SDavid Spinadel * before connection. 4654093a48d2SNathan Errera * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys 46557b0a0e3cSJohannes Berg * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs, 46567b0a0e3cSJohannes Berg * in order to not have them reachable in normal drivers, until we have 46577b0a0e3cSJohannes Berg * complete feature/interface combinations/etc. advertisement. No driver 46587b0a0e3cSJohannes Berg * should set this flag for now. 46595be83de5SJohannes Berg */ 46605be83de5SJohannes Berg enum wiphy_flags { 4661093a48d2SNathan Errera WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), 46627b0a0e3cSJohannes Berg WIPHY_FLAG_SUPPORTS_MLO = BIT(1), 4663c8cb5b85STova Mussai WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2), 46645be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 46655be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 46669bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 46679bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 4668c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 4669309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 467015d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 4671ca986ad9SArend Van Spriel /* use hole at 11 */ 46728e8b41f9SJohannes Berg /* use hole at 12 */ 4673f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 4674cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 4675109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 4676109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 4677562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 46785e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 467987bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 46807c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 46817c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 46822f301ab2SSimon Wunderlich WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22), 468316ef1fe2SSimon Wunderlich WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), 4684b8676221SDavid Spinadel WIPHY_FLAG_HAS_STATIC_WEP = BIT(24), 46857527a782SJohannes Berg }; 46867527a782SJohannes Berg 46877527a782SJohannes Berg /** 46887527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 46897527a782SJohannes Berg * @max: maximum number of interfaces of these types 46907527a782SJohannes Berg * @types: interface types (bits) 46917527a782SJohannes Berg */ 46927527a782SJohannes Berg struct ieee80211_iface_limit { 46937527a782SJohannes Berg u16 max; 46947527a782SJohannes Berg u16 types; 46957527a782SJohannes Berg }; 46967527a782SJohannes Berg 46977527a782SJohannes Berg /** 46987527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 46997527a782SJohannes Berg * 4700b80edbc1SLuciano Coelho * With this structure the driver can describe which interface 4701b80edbc1SLuciano Coelho * combinations it supports concurrently. 47027527a782SJohannes Berg * 4703b80edbc1SLuciano Coelho * Examples: 4704b80edbc1SLuciano Coelho * 4705b80edbc1SLuciano Coelho * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 47067527a782SJohannes Berg * 4707819bf593SJohannes Berg * .. code-block:: c 4708819bf593SJohannes Berg * 47097527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 47107527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 47117527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 47127527a782SJohannes Berg * }; 47137527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 47147527a782SJohannes Berg * .limits = limits1, 47157527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 47167527a782SJohannes Berg * .max_interfaces = 2, 47177527a782SJohannes Berg * .beacon_int_infra_match = true, 47187527a782SJohannes Berg * }; 47197527a782SJohannes Berg * 47207527a782SJohannes Berg * 4721b80edbc1SLuciano Coelho * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 47227527a782SJohannes Berg * 4723819bf593SJohannes Berg * .. code-block:: c 4724819bf593SJohannes Berg * 47257527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 47267527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 47277527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 47287527a782SJohannes Berg * }; 47297527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 47307527a782SJohannes Berg * .limits = limits2, 47317527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 47327527a782SJohannes Berg * .max_interfaces = 8, 47337527a782SJohannes Berg * .num_different_channels = 1, 47347527a782SJohannes Berg * }; 47357527a782SJohannes Berg * 47367527a782SJohannes Berg * 4737b80edbc1SLuciano Coelho * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 4738b80edbc1SLuciano Coelho * 47397527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 47407527a782SJohannes Berg * 4741819bf593SJohannes Berg * .. code-block:: c 4742819bf593SJohannes Berg * 47437527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 47447527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 47457527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 47467527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 47477527a782SJohannes Berg * }; 47487527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 47497527a782SJohannes Berg * .limits = limits3, 47507527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 47517527a782SJohannes Berg * .max_interfaces = 4, 47527527a782SJohannes Berg * .num_different_channels = 2, 47537527a782SJohannes Berg * }; 4754819bf593SJohannes Berg * 47557527a782SJohannes Berg */ 47567527a782SJohannes Berg struct ieee80211_iface_combination { 4757c6c94aeaSJohannes Berg /** 4758c6c94aeaSJohannes Berg * @limits: 4759c6c94aeaSJohannes Berg * limits for the given interface types 4760c6c94aeaSJohannes Berg */ 47617527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 4762c6c94aeaSJohannes Berg 4763c6c94aeaSJohannes Berg /** 4764c6c94aeaSJohannes Berg * @num_different_channels: 4765c6c94aeaSJohannes Berg * can use up to this many different channels 4766c6c94aeaSJohannes Berg */ 47677527a782SJohannes Berg u32 num_different_channels; 4768c6c94aeaSJohannes Berg 4769c6c94aeaSJohannes Berg /** 4770c6c94aeaSJohannes Berg * @max_interfaces: 4771c6c94aeaSJohannes Berg * maximum number of interfaces in total allowed in this group 4772c6c94aeaSJohannes Berg */ 47737527a782SJohannes Berg u16 max_interfaces; 4774c6c94aeaSJohannes Berg 4775c6c94aeaSJohannes Berg /** 4776c6c94aeaSJohannes Berg * @n_limits: 4777c6c94aeaSJohannes Berg * number of limitations 4778c6c94aeaSJohannes Berg */ 47797527a782SJohannes Berg u8 n_limits; 4780c6c94aeaSJohannes Berg 4781c6c94aeaSJohannes Berg /** 4782c6c94aeaSJohannes Berg * @beacon_int_infra_match: 4783c6c94aeaSJohannes Berg * In this combination, the beacon intervals between infrastructure 4784c6c94aeaSJohannes Berg * and AP types must match. This is required only in special cases. 4785c6c94aeaSJohannes Berg */ 47867527a782SJohannes Berg bool beacon_int_infra_match; 4787c6c94aeaSJohannes Berg 4788c6c94aeaSJohannes Berg /** 4789c6c94aeaSJohannes Berg * @radar_detect_widths: 4790c6c94aeaSJohannes Berg * bitmap of channel widths supported for radar detection 4791c6c94aeaSJohannes Berg */ 479211c4a075SSimon Wunderlich u8 radar_detect_widths; 4793c6c94aeaSJohannes Berg 4794c6c94aeaSJohannes Berg /** 4795c6c94aeaSJohannes Berg * @radar_detect_regions: 4796c6c94aeaSJohannes Berg * bitmap of regions supported for radar detection 4797c6c94aeaSJohannes Berg */ 47988c48b50aSFelix Fietkau u8 radar_detect_regions; 4799c6c94aeaSJohannes Berg 4800c6c94aeaSJohannes Berg /** 4801c6c94aeaSJohannes Berg * @beacon_int_min_gcd: 4802c6c94aeaSJohannes Berg * This interface combination supports different beacon intervals. 4803c6c94aeaSJohannes Berg * 4804c6c94aeaSJohannes Berg * = 0 4805c6c94aeaSJohannes Berg * all beacon intervals for different interface must be same. 4806c6c94aeaSJohannes Berg * > 0 4807c6c94aeaSJohannes Berg * any beacon interval for the interface part of this combination AND 4808c6c94aeaSJohannes Berg * GCD of all beacon intervals from beaconing interfaces of this 4809c6c94aeaSJohannes Berg * combination must be greater or equal to this value. 4810c6c94aeaSJohannes Berg */ 48110c317a02SPurushottam Kushwaha u32 beacon_int_min_gcd; 48125be83de5SJohannes Berg }; 48135be83de5SJohannes Berg 48142e161f78SJohannes Berg struct ieee80211_txrx_stypes { 48152e161f78SJohannes Berg u16 tx, rx; 48162e161f78SJohannes Berg }; 48172e161f78SJohannes Berg 48185be83de5SJohannes Berg /** 4819ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 4820ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 4821ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 4822ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 4823ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 4824ff1b6e69SJohannes Berg * packet should be preserved in that case 4825ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 4826ff1b6e69SJohannes Berg * (see nl80211.h) 4827ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 482877dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 482977dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 483077dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 483177dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 483277dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 48338cd4d456SLuciano Coelho * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection 4834ff1b6e69SJohannes Berg */ 4835ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 4836ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 4837ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 4838ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 483977dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 484077dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 484177dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 484277dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 484377dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 48448cd4d456SLuciano Coelho WIPHY_WOWLAN_NET_DETECT = BIT(8), 4845ff1b6e69SJohannes Berg }; 4846ff1b6e69SJohannes Berg 48472a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support { 48482a0e047eSJohannes Berg const struct nl80211_wowlan_tcp_data_token_feature *tok; 48492a0e047eSJohannes Berg u32 data_payload_max; 48502a0e047eSJohannes Berg u32 data_interval_max; 48512a0e047eSJohannes Berg u32 wake_payload_max; 48522a0e047eSJohannes Berg bool seq; 48532a0e047eSJohannes Berg }; 48542a0e047eSJohannes Berg 4855ff1b6e69SJohannes Berg /** 4856ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 4857ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 4858ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 4859ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 4860ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 4861ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 4862bb92d199SAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 48638cd4d456SLuciano Coelho * @max_nd_match_sets: maximum number of matchsets for net-detect, 48648cd4d456SLuciano Coelho * similar, but not necessarily identical, to max_match_sets for 48658cd4d456SLuciano Coelho * scheduled scans. 48668cd4d456SLuciano Coelho * See &struct cfg80211_sched_scan_request.@match_sets for more 48678cd4d456SLuciano Coelho * details. 48682a0e047eSJohannes Berg * @tcp: TCP wakeup support information 4869ff1b6e69SJohannes Berg */ 4870ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 4871ff1b6e69SJohannes Berg u32 flags; 4872ff1b6e69SJohannes Berg int n_patterns; 4873ff1b6e69SJohannes Berg int pattern_max_len; 4874ff1b6e69SJohannes Berg int pattern_min_len; 4875bb92d199SAmitkumar Karwar int max_pkt_offset; 48768cd4d456SLuciano Coelho int max_nd_match_sets; 48772a0e047eSJohannes Berg const struct wiphy_wowlan_tcp_support *tcp; 4878ff1b6e69SJohannes Berg }; 4879ff1b6e69SJohannes Berg 4880ff1b6e69SJohannes Berg /** 4881be29b99aSAmitkumar Karwar * struct wiphy_coalesce_support - coalesce support data 4882be29b99aSAmitkumar Karwar * @n_rules: maximum number of coalesce rules 4883be29b99aSAmitkumar Karwar * @max_delay: maximum supported coalescing delay in msecs 4884be29b99aSAmitkumar Karwar * @n_patterns: number of supported patterns in a rule 4885be29b99aSAmitkumar Karwar * (see nl80211.h for the pattern definition) 4886be29b99aSAmitkumar Karwar * @pattern_max_len: maximum length of each pattern 4887be29b99aSAmitkumar Karwar * @pattern_min_len: minimum length of each pattern 4888be29b99aSAmitkumar Karwar * @max_pkt_offset: maximum Rx packet offset 4889be29b99aSAmitkumar Karwar */ 4890be29b99aSAmitkumar Karwar struct wiphy_coalesce_support { 4891be29b99aSAmitkumar Karwar int n_rules; 4892be29b99aSAmitkumar Karwar int max_delay; 4893be29b99aSAmitkumar Karwar int n_patterns; 4894be29b99aSAmitkumar Karwar int pattern_max_len; 4895be29b99aSAmitkumar Karwar int pattern_min_len; 4896be29b99aSAmitkumar Karwar int max_pkt_offset; 4897be29b99aSAmitkumar Karwar }; 4898be29b99aSAmitkumar Karwar 4899be29b99aSAmitkumar Karwar /** 4900ad7e718cSJohannes Berg * enum wiphy_vendor_command_flags - validation flags for vendor commands 4901ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev 4902ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev 4903ad7e718cSJohannes Berg * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running 4904ad7e718cSJohannes Berg * (must be combined with %_WDEV or %_NETDEV) 4905ad7e718cSJohannes Berg */ 4906ad7e718cSJohannes Berg enum wiphy_vendor_command_flags { 4907ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0), 4908ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1), 4909ad7e718cSJohannes Berg WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2), 4910ad7e718cSJohannes Berg }; 4911ad7e718cSJohannes Berg 4912ad7e718cSJohannes Berg /** 4913466b9936Stamizhr@codeaurora.org * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags 4914466b9936Stamizhr@codeaurora.org * 4915466b9936Stamizhr@codeaurora.org * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed 4916466b9936Stamizhr@codeaurora.org * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed 4917466b9936Stamizhr@codeaurora.org * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed 4918466b9936Stamizhr@codeaurora.org * 4919466b9936Stamizhr@codeaurora.org */ 4920466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag { 4921466b9936Stamizhr@codeaurora.org STA_OPMODE_MAX_BW_CHANGED = BIT(0), 4922466b9936Stamizhr@codeaurora.org STA_OPMODE_SMPS_MODE_CHANGED = BIT(1), 4923466b9936Stamizhr@codeaurora.org STA_OPMODE_N_SS_CHANGED = BIT(2), 4924466b9936Stamizhr@codeaurora.org }; 4925466b9936Stamizhr@codeaurora.org 4926466b9936Stamizhr@codeaurora.org /** 4927466b9936Stamizhr@codeaurora.org * struct sta_opmode_info - Station's ht/vht operation mode information 4928466b9936Stamizhr@codeaurora.org * @changed: contains value from &enum wiphy_opmode_flag 49295e78abd0Stamizhr@codeaurora.org * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station 49305e78abd0Stamizhr@codeaurora.org * @bw: new max bandwidth value from &enum nl80211_chan_width of a station 4931466b9936Stamizhr@codeaurora.org * @rx_nss: new rx_nss value of a station 4932466b9936Stamizhr@codeaurora.org */ 4933466b9936Stamizhr@codeaurora.org 4934466b9936Stamizhr@codeaurora.org struct sta_opmode_info { 4935466b9936Stamizhr@codeaurora.org u32 changed; 49365e78abd0Stamizhr@codeaurora.org enum nl80211_smps_mode smps_mode; 49375e78abd0Stamizhr@codeaurora.org enum nl80211_chan_width bw; 4938466b9936Stamizhr@codeaurora.org u8 rx_nss; 4939466b9936Stamizhr@codeaurora.org }; 4940466b9936Stamizhr@codeaurora.org 494191046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA)) 4942901bb989SJohannes Berg 4943466b9936Stamizhr@codeaurora.org /** 4944ad7e718cSJohannes Berg * struct wiphy_vendor_command - vendor command definition 4945ad7e718cSJohannes Berg * @info: vendor command identifying information, as used in nl80211 4946ad7e718cSJohannes Berg * @flags: flags, see &enum wiphy_vendor_command_flags 4947ad7e718cSJohannes Berg * @doit: callback for the operation, note that wdev is %NULL if the 4948ad7e718cSJohannes Berg * flags didn't ask for a wdev and non-%NULL otherwise; the data 4949ad7e718cSJohannes Berg * pointer may be %NULL if userspace provided no data at all 49507bdbe400SJohannes Berg * @dumpit: dump callback, for transferring bigger/multiple items. The 49517bdbe400SJohannes Berg * @storage points to cb->args[5], ie. is preserved over the multiple 49527bdbe400SJohannes Berg * dumpit calls. 4953901bb989SJohannes Berg * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA. 4954901bb989SJohannes Berg * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the 4955901bb989SJohannes Berg * attribute is just raw data (e.g. a firmware command). 4956901bb989SJohannes Berg * @maxattr: highest attribute number in policy 49577bdbe400SJohannes Berg * It's recommended to not have the same sub command with both @doit and 49587bdbe400SJohannes Berg * @dumpit, so that userspace can assume certain ones are get and others 49597bdbe400SJohannes Berg * are used with dump requests. 4960ad7e718cSJohannes Berg */ 4961ad7e718cSJohannes Berg struct wiphy_vendor_command { 4962ad7e718cSJohannes Berg struct nl80211_vendor_cmd_info info; 4963ad7e718cSJohannes Berg u32 flags; 4964ad7e718cSJohannes Berg int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev, 4965ad7e718cSJohannes Berg const void *data, int data_len); 49667bdbe400SJohannes Berg int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, 49677bdbe400SJohannes Berg struct sk_buff *skb, const void *data, int data_len, 49687bdbe400SJohannes Berg unsigned long *storage); 4969901bb989SJohannes Berg const struct nla_policy *policy; 4970901bb989SJohannes Berg unsigned int maxattr; 4971ad7e718cSJohannes Berg }; 4972ad7e718cSJohannes Berg 4973ad7e718cSJohannes Berg /** 4974019ae3a9SKanchanapally, Vidyullatha * struct wiphy_iftype_ext_capab - extended capabilities per interface type 4975019ae3a9SKanchanapally, Vidyullatha * @iftype: interface type 4976019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities: extended capabilities supported by the driver, 4977019ae3a9SKanchanapally, Vidyullatha * additional capabilities might be supported by userspace; these are the 4978019ae3a9SKanchanapally, Vidyullatha * 802.11 extended capabilities ("Extended Capabilities element") and are 4979019ae3a9SKanchanapally, Vidyullatha * in the same format as in the information element. See IEEE Std 4980019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. 4981019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_mask: mask of the valid values 4982019ae3a9SKanchanapally, Vidyullatha * @extended_capabilities_len: length of the extended capabilities 4983019ae3a9SKanchanapally, Vidyullatha */ 4984019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab { 4985019ae3a9SKanchanapally, Vidyullatha enum nl80211_iftype iftype; 4986019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities; 4987019ae3a9SKanchanapally, Vidyullatha const u8 *extended_capabilities_mask; 4988019ae3a9SKanchanapally, Vidyullatha u8 extended_capabilities_len; 4989019ae3a9SKanchanapally, Vidyullatha }; 4990019ae3a9SKanchanapally, Vidyullatha 4991019ae3a9SKanchanapally, Vidyullatha /** 49929bb7e0f2SJohannes Berg * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities 49939bb7e0f2SJohannes Berg * @max_peers: maximum number of peers in a single measurement 49949bb7e0f2SJohannes Berg * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement 49959bb7e0f2SJohannes Berg * @randomize_mac_addr: can randomize MAC address for measurement 49962d8b08feSMauro Carvalho Chehab * @ftm: FTM measurement data 49979bb7e0f2SJohannes Berg * @ftm.supported: FTM measurement is supported 49989bb7e0f2SJohannes Berg * @ftm.asap: ASAP-mode is supported 49999bb7e0f2SJohannes Berg * @ftm.non_asap: non-ASAP-mode is supported 50009bb7e0f2SJohannes Berg * @ftm.request_lci: can request LCI data 50019bb7e0f2SJohannes Berg * @ftm.request_civicloc: can request civic location data 50029bb7e0f2SJohannes Berg * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble) 50039bb7e0f2SJohannes Berg * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width) 50049bb7e0f2SJohannes Berg * @ftm.max_bursts_exponent: maximum burst exponent supported 50059bb7e0f2SJohannes Berg * (set to -1 if not limited; note that setting this will necessarily 50069bb7e0f2SJohannes Berg * forbid using the value 15 to let the responder pick) 50079bb7e0f2SJohannes Berg * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if 50089bb7e0f2SJohannes Berg * not limited) 5009efb5520dSAvraham Stern * @ftm.trigger_based: trigger based ranging measurement is supported 5010efb5520dSAvraham Stern * @ftm.non_trigger_based: non trigger based ranging measurement is supported 50119bb7e0f2SJohannes Berg */ 50129bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities { 50139bb7e0f2SJohannes Berg unsigned int max_peers; 50149bb7e0f2SJohannes Berg u8 report_ap_tsf:1, 50159bb7e0f2SJohannes Berg randomize_mac_addr:1; 50169bb7e0f2SJohannes Berg 50179bb7e0f2SJohannes Berg struct { 50189bb7e0f2SJohannes Berg u32 preambles; 50199bb7e0f2SJohannes Berg u32 bandwidths; 50209bb7e0f2SJohannes Berg s8 max_bursts_exponent; 50219bb7e0f2SJohannes Berg u8 max_ftms_per_burst; 50229bb7e0f2SJohannes Berg u8 supported:1, 50239bb7e0f2SJohannes Berg asap:1, 50249bb7e0f2SJohannes Berg non_asap:1, 50259bb7e0f2SJohannes Berg request_lci:1, 5026efb5520dSAvraham Stern request_civicloc:1, 5027efb5520dSAvraham Stern trigger_based:1, 5028efb5520dSAvraham Stern non_trigger_based:1; 50299bb7e0f2SJohannes Berg } ftm; 50309bb7e0f2SJohannes Berg }; 50319bb7e0f2SJohannes Berg 50329bb7e0f2SJohannes Berg /** 5033d6039a34SVeerendranath Jakkam * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm 5034d6039a34SVeerendranath Jakkam * suites for interface types defined in @iftypes_mask. Each type in the 5035d6039a34SVeerendranath Jakkam * @iftypes_mask must be unique across all instances of iftype_akm_suites. 5036d6039a34SVeerendranath Jakkam * 5037d6039a34SVeerendranath Jakkam * @iftypes_mask: bitmask of interfaces types 5038d6039a34SVeerendranath Jakkam * @akm_suites: points to an array of supported akm suites 5039d6039a34SVeerendranath Jakkam * @n_akm_suites: number of supported AKM suites 5040d6039a34SVeerendranath Jakkam */ 5041d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites { 5042d6039a34SVeerendranath Jakkam u16 iftypes_mask; 5043d6039a34SVeerendranath Jakkam const u32 *akm_suites; 5044d6039a34SVeerendranath Jakkam int n_akm_suites; 5045d6039a34SVeerendranath Jakkam }; 5046d6039a34SVeerendranath Jakkam 5047d6039a34SVeerendranath Jakkam /** 50485be83de5SJohannes Berg * struct wiphy - wireless hardware description 5049a05829a7SJohannes Berg * @mtx: mutex for the data (structures) of this device 50502784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 50512784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 50522784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 5053d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 5054d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 5055d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 5056d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 5057d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 5058d3236553SJohannes Berg * @cipher_suites: supported cipher suites 5059d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 5060d6039a34SVeerendranath Jakkam * @akm_suites: supported AKM suites. These are the default AKMs supported if 5061d6039a34SVeerendranath Jakkam * the supported AKMs not advertized for a specific interface type in 5062d6039a34SVeerendranath Jakkam * iftype_akm_suites. 5063ab4dfa20SVeerendranath Jakkam * @n_akm_suites: number of supported AKM suites 5064d6039a34SVeerendranath Jakkam * @iftype_akm_suites: array of supported akm suites info per interface type. 5065d6039a34SVeerendranath Jakkam * Note that the bits in @iftypes_mask inside this structure cannot 5066d6039a34SVeerendranath Jakkam * overlap (i.e. only one occurrence of each type is allowed across all 5067d6039a34SVeerendranath Jakkam * instances of iftype_akm_suites). 5068d6039a34SVeerendranath Jakkam * @num_iftype_akm_suites: number of interface types for which supported akm 5069d6039a34SVeerendranath Jakkam * suites are specified separately. 5070b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 5071b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 5072b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 5073b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 5074b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 5075abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 5076ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 5077ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 5078ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 50790fcf8ac5SLuciano Coelho * four bits are variable then set it to 00-00-00-00-00-0f. The actual 5080ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 5081ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 5082ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 5083ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 5084ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 5085ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 5086ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 5087ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 5088fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 5089fd235913SRandy Dunlap * unregister hardware 5090edf77192SJérôme Pouiller * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>). 5091edf77192SJérôme Pouiller * It will be renamed automatically on wiphy renames 509215bc6dfbSJérôme Pouiller * @dev: (virtual) struct device for this wiphy. The item in 509315bc6dfbSJérôme Pouiller * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev() 509415bc6dfbSJérôme Pouiller * (see below). 5095abe37c4bSJohannes Berg * @wext: wireless extension handlers 5096abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 5097abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 5098abe37c4bSJohannes Berg * must be set by driver 50997527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 51007527a782SJohannes Berg * list single interface types. 51017527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 51027527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 51037527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 5104abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 5105a2f73b6cSLuis R. Rodriguez * @regulatory_flags: wiphy regulatory flags, see 5106a2f73b6cSLuis R. Rodriguez * &enum ieee80211_regulatory_flags 51071f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 5108d75bb06bSGautam Kumar Shukla * @ext_features: extended features advertised to nl80211, see 5109d75bb06bSGautam Kumar Shukla * &enum nl80211_ext_feature_index. 5110abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 5111abe37c4bSJohannes Berg * this variable determines its size 5112abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 5113abe37c4bSJohannes Berg * any given scan 5114ca986ad9SArend Van Spriel * @max_sched_scan_reqs: maximum number of scheduled scan requests that 5115ca986ad9SArend Van Spriel * the device can run concurrently. 511693b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 511793b6aa69SLuciano Coelho * for in any given scheduled scan 5118a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 5119a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 5120a1f1c21cSLuciano Coelho * supported. 5121abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 5122abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 5123abe37c4bSJohannes Berg * include fixed IEs like supported rates 51245a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 51255a865badSLuciano Coelho * scans 51263b06d277SAvraham Stern * @max_sched_scan_plans: maximum number of scan plans (scan interval and number 51273b06d277SAvraham Stern * of iterations) for scheduled scan supported by the device. 51283b06d277SAvraham Stern * @max_sched_scan_plan_interval: maximum interval (in seconds) for a 51293b06d277SAvraham Stern * single scan plan supported by the device. 51303b06d277SAvraham Stern * @max_sched_scan_plan_iterations: maximum number of iterations for a single 51313b06d277SAvraham Stern * scan plan supported by the device. 5132abe37c4bSJohannes Berg * @coverage_class: current coverage class 5133abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 5134abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 5135abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 5136abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 5137abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 5138abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 51392e161f78SJohannes Berg * 51402e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 51412e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 51422e161f78SJohannes Berg * type 5143a7ffac95SBruno Randolf * 51447f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 51457f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 51467f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 51477f531e03SBruno Randolf * 51487f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 51497f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 51507f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 5151a293911dSJohannes Berg * 515215f0ebc2SRandy Dunlap * @probe_resp_offload: 515315f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 515415f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 515515f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 515615f0ebc2SRandy Dunlap * 5157a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 5158a293911dSJohannes Berg * may request, if implemented. 5159ff1b6e69SJohannes Berg * 5160ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 51616abb9cb9SJohannes Berg * @wowlan_config: current WoWLAN configuration; this should usually not be 51626abb9cb9SJohannes Berg * used since access to it is necessarily racy, use the parameter passed 51636abb9cb9SJohannes Berg * to the suspend() operation instead. 5164562a7480SJohannes Berg * 5165562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 51667e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 51677e7c8926SBen Greear * If null, then none can be over-ridden. 5168ee2aca34SJohannes Berg * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden. 5169ee2aca34SJohannes Berg * If null, then none can be over-ridden. 517077765eafSVasanthakumar Thiagarajan * 517153873f13SJohannes Berg * @wdev_list: the list of associated (virtual) interfaces; this list must 517253873f13SJohannes Berg * not be modified by the driver, but can be read with RTNL/RCU protection. 517353873f13SJohannes Berg * 517477765eafSVasanthakumar Thiagarajan * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 517577765eafSVasanthakumar Thiagarajan * supports for ACL. 5176a50df0c4SJohannes Berg * 5177a50df0c4SJohannes Berg * @extended_capabilities: extended capabilities supported by the driver, 5178a50df0c4SJohannes Berg * additional capabilities might be supported by userspace; these are 5179a50df0c4SJohannes Berg * the 802.11 extended capabilities ("Extended Capabilities element") 5180a50df0c4SJohannes Berg * and are in the same format as in the information element. See 5181019ae3a9SKanchanapally, Vidyullatha * 802.11-2012 8.4.2.29 for the defined fields. These are the default 5182019ae3a9SKanchanapally, Vidyullatha * extended capabilities to be used if the capabilities are not specified 5183019ae3a9SKanchanapally, Vidyullatha * for a specific interface type in iftype_ext_capab. 5184a50df0c4SJohannes Berg * @extended_capabilities_mask: mask of the valid values 5185a50df0c4SJohannes Berg * @extended_capabilities_len: length of the extended capabilities 5186019ae3a9SKanchanapally, Vidyullatha * @iftype_ext_capab: array of extended capabilities per interface type 5187019ae3a9SKanchanapally, Vidyullatha * @num_iftype_ext_capab: number of interface types for which extended 5188019ae3a9SKanchanapally, Vidyullatha * capabilities are specified separately. 5189be29b99aSAmitkumar Karwar * @coalesce: packet coalescing support information 5190ad7e718cSJohannes Berg * 5191ad7e718cSJohannes Berg * @vendor_commands: array of vendor commands supported by the hardware 5192ad7e718cSJohannes Berg * @n_vendor_commands: number of vendor commands 5193567ffc35SJohannes Berg * @vendor_events: array of vendor events supported by the hardware 5194567ffc35SJohannes Berg * @n_vendor_events: number of vendor events 5195b43504cfSJouni Malinen * 5196b43504cfSJouni Malinen * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode 5197b43504cfSJouni Malinen * (including P2P GO) or 0 to indicate no such limit is advertised. The 5198b43504cfSJouni Malinen * driver is allowed to advertise a theoretical limit that it can reach in 5199b43504cfSJouni Malinen * some cases, but may not always reach. 5200c2e4323bSLuciano Coelho * 5201c2e4323bSLuciano Coelho * @max_num_csa_counters: Number of supported csa_counters in beacons 5202c2e4323bSLuciano Coelho * and probe responses. This value should be set if the driver 5203c2e4323bSLuciano Coelho * wishes to limit the number of csa counters. Default (0) means 5204c2e4323bSLuciano Coelho * infinite. 520538de03d2SArend van Spriel * @bss_select_support: bitmask indicating the BSS selection criteria supported 520638de03d2SArend van Spriel * by the driver in the .connect() callback. The bit position maps to the 520738de03d2SArend van Spriel * attribute indices defined in &enum nl80211_bss_select_attr. 5208a442b761SAyala Beker * 52098585989dSLuca Coelho * @nan_supported_bands: bands supported by the device in NAN mode, a 52108585989dSLuca Coelho * bitmap of &enum nl80211_band values. For instance, for 52118585989dSLuca Coelho * NL80211_BAND_2GHZ, bit 0 would be set 52128585989dSLuca Coelho * (i.e. BIT(NL80211_BAND_2GHZ)). 5213f3a7ca64SJohannes Berg * 5214f3a7ca64SJohannes Berg * @txq_limit: configuration of internal TX queue frame limit 5215f3a7ca64SJohannes Berg * @txq_memory_limit: configuration internal TX queue memory limit 5216f3a7ca64SJohannes Berg * @txq_quantum: configuration of internal TX queue scheduler quantum 52179bb7e0f2SJohannes Berg * 5218a710d214SLothar Rubusch * @tx_queue_len: allow setting transmit queue len for drivers not using 5219a710d214SLothar Rubusch * wake_tx_queue 5220a710d214SLothar Rubusch * 5221213ed579SSara Sharon * @support_mbssid: can HW support association with nontransmitted AP 5222213ed579SSara Sharon * @support_only_he_mbssid: don't parse MBSSID elements if it is not 5223213ed579SSara Sharon * HE AP, in order to avoid compatibility issues. 5224213ed579SSara Sharon * @support_mbssid must be set for this to have any effect. 5225213ed579SSara Sharon * 52269bb7e0f2SJohannes Berg * @pmsr_capa: peer measurement capabilities 52273710a8a6SJohannes Berg * 52283710a8a6SJohannes Berg * @tid_config_support: describes the per-TID config support that the 52293710a8a6SJohannes Berg * device has 52303710a8a6SJohannes Berg * @tid_config_support.vif: bitmap of attributes (configurations) 52313710a8a6SJohannes Berg * supported by the driver for each vif 52323710a8a6SJohannes Berg * @tid_config_support.peer: bitmap of attributes (configurations) 52333710a8a6SJohannes Berg * supported by the driver for each peer 52346a21d16cSTamizh chelvam * @tid_config_support.max_retry: maximum supported retry count for 52356a21d16cSTamizh chelvam * long/short retry configuration 5236a710d214SLothar Rubusch * 5237a710d214SLothar Rubusch * @max_data_retry_count: maximum supported per TID retry count for 5238a710d214SLothar Rubusch * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and 5239a710d214SLothar Rubusch * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes 524070b6ff35SJohannes Berg * @sar_capa: SAR control capabilities 5241358ae888SEmmanuel Grumbach * @rfkill: a pointer to the rfkill structure 5242dc1e3cb8SJohn Crispin * 5243dc1e3cb8SJohn Crispin * @mbssid_max_interfaces: maximum number of interfaces supported by the driver 5244dc1e3cb8SJohn Crispin * in a multiple BSSID set. This field must be set to a non-zero value 5245dc1e3cb8SJohn Crispin * by the driver to advertise MBSSID support. 5246f9d366d4SJohannes Berg * @ema_max_profile_periodicity: maximum profile periodicity supported by 5247dc1e3cb8SJohn Crispin * the driver. Setting this field to a non-zero value indicates that the 5248dc1e3cb8SJohn Crispin * driver supports enhanced multi-BSSID advertisements (EMA AP). 5249ecad3b0bSVeerendranath Jakkam * @max_num_akm_suites: maximum number of AKM suites allowed for 5250ecad3b0bSVeerendranath Jakkam * configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and 5251ecad3b0bSVeerendranath Jakkam * %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by 5252ecad3b0bSVeerendranath Jakkam * driver. If set by driver minimum allowed value is 5253ecad3b0bSVeerendranath Jakkam * NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with 5254ecad3b0bSVeerendranath Jakkam * legacy userspace and maximum allowed value is 5255ecad3b0bSVeerendranath Jakkam * CFG80211_MAX_NUM_AKM_SUITES. 5256d3236553SJohannes Berg */ 5257d3236553SJohannes Berg struct wiphy { 5258a05829a7SJohannes Berg struct mutex mtx; 5259a05829a7SJohannes Berg 5260d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 5261d3236553SJohannes Berg 5262d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 5263ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 5264ef15aac6SJohannes Berg 5265ef15aac6SJohannes Berg struct mac_address *addresses; 5266d3236553SJohannes Berg 52672e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 52682e161f78SJohannes Berg 52697527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 52707527a782SJohannes Berg int n_iface_combinations; 52717527a782SJohannes Berg u16 software_iftypes; 52727527a782SJohannes Berg 52732e161f78SJohannes Berg u16 n_addresses; 52742e161f78SJohannes Berg 5275d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 5276d3236553SJohannes Berg u16 interface_modes; 5277d3236553SJohannes Berg 527877765eafSVasanthakumar Thiagarajan u16 max_acl_mac_addrs; 527977765eafSVasanthakumar Thiagarajan 5280a2f73b6cSLuis R. Rodriguez u32 flags, regulatory_flags, features; 5281d75bb06bSGautam Kumar Shukla u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)]; 5282463d0183SJohannes Berg 5283562a7480SJohannes Berg u32 ap_sme_capa; 5284562a7480SJohannes Berg 5285d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 5286d3236553SJohannes Berg 5287d3236553SJohannes Berg int bss_priv_size; 5288d3236553SJohannes Berg u8 max_scan_ssids; 5289ca986ad9SArend Van Spriel u8 max_sched_scan_reqs; 529093b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 5291a1f1c21cSLuciano Coelho u8 max_match_sets; 5292d3236553SJohannes Berg u16 max_scan_ie_len; 52935a865badSLuciano Coelho u16 max_sched_scan_ie_len; 52943b06d277SAvraham Stern u32 max_sched_scan_plans; 52953b06d277SAvraham Stern u32 max_sched_scan_plan_interval; 52963b06d277SAvraham Stern u32 max_sched_scan_plan_iterations; 5297d3236553SJohannes Berg 5298d3236553SJohannes Berg int n_cipher_suites; 5299d3236553SJohannes Berg const u32 *cipher_suites; 5300d3236553SJohannes Berg 5301ab4dfa20SVeerendranath Jakkam int n_akm_suites; 5302ab4dfa20SVeerendranath Jakkam const u32 *akm_suites; 5303ab4dfa20SVeerendranath Jakkam 5304d6039a34SVeerendranath Jakkam const struct wiphy_iftype_akm_suites *iftype_akm_suites; 5305d6039a34SVeerendranath Jakkam unsigned int num_iftype_akm_suites; 5306d6039a34SVeerendranath Jakkam 5307b9a5f8caSJouni Malinen u8 retry_short; 5308b9a5f8caSJouni Malinen u8 retry_long; 5309b9a5f8caSJouni Malinen u32 frag_threshold; 5310b9a5f8caSJouni Malinen u32 rts_threshold; 531181077e82SLukáš Turek u8 coverage_class; 5312b9a5f8caSJouni Malinen 531381135548SJiri Pirko char fw_version[ETHTOOL_FWVERS_LEN]; 5314dfce95f5SKalle Valo u32 hw_version; 5315dfce95f5SKalle Valo 5316dfb89c56SJohannes Berg #ifdef CONFIG_PM 5317964dc9e2SJohannes Berg const struct wiphy_wowlan_support *wowlan; 53186abb9cb9SJohannes Berg struct cfg80211_wowlan *wowlan_config; 5319dfb89c56SJohannes Berg #endif 5320ff1b6e69SJohannes Berg 5321a293911dSJohannes Berg u16 max_remain_on_channel_duration; 5322a293911dSJohannes Berg 532367fbb16bSSamuel Ortiz u8 max_num_pmkids; 532467fbb16bSSamuel Ortiz 53257f531e03SBruno Randolf u32 available_antennas_tx; 53267f531e03SBruno Randolf u32 available_antennas_rx; 5327a7ffac95SBruno Randolf 532887bbbe22SArik Nemtsov u32 probe_resp_offload; 532987bbbe22SArik Nemtsov 5330a50df0c4SJohannes Berg const u8 *extended_capabilities, *extended_capabilities_mask; 5331a50df0c4SJohannes Berg u8 extended_capabilities_len; 5332a50df0c4SJohannes Berg 5333019ae3a9SKanchanapally, Vidyullatha const struct wiphy_iftype_ext_capab *iftype_ext_capab; 5334019ae3a9SKanchanapally, Vidyullatha unsigned int num_iftype_ext_capab; 5335019ae3a9SKanchanapally, Vidyullatha 5336cf5aa2f1SDavid Kilroy const void *privid; 5337d3236553SJohannes Berg 533857fbcce3SJohannes Berg struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 5339d3236553SJohannes Berg 53400c0280bdSLuis R. Rodriguez void (*reg_notifier)(struct wiphy *wiphy, 5341d3236553SJohannes Berg struct regulatory_request *request); 5342d3236553SJohannes Berg 5343d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 5344d3236553SJohannes Berg 5345458f4f9eSJohannes Berg const struct ieee80211_regdomain __rcu *regd; 5346d3236553SJohannes Berg 5347d3236553SJohannes Berg struct device dev; 5348d3236553SJohannes Berg 5349ecb44335SStanislaw Gruszka bool registered; 5350ecb44335SStanislaw Gruszka 5351d3236553SJohannes Berg struct dentry *debugfsdir; 5352d3236553SJohannes Berg 53537e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 5354ee2aca34SJohannes Berg const struct ieee80211_vht_cap *vht_capa_mod_mask; 53557e7c8926SBen Greear 535653873f13SJohannes Berg struct list_head wdev_list; 535753873f13SJohannes Berg 53580c5c9fb5SEric W. Biederman possible_net_t _net; 5359463d0183SJohannes Berg 53603d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 53613d23e349SJohannes Berg const struct iw_handler_def *wext; 53623d23e349SJohannes Berg #endif 53633d23e349SJohannes Berg 5364be29b99aSAmitkumar Karwar const struct wiphy_coalesce_support *coalesce; 5365be29b99aSAmitkumar Karwar 5366ad7e718cSJohannes Berg const struct wiphy_vendor_command *vendor_commands; 5367567ffc35SJohannes Berg const struct nl80211_vendor_cmd_info *vendor_events; 5368567ffc35SJohannes Berg int n_vendor_commands, n_vendor_events; 5369ad7e718cSJohannes Berg 5370b43504cfSJouni Malinen u16 max_ap_assoc_sta; 5371b43504cfSJouni Malinen 53729a774c78SAndrei Otcheretianski u8 max_num_csa_counters; 53739a774c78SAndrei Otcheretianski 537438de03d2SArend van Spriel u32 bss_select_support; 537538de03d2SArend van Spriel 53768585989dSLuca Coelho u8 nan_supported_bands; 53778585989dSLuca Coelho 537852539ca8SToke Høiland-Jørgensen u32 txq_limit; 537952539ca8SToke Høiland-Jørgensen u32 txq_memory_limit; 538052539ca8SToke Høiland-Jørgensen u32 txq_quantum; 538152539ca8SToke Høiland-Jørgensen 53821f6e0baaSJohn Crispin unsigned long tx_queue_len; 53831f6e0baaSJohn Crispin 5384213ed579SSara Sharon u8 support_mbssid:1, 5385213ed579SSara Sharon support_only_he_mbssid:1; 5386213ed579SSara Sharon 53879bb7e0f2SJohannes Berg const struct cfg80211_pmsr_capabilities *pmsr_capa; 53889bb7e0f2SJohannes Berg 53893710a8a6SJohannes Berg struct { 53903710a8a6SJohannes Berg u64 peer, vif; 53916a21d16cSTamizh chelvam u8 max_retry; 53923710a8a6SJohannes Berg } tid_config_support; 53933710a8a6SJohannes Berg 53946a21d16cSTamizh chelvam u8 max_data_retry_count; 53956a21d16cSTamizh chelvam 53966bdb68ceSCarl Huang const struct cfg80211_sar_capa *sar_capa; 53976bdb68ceSCarl Huang 5398358ae888SEmmanuel Grumbach struct rfkill *rfkill; 5399358ae888SEmmanuel Grumbach 5400dc1e3cb8SJohn Crispin u8 mbssid_max_interfaces; 5401dc1e3cb8SJohn Crispin u8 ema_max_profile_periodicity; 5402ecad3b0bSVeerendranath Jakkam u16 max_num_akm_suites; 5403dc1e3cb8SJohn Crispin 5404396fba0aSGustavo A. R. Silva char priv[] __aligned(NETDEV_ALIGN); 5405d3236553SJohannes Berg }; 5406d3236553SJohannes Berg 5407463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 5408463d0183SJohannes Berg { 5409c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 5410463d0183SJohannes Berg } 5411463d0183SJohannes Berg 5412463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 5413463d0183SJohannes Berg { 5414c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 5415463d0183SJohannes Berg } 5416463d0183SJohannes Berg 5417d3236553SJohannes Berg /** 5418d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 5419d3236553SJohannes Berg * 5420d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 54210ae997dcSYacine Belkadi * Return: The priv of @wiphy. 5422d3236553SJohannes Berg */ 5423d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 5424d3236553SJohannes Berg { 5425d3236553SJohannes Berg BUG_ON(!wiphy); 5426d3236553SJohannes Berg return &wiphy->priv; 5427d3236553SJohannes Berg } 5428d3236553SJohannes Berg 5429d3236553SJohannes Berg /** 5430f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 5431f1f74825SDavid Kilroy * 5432f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 54330ae997dcSYacine Belkadi * Return: The wiphy of @priv. 5434f1f74825SDavid Kilroy */ 5435f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 5436f1f74825SDavid Kilroy { 5437f1f74825SDavid Kilroy BUG_ON(!priv); 5438f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 5439f1f74825SDavid Kilroy } 5440f1f74825SDavid Kilroy 5441f1f74825SDavid Kilroy /** 5442d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 5443d3236553SJohannes Berg * 5444d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 5445d3236553SJohannes Berg * @dev: The device to parent it to 5446d3236553SJohannes Berg */ 5447d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 5448d3236553SJohannes Berg { 5449d3236553SJohannes Berg wiphy->dev.parent = dev; 5450d3236553SJohannes Berg } 5451d3236553SJohannes Berg 5452d3236553SJohannes Berg /** 5453d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 5454d3236553SJohannes Berg * 5455d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 54560ae997dcSYacine Belkadi * Return: The dev of @wiphy. 5457d3236553SJohannes Berg */ 5458d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 5459d3236553SJohannes Berg { 5460d3236553SJohannes Berg return wiphy->dev.parent; 5461d3236553SJohannes Berg } 5462d3236553SJohannes Berg 5463d3236553SJohannes Berg /** 5464d3236553SJohannes Berg * wiphy_name - get wiphy name 5465d3236553SJohannes Berg * 5466d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 54670ae997dcSYacine Belkadi * Return: The name of @wiphy. 5468d3236553SJohannes Berg */ 5469e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 5470d3236553SJohannes Berg { 5471d3236553SJohannes Berg return dev_name(&wiphy->dev); 5472d3236553SJohannes Berg } 5473d3236553SJohannes Berg 5474d3236553SJohannes Berg /** 54751998d90aSBen Greear * wiphy_new_nm - create a new wiphy for use with cfg80211 54761998d90aSBen Greear * 54771998d90aSBen Greear * @ops: The configuration operations for this device 54781998d90aSBen Greear * @sizeof_priv: The size of the private area to allocate 54791998d90aSBen Greear * @requested_name: Request a particular name. 54801998d90aSBen Greear * NULL is valid value, and means use the default phy%d naming. 54811998d90aSBen Greear * 54821998d90aSBen Greear * Create a new wiphy and associate the given operations with it. 54831998d90aSBen Greear * @sizeof_priv bytes are allocated for private use. 54841998d90aSBen Greear * 54851998d90aSBen Greear * Return: A pointer to the new wiphy. This pointer must be 54861998d90aSBen Greear * assigned to each netdev's ieee80211_ptr for proper operation. 54871998d90aSBen Greear */ 54881998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, 54891998d90aSBen Greear const char *requested_name); 54901998d90aSBen Greear 54911998d90aSBen Greear /** 5492d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 5493d3236553SJohannes Berg * 5494d3236553SJohannes Berg * @ops: The configuration operations for this device 5495d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 5496d3236553SJohannes Berg * 5497d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 5498d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 5499d3236553SJohannes Berg * 55000ae997dcSYacine Belkadi * Return: A pointer to the new wiphy. This pointer must be 55010ae997dcSYacine Belkadi * assigned to each netdev's ieee80211_ptr for proper operation. 5502d3236553SJohannes Berg */ 55031998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, 55041998d90aSBen Greear int sizeof_priv) 55051998d90aSBen Greear { 55061998d90aSBen Greear return wiphy_new_nm(ops, sizeof_priv, NULL); 55071998d90aSBen Greear } 5508d3236553SJohannes Berg 5509d3236553SJohannes Berg /** 5510d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 5511d3236553SJohannes Berg * 5512d3236553SJohannes Berg * @wiphy: The wiphy to register. 5513d3236553SJohannes Berg * 55140ae997dcSYacine Belkadi * Return: A non-negative wiphy index or a negative error code. 5515d3236553SJohannes Berg */ 551610dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy); 5517d3236553SJohannes Berg 5518a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */ 5519a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx) 5520a05829a7SJohannes Berg 5521a05829a7SJohannes Berg /** 5522a05829a7SJohannes Berg * rcu_dereference_wiphy - rcu_dereference with debug checking 5523a05829a7SJohannes Berg * @wiphy: the wiphy to check the locking on 5524a05829a7SJohannes Berg * @p: The pointer to read, prior to dereferencing 5525a05829a7SJohannes Berg * 5526a05829a7SJohannes Berg * Do an rcu_dereference(p), but check caller either holds rcu_read_lock() 5527a05829a7SJohannes Berg * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference(). 5528a05829a7SJohannes Berg */ 5529a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p) \ 5530a05829a7SJohannes Berg rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx)) 5531a05829a7SJohannes Berg 5532a05829a7SJohannes Berg /** 5533a05829a7SJohannes Berg * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx 5534a05829a7SJohannes Berg * @wiphy: the wiphy to check the locking on 5535a05829a7SJohannes Berg * @p: The pointer to read, prior to dereferencing 5536a05829a7SJohannes Berg * 5537a05829a7SJohannes Berg * Return the value of the specified RCU-protected pointer, but omit the 5538a05829a7SJohannes Berg * READ_ONCE(), because caller holds the wiphy mutex used for updates. 5539a05829a7SJohannes Berg */ 5540a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p) \ 5541a05829a7SJohannes Berg rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx)) 5542a05829a7SJohannes Berg 5543a05829a7SJohannes Berg /** 5544a05829a7SJohannes Berg * get_wiphy_regdom - get custom regdomain for the given wiphy 5545a05829a7SJohannes Berg * @wiphy: the wiphy to get the regdomain from 5546a05829a7SJohannes Berg */ 5547a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy); 5548a05829a7SJohannes Berg 5549d3236553SJohannes Berg /** 5550d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 5551d3236553SJohannes Berg * 5552d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 5553d3236553SJohannes Berg * 5554d3236553SJohannes Berg * After this call, no more requests can be made with this priv 5555d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 5556d3236553SJohannes Berg * request that is being handled. 5557d3236553SJohannes Berg */ 555810dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy); 5559d3236553SJohannes Berg 5560d3236553SJohannes Berg /** 5561d3236553SJohannes Berg * wiphy_free - free wiphy 5562d3236553SJohannes Berg * 5563d3236553SJohannes Berg * @wiphy: The wiphy to free 5564d3236553SJohannes Berg */ 556510dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy); 5566d3236553SJohannes Berg 5567fffd0934SJohannes Berg /* internal structs */ 55686829c878SJohannes Berg struct cfg80211_conn; 556919957bb3SJohannes Berg struct cfg80211_internal_bss; 5570fffd0934SJohannes Berg struct cfg80211_cached_keys; 55714a4b8169SAndrew Zaborowski struct cfg80211_cqm_config; 557219957bb3SJohannes Berg 5573d3236553SJohannes Berg /** 5574a05829a7SJohannes Berg * wiphy_lock - lock the wiphy 5575a05829a7SJohannes Berg * @wiphy: the wiphy to lock 5576a05829a7SJohannes Berg * 5577a05829a7SJohannes Berg * This is mostly exposed so it can be done around registering and 5578a05829a7SJohannes Berg * unregistering netdevs that aren't created through cfg80211 calls, 5579a05829a7SJohannes Berg * since that requires locking in cfg80211 when the notifiers is 5580a05829a7SJohannes Berg * called, but that cannot differentiate which way it's called. 5581a05829a7SJohannes Berg * 5582a05829a7SJohannes Berg * When cfg80211 ops are called, the wiphy is already locked. 5583a05829a7SJohannes Berg */ 5584a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy) 5585a05829a7SJohannes Berg __acquires(&wiphy->mtx) 5586a05829a7SJohannes Berg { 5587a05829a7SJohannes Berg mutex_lock(&wiphy->mtx); 5588a05829a7SJohannes Berg __acquire(&wiphy->mtx); 5589a05829a7SJohannes Berg } 5590a05829a7SJohannes Berg 5591a05829a7SJohannes Berg /** 5592a05829a7SJohannes Berg * wiphy_unlock - unlock the wiphy again 5593a05829a7SJohannes Berg * @wiphy: the wiphy to unlock 5594a05829a7SJohannes Berg */ 5595a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy) 5596a05829a7SJohannes Berg __releases(&wiphy->mtx) 5597a05829a7SJohannes Berg { 5598a05829a7SJohannes Berg __release(&wiphy->mtx); 5599a05829a7SJohannes Berg mutex_unlock(&wiphy->mtx); 5600a05829a7SJohannes Berg } 5601a05829a7SJohannes Berg 5602a05829a7SJohannes Berg /** 560389a54e48SJohannes Berg * struct wireless_dev - wireless device state 5604d3236553SJohannes Berg * 560589a54e48SJohannes Berg * For netdevs, this structure must be allocated by the driver 560689a54e48SJohannes Berg * that uses the ieee80211_ptr field in struct net_device (this 560789a54e48SJohannes Berg * is intentional so it can be allocated along with the netdev.) 560889a54e48SJohannes Berg * It need not be registered then as netdev registration will 5609a05829a7SJohannes Berg * be intercepted by cfg80211 to see the new wireless device, 5610a05829a7SJohannes Berg * however, drivers must lock the wiphy before registering or 5611a05829a7SJohannes Berg * unregistering netdevs if they pre-create any netdevs (in ops 5612a05829a7SJohannes Berg * called from cfg80211, the wiphy is already locked.) 561389a54e48SJohannes Berg * 561489a54e48SJohannes Berg * For non-netdev uses, it must also be allocated by the driver 561589a54e48SJohannes Berg * in response to the cfg80211 callbacks that require it, as 561689a54e48SJohannes Berg * there's no netdev registration in that case it may not be 561789a54e48SJohannes Berg * allocated outside of callback operations that return it. 5618d3236553SJohannes Berg * 5619d3236553SJohannes Berg * @wiphy: pointer to hardware description 5620d3236553SJohannes Berg * @iftype: interface type 56212fe8ef10SJohannes Berg * @registered: is this wdev already registered with cfg80211 562240c575d1SJohannes Berg * @registering: indicates we're doing registration under wiphy lock 562340c575d1SJohannes Berg * for the notifier 5624d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 562589a54e48SJohannes Berg * @netdev: (private) Used to reference back to the netdev, may be %NULL 562689a54e48SJohannes Berg * @identifier: (private) Identifier used in nl80211 to identify this 562789a54e48SJohannes Berg * wireless device if it has no netdev 56282d8b08feSMauro Carvalho Chehab * @u: union containing data specific to @iftype 56297b0a0e3cSJohannes Berg * @connected: indicates if connected or not (STA mode) 5630d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 5631d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 56329874b71fSJohannes Berg * @wext.ibss: (private) IBSS data part of wext handling 56339874b71fSJohannes Berg * @wext.connect: (private) connection handling data 56349874b71fSJohannes Berg * @wext.keys: (private) (WEP) key data 56359874b71fSJohannes Berg * @wext.ie: (private) extra elements for association 56369874b71fSJohannes Berg * @wext.ie_len: (private) length of extra elements 56379874b71fSJohannes Berg * @wext.bssid: (private) selected network BSSID 56389874b71fSJohannes Berg * @wext.ssid: (private) selected network SSID 56399874b71fSJohannes Berg * @wext.default_key: (private) selected default key index 56409874b71fSJohannes Berg * @wext.default_mgmt_key: (private) selected default management key index 56419874b71fSJohannes Berg * @wext.prev_bssid: (private) previous BSSID for reassociation 56429874b71fSJohannes Berg * @wext.prev_bssid_valid: (private) previous BSSID validity 56439bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 56449bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 56459bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 56469bc383deSJohannes Berg * by cfg80211 on change_interface 56472e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 564879ea1e12SJohannes Berg * @mgmt_registrations_need_update: mgmt registrations were updated, 564979ea1e12SJohannes Berg * need to propagate the update to the driver 56508d61ffa5SJohannes Berg * @mtx: mutex used to lock data in this struct, may be used by drivers 56518d61ffa5SJohannes Berg * and some API functions require it held 565256d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 565356d1893dSJohannes Berg * beacons, 0 when not valid 565498104fdeSJohannes Berg * @address: The address for this device, valid only if @netdev is %NULL 565573c7da3dSArend Van Spriel * @is_running: true if this is a non-netdev device that has been started, e.g. 565673c7da3dSArend Van Spriel * the P2P Device. 565704f39047SSimon Wunderlich * @cac_started: true if DFS channel availability check has been started 565804f39047SSimon Wunderlich * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 565931559f35SJanusz Dziedzic * @cac_time_ms: CAC time in ms 5660780b40dfSJohannes Berg * @ps: powersave mode is enabled 5661780b40dfSJohannes Berg * @ps_timeout: dynamic powersave timeout 5662780b40dfSJohannes Berg * @ap_unexpected_nlportid: (private) netlink port ID of application 5663780b40dfSJohannes Berg * registered for unexpected class 3 frames (AP mode) 5664780b40dfSJohannes Berg * @conn: (private) cfg80211 software SME connection state machine data 5665780b40dfSJohannes Berg * @connect_keys: (private) keys to set after connection is established 566634d50519SLior David * @conn_bss_type: connecting/connected BSS type 5667bd2522b1SAndrzej Zaborowski * @conn_owner_nlportid: (private) connection owner socket port ID 5668bd2522b1SAndrzej Zaborowski * @disconnect_wk: (private) auto-disconnect work 5669bd2522b1SAndrzej Zaborowski * @disconnect_bssid: (private) the BSSID to use for auto-disconnect 5670780b40dfSJohannes Berg * @event_list: (private) list for internal event processing 5671780b40dfSJohannes Berg * @event_lock: (private) lock for event list 567278f22b6aSJohannes Berg * @owner_nlportid: (private) owner socket port ID 5673ab81007aSJohannes Berg * @nl_owner_dead: (private) owner socket went away 56744a4b8169SAndrew Zaborowski * @cqm_config: (private) nl80211 RSSI monitor state 56759bb7e0f2SJohannes Berg * @pmsr_list: (private) peer measurement requests 56769bb7e0f2SJohannes Berg * @pmsr_lock: (private) peer measurements requests/results lock 56779bb7e0f2SJohannes Berg * @pmsr_free_wk: (private) peer measurements cleanup work 56784d797fceSJouni Malinen * @unprot_beacon_reported: (private) timestamp of last 56794d797fceSJouni Malinen * unprotected beacon report 56802d8b08feSMauro Carvalho Chehab * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr 56812d8b08feSMauro Carvalho Chehab * @ap and @client for each link 56822d8b08feSMauro Carvalho Chehab * @valid_links: bitmap describing what elements of @links are valid 5683d3236553SJohannes Berg */ 5684d3236553SJohannes Berg struct wireless_dev { 5685d3236553SJohannes Berg struct wiphy *wiphy; 5686d3236553SJohannes Berg enum nl80211_iftype iftype; 5687d3236553SJohannes Berg 5688667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 5689d3236553SJohannes Berg struct list_head list; 5690d3236553SJohannes Berg struct net_device *netdev; 5691d3236553SJohannes Berg 569289a54e48SJohannes Berg u32 identifier; 569389a54e48SJohannes Berg 56942e161f78SJohannes Berg struct list_head mgmt_registrations; 569579ea1e12SJohannes Berg u8 mgmt_registrations_need_update:1; 5696026331c4SJouni Malinen 5697667503ddSJohannes Berg struct mutex mtx; 5698667503ddSJohannes Berg 569940c575d1SJohannes Berg bool use_4addr, is_running, registered, registering; 570098104fdeSJohannes Berg 570198104fdeSJohannes Berg u8 address[ETH_ALEN] __aligned(sizeof(u16)); 57029bc383deSJohannes Berg 5703b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 57046829c878SJohannes Berg struct cfg80211_conn *conn; 5705fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 570634d50519SLior David enum ieee80211_bss_type conn_bss_type; 5707bd2522b1SAndrzej Zaborowski u32 conn_owner_nlportid; 5708bd2522b1SAndrzej Zaborowski 5709bd2522b1SAndrzej Zaborowski struct work_struct disconnect_wk; 5710bd2522b1SAndrzej Zaborowski u8 disconnect_bssid[ETH_ALEN]; 5711d3236553SJohannes Berg 5712667503ddSJohannes Berg struct list_head event_list; 5713667503ddSJohannes Berg spinlock_t event_lock; 5714667503ddSJohannes Berg 57157b0a0e3cSJohannes Berg u8 connected:1; 5716f4489ebeSMichal Kazior 5717ffb9eb3dSKalle Valo bool ps; 5718ffb9eb3dSKalle Valo int ps_timeout; 5719ffb9eb3dSKalle Valo 572015e47304SEric W. Biederman u32 ap_unexpected_nlportid; 572128946da7SJohannes Berg 5722ab81007aSJohannes Berg u32 owner_nlportid; 5723ab81007aSJohannes Berg bool nl_owner_dead; 5724ab81007aSJohannes Berg 57257b0a0e3cSJohannes Berg /* FIXME: need to rework radar detection for MLO */ 572604f39047SSimon Wunderlich bool cac_started; 572704f39047SSimon Wunderlich unsigned long cac_start_time; 572831559f35SJanusz Dziedzic unsigned int cac_time_ms; 572904f39047SSimon Wunderlich 57303d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 5731d3236553SJohannes Berg /* wext data */ 5732cbe8fa9cSJohannes Berg struct { 5733cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 5734f2129354SJohannes Berg struct cfg80211_connect_params connect; 5735fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 5736c1e5f471SJohannes Berg const u8 *ie; 5737f2129354SJohannes Berg size_t ie_len; 57389874b71fSJohannes Berg u8 bssid[ETH_ALEN]; 57399874b71fSJohannes Berg u8 prev_bssid[ETH_ALEN]; 5740f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 574108645126SJohannes Berg s8 default_key, default_mgmt_key; 5742ffb9eb3dSKalle Valo bool prev_bssid_valid; 5743cbe8fa9cSJohannes Berg } wext; 5744d3236553SJohannes Berg #endif 57454a4b8169SAndrew Zaborowski 57464a4b8169SAndrew Zaborowski struct cfg80211_cqm_config *cqm_config; 57479bb7e0f2SJohannes Berg 57489bb7e0f2SJohannes Berg struct list_head pmsr_list; 57499bb7e0f2SJohannes Berg spinlock_t pmsr_lock; 57509bb7e0f2SJohannes Berg struct work_struct pmsr_free_wk; 57514d797fceSJouni Malinen 57524d797fceSJouni Malinen unsigned long unprot_beacon_reported; 57537b0a0e3cSJohannes Berg 57547b0a0e3cSJohannes Berg union { 57557b0a0e3cSJohannes Berg struct { 57567b0a0e3cSJohannes Berg u8 connected_addr[ETH_ALEN] __aligned(2); 57577b0a0e3cSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 57587b0a0e3cSJohannes Berg u8 ssid_len; 57597b0a0e3cSJohannes Berg } client; 57607b0a0e3cSJohannes Berg struct { 57617b0a0e3cSJohannes Berg int beacon_interval; 57627b0a0e3cSJohannes Berg struct cfg80211_chan_def preset_chandef; 57637b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 57647b0a0e3cSJohannes Berg u8 id[IEEE80211_MAX_SSID_LEN]; 57657b0a0e3cSJohannes Berg u8 id_len, id_up_len; 57667b0a0e3cSJohannes Berg } mesh; 57677b0a0e3cSJohannes Berg struct { 57687b0a0e3cSJohannes Berg struct cfg80211_chan_def preset_chandef; 57697b0a0e3cSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 57707b0a0e3cSJohannes Berg u8 ssid_len; 57717b0a0e3cSJohannes Berg } ap; 57727b0a0e3cSJohannes Berg struct { 57737b0a0e3cSJohannes Berg struct cfg80211_internal_bss *current_bss; 57747b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 57757b0a0e3cSJohannes Berg int beacon_interval; 57767b0a0e3cSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 57777b0a0e3cSJohannes Berg u8 ssid_len; 57787b0a0e3cSJohannes Berg } ibss; 57797b0a0e3cSJohannes Berg struct { 57807b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 57817b0a0e3cSJohannes Berg } ocb; 57827b0a0e3cSJohannes Berg } u; 57837b0a0e3cSJohannes Berg 57847b0a0e3cSJohannes Berg struct { 57857b0a0e3cSJohannes Berg u8 addr[ETH_ALEN] __aligned(2); 57867b0a0e3cSJohannes Berg union { 57877b0a0e3cSJohannes Berg struct { 57887b0a0e3cSJohannes Berg unsigned int beacon_interval; 57897b0a0e3cSJohannes Berg struct cfg80211_chan_def chandef; 57907b0a0e3cSJohannes Berg } ap; 57917b0a0e3cSJohannes Berg struct { 57927b0a0e3cSJohannes Berg struct cfg80211_internal_bss *current_bss; 57937b0a0e3cSJohannes Berg } client; 57947b0a0e3cSJohannes Berg }; 57957b0a0e3cSJohannes Berg } links[IEEE80211_MLD_MAX_NUM_LINKS]; 57967b0a0e3cSJohannes Berg u16 valid_links; 5797d3236553SJohannes Berg }; 5798d3236553SJohannes Berg 579910de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev) 580098104fdeSJohannes Berg { 580198104fdeSJohannes Berg if (wdev->netdev) 580298104fdeSJohannes Berg return wdev->netdev->dev_addr; 580398104fdeSJohannes Berg return wdev->address; 580498104fdeSJohannes Berg } 580598104fdeSJohannes Berg 580673c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev) 580773c7da3dSArend Van Spriel { 580873c7da3dSArend Van Spriel if (wdev->netdev) 580973c7da3dSArend Van Spriel return netif_running(wdev->netdev); 581073c7da3dSArend Van Spriel return wdev->is_running; 581173c7da3dSArend Van Spriel } 581273c7da3dSArend Van Spriel 5813d3236553SJohannes Berg /** 5814d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 5815d3236553SJohannes Berg * 5816d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 58170ae997dcSYacine Belkadi * Return: The wiphy priv of @wdev. 5818d3236553SJohannes Berg */ 5819d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 5820d3236553SJohannes Berg { 5821d3236553SJohannes Berg BUG_ON(!wdev); 5822d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 5823d3236553SJohannes Berg } 5824d3236553SJohannes Berg 5825d70e9693SJohannes Berg /** 58267b0a0e3cSJohannes Berg * wdev_chandef - return chandef pointer from wireless_dev 58277b0a0e3cSJohannes Berg * @wdev: the wdev 58287b0a0e3cSJohannes Berg * @link_id: the link ID for MLO 58297b0a0e3cSJohannes Berg * 58307b0a0e3cSJohannes Berg * Return: The chandef depending on the mode, or %NULL. 58317b0a0e3cSJohannes Berg */ 58327b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev, 58337b0a0e3cSJohannes Berg unsigned int link_id); 58347b0a0e3cSJohannes Berg 58357b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev, 58367b0a0e3cSJohannes Berg unsigned int link_id) 58377b0a0e3cSJohannes Berg { 58387b0a0e3cSJohannes Berg WARN_ON(link_id && !wdev->valid_links); 58397b0a0e3cSJohannes Berg WARN_ON(wdev->valid_links && 58407b0a0e3cSJohannes Berg !(wdev->valid_links & BIT(link_id))); 58417b0a0e3cSJohannes Berg } 58427b0a0e3cSJohannes Berg 5843efbabc11SVeerendranath Jakkam #define for_each_valid_link(link_info, link_id) \ 58447b0a0e3cSJohannes Berg for (link_id = 0; \ 5845efbabc11SVeerendranath Jakkam link_id < ((link_info)->valid_links ? \ 5846efbabc11SVeerendranath Jakkam ARRAY_SIZE((link_info)->links) : 1); \ 58477b0a0e3cSJohannes Berg link_id++) \ 5848efbabc11SVeerendranath Jakkam if (!(link_info)->valid_links || \ 5849efbabc11SVeerendranath Jakkam ((link_info)->valid_links & BIT(link_id))) 58507b0a0e3cSJohannes Berg 58517b0a0e3cSJohannes Berg /** 5852d70e9693SJohannes Berg * DOC: Utility functions 5853d70e9693SJohannes Berg * 5854d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 5855d3236553SJohannes Berg */ 5856d3236553SJohannes Berg 5857d3236553SJohannes Berg /** 5858934f4c7dSThomas Pedersen * ieee80211_channel_equal - compare two struct ieee80211_channel 5859934f4c7dSThomas Pedersen * 5860934f4c7dSThomas Pedersen * @a: 1st struct ieee80211_channel 5861934f4c7dSThomas Pedersen * @b: 2nd struct ieee80211_channel 5862934f4c7dSThomas Pedersen * Return: true if center frequency of @a == @b 5863934f4c7dSThomas Pedersen */ 5864934f4c7dSThomas Pedersen static inline bool 5865934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a, 5866934f4c7dSThomas Pedersen struct ieee80211_channel *b) 5867934f4c7dSThomas Pedersen { 5868934f4c7dSThomas Pedersen return (a->center_freq == b->center_freq && 5869934f4c7dSThomas Pedersen a->freq_offset == b->freq_offset); 5870934f4c7dSThomas Pedersen } 5871934f4c7dSThomas Pedersen 5872934f4c7dSThomas Pedersen /** 5873934f4c7dSThomas Pedersen * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz 5874934f4c7dSThomas Pedersen * @chan: struct ieee80211_channel to convert 5875934f4c7dSThomas Pedersen * Return: The corresponding frequency (in KHz) 5876934f4c7dSThomas Pedersen */ 5877934f4c7dSThomas Pedersen static inline u32 5878934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan) 5879934f4c7dSThomas Pedersen { 5880934f4c7dSThomas Pedersen return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset; 5881934f4c7dSThomas Pedersen } 5882934f4c7dSThomas Pedersen 5883934f4c7dSThomas Pedersen /** 588411b34737SThomas Pedersen * ieee80211_s1g_channel_width - get allowed channel width from @chan 588511b34737SThomas Pedersen * 588611b34737SThomas Pedersen * Only allowed for band NL80211_BAND_S1GHZ 588711b34737SThomas Pedersen * @chan: channel 588811b34737SThomas Pedersen * Return: The allowed channel width for this center_freq 588911b34737SThomas Pedersen */ 589011b34737SThomas Pedersen enum nl80211_chan_width 589111b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan); 589211b34737SThomas Pedersen 589311b34737SThomas Pedersen /** 5894934f4c7dSThomas Pedersen * ieee80211_channel_to_freq_khz - convert channel number to frequency 5895934f4c7dSThomas Pedersen * @chan: channel number 5896934f4c7dSThomas Pedersen * @band: band, necessary due to channel number overlap 5897934f4c7dSThomas Pedersen * Return: The corresponding frequency (in KHz), or 0 if the conversion failed. 5898934f4c7dSThomas Pedersen */ 5899934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band); 5900934f4c7dSThomas Pedersen 5901934f4c7dSThomas Pedersen /** 5902d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 5903abe37c4bSJohannes Berg * @chan: channel number 590459eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 59050ae997dcSYacine Belkadi * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. 5906d3236553SJohannes Berg */ 5907934f4c7dSThomas Pedersen static inline int 5908934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band) 5909934f4c7dSThomas Pedersen { 5910934f4c7dSThomas Pedersen return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band)); 5911934f4c7dSThomas Pedersen } 5912934f4c7dSThomas Pedersen 5913934f4c7dSThomas Pedersen /** 5914934f4c7dSThomas Pedersen * ieee80211_freq_khz_to_channel - convert frequency to channel number 5915934f4c7dSThomas Pedersen * @freq: center frequency in KHz 5916934f4c7dSThomas Pedersen * Return: The corresponding channel, or 0 if the conversion failed. 5917934f4c7dSThomas Pedersen */ 5918934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq); 5919d3236553SJohannes Berg 5920d3236553SJohannes Berg /** 5921d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 5922934f4c7dSThomas Pedersen * @freq: center frequency in MHz 59230ae997dcSYacine Belkadi * Return: The corresponding channel, or 0 if the conversion failed. 5924d3236553SJohannes Berg */ 5925934f4c7dSThomas Pedersen static inline int 5926934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq) 5927934f4c7dSThomas Pedersen { 5928934f4c7dSThomas Pedersen return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq)); 5929934f4c7dSThomas Pedersen } 5930934f4c7dSThomas Pedersen 5931934f4c7dSThomas Pedersen /** 5932934f4c7dSThomas Pedersen * ieee80211_get_channel_khz - get channel struct from wiphy for specified 5933934f4c7dSThomas Pedersen * frequency 5934934f4c7dSThomas Pedersen * @wiphy: the struct wiphy to get the channel for 5935934f4c7dSThomas Pedersen * @freq: the center frequency (in KHz) of the channel 5936934f4c7dSThomas Pedersen * Return: The channel struct from @wiphy at @freq. 5937934f4c7dSThomas Pedersen */ 5938934f4c7dSThomas Pedersen struct ieee80211_channel * 5939934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq); 5940d3236553SJohannes Berg 5941d3236553SJohannes Berg /** 5942d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 5943543b921bSArend Van Spriel * 5944abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 5945934f4c7dSThomas Pedersen * @freq: the center frequency (in MHz) of the channel 59460ae997dcSYacine Belkadi * Return: The channel struct from @wiphy at @freq. 5947d3236553SJohannes Berg */ 5948934f4c7dSThomas Pedersen static inline struct ieee80211_channel * 5949934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq) 5950934f4c7dSThomas Pedersen { 5951934f4c7dSThomas Pedersen return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq)); 5952934f4c7dSThomas Pedersen } 5953d3236553SJohannes Berg 5954d3236553SJohannes Berg /** 5955afbc9c9eSJohannes Berg * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC 5956afbc9c9eSJohannes Berg * @chan: control channel to check 5957afbc9c9eSJohannes Berg * 5958afbc9c9eSJohannes Berg * The Preferred Scanning Channels (PSC) are defined in 5959afbc9c9eSJohannes Berg * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3 5960afbc9c9eSJohannes Berg */ 5961afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan) 5962afbc9c9eSJohannes Berg { 5963afbc9c9eSJohannes Berg if (chan->band != NL80211_BAND_6GHZ) 5964afbc9c9eSJohannes Berg return false; 5965afbc9c9eSJohannes Berg 5966afbc9c9eSJohannes Berg return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5; 5967afbc9c9eSJohannes Berg } 5968afbc9c9eSJohannes Berg 5969afbc9c9eSJohannes Berg /** 5970d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 5971d3236553SJohannes Berg * 5972d3236553SJohannes Berg * @sband: the band to look for rates in 5973d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 5974d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 5975d3236553SJohannes Berg * 59760ae997dcSYacine Belkadi * Return: The basic rate corresponding to a given bitrate, that 59770ae997dcSYacine Belkadi * is the next lower bitrate contained in the basic rate map, 59780ae997dcSYacine Belkadi * which is, for this function, given as a bitmap of indices of 59790ae997dcSYacine Belkadi * rates in the band's bitrate table. 5980d3236553SJohannes Berg */ 5981623b988fSJoe Perches const struct ieee80211_rate * 5982d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 5983d3236553SJohannes Berg u32 basic_rates, int bitrate); 5984d3236553SJohannes Berg 5985b422c6cdSAshok Nagarajan /** 5986b422c6cdSAshok Nagarajan * ieee80211_mandatory_rates - get mandatory rates for a given band 5987b422c6cdSAshok Nagarajan * @sband: the band to look for rates in 598874608acaSSimon Wunderlich * @scan_width: width of the control channel 5989b422c6cdSAshok Nagarajan * 5990b422c6cdSAshok Nagarajan * This function returns a bitmap of the mandatory rates for the given 5991b422c6cdSAshok Nagarajan * band, bits are set according to the rate position in the bitrates array. 5992b422c6cdSAshok Nagarajan */ 599374608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, 599474608acaSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 5995b422c6cdSAshok Nagarajan 5996d3236553SJohannes Berg /* 5997d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 5998d3236553SJohannes Berg * 5999d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 600066d495d0SMauro Carvalho Chehab * Documentation in Documentation/networking/radiotap-headers.rst 6001d3236553SJohannes Berg */ 6002d3236553SJohannes Berg 600333e5a2f7SJohannes Berg struct radiotap_align_size { 600433e5a2f7SJohannes Berg uint8_t align:4, size:4; 600533e5a2f7SJohannes Berg }; 600633e5a2f7SJohannes Berg 600733e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 600833e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 600933e5a2f7SJohannes Berg int n_bits; 601033e5a2f7SJohannes Berg uint32_t oui; 601133e5a2f7SJohannes Berg uint8_t subns; 601233e5a2f7SJohannes Berg }; 601333e5a2f7SJohannes Berg 601433e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 601533e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 601633e5a2f7SJohannes Berg int n_ns; 601733e5a2f7SJohannes Berg }; 601833e5a2f7SJohannes Berg 6019d3236553SJohannes Berg /** 6020d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 602133e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 602233e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 602333e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 602433e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 602533e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 602633e5a2f7SJohannes Berg * the beginning of the actual data portion 602733e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 602833e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 602933e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 603033e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 603133e5a2f7SJohannes Berg * radiotap namespace or not 603233e5a2f7SJohannes Berg * 603333e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 603433e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 603533e5a2f7SJohannes Berg * @_arg_index: next argument index 603633e5a2f7SJohannes Berg * @_arg: next argument pointer 603733e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 603833e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 603933e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 604033e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 604133e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 604233e5a2f7SJohannes Berg * next bitmap word 604333e5a2f7SJohannes Berg * 604433e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 604533e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 6046d3236553SJohannes Berg */ 6047d3236553SJohannes Berg 6048d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 604933e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 605033e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 605133e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 6052d3236553SJohannes Berg 605333e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 605467272440SJohannes Berg __le32 *_next_bitmap; 605533e5a2f7SJohannes Berg 605633e5a2f7SJohannes Berg unsigned char *this_arg; 605733e5a2f7SJohannes Berg int this_arg_index; 605833e5a2f7SJohannes Berg int this_arg_size; 605933e5a2f7SJohannes Berg 606033e5a2f7SJohannes Berg int is_radiotap_ns; 606133e5a2f7SJohannes Berg 606233e5a2f7SJohannes Berg int _max_length; 606333e5a2f7SJohannes Berg int _arg_index; 606433e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 606533e5a2f7SJohannes Berg int _reset_on_ext; 6066d3236553SJohannes Berg }; 6067d3236553SJohannes Berg 606810dd9b7cSJoe Perches int 606910dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator, 6070d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 607110dd9b7cSJoe Perches int max_length, 607210dd9b7cSJoe Perches const struct ieee80211_radiotap_vendor_namespaces *vns); 6073d3236553SJohannes Berg 607410dd9b7cSJoe Perches int 607510dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator); 6076d3236553SJohannes Berg 607733e5a2f7SJohannes Berg 6078e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 6079e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 6080e31a16d6SZhu Yi 6081e31a16d6SZhu Yi /** 6082e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 6083e31a16d6SZhu Yi * 6084e31a16d6SZhu Yi * @skb: the frame 60850ae997dcSYacine Belkadi * 60860ae997dcSYacine Belkadi * Given an skb with a raw 802.11 header at the data pointer this function 60870ae997dcSYacine Belkadi * returns the 802.11 header length. 60880ae997dcSYacine Belkadi * 60890ae997dcSYacine Belkadi * Return: The 802.11 header length in bytes (not including encryption 60900ae997dcSYacine Belkadi * headers). Or 0 if the data in the sk_buff is too short to contain a valid 60910ae997dcSYacine Belkadi * 802.11 header. 6092e31a16d6SZhu Yi */ 6093e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 6094e31a16d6SZhu Yi 6095e31a16d6SZhu Yi /** 6096e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 6097e31a16d6SZhu Yi * @fc: frame control field in little-endian format 60980ae997dcSYacine Belkadi * Return: The header length in bytes. 6099e31a16d6SZhu Yi */ 6100633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 6101e31a16d6SZhu Yi 6102e31a16d6SZhu Yi /** 61039b395bc3SJohannes Berg * ieee80211_get_mesh_hdrlen - get mesh extension header length 61049b395bc3SJohannes Berg * @meshhdr: the mesh extension header, only the flags field 61059b395bc3SJohannes Berg * (first byte) will be accessed 61060ae997dcSYacine Belkadi * Return: The length of the extension header, which is always at 61079b395bc3SJohannes Berg * least 6 bytes and at most 18 if address 5 and 6 are present. 61089b395bc3SJohannes Berg */ 61099b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); 61109b395bc3SJohannes Berg 61119b395bc3SJohannes Berg /** 6112d70e9693SJohannes Berg * DOC: Data path helpers 6113d70e9693SJohannes Berg * 6114d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 6115d70e9693SJohannes Berg * functions that help implement the data path for devices 6116d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 6117d70e9693SJohannes Berg */ 6118d70e9693SJohannes Berg 6119d70e9693SJohannes Berg /** 61207f6990c8SJohannes Berg * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3 61217f6990c8SJohannes Berg * @skb: the 802.11 data frame 61227f6990c8SJohannes Berg * @ehdr: pointer to a &struct ethhdr that will get the header, instead 61237f6990c8SJohannes Berg * of it being pushed into the SKB 61247f6990c8SJohannes Berg * @addr: the device MAC address 61257f6990c8SJohannes Berg * @iftype: the virtual interface type 612624bba078SFelix Fietkau * @data_offset: offset of payload after the 802.11 header 61272d8b08feSMauro Carvalho Chehab * @is_amsdu: true if the 802.11 header is A-MSDU 61287f6990c8SJohannes Berg * Return: 0 on success. Non-zero on error. 61297f6990c8SJohannes Berg */ 61307f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, 613124bba078SFelix Fietkau const u8 *addr, enum nl80211_iftype iftype, 6132a1d5ff56SMathy Vanhoef u8 data_offset, bool is_amsdu); 61337f6990c8SJohannes Berg 61347f6990c8SJohannes Berg /** 6135e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 6136e31a16d6SZhu Yi * @skb: the 802.11 data frame 6137e31a16d6SZhu Yi * @addr: the device MAC address 6138e31a16d6SZhu Yi * @iftype: the virtual interface type 61390ae997dcSYacine Belkadi * Return: 0 on success. Non-zero on error. 6140e31a16d6SZhu Yi */ 61417f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 61427f6990c8SJohannes Berg enum nl80211_iftype iftype) 61437f6990c8SJohannes Berg { 6144a1d5ff56SMathy Vanhoef return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false); 61457f6990c8SJohannes Berg } 6146e31a16d6SZhu Yi 6147e31a16d6SZhu Yi /** 6148eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 6149eaf85ca7SZhu Yi * 61507f6990c8SJohannes Berg * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. 61517f6990c8SJohannes Berg * The @list will be empty if the decode fails. The @skb must be fully 61527f6990c8SJohannes Berg * header-less before being passed in here; it is freed in this function. 6153eaf85ca7SZhu Yi * 61547f6990c8SJohannes Berg * @skb: The input A-MSDU frame without any headers. 6155eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 6156085a6c10SRandy Dunlap * initialized by the caller. 6157eaf85ca7SZhu Yi * @addr: The device MAC address. 6158eaf85ca7SZhu Yi * @iftype: The device interface type. 6159eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 61608b935ee2SJohannes Berg * @check_da: DA to check in the inner ethernet header, or NULL 61618b935ee2SJohannes Berg * @check_sa: SA to check in the inner ethernet header, or NULL 6162eaf85ca7SZhu Yi */ 6163eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 6164eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 61658b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 61668b935ee2SJohannes Berg const u8 *check_da, const u8 *check_sa); 6167eaf85ca7SZhu Yi 6168eaf85ca7SZhu Yi /** 6169e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 6170e31a16d6SZhu Yi * @skb: the data frame 6171fa9ffc74SKyeyoon Park * @qos_map: Interworking QoS mapping or %NULL if not in use 61720ae997dcSYacine Belkadi * Return: The 802.1p/1d tag. 6173e31a16d6SZhu Yi */ 6174fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb, 6175fa9ffc74SKyeyoon Park struct cfg80211_qos_map *qos_map); 6176e31a16d6SZhu Yi 6177c21dbf92SJohannes Berg /** 617849a68e0dSJohannes Berg * cfg80211_find_elem_match - match information element and byte array in data 617949a68e0dSJohannes Berg * 618049a68e0dSJohannes Berg * @eid: element ID 618149a68e0dSJohannes Berg * @ies: data consisting of IEs 618249a68e0dSJohannes Berg * @len: length of data 618349a68e0dSJohannes Berg * @match: byte array to match 618449a68e0dSJohannes Berg * @match_len: number of bytes in the match array 618549a68e0dSJohannes Berg * @match_offset: offset in the IE data where the byte array should match. 618649a68e0dSJohannes Berg * Note the difference to cfg80211_find_ie_match() which considers 618749a68e0dSJohannes Berg * the offset to start from the element ID byte, but here we take 618849a68e0dSJohannes Berg * the data portion instead. 618949a68e0dSJohannes Berg * 619049a68e0dSJohannes Berg * Return: %NULL if the element ID could not be found or if 619149a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 619249a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 619349a68e0dSJohannes Berg * requested element struct. 619449a68e0dSJohannes Berg * 619549a68e0dSJohannes Berg * Note: There are no checks on the element length other than 619649a68e0dSJohannes Berg * having to fit into the given data and being large enough for the 619749a68e0dSJohannes Berg * byte array to match. 619849a68e0dSJohannes Berg */ 619949a68e0dSJohannes Berg const struct element * 620049a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len, 620149a68e0dSJohannes Berg const u8 *match, unsigned int match_len, 620249a68e0dSJohannes Berg unsigned int match_offset); 620349a68e0dSJohannes Berg 620449a68e0dSJohannes Berg /** 6205fbd05e4aSLuca Coelho * cfg80211_find_ie_match - match information element and byte array in data 6206fbd05e4aSLuca Coelho * 6207fbd05e4aSLuca Coelho * @eid: element ID 6208fbd05e4aSLuca Coelho * @ies: data consisting of IEs 6209fbd05e4aSLuca Coelho * @len: length of data 6210fbd05e4aSLuca Coelho * @match: byte array to match 6211fbd05e4aSLuca Coelho * @match_len: number of bytes in the match array 6212fbd05e4aSLuca Coelho * @match_offset: offset in the IE where the byte array should match. 6213fbd05e4aSLuca Coelho * If match_len is zero, this must also be set to zero. 6214fbd05e4aSLuca Coelho * Otherwise this must be set to 2 or more, because the first 6215fbd05e4aSLuca Coelho * byte is the element id, which is already compared to eid, and 6216fbd05e4aSLuca Coelho * the second byte is the IE length. 6217fbd05e4aSLuca Coelho * 6218fbd05e4aSLuca Coelho * Return: %NULL if the element ID could not be found or if 6219fbd05e4aSLuca Coelho * the element is invalid (claims to be longer than the given 6220fbd05e4aSLuca Coelho * data) or if the byte array doesn't match, or a pointer to the first 6221fbd05e4aSLuca Coelho * byte of the requested element, that is the byte containing the 6222fbd05e4aSLuca Coelho * element ID. 6223fbd05e4aSLuca Coelho * 6224fbd05e4aSLuca Coelho * Note: There are no checks on the element length other than 6225fbd05e4aSLuca Coelho * having to fit into the given data and being large enough for the 6226fbd05e4aSLuca Coelho * byte array to match. 6227fbd05e4aSLuca Coelho */ 622849a68e0dSJohannes Berg static inline const u8 * 622949a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len, 623049a68e0dSJohannes Berg const u8 *match, unsigned int match_len, 623149a68e0dSJohannes Berg unsigned int match_offset) 623249a68e0dSJohannes Berg { 623349a68e0dSJohannes Berg /* match_offset can't be smaller than 2, unless match_len is 623449a68e0dSJohannes Berg * zero, in which case match_offset must be zero as well. 623549a68e0dSJohannes Berg */ 623649a68e0dSJohannes Berg if (WARN_ON((match_len && match_offset < 2) || 623749a68e0dSJohannes Berg (!match_len && match_offset))) 623849a68e0dSJohannes Berg return NULL; 623949a68e0dSJohannes Berg 62407e367b06SJohannes Berg return (const void *)cfg80211_find_elem_match(eid, ies, len, 624149a68e0dSJohannes Berg match, match_len, 624249a68e0dSJohannes Berg match_offset ? 624349a68e0dSJohannes Berg match_offset - 2 : 0); 624449a68e0dSJohannes Berg } 624549a68e0dSJohannes Berg 624649a68e0dSJohannes Berg /** 624749a68e0dSJohannes Berg * cfg80211_find_elem - find information element in data 624849a68e0dSJohannes Berg * 624949a68e0dSJohannes Berg * @eid: element ID 625049a68e0dSJohannes Berg * @ies: data consisting of IEs 625149a68e0dSJohannes Berg * @len: length of data 625249a68e0dSJohannes Berg * 625349a68e0dSJohannes Berg * Return: %NULL if the element ID could not be found or if 625449a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 625549a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 625649a68e0dSJohannes Berg * requested element struct. 625749a68e0dSJohannes Berg * 625849a68e0dSJohannes Berg * Note: There are no checks on the element length other than 625949a68e0dSJohannes Berg * having to fit into the given data. 626049a68e0dSJohannes Berg */ 626149a68e0dSJohannes Berg static inline const struct element * 626249a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len) 626349a68e0dSJohannes Berg { 626449a68e0dSJohannes Berg return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0); 626549a68e0dSJohannes Berg } 6266fbd05e4aSLuca Coelho 6267fbd05e4aSLuca Coelho /** 6268c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 6269c21dbf92SJohannes Berg * 6270c21dbf92SJohannes Berg * @eid: element ID 6271c21dbf92SJohannes Berg * @ies: data consisting of IEs 6272c21dbf92SJohannes Berg * @len: length of data 6273c21dbf92SJohannes Berg * 62740ae997dcSYacine Belkadi * Return: %NULL if the element ID could not be found or if 62750ae997dcSYacine Belkadi * the element is invalid (claims to be longer than the given 62760ae997dcSYacine Belkadi * data), or a pointer to the first byte of the requested 62770ae997dcSYacine Belkadi * element, that is the byte containing the element ID. 62780ae997dcSYacine Belkadi * 62790ae997dcSYacine Belkadi * Note: There are no checks on the element length other than 62800ae997dcSYacine Belkadi * having to fit into the given data. 6281c21dbf92SJohannes Berg */ 6282fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 6283fbd05e4aSLuca Coelho { 6284fbd05e4aSLuca Coelho return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0); 6285fbd05e4aSLuca Coelho } 6286c21dbf92SJohannes Berg 6287d70e9693SJohannes Berg /** 628849a68e0dSJohannes Berg * cfg80211_find_ext_elem - find information element with EID Extension in data 628949a68e0dSJohannes Berg * 629049a68e0dSJohannes Berg * @ext_eid: element ID Extension 629149a68e0dSJohannes Berg * @ies: data consisting of IEs 629249a68e0dSJohannes Berg * @len: length of data 629349a68e0dSJohannes Berg * 629449a68e0dSJohannes Berg * Return: %NULL if the etended element could not be found or if 629549a68e0dSJohannes Berg * the element is invalid (claims to be longer than the given 629649a68e0dSJohannes Berg * data) or if the byte array doesn't match; otherwise return the 629749a68e0dSJohannes Berg * requested element struct. 629849a68e0dSJohannes Berg * 629949a68e0dSJohannes Berg * Note: There are no checks on the element length other than 630049a68e0dSJohannes Berg * having to fit into the given data. 630149a68e0dSJohannes Berg */ 630249a68e0dSJohannes Berg static inline const struct element * 630349a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len) 630449a68e0dSJohannes Berg { 630549a68e0dSJohannes Berg return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len, 630649a68e0dSJohannes Berg &ext_eid, 1, 0); 630749a68e0dSJohannes Berg } 630849a68e0dSJohannes Berg 630949a68e0dSJohannes Berg /** 63103f817fe7SJouni Malinen * cfg80211_find_ext_ie - find information element with EID Extension in data 63113f817fe7SJouni Malinen * 63123f817fe7SJouni Malinen * @ext_eid: element ID Extension 63133f817fe7SJouni Malinen * @ies: data consisting of IEs 63143f817fe7SJouni Malinen * @len: length of data 63153f817fe7SJouni Malinen * 63163f817fe7SJouni Malinen * Return: %NULL if the extended element ID could not be found or if 63173f817fe7SJouni Malinen * the element is invalid (claims to be longer than the given 63183f817fe7SJouni Malinen * data), or a pointer to the first byte of the requested 63193f817fe7SJouni Malinen * element, that is the byte containing the element ID. 63203f817fe7SJouni Malinen * 63213f817fe7SJouni Malinen * Note: There are no checks on the element length other than 63223f817fe7SJouni Malinen * having to fit into the given data. 63233f817fe7SJouni Malinen */ 63243f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) 63253f817fe7SJouni Malinen { 63263f817fe7SJouni Malinen return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len, 63273f817fe7SJouni Malinen &ext_eid, 1, 2); 63283f817fe7SJouni Malinen } 63293f817fe7SJouni Malinen 63303f817fe7SJouni Malinen /** 633149a68e0dSJohannes Berg * cfg80211_find_vendor_elem - find vendor specific information element in data 633249a68e0dSJohannes Berg * 633349a68e0dSJohannes Berg * @oui: vendor OUI 633449a68e0dSJohannes Berg * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 633549a68e0dSJohannes Berg * @ies: data consisting of IEs 633649a68e0dSJohannes Berg * @len: length of data 633749a68e0dSJohannes Berg * 633849a68e0dSJohannes Berg * Return: %NULL if the vendor specific element ID could not be found or if the 633949a68e0dSJohannes Berg * element is invalid (claims to be longer than the given data); otherwise 634049a68e0dSJohannes Berg * return the element structure for the requested element. 634149a68e0dSJohannes Berg * 634249a68e0dSJohannes Berg * Note: There are no checks on the element length other than having to fit into 634349a68e0dSJohannes Berg * the given data. 634449a68e0dSJohannes Berg */ 634549a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type, 634649a68e0dSJohannes Berg const u8 *ies, 634749a68e0dSJohannes Berg unsigned int len); 634849a68e0dSJohannes Berg 634949a68e0dSJohannes Berg /** 63500c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 63510c28ec58SEliad Peller * 63520c28ec58SEliad Peller * @oui: vendor OUI 63539e9ea439SEmmanuel Grumbach * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any 63540c28ec58SEliad Peller * @ies: data consisting of IEs 63550c28ec58SEliad Peller * @len: length of data 63560c28ec58SEliad Peller * 63570ae997dcSYacine Belkadi * Return: %NULL if the vendor specific element ID could not be found or if the 63580ae997dcSYacine Belkadi * element is invalid (claims to be longer than the given data), or a pointer to 63590ae997dcSYacine Belkadi * the first byte of the requested element, that is the byte containing the 63600ae997dcSYacine Belkadi * element ID. 63610ae997dcSYacine Belkadi * 63620ae997dcSYacine Belkadi * Note: There are no checks on the element length other than having to fit into 63630ae997dcSYacine Belkadi * the given data. 63640c28ec58SEliad Peller */ 636549a68e0dSJohannes Berg static inline const u8 * 636649a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 636749a68e0dSJohannes Berg const u8 *ies, unsigned int len) 636849a68e0dSJohannes Berg { 63697e367b06SJohannes Berg return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len); 637049a68e0dSJohannes Berg } 63710c28ec58SEliad Peller 63720c28ec58SEliad Peller /** 637330ca1aa5SDedy Lansky * cfg80211_send_layer2_update - send layer 2 update frame 637430ca1aa5SDedy Lansky * 637530ca1aa5SDedy Lansky * @dev: network device 637630ca1aa5SDedy Lansky * @addr: STA MAC address 637730ca1aa5SDedy Lansky * 637830ca1aa5SDedy Lansky * Wireless drivers can use this function to update forwarding tables in bridge 637930ca1aa5SDedy Lansky * devices upon STA association. 638030ca1aa5SDedy Lansky */ 638130ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); 638230ca1aa5SDedy Lansky 638330ca1aa5SDedy Lansky /** 6384d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 6385d70e9693SJohannes Berg * 6386d70e9693SJohannes Berg * TODO 6387d3236553SJohannes Berg */ 6388d3236553SJohannes Berg 6389d3236553SJohannes Berg /** 6390d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 6391d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 6392d3236553SJohannes Berg * conflicts) 6393d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 6394d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 6395d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 6396d3236553SJohannes Berg * alpha2. 6397d3236553SJohannes Berg * 6398d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 6399d3236553SJohannes Berg * what it believes should be the current regulatory domain by 6400d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 6401d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 6402d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 6403d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 6404d3236553SJohannes Berg * 6405d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 6406d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 6407d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 6408d3236553SJohannes Berg * 6409d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 6410d3236553SJohannes Berg * an -ENOMEM. 64110ae997dcSYacine Belkadi * 64120ae997dcSYacine Belkadi * Return: 0 on success. -ENOMEM. 6413d3236553SJohannes Berg */ 641410dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 6415d3236553SJohannes Berg 6416d3236553SJohannes Berg /** 6417b0d7aa59SJonathan Doron * regulatory_set_wiphy_regd - set regdom info for self managed drivers 6418b0d7aa59SJonathan Doron * @wiphy: the wireless device we want to process the regulatory domain on 6419b0d7aa59SJonathan Doron * @rd: the regulatory domain informatoin to use for this wiphy 6420b0d7aa59SJonathan Doron * 6421b0d7aa59SJonathan Doron * Set the regulatory domain information for self-managed wiphys, only they 6422b0d7aa59SJonathan Doron * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more 6423b0d7aa59SJonathan Doron * information. 6424b0d7aa59SJonathan Doron * 6425b0d7aa59SJonathan Doron * Return: 0 on success. -EINVAL, -EPERM 6426b0d7aa59SJonathan Doron */ 6427b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy, 6428b0d7aa59SJonathan Doron struct ieee80211_regdomain *rd); 6429b0d7aa59SJonathan Doron 6430b0d7aa59SJonathan Doron /** 6431a05829a7SJohannes Berg * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers 64322c3e861cSArik Nemtsov * @wiphy: the wireless device we want to process the regulatory domain on 64332c3e861cSArik Nemtsov * @rd: the regulatory domain information to use for this wiphy 64342c3e861cSArik Nemtsov * 6435a05829a7SJohannes Berg * This functions requires the RTNL and the wiphy mutex to be held and 6436a05829a7SJohannes Berg * applies the new regdomain synchronously to this wiphy. For more details 6437a05829a7SJohannes Berg * see regulatory_set_wiphy_regd(). 64382c3e861cSArik Nemtsov * 64392c3e861cSArik Nemtsov * Return: 0 on success. -EINVAL, -EPERM 64402c3e861cSArik Nemtsov */ 6441a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 64422c3e861cSArik Nemtsov struct ieee80211_regdomain *rd); 64432c3e861cSArik Nemtsov 64442c3e861cSArik Nemtsov /** 6445d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 6446d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 6447d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 6448d3236553SJohannes Berg * 6449d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 6450d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 6451d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 6452d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 6453d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 6454d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 6455222ea581SLuis R. Rodriguez * Drivers using this for a wiphy should also set the wiphy flag 6456ce26151bSKalle Valo * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy 6457222ea581SLuis R. Rodriguez * that called this helper. 6458d3236553SJohannes Berg */ 645910dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 6460d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 6461d3236553SJohannes Berg 6462d3236553SJohannes Berg /** 6463d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 6464d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 6465d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 6466d3236553SJohannes Berg * 6467d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 6468d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 6469d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 6470d3236553SJohannes Berg * and processed already. 6471d3236553SJohannes Berg * 64720ae997dcSYacine Belkadi * Return: A valid pointer, or, when an error occurs, for example if no rule 64730ae997dcSYacine Belkadi * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to 64740ae997dcSYacine Belkadi * check and PTR_ERR() to obtain the numeric return value. The numeric return 64750ae997dcSYacine Belkadi * value will be -ERANGE if we determine the given center_freq does not even 64760ae997dcSYacine Belkadi * have a regulatory rule for a frequency range in the center_freq's band. 64770ae997dcSYacine Belkadi * See freq_in_rule_band() for our current definition of a band -- this is 64780ae997dcSYacine Belkadi * purely subjective and right now it's 802.11 specific. 6479d3236553SJohannes Berg */ 6480361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 6481361c9c8bSJohannes Berg u32 center_freq); 6482d3236553SJohannes Berg 6483034c6d6eSLuis R. Rodriguez /** 6484034c6d6eSLuis R. Rodriguez * reg_initiator_name - map regulatory request initiator enum to name 6485034c6d6eSLuis R. Rodriguez * @initiator: the regulatory request initiator 6486034c6d6eSLuis R. Rodriguez * 6487034c6d6eSLuis R. Rodriguez * You can use this to map the regulatory request initiator enum to a 6488034c6d6eSLuis R. Rodriguez * proper string representation. 6489034c6d6eSLuis R. Rodriguez */ 6490034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator); 6491034c6d6eSLuis R. Rodriguez 649219d3577eSHaim Dreyfuss /** 6493dc0c18edSAaron Komisar * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom 6494dc0c18edSAaron Komisar * @wiphy: wiphy for which pre-CAC capability is checked. 6495dc0c18edSAaron Komisar * 6496dc0c18edSAaron Komisar * Pre-CAC is allowed only in some regdomains (notable ETSI). 6497dc0c18edSAaron Komisar */ 6498dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy); 6499dc0c18edSAaron Komisar 6500dc0c18edSAaron Komisar /** 650119d3577eSHaim Dreyfuss * DOC: Internal regulatory db functions 650219d3577eSHaim Dreyfuss * 650319d3577eSHaim Dreyfuss */ 650419d3577eSHaim Dreyfuss 650519d3577eSHaim Dreyfuss /** 650619d3577eSHaim Dreyfuss * reg_query_regdb_wmm - Query internal regulatory db for wmm rule 650719d3577eSHaim Dreyfuss * Regulatory self-managed driver can use it to proactively 650819d3577eSHaim Dreyfuss * 650919d3577eSHaim Dreyfuss * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 651019d3577eSHaim Dreyfuss * @freq: the freqency(in MHz) to be queried. 651119d3577eSHaim Dreyfuss * @rule: pointer to store the wmm rule from the regulatory db. 651219d3577eSHaim Dreyfuss * 651319d3577eSHaim Dreyfuss * Self-managed wireless drivers can use this function to query 651419d3577eSHaim Dreyfuss * the internal regulatory database to check whether the given 651519d3577eSHaim Dreyfuss * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations. 651619d3577eSHaim Dreyfuss * 651719d3577eSHaim Dreyfuss * Drivers should check the return value, its possible you can get 651819d3577eSHaim Dreyfuss * an -ENODATA. 651919d3577eSHaim Dreyfuss * 652019d3577eSHaim Dreyfuss * Return: 0 on success. -ENODATA. 652119d3577eSHaim Dreyfuss */ 652238cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq, 652338cb87eeSStanislaw Gruszka struct ieee80211_reg_rule *rule); 652419d3577eSHaim Dreyfuss 6525d3236553SJohannes Berg /* 6526d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 6527d3236553SJohannes Berg * functions and BSS handling helpers 6528d3236553SJohannes Berg */ 6529d3236553SJohannes Berg 65302a519311SJohannes Berg /** 65312a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 65322a519311SJohannes Berg * 65332a519311SJohannes Berg * @request: the corresponding scan request 65341d76250bSAvraham Stern * @info: information about the completed scan 65352a519311SJohannes Berg */ 65361d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request, 65371d76250bSAvraham Stern struct cfg80211_scan_info *info); 65382a519311SJohannes Berg 65392a519311SJohannes Berg /** 6540807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 6541807f8a8cSLuciano Coelho * 6542807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 6543b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 6544807f8a8cSLuciano Coelho */ 6545b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid); 6546807f8a8cSLuciano Coelho 6547807f8a8cSLuciano Coelho /** 6548807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 6549807f8a8cSLuciano Coelho * 6550807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 6551b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 6552807f8a8cSLuciano Coelho * 6553807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 6554807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 6555807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 6556807f8a8cSLuciano Coelho */ 6557b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid); 6558807f8a8cSLuciano Coelho 6559807f8a8cSLuciano Coelho /** 6560a05829a7SJohannes Berg * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped 6561792e6aa7SEliad Peller * 6562792e6aa7SEliad Peller * @wiphy: the wiphy on which the scheduled scan stopped 6563b34939b9SArend Van Spriel * @reqid: identifier for the related scheduled scan request 6564792e6aa7SEliad Peller * 6565792e6aa7SEliad Peller * The driver can call this function to inform cfg80211 that the 6566792e6aa7SEliad Peller * scheduled scan had to be stopped, for whatever reason. The driver 6567792e6aa7SEliad Peller * is then called back via the sched_scan_stop operation when done. 6568a05829a7SJohannes Berg * This function should be called with the wiphy mutex held. 6569792e6aa7SEliad Peller */ 6570a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid); 6571792e6aa7SEliad Peller 6572792e6aa7SEliad Peller /** 65736e19bc4bSDmitry Shmidt * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame 65742a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 65756e19bc4bSDmitry Shmidt * @data: the BSS metadata 6576abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 6577abe37c4bSJohannes Berg * @len: length of the management frame 65782a519311SJohannes Berg * @gfp: context flags 65792a519311SJohannes Berg * 65802a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 65812a519311SJohannes Berg * the BSS should be updated/added. 6582ef100682SJohannes Berg * 65830ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 65840ae997dcSYacine Belkadi * Or %NULL on error. 65852a519311SJohannes Berg */ 6586ef100682SJohannes Berg struct cfg80211_bss * __must_check 65876e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy, 65886e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 65896e19bc4bSDmitry Shmidt struct ieee80211_mgmt *mgmt, size_t len, 65906e19bc4bSDmitry Shmidt gfp_t gfp); 65916e19bc4bSDmitry Shmidt 65926e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 6593dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 65943afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 6595dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 6596dcd6eac1SSimon Wunderlich struct ieee80211_mgmt *mgmt, size_t len, 65976e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 65986e19bc4bSDmitry Shmidt { 65996e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 66006e19bc4bSDmitry Shmidt .chan = rx_channel, 66016e19bc4bSDmitry Shmidt .scan_width = scan_width, 66026e19bc4bSDmitry Shmidt .signal = signal, 66036e19bc4bSDmitry Shmidt }; 66046e19bc4bSDmitry Shmidt 66056e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 66066e19bc4bSDmitry Shmidt } 6607dcd6eac1SSimon Wunderlich 6608dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 66092a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 66103afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 66112a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 6612dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 6613dcd6eac1SSimon Wunderlich { 66146e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 66156e19bc4bSDmitry Shmidt .chan = rx_channel, 66166e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 66176e19bc4bSDmitry Shmidt .signal = signal, 66186e19bc4bSDmitry Shmidt }; 66196e19bc4bSDmitry Shmidt 66206e19bc4bSDmitry Shmidt return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp); 6621dcd6eac1SSimon Wunderlich } 66222a519311SJohannes Berg 6623abe37c4bSJohannes Berg /** 66247ece9c37SSara Sharon * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID 66257ece9c37SSara Sharon * @bssid: transmitter BSSID 66267ece9c37SSara Sharon * @max_bssid: max BSSID indicator, taken from Multiple BSSID element 66277ece9c37SSara Sharon * @mbssid_index: BSSID index, taken from Multiple BSSID index element 66285d4071abSJohannes Berg * @new_bssid: calculated nontransmitted BSSID 66297ece9c37SSara Sharon */ 66307ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid, 66315d4071abSJohannes Berg u8 mbssid_index, u8 *new_bssid) 66327ece9c37SSara Sharon { 66335d4071abSJohannes Berg u64 bssid_u64 = ether_addr_to_u64(bssid); 66345d4071abSJohannes Berg u64 mask = GENMASK_ULL(max_bssid - 1, 0); 66355d4071abSJohannes Berg u64 new_bssid_u64; 66367ece9c37SSara Sharon 66375d4071abSJohannes Berg new_bssid_u64 = bssid_u64 & ~mask; 66387ece9c37SSara Sharon 66395d4071abSJohannes Berg new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask; 66407ece9c37SSara Sharon 66415d4071abSJohannes Berg u64_to_ether_addr(new_bssid_u64, new_bssid); 66427ece9c37SSara Sharon } 66437ece9c37SSara Sharon 66447ece9c37SSara Sharon /** 6645f7dacfb1SSara Sharon * cfg80211_is_element_inherited - returns if element ID should be inherited 6646f7dacfb1SSara Sharon * @element: element to check 6647f7dacfb1SSara Sharon * @non_inherit_element: non inheritance element 6648f7dacfb1SSara Sharon */ 6649f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element, 6650f7dacfb1SSara Sharon const struct element *non_inherit_element); 6651f7dacfb1SSara Sharon 6652f7dacfb1SSara Sharon /** 6653fe806e49SSara Sharon * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs 6654fe806e49SSara Sharon * @ie: ies 6655fe806e49SSara Sharon * @ielen: length of IEs 6656fe806e49SSara Sharon * @mbssid_elem: current MBSSID element 6657fe806e49SSara Sharon * @sub_elem: current MBSSID subelement (profile) 6658fe806e49SSara Sharon * @merged_ie: location of the merged profile 6659fe806e49SSara Sharon * @max_copy_len: max merged profile length 6660fe806e49SSara Sharon */ 6661fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen, 6662fe806e49SSara Sharon const struct element *mbssid_elem, 6663fe806e49SSara Sharon const struct element *sub_elem, 66645809a5d5SDan Carpenter u8 *merged_ie, size_t max_copy_len); 6665fe806e49SSara Sharon 6666fe806e49SSara Sharon /** 66675bc8c1f2SJohannes Berg * enum cfg80211_bss_frame_type - frame type that the BSS data came from 66685bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is 66695bc8c1f2SJohannes Berg * from a beacon or probe response 66705bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon 66715bc8c1f2SJohannes Berg * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response 66725bc8c1f2SJohannes Berg */ 66735bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type { 66745bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_UNKNOWN, 66755bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_BEACON, 66765bc8c1f2SJohannes Berg CFG80211_BSS_FTYPE_PRESP, 66775bc8c1f2SJohannes Berg }; 66785bc8c1f2SJohannes Berg 66795bc8c1f2SJohannes Berg /** 66807f599aecSAyala Beker * cfg80211_get_ies_channel_number - returns the channel number from ies 66817f599aecSAyala Beker * @ie: IEs 66827f599aecSAyala Beker * @ielen: length of IEs 66837f599aecSAyala Beker * @band: enum nl80211_band of the channel 66847f599aecSAyala Beker * @ftype: frame type 66857f599aecSAyala Beker * 66867f599aecSAyala Beker * Returns the channel number, or -1 if none could be determined. 66877f599aecSAyala Beker */ 66887f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen, 66897f599aecSAyala Beker enum nl80211_band band, 66907f599aecSAyala Beker enum cfg80211_bss_frame_type ftype); 66917f599aecSAyala Beker 66927f599aecSAyala Beker /** 66936e19bc4bSDmitry Shmidt * cfg80211_inform_bss_data - inform cfg80211 of a new BSS 6694abe37c4bSJohannes Berg * 6695abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 66966e19bc4bSDmitry Shmidt * @data: the BSS metadata 66975bc8c1f2SJohannes Berg * @ftype: frame type (if known) 6698abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 66997b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 6700abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 6701abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 6702abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 6703abe37c4bSJohannes Berg * @ielen: length of the additional IEs 6704abe37c4bSJohannes Berg * @gfp: context flags 6705abe37c4bSJohannes Berg * 6706abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 6707abe37c4bSJohannes Berg * the BSS should be updated/added. 6708ef100682SJohannes Berg * 67090ae997dcSYacine Belkadi * Return: A referenced struct, must be released with cfg80211_put_bss()! 67100ae997dcSYacine Belkadi * Or %NULL on error. 6711abe37c4bSJohannes Berg */ 6712ef100682SJohannes Berg struct cfg80211_bss * __must_check 67136e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy, 67146e19bc4bSDmitry Shmidt struct cfg80211_inform_bss *data, 67156e19bc4bSDmitry Shmidt enum cfg80211_bss_frame_type ftype, 67166e19bc4bSDmitry Shmidt const u8 *bssid, u64 tsf, u16 capability, 67176e19bc4bSDmitry Shmidt u16 beacon_interval, const u8 *ie, size_t ielen, 67186e19bc4bSDmitry Shmidt gfp_t gfp); 67196e19bc4bSDmitry Shmidt 67206e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check 6721dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy, 67223afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 6723dcd6eac1SSimon Wunderlich enum nl80211_bss_scan_width scan_width, 67245bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 6725dcd6eac1SSimon Wunderlich const u8 *bssid, u64 tsf, u16 capability, 6726dcd6eac1SSimon Wunderlich u16 beacon_interval, const u8 *ie, size_t ielen, 67276e19bc4bSDmitry Shmidt s32 signal, gfp_t gfp) 67286e19bc4bSDmitry Shmidt { 67296e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 67306e19bc4bSDmitry Shmidt .chan = rx_channel, 67316e19bc4bSDmitry Shmidt .scan_width = scan_width, 67326e19bc4bSDmitry Shmidt .signal = signal, 67336e19bc4bSDmitry Shmidt }; 67346e19bc4bSDmitry Shmidt 67356e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 67366e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 67376e19bc4bSDmitry Shmidt gfp); 67386e19bc4bSDmitry Shmidt } 6739dcd6eac1SSimon Wunderlich 6740dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check 674106aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 67423afc2167SEmmanuel Grumbach struct ieee80211_channel *rx_channel, 67435bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type ftype, 67447b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 67457b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 6746dcd6eac1SSimon Wunderlich s32 signal, gfp_t gfp) 6747dcd6eac1SSimon Wunderlich { 67486e19bc4bSDmitry Shmidt struct cfg80211_inform_bss data = { 67496e19bc4bSDmitry Shmidt .chan = rx_channel, 67506e19bc4bSDmitry Shmidt .scan_width = NL80211_BSS_CHAN_WIDTH_20, 67516e19bc4bSDmitry Shmidt .signal = signal, 67526e19bc4bSDmitry Shmidt }; 67536e19bc4bSDmitry Shmidt 67546e19bc4bSDmitry Shmidt return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf, 67556e19bc4bSDmitry Shmidt capability, beacon_interval, ie, ielen, 6756dcd6eac1SSimon Wunderlich gfp); 6757dcd6eac1SSimon Wunderlich } 675806aa7afaSJussi Kivilinna 675927548677SJohannes Berg /** 676027548677SJohannes Berg * cfg80211_get_bss - get a BSS reference 676127548677SJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 676227548677SJohannes Berg * @channel: the channel to search on (or %NULL) 676327548677SJohannes Berg * @bssid: the desired BSSID (or %NULL) 676427548677SJohannes Berg * @ssid: the desired SSID (or %NULL) 676527548677SJohannes Berg * @ssid_len: length of the SSID (or 0) 676627548677SJohannes Berg * @bss_type: type of BSS, see &enum ieee80211_bss_type 676727548677SJohannes Berg * @privacy: privacy filter, see &enum ieee80211_privacy 676827548677SJohannes Berg */ 67692a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 67702a519311SJohannes Berg struct ieee80211_channel *channel, 67712a519311SJohannes Berg const u8 *bssid, 677279420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 67736eb18137SDedy Lansky enum ieee80211_bss_type bss_type, 677427548677SJohannes Berg enum ieee80211_privacy privacy); 677579420f09SJohannes Berg static inline struct cfg80211_bss * 677679420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 677779420f09SJohannes Berg struct ieee80211_channel *channel, 677879420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 677979420f09SJohannes Berg { 678079420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 67816eb18137SDedy Lansky IEEE80211_BSS_TYPE_IBSS, 67826eb18137SDedy Lansky IEEE80211_PRIVACY_ANY); 678379420f09SJohannes Berg } 678479420f09SJohannes Berg 67854c0c0b75SJohannes Berg /** 67864c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 67875b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 67884c0c0b75SJohannes Berg * @bss: the BSS struct to reference 67894c0c0b75SJohannes Berg * 67904c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 67914c0c0b75SJohannes Berg */ 67925b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 67934c0c0b75SJohannes Berg 67944c0c0b75SJohannes Berg /** 67954c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 67965b112d3dSJohannes Berg * @wiphy: the wiphy this BSS struct belongs to 67974c0c0b75SJohannes Berg * @bss: the BSS struct 67984c0c0b75SJohannes Berg * 67994c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 68004c0c0b75SJohannes Berg */ 68015b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6802d3236553SJohannes Berg 6803d491af19SJohannes Berg /** 6804d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 6805d491af19SJohannes Berg * @wiphy: the wiphy 6806d491af19SJohannes Berg * @bss: the bss to remove 6807d491af19SJohannes Berg * 6808d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 6809d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 6810d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 6811d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 6812d491af19SJohannes Berg */ 6813d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 6814fee52678SJohannes Berg 68154770c8f9SIlan Peer /** 68164770c8f9SIlan Peer * cfg80211_bss_iter - iterate all BSS entries 68174770c8f9SIlan Peer * 68184770c8f9SIlan Peer * This function iterates over the BSS entries associated with the given wiphy 68194770c8f9SIlan Peer * and calls the callback for the iterated BSS. The iterator function is not 68204770c8f9SIlan Peer * allowed to call functions that might modify the internal state of the BSS DB. 68214770c8f9SIlan Peer * 68224770c8f9SIlan Peer * @wiphy: the wiphy 68234770c8f9SIlan Peer * @chandef: if given, the iterator function will be called only if the channel 68244770c8f9SIlan Peer * of the currently iterated BSS is a subset of the given channel. 68254770c8f9SIlan Peer * @iter: the iterator function to call 68264770c8f9SIlan Peer * @iter_data: an argument to the iterator function 68274770c8f9SIlan Peer */ 68284770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy, 68294770c8f9SIlan Peer struct cfg80211_chan_def *chandef, 68304770c8f9SIlan Peer void (*iter)(struct wiphy *wiphy, 68314770c8f9SIlan Peer struct cfg80211_bss *bss, 68324770c8f9SIlan Peer void *data), 68334770c8f9SIlan Peer void *iter_data); 68344770c8f9SIlan Peer 6835dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width 6836dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) 6837dcd6eac1SSimon Wunderlich { 6838dcd6eac1SSimon Wunderlich switch (chandef->width) { 6839dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 6840dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_5; 6841dcd6eac1SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 6842dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_10; 6843dcd6eac1SSimon Wunderlich default: 6844dcd6eac1SSimon Wunderlich return NL80211_BSS_CHAN_WIDTH_20; 6845dcd6eac1SSimon Wunderlich } 6846dcd6eac1SSimon Wunderlich } 6847dcd6eac1SSimon Wunderlich 68486039f6d2SJouni Malinen /** 68496ff57cf8SJohannes Berg * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame 68506039f6d2SJouni Malinen * @dev: network device 68516039f6d2SJouni Malinen * @buf: authentication frame (header + body) 68526039f6d2SJouni Malinen * @len: length of the frame data 68536039f6d2SJouni Malinen * 68546ff57cf8SJohannes Berg * This function is called whenever an authentication, disassociation or 68556ff57cf8SJohannes Berg * deauthentication frame has been received and processed in station mode. 68566ff57cf8SJohannes Berg * After being asked to authenticate via cfg80211_ops::auth() the driver must 68576ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 68586ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 68596ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 68606ff57cf8SJohannes Berg * While connected, the driver must calls this for received and processed 68616ff57cf8SJohannes Berg * disassociation and deauthentication frames. If the frame couldn't be used 68626ff57cf8SJohannes Berg * because it was unprotected, the driver must call the function 68636ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt() instead. 68646ff57cf8SJohannes Berg * 68656ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 68666039f6d2SJouni Malinen */ 68676ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); 68686039f6d2SJouni Malinen 68696039f6d2SJouni Malinen /** 68706ff57cf8SJohannes Berg * cfg80211_auth_timeout - notification of timed out authentication 68711965c853SJouni Malinen * @dev: network device 68721965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 6873cb0b4bebSJohannes Berg * 68748d61ffa5SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's 68758d61ffa5SJohannes Berg * mutex. 68761965c853SJouni Malinen */ 68776ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); 68781965c853SJouni Malinen 68791965c853SJouni Malinen /** 68806ff57cf8SJohannes Berg * cfg80211_rx_assoc_resp - notification of processed association response 68816039f6d2SJouni Malinen * @dev: network device 68826ff57cf8SJohannes Berg * @bss: the BSS that association was requested with, ownership of the pointer 68836ff57cf8SJohannes Berg * moves to cfg80211 in this call 68844d9ec73dSJouni Malinen * @buf: (Re)Association Response frame (header + body) 68856039f6d2SJouni Malinen * @len: length of the frame data 6886f438ceb8SEmmanuel Grumbach * @uapsd_queues: bitmap of queues configured for uapsd. Same format 6887f438ceb8SEmmanuel Grumbach * as the AC bitmap in the QoS info field 68884d9ec73dSJouni Malinen * @req_ies: information elements from the (Re)Association Request frame 68894d9ec73dSJouni Malinen * @req_ies_len: length of req_ies data 68906039f6d2SJouni Malinen * 68916ff57cf8SJohannes Berg * After being asked to associate via cfg80211_ops::assoc() the driver must 68926ff57cf8SJohannes Berg * call either this function or cfg80211_auth_timeout(). 68936ff57cf8SJohannes Berg * 68946ff57cf8SJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 68956039f6d2SJouni Malinen */ 68966ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev, 68976ff57cf8SJohannes Berg struct cfg80211_bss *bss, 6898b0b6aa2cSEliad Peller const u8 *buf, size_t len, 68994d9ec73dSJouni Malinen int uapsd_queues, 69004d9ec73dSJouni Malinen const u8 *req_ies, size_t req_ies_len); 69016039f6d2SJouni Malinen 69026039f6d2SJouni Malinen /** 6903*f662d2f4SJohannes Berg * struct cfg80211_assoc_failure - association failure data 6904*f662d2f4SJohannes Berg * @ap_mld_addr: AP MLD address, or %NULL 6905*f662d2f4SJohannes Berg * @bss: list of BSSes, must use entry 0 for non-MLO connections 6906*f662d2f4SJohannes Berg * (@ap_mld_addr is %NULL) 6907*f662d2f4SJohannes Berg * @timeout: indicates the association failed due to timeout, otherwise 6908*f662d2f4SJohannes Berg * the association was abandoned for a reason reported through some 6909*f662d2f4SJohannes Berg * other API (e.g. deauth RX) 69101965c853SJouni Malinen */ 6911*f662d2f4SJohannes Berg struct cfg80211_assoc_failure { 6912*f662d2f4SJohannes Berg const u8 *ap_mld_addr; 6913*f662d2f4SJohannes Berg struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS]; 6914*f662d2f4SJohannes Berg bool timeout; 6915*f662d2f4SJohannes Berg }; 69161965c853SJouni Malinen 69171965c853SJouni Malinen /** 6918*f662d2f4SJohannes Berg * cfg80211_assoc_failure - notification of association failure 6919e6f462dfSJohannes Berg * @dev: network device 6920*f662d2f4SJohannes Berg * @data: data describing the association failure 6921e6f462dfSJohannes Berg * 6922e6f462dfSJohannes Berg * This function may sleep. The caller must hold the corresponding wdev's mutex. 6923e6f462dfSJohannes Berg */ 6924*f662d2f4SJohannes Berg void cfg80211_assoc_failure(struct net_device *dev, 6925*f662d2f4SJohannes Berg struct cfg80211_assoc_failure *data); 6926e6f462dfSJohannes Berg 6927e6f462dfSJohannes Berg /** 69286ff57cf8SJohannes Berg * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame 69296039f6d2SJouni Malinen * @dev: network device 69306ff57cf8SJohannes Berg * @buf: 802.11 frame (header + body) 69316039f6d2SJouni Malinen * @len: length of the frame data 69323bb02143SJohannes Berg * @reconnect: immediate reconnect is desired (include the nl80211 attribute) 69336039f6d2SJouni Malinen * 69346039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 693553b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 69368d61ffa5SJohannes Berg * locally generated ones. This function may sleep. The caller must hold the 69378d61ffa5SJohannes Berg * corresponding wdev's mutex. 69386039f6d2SJouni Malinen */ 69393bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, 69403bb02143SJohannes Berg bool reconnect); 6941ce470613SHolger Schurig 6942ce470613SHolger Schurig /** 69436ff57cf8SJohannes Berg * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame 6944cf4e594eSJouni Malinen * @dev: network device 69454d797fceSJouni Malinen * @buf: received management frame (header + body) 6946cf4e594eSJouni Malinen * @len: length of the frame data 6947cf4e594eSJouni Malinen * 69486ff57cf8SJohannes Berg * This function is called whenever a received deauthentication or dissassoc 69496ff57cf8SJohannes Berg * frame has been dropped in station mode because of MFP being used but the 69504d797fceSJouni Malinen * frame was not protected. This is also used to notify reception of a Beacon 69514d797fceSJouni Malinen * frame that was dropped because it did not include a valid MME MIC while 69524d797fceSJouni Malinen * beacon protection was enabled (BIGTK configured in station mode). 69534d797fceSJouni Malinen * 69544d797fceSJouni Malinen * This function may sleep. 6955cf4e594eSJouni Malinen */ 69566ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, 69576ff57cf8SJohannes Berg const u8 *buf, size_t len); 6958cf4e594eSJouni Malinen 6959cf4e594eSJouni Malinen /** 6960a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 6961a3b8b056SJouni Malinen * @dev: network device 6962a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 6963a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 6964a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 6965a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 6966e6d6e342SJohannes Berg * @gfp: allocation flags 6967a3b8b056SJouni Malinen * 6968a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 6969a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 6970a3b8b056SJouni Malinen * primitive. 6971a3b8b056SJouni Malinen */ 6972a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 6973a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 6974e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 6975a3b8b056SJouni Malinen 697604a773adSJohannes Berg /** 697704a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 697804a773adSJohannes Berg * 697904a773adSJohannes Berg * @dev: network device 698004a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 6981fe94f3a4SAntonio Quartulli * @channel: the channel of the IBSS joined 698204a773adSJohannes Berg * @gfp: allocation flags 698304a773adSJohannes Berg * 698404a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 698504a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 698604a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 698704a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 698804a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 698904a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 699004a773adSJohannes Berg */ 6991fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, 6992fe94f3a4SAntonio Quartulli struct ieee80211_channel *channel, gfp_t gfp); 699304a773adSJohannes Berg 69941f87f7d3SJohannes Berg /** 6995b1e8eb11SMauro Carvalho Chehab * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer 6996b1e8eb11SMauro Carvalho Chehab * candidate 6997c93b5e71SJavier Cardona * 6998c93b5e71SJavier Cardona * @dev: network device 6999c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 7000c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 70015ac4a12dSMatteo Croce * @ie_len: length of the information elements buffer 70022d8b08feSMauro Carvalho Chehab * @sig_dbm: signal level in dBm 7003c93b5e71SJavier Cardona * @gfp: allocation flags 7004c93b5e71SJavier Cardona * 7005c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 7006c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 7007c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 7008c93b5e71SJavier Cardona */ 7009c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 7010ecbc12adSBob Copeland const u8 *macaddr, const u8 *ie, u8 ie_len, 7011ecbc12adSBob Copeland int sig_dbm, gfp_t gfp); 7012c93b5e71SJavier Cardona 7013c93b5e71SJavier Cardona /** 7014d70e9693SJohannes Berg * DOC: RFkill integration 7015d70e9693SJohannes Berg * 7016d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 7017d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 7018d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 7019d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 7020d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 7021d70e9693SJohannes Berg * 7022d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 7023d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 7024d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 7025d70e9693SJohannes Berg */ 7026d70e9693SJohannes Berg 7027d70e9693SJohannes Berg /** 7028810344edSEmmanuel Grumbach * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state 70291f87f7d3SJohannes Berg * @wiphy: the wiphy 70301f87f7d3SJohannes Berg * @blocked: block status 70316f779a66SEmmanuel Grumbach * @reason: one of reasons in &enum rfkill_hard_block_reasons 70321f87f7d3SJohannes Berg */ 70336f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, 70346f779a66SEmmanuel Grumbach enum rfkill_hard_block_reasons reason); 70356f779a66SEmmanuel Grumbach 70366f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) 70376f779a66SEmmanuel Grumbach { 70386f779a66SEmmanuel Grumbach wiphy_rfkill_set_hw_state_reason(wiphy, blocked, 70396f779a66SEmmanuel Grumbach RFKILL_HARD_BLOCK_SIGNAL); 70406f779a66SEmmanuel Grumbach } 70411f87f7d3SJohannes Berg 70421f87f7d3SJohannes Berg /** 70431f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 70441f87f7d3SJohannes Berg * @wiphy: the wiphy 70451f87f7d3SJohannes Berg */ 70461f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 70471f87f7d3SJohannes Berg 70481f87f7d3SJohannes Berg /** 70491f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 70501f87f7d3SJohannes Berg * @wiphy: the wiphy 70511f87f7d3SJohannes Berg */ 7052358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy) 7053358ae888SEmmanuel Grumbach { 7054358ae888SEmmanuel Grumbach rfkill_pause_polling(wiphy->rfkill); 7055358ae888SEmmanuel Grumbach } 70561f87f7d3SJohannes Berg 7057ad7e718cSJohannes Berg /** 7058ad7e718cSJohannes Berg * DOC: Vendor commands 7059ad7e718cSJohannes Berg * 7060ad7e718cSJohannes Berg * Occasionally, there are special protocol or firmware features that 7061ad7e718cSJohannes Berg * can't be implemented very openly. For this and similar cases, the 7062ad7e718cSJohannes Berg * vendor command functionality allows implementing the features with 7063ad7e718cSJohannes Berg * (typically closed-source) userspace and firmware, using nl80211 as 7064ad7e718cSJohannes Berg * the configuration mechanism. 7065ad7e718cSJohannes Berg * 7066ad7e718cSJohannes Berg * A driver supporting vendor commands must register them as an array 7067ad7e718cSJohannes Berg * in struct wiphy, with handlers for each one, each command has an 7068ad7e718cSJohannes Berg * OUI and sub command ID to identify it. 7069ad7e718cSJohannes Berg * 7070ad7e718cSJohannes Berg * Note that this feature should not be (ab)used to implement protocol 7071ad7e718cSJohannes Berg * features that could openly be shared across drivers. In particular, 7072ad7e718cSJohannes Berg * it must never be required to use vendor commands to implement any 7073ad7e718cSJohannes Berg * "normal" functionality that higher-level userspace like connection 7074ad7e718cSJohannes Berg * managers etc. need. 7075ad7e718cSJohannes Berg */ 7076ad7e718cSJohannes Berg 7077ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy, 7078ad7e718cSJohannes Berg enum nl80211_commands cmd, 7079ad7e718cSJohannes Berg enum nl80211_attrs attr, 7080ad7e718cSJohannes Berg int approxlen); 7081ad7e718cSJohannes Berg 7082567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 70836c09e791SAhmad Kholaif struct wireless_dev *wdev, 7084567ffc35SJohannes Berg enum nl80211_commands cmd, 7085567ffc35SJohannes Berg enum nl80211_attrs attr, 708655c1fdf0SJohannes Berg unsigned int portid, 7087567ffc35SJohannes Berg int vendor_event_idx, 7088567ffc35SJohannes Berg int approxlen, gfp_t gfp); 7089567ffc35SJohannes Berg 7090567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp); 7091567ffc35SJohannes Berg 7092ad7e718cSJohannes Berg /** 7093ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 7094ad7e718cSJohannes Berg * @wiphy: the wiphy 7095ad7e718cSJohannes Berg * @approxlen: an upper bound of the length of the data that will 7096ad7e718cSJohannes Berg * be put into the skb 7097ad7e718cSJohannes Berg * 7098ad7e718cSJohannes Berg * This function allocates and pre-fills an skb for a reply to 7099ad7e718cSJohannes Berg * a vendor command. Since it is intended for a reply, calling 7100ad7e718cSJohannes Berg * it outside of a vendor command's doit() operation is invalid. 7101ad7e718cSJohannes Berg * 7102ad7e718cSJohannes Berg * The returned skb is pre-filled with some identifying data in 7103ad7e718cSJohannes Berg * a way that any data that is put into the skb (with skb_put(), 7104ad7e718cSJohannes Berg * nla_put() or similar) will end up being within the 7105ad7e718cSJohannes Berg * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done 7106ad7e718cSJohannes Berg * with the skb is adding data for the corresponding userspace tool 7107ad7e718cSJohannes Berg * which can then read that data out of the vendor data attribute. 7108ad7e718cSJohannes Berg * You must not modify the skb in any other way. 7109ad7e718cSJohannes Berg * 7110ad7e718cSJohannes Berg * When done, call cfg80211_vendor_cmd_reply() with the skb and return 7111ad7e718cSJohannes Berg * its error code as the result of the doit() operation. 7112ad7e718cSJohannes Berg * 7113ad7e718cSJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7114ad7e718cSJohannes Berg */ 7115ad7e718cSJohannes Berg static inline struct sk_buff * 7116ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 7117ad7e718cSJohannes Berg { 7118ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR, 7119ad7e718cSJohannes Berg NL80211_ATTR_VENDOR_DATA, approxlen); 7120ad7e718cSJohannes Berg } 7121ad7e718cSJohannes Berg 7122ad7e718cSJohannes Berg /** 7123ad7e718cSJohannes Berg * cfg80211_vendor_cmd_reply - send the reply skb 7124ad7e718cSJohannes Berg * @skb: The skb, must have been allocated with 7125ad7e718cSJohannes Berg * cfg80211_vendor_cmd_alloc_reply_skb() 7126ad7e718cSJohannes Berg * 7127ad7e718cSJohannes Berg * Since calling this function will usually be the last thing 7128ad7e718cSJohannes Berg * before returning from the vendor command doit() you should 7129ad7e718cSJohannes Berg * return the error code. Note that this function consumes the 7130ad7e718cSJohannes Berg * skb regardless of the return value. 7131ad7e718cSJohannes Berg * 7132ad7e718cSJohannes Berg * Return: An error code or 0 on success. 7133ad7e718cSJohannes Berg */ 7134ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 7135ad7e718cSJohannes Berg 7136567ffc35SJohannes Berg /** 71375d9c358dSRandy Dunlap * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID 713855c1fdf0SJohannes Berg * @wiphy: the wiphy 713955c1fdf0SJohannes Berg * 714055c1fdf0SJohannes Berg * Return the current netlink port ID in a vendor command handler. 714155c1fdf0SJohannes Berg * Valid to call only there. 714255c1fdf0SJohannes Berg */ 714355c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy); 714455c1fdf0SJohannes Berg 714555c1fdf0SJohannes Berg /** 7146567ffc35SJohannes Berg * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 7147567ffc35SJohannes Berg * @wiphy: the wiphy 71486c09e791SAhmad Kholaif * @wdev: the wireless device 7149567ffc35SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 7150567ffc35SJohannes Berg * @approxlen: an upper bound of the length of the data that will 7151567ffc35SJohannes Berg * be put into the skb 7152567ffc35SJohannes Berg * @gfp: allocation flags 7153567ffc35SJohannes Berg * 7154567ffc35SJohannes Berg * This function allocates and pre-fills an skb for an event on the 7155567ffc35SJohannes Berg * vendor-specific multicast group. 7156567ffc35SJohannes Berg * 71576c09e791SAhmad Kholaif * If wdev != NULL, both the ifindex and identifier of the specified 71586c09e791SAhmad Kholaif * wireless device are added to the event message before the vendor data 71596c09e791SAhmad Kholaif * attribute. 71606c09e791SAhmad Kholaif * 7161567ffc35SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 7162567ffc35SJohannes Berg * skb to send the event. 7163567ffc35SJohannes Berg * 7164567ffc35SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7165567ffc35SJohannes Berg */ 7166567ffc35SJohannes Berg static inline struct sk_buff * 71676c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev, 71686c09e791SAhmad Kholaif int approxlen, int event_idx, gfp_t gfp) 7169567ffc35SJohannes Berg { 71706c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 7171567ffc35SJohannes Berg NL80211_ATTR_VENDOR_DATA, 717255c1fdf0SJohannes Berg 0, event_idx, approxlen, gfp); 717355c1fdf0SJohannes Berg } 717455c1fdf0SJohannes Berg 717555c1fdf0SJohannes Berg /** 717655c1fdf0SJohannes Berg * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb 717755c1fdf0SJohannes Berg * @wiphy: the wiphy 717855c1fdf0SJohannes Berg * @wdev: the wireless device 717955c1fdf0SJohannes Berg * @event_idx: index of the vendor event in the wiphy's vendor_events 718055c1fdf0SJohannes Berg * @portid: port ID of the receiver 718155c1fdf0SJohannes Berg * @approxlen: an upper bound of the length of the data that will 718255c1fdf0SJohannes Berg * be put into the skb 718355c1fdf0SJohannes Berg * @gfp: allocation flags 718455c1fdf0SJohannes Berg * 718555c1fdf0SJohannes Berg * This function allocates and pre-fills an skb for an event to send to 718655c1fdf0SJohannes Berg * a specific (userland) socket. This socket would previously have been 718755c1fdf0SJohannes Berg * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take 718855c1fdf0SJohannes Berg * care to register a netlink notifier to see when the socket closes. 718955c1fdf0SJohannes Berg * 719055c1fdf0SJohannes Berg * If wdev != NULL, both the ifindex and identifier of the specified 719155c1fdf0SJohannes Berg * wireless device are added to the event message before the vendor data 719255c1fdf0SJohannes Berg * attribute. 719355c1fdf0SJohannes Berg * 719455c1fdf0SJohannes Berg * When done filling the skb, call cfg80211_vendor_event() with the 719555c1fdf0SJohannes Berg * skb to send the event. 719655c1fdf0SJohannes Berg * 719755c1fdf0SJohannes Berg * Return: An allocated and pre-filled skb. %NULL if any errors happen. 719855c1fdf0SJohannes Berg */ 719955c1fdf0SJohannes Berg static inline struct sk_buff * 720055c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy, 720155c1fdf0SJohannes Berg struct wireless_dev *wdev, 720255c1fdf0SJohannes Berg unsigned int portid, int approxlen, 720355c1fdf0SJohannes Berg int event_idx, gfp_t gfp) 720455c1fdf0SJohannes Berg { 720555c1fdf0SJohannes Berg return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR, 720655c1fdf0SJohannes Berg NL80211_ATTR_VENDOR_DATA, 720755c1fdf0SJohannes Berg portid, event_idx, approxlen, gfp); 7208567ffc35SJohannes Berg } 7209567ffc35SJohannes Berg 7210567ffc35SJohannes Berg /** 7211567ffc35SJohannes Berg * cfg80211_vendor_event - send the event 7212567ffc35SJohannes Berg * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc() 7213567ffc35SJohannes Berg * @gfp: allocation flags 7214567ffc35SJohannes Berg * 7215567ffc35SJohannes Berg * This function sends the given @skb, which must have been allocated 7216567ffc35SJohannes Berg * by cfg80211_vendor_event_alloc(), as an event. It always consumes it. 7217567ffc35SJohannes Berg */ 7218567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp) 7219567ffc35SJohannes Berg { 7220567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 7221567ffc35SJohannes Berg } 7222567ffc35SJohannes Berg 7223aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 7224aff89a9bSJohannes Berg /** 7225d70e9693SJohannes Berg * DOC: Test mode 7226d70e9693SJohannes Berg * 7227d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 7228d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 7229d70e9693SJohannes Berg * factory programming. 7230d70e9693SJohannes Berg * 7231d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 7232d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 7233d70e9693SJohannes Berg */ 7234d70e9693SJohannes Berg 7235d70e9693SJohannes Berg /** 7236aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 7237aff89a9bSJohannes Berg * @wiphy: the wiphy 7238aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 7239aff89a9bSJohannes Berg * be put into the skb 7240aff89a9bSJohannes Berg * 7241aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 7242aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 7243aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 7244aff89a9bSJohannes Berg * 72450ae997dcSYacine Belkadi * The returned skb is pre-filled with the wiphy index and set up in 72460ae997dcSYacine Belkadi * a way that any data that is put into the skb (with skb_put(), 72470ae997dcSYacine Belkadi * nla_put() or similar) will end up being within the 72480ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done 72490ae997dcSYacine Belkadi * with the skb is adding data for the corresponding userspace tool 72500ae997dcSYacine Belkadi * which can then read that data out of the testdata attribute. You 72510ae997dcSYacine Belkadi * must not modify the skb in any other way. 7252aff89a9bSJohannes Berg * 7253aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 7254aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 72550ae997dcSYacine Belkadi * 72560ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7257aff89a9bSJohannes Berg */ 7258ad7e718cSJohannes Berg static inline struct sk_buff * 7259ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen) 7260ad7e718cSJohannes Berg { 7261ad7e718cSJohannes Berg return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE, 7262ad7e718cSJohannes Berg NL80211_ATTR_TESTDATA, approxlen); 7263ad7e718cSJohannes Berg } 7264aff89a9bSJohannes Berg 7265aff89a9bSJohannes Berg /** 7266aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 7267aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 7268aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 7269aff89a9bSJohannes Berg * 72700ae997dcSYacine Belkadi * Since calling this function will usually be the last thing 72710ae997dcSYacine Belkadi * before returning from the @testmode_cmd you should return 72720ae997dcSYacine Belkadi * the error code. Note that this function consumes the skb 72730ae997dcSYacine Belkadi * regardless of the return value. 72740ae997dcSYacine Belkadi * 72750ae997dcSYacine Belkadi * Return: An error code or 0 on success. 7276aff89a9bSJohannes Berg */ 7277ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb) 7278ad7e718cSJohannes Berg { 7279ad7e718cSJohannes Berg return cfg80211_vendor_cmd_reply(skb); 7280ad7e718cSJohannes Berg } 7281aff89a9bSJohannes Berg 7282aff89a9bSJohannes Berg /** 7283aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 7284aff89a9bSJohannes Berg * @wiphy: the wiphy 7285aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 7286aff89a9bSJohannes Berg * be put into the skb 7287aff89a9bSJohannes Berg * @gfp: allocation flags 7288aff89a9bSJohannes Berg * 7289aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 7290aff89a9bSJohannes Berg * testmode multicast group. 7291aff89a9bSJohannes Berg * 72920ae997dcSYacine Belkadi * The returned skb is set up in the same way as with 72930ae997dcSYacine Belkadi * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As 72940ae997dcSYacine Belkadi * there, you should simply add data to it that will then end up in the 72950ae997dcSYacine Belkadi * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb 72960ae997dcSYacine Belkadi * in any other way. 7297aff89a9bSJohannes Berg * 7298aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 7299aff89a9bSJohannes Berg * skb to send the event. 73000ae997dcSYacine Belkadi * 73010ae997dcSYacine Belkadi * Return: An allocated and pre-filled skb. %NULL if any errors happen. 7302aff89a9bSJohannes Berg */ 7303567ffc35SJohannes Berg static inline struct sk_buff * 7304567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 7305567ffc35SJohannes Berg { 73066c09e791SAhmad Kholaif return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE, 730755c1fdf0SJohannes Berg NL80211_ATTR_TESTDATA, 0, -1, 7308567ffc35SJohannes Berg approxlen, gfp); 7309567ffc35SJohannes Berg } 7310aff89a9bSJohannes Berg 7311aff89a9bSJohannes Berg /** 7312aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 7313aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 7314aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 7315aff89a9bSJohannes Berg * @gfp: allocation flags 7316aff89a9bSJohannes Berg * 7317aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 7318aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 7319aff89a9bSJohannes Berg * consumes it. 7320aff89a9bSJohannes Berg */ 7321567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) 7322567ffc35SJohannes Berg { 7323567ffc35SJohannes Berg __cfg80211_send_event_skb(skb, gfp); 7324567ffc35SJohannes Berg } 7325aff89a9bSJohannes Berg 7326aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 732771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 7328aff89a9bSJohannes Berg #else 7329aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 733071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 7331aff89a9bSJohannes Berg #endif 7332aff89a9bSJohannes Berg 7333b23aa676SSamuel Ortiz /** 733476804d28SArend Van Spriel * struct cfg80211_fils_resp_params - FILS connection response params 733576804d28SArend Van Spriel * @kek: KEK derived from a successful FILS connection (may be %NULL) 733676804d28SArend Van Spriel * @kek_len: Length of @fils_kek in octets 733776804d28SArend Van Spriel * @update_erp_next_seq_num: Boolean value to specify whether the value in 733876804d28SArend Van Spriel * @erp_next_seq_num is valid. 733976804d28SArend Van Spriel * @erp_next_seq_num: The next sequence number to use in ERP message in 734076804d28SArend Van Spriel * FILS Authentication. This value should be specified irrespective of the 734176804d28SArend Van Spriel * status for a FILS connection. 734276804d28SArend Van Spriel * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL). 734376804d28SArend Van Spriel * @pmk_len: Length of @pmk in octets 734476804d28SArend Van Spriel * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID 734576804d28SArend Van Spriel * used for this FILS connection (may be %NULL). 734676804d28SArend Van Spriel */ 734776804d28SArend Van Spriel struct cfg80211_fils_resp_params { 734876804d28SArend Van Spriel const u8 *kek; 734976804d28SArend Van Spriel size_t kek_len; 735076804d28SArend Van Spriel bool update_erp_next_seq_num; 735176804d28SArend Van Spriel u16 erp_next_seq_num; 735276804d28SArend Van Spriel const u8 *pmk; 735376804d28SArend Van Spriel size_t pmk_len; 735476804d28SArend Van Spriel const u8 *pmkid; 735576804d28SArend Van Spriel }; 735676804d28SArend Van Spriel 735776804d28SArend Van Spriel /** 73585349a0f7SVidyullatha Kanchanapally * struct cfg80211_connect_resp_params - Connection response params 73595349a0f7SVidyullatha Kanchanapally * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 73605349a0f7SVidyullatha Kanchanapally * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 73615349a0f7SVidyullatha Kanchanapally * the real status code for failures. If this call is used to report a 73625349a0f7SVidyullatha Kanchanapally * failure due to a timeout (e.g., not receiving an Authentication frame 73635349a0f7SVidyullatha Kanchanapally * from the AP) instead of an explicit rejection by the AP, -1 is used to 73645349a0f7SVidyullatha Kanchanapally * indicate that this is a failure, but without a status code. 73655349a0f7SVidyullatha Kanchanapally * @timeout_reason is used to report the reason for the timeout in that 73665349a0f7SVidyullatha Kanchanapally * case. 73675349a0f7SVidyullatha Kanchanapally * @req_ie: Association request IEs (may be %NULL) 73685349a0f7SVidyullatha Kanchanapally * @req_ie_len: Association request IEs length 73695349a0f7SVidyullatha Kanchanapally * @resp_ie: Association response IEs (may be %NULL) 73705349a0f7SVidyullatha Kanchanapally * @resp_ie_len: Association response IEs length 737176804d28SArend Van Spriel * @fils: FILS connection response parameters. 73725349a0f7SVidyullatha Kanchanapally * @timeout_reason: Reason for connection timeout. This is used when the 73735349a0f7SVidyullatha Kanchanapally * connection fails due to a timeout instead of an explicit rejection from 73745349a0f7SVidyullatha Kanchanapally * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 73755349a0f7SVidyullatha Kanchanapally * not known. This value is used only if @status < 0 to indicate that the 73765349a0f7SVidyullatha Kanchanapally * failure is due to a timeout and not due to explicit rejection by the AP. 73775349a0f7SVidyullatha Kanchanapally * This value is ignored in other cases (@status >= 0). 7378efbabc11SVeerendranath Jakkam * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise 7379efbabc11SVeerendranath Jakkam * zero. 7380efbabc11SVeerendranath Jakkam * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL. 7381efbabc11SVeerendranath Jakkam * @links : For MLO connection, contains link info for the valid links indicated 7382efbabc11SVeerendranath Jakkam * using @valid_links. For non-MLO connection, links[0] contains the 7383efbabc11SVeerendranath Jakkam * connected AP info. 7384efbabc11SVeerendranath Jakkam * @links.addr: For MLO connection, MAC address of the STA link. Otherwise 7385efbabc11SVeerendranath Jakkam * %NULL. 7386efbabc11SVeerendranath Jakkam * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO 7387efbabc11SVeerendranath Jakkam * connection, links[0].bssid points to the BSSID of the AP (may be %NULL). 7388efbabc11SVeerendranath Jakkam * @links.bss: For MLO connection, entry of bss to which STA link is connected. 7389efbabc11SVeerendranath Jakkam * For non-MLO connection, links[0].bss points to entry of bss to which STA 7390efbabc11SVeerendranath Jakkam * is connected. It can be obtained through cfg80211_get_bss() (may be 7391efbabc11SVeerendranath Jakkam * %NULL). It is recommended to store the bss from the connect_request and 7392efbabc11SVeerendranath Jakkam * hold a reference to it and return through this param to avoid a warning 7393efbabc11SVeerendranath Jakkam * if the bss is expired during the connection, esp. for those drivers 7394efbabc11SVeerendranath Jakkam * implementing connect op. Only one parameter among @bssid and @bss needs 7395efbabc11SVeerendranath Jakkam * to be specified. 73965349a0f7SVidyullatha Kanchanapally */ 73975349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params { 73985349a0f7SVidyullatha Kanchanapally int status; 73995349a0f7SVidyullatha Kanchanapally const u8 *req_ie; 74005349a0f7SVidyullatha Kanchanapally size_t req_ie_len; 74015349a0f7SVidyullatha Kanchanapally const u8 *resp_ie; 74025349a0f7SVidyullatha Kanchanapally size_t resp_ie_len; 740376804d28SArend Van Spriel struct cfg80211_fils_resp_params fils; 74045349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason; 7405efbabc11SVeerendranath Jakkam 7406efbabc11SVeerendranath Jakkam const u8 *ap_mld_addr; 7407efbabc11SVeerendranath Jakkam u16 valid_links; 7408efbabc11SVeerendranath Jakkam struct { 7409efbabc11SVeerendranath Jakkam const u8 *addr; 7410efbabc11SVeerendranath Jakkam const u8 *bssid; 7411efbabc11SVeerendranath Jakkam struct cfg80211_bss *bss; 7412efbabc11SVeerendranath Jakkam } links[IEEE80211_MLD_MAX_NUM_LINKS]; 74135349a0f7SVidyullatha Kanchanapally }; 74145349a0f7SVidyullatha Kanchanapally 74155349a0f7SVidyullatha Kanchanapally /** 74165349a0f7SVidyullatha Kanchanapally * cfg80211_connect_done - notify cfg80211 of connection result 74175349a0f7SVidyullatha Kanchanapally * 74185349a0f7SVidyullatha Kanchanapally * @dev: network device 74195349a0f7SVidyullatha Kanchanapally * @params: connection response parameters 74205349a0f7SVidyullatha Kanchanapally * @gfp: allocation flags 74215349a0f7SVidyullatha Kanchanapally * 74225349a0f7SVidyullatha Kanchanapally * It should be called by the underlying driver once execution of the connection 74235349a0f7SVidyullatha Kanchanapally * request from connect() has been completed. This is similar to 74245349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), but takes a structure pointer for connection response 74255349a0f7SVidyullatha Kanchanapally * parameters. Only one of the functions among cfg80211_connect_bss(), 74265349a0f7SVidyullatha Kanchanapally * cfg80211_connect_result(), cfg80211_connect_timeout(), 74275349a0f7SVidyullatha Kanchanapally * and cfg80211_connect_done() should be called. 74285349a0f7SVidyullatha Kanchanapally */ 74295349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev, 74305349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params *params, 74315349a0f7SVidyullatha Kanchanapally gfp_t gfp); 74325349a0f7SVidyullatha Kanchanapally 74335349a0f7SVidyullatha Kanchanapally /** 7434e7054989SKanchanapally, Vidyullatha * cfg80211_connect_bss - notify cfg80211 of connection result 7435e7054989SKanchanapally, Vidyullatha * 7436e7054989SKanchanapally, Vidyullatha * @dev: network device 7437e7054989SKanchanapally, Vidyullatha * @bssid: the BSSID of the AP 7438a3ce17d1SChaitanya Tata * @bss: Entry of bss to which STA got connected to, can be obtained through 7439a3ce17d1SChaitanya Tata * cfg80211_get_bss() (may be %NULL). But it is recommended to store the 7440a3ce17d1SChaitanya Tata * bss from the connect_request and hold a reference to it and return 7441a3ce17d1SChaitanya Tata * through this param to avoid a warning if the bss is expired during the 7442a3ce17d1SChaitanya Tata * connection, esp. for those drivers implementing connect op. 7443a3ce17d1SChaitanya Tata * Only one parameter among @bssid and @bss needs to be specified. 7444e7054989SKanchanapally, Vidyullatha * @req_ie: association request IEs (maybe be %NULL) 7445e7054989SKanchanapally, Vidyullatha * @req_ie_len: association request IEs length 7446e7054989SKanchanapally, Vidyullatha * @resp_ie: association response IEs (may be %NULL) 7447e7054989SKanchanapally, Vidyullatha * @resp_ie_len: assoc response IEs length 7448c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 7449e7054989SKanchanapally, Vidyullatha * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 7450c88215d7SJouni Malinen * the real status code for failures. If this call is used to report a 7451c88215d7SJouni Malinen * failure due to a timeout (e.g., not receiving an Authentication frame 7452c88215d7SJouni Malinen * from the AP) instead of an explicit rejection by the AP, -1 is used to 7453c88215d7SJouni Malinen * indicate that this is a failure, but without a status code. 7454c88215d7SJouni Malinen * @timeout_reason is used to report the reason for the timeout in that 7455c88215d7SJouni Malinen * case. 7456e7054989SKanchanapally, Vidyullatha * @gfp: allocation flags 74573093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. This is used when the 74583093ebbeSPurushottam Kushwaha * connection fails due to a timeout instead of an explicit rejection from 74593093ebbeSPurushottam Kushwaha * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 74603093ebbeSPurushottam Kushwaha * not known. This value is used only if @status < 0 to indicate that the 74613093ebbeSPurushottam Kushwaha * failure is due to a timeout and not due to explicit rejection by the AP. 74623093ebbeSPurushottam Kushwaha * This value is ignored in other cases (@status >= 0). 7463e7054989SKanchanapally, Vidyullatha * 7464c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 7465c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 7466c88215d7SJouni Malinen * cfg80211_connect_result(), but with the option of identifying the exact bss 74675349a0f7SVidyullatha Kanchanapally * entry for the connection. Only one of the functions among 74685349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 74695349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 7470e7054989SKanchanapally, Vidyullatha */ 74715349a0f7SVidyullatha Kanchanapally static inline void 74725349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, 7473e7054989SKanchanapally, Vidyullatha struct cfg80211_bss *bss, const u8 *req_ie, 7474e7054989SKanchanapally, Vidyullatha size_t req_ie_len, const u8 *resp_ie, 74753093ebbeSPurushottam Kushwaha size_t resp_ie_len, int status, gfp_t gfp, 74765349a0f7SVidyullatha Kanchanapally enum nl80211_timeout_reason timeout_reason) 74775349a0f7SVidyullatha Kanchanapally { 74785349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params params; 74795349a0f7SVidyullatha Kanchanapally 74805349a0f7SVidyullatha Kanchanapally memset(¶ms, 0, sizeof(params)); 74815349a0f7SVidyullatha Kanchanapally params.status = status; 7482efbabc11SVeerendranath Jakkam params.links[0].bssid = bssid; 7483efbabc11SVeerendranath Jakkam params.links[0].bss = bss; 74845349a0f7SVidyullatha Kanchanapally params.req_ie = req_ie; 74855349a0f7SVidyullatha Kanchanapally params.req_ie_len = req_ie_len; 74865349a0f7SVidyullatha Kanchanapally params.resp_ie = resp_ie; 74875349a0f7SVidyullatha Kanchanapally params.resp_ie_len = resp_ie_len; 74885349a0f7SVidyullatha Kanchanapally params.timeout_reason = timeout_reason; 74895349a0f7SVidyullatha Kanchanapally 74905349a0f7SVidyullatha Kanchanapally cfg80211_connect_done(dev, ¶ms, gfp); 74915349a0f7SVidyullatha Kanchanapally } 7492e7054989SKanchanapally, Vidyullatha 7493e7054989SKanchanapally, Vidyullatha /** 7494b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 7495b23aa676SSamuel Ortiz * 7496b23aa676SSamuel Ortiz * @dev: network device 7497b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 7498b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 7499b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 7500b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 7501b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 7502c88215d7SJouni Malinen * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use 7503b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 7504b23aa676SSamuel Ortiz * the real status code for failures. 7505b23aa676SSamuel Ortiz * @gfp: allocation flags 7506b23aa676SSamuel Ortiz * 7507c88215d7SJouni Malinen * It should be called by the underlying driver once execution of the connection 7508c88215d7SJouni Malinen * request from connect() has been completed. This is similar to 7509c88215d7SJouni Malinen * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only 75105349a0f7SVidyullatha Kanchanapally * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(), 75115349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 7512b23aa676SSamuel Ortiz */ 7513e7054989SKanchanapally, Vidyullatha static inline void 7514e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 7515b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 7516b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 7517e7054989SKanchanapally, Vidyullatha u16 status, gfp_t gfp) 7518e7054989SKanchanapally, Vidyullatha { 7519e7054989SKanchanapally, Vidyullatha cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie, 75203093ebbeSPurushottam Kushwaha resp_ie_len, status, gfp, 75213093ebbeSPurushottam Kushwaha NL80211_TIMEOUT_UNSPECIFIED); 7522e7054989SKanchanapally, Vidyullatha } 7523b23aa676SSamuel Ortiz 7524b23aa676SSamuel Ortiz /** 7525bf1ecd21SJouni Malinen * cfg80211_connect_timeout - notify cfg80211 of connection timeout 7526bf1ecd21SJouni Malinen * 7527bf1ecd21SJouni Malinen * @dev: network device 7528bf1ecd21SJouni Malinen * @bssid: the BSSID of the AP 7529bf1ecd21SJouni Malinen * @req_ie: association request IEs (maybe be %NULL) 7530bf1ecd21SJouni Malinen * @req_ie_len: association request IEs length 7531bf1ecd21SJouni Malinen * @gfp: allocation flags 75323093ebbeSPurushottam Kushwaha * @timeout_reason: reason for connection timeout. 7533bf1ecd21SJouni Malinen * 7534bf1ecd21SJouni Malinen * It should be called by the underlying driver whenever connect() has failed 7535bf1ecd21SJouni Malinen * in a sequence where no explicit authentication/association rejection was 7536bf1ecd21SJouni Malinen * received from the AP. This could happen, e.g., due to not being able to send 7537bf1ecd21SJouni Malinen * out the Authentication or Association Request frame or timing out while 75385349a0f7SVidyullatha Kanchanapally * waiting for the response. Only one of the functions among 75395349a0f7SVidyullatha Kanchanapally * cfg80211_connect_bss(), cfg80211_connect_result(), 75405349a0f7SVidyullatha Kanchanapally * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called. 7541bf1ecd21SJouni Malinen */ 7542bf1ecd21SJouni Malinen static inline void 7543bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, 75443093ebbeSPurushottam Kushwaha const u8 *req_ie, size_t req_ie_len, gfp_t gfp, 75453093ebbeSPurushottam Kushwaha enum nl80211_timeout_reason timeout_reason) 7546bf1ecd21SJouni Malinen { 7547bf1ecd21SJouni Malinen cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1, 75483093ebbeSPurushottam Kushwaha gfp, timeout_reason); 7549bf1ecd21SJouni Malinen } 7550bf1ecd21SJouni Malinen 7551bf1ecd21SJouni Malinen /** 755229ce6ecbSAvraham Stern * struct cfg80211_roam_info - driver initiated roaming information 755329ce6ecbSAvraham Stern * 755429ce6ecbSAvraham Stern * @req_ie: association request IEs (maybe be %NULL) 755529ce6ecbSAvraham Stern * @req_ie_len: association request IEs length 755629ce6ecbSAvraham Stern * @resp_ie: association response IEs (may be %NULL) 755729ce6ecbSAvraham Stern * @resp_ie_len: assoc response IEs length 7558e841b7b1SArend Van Spriel * @fils: FILS related roaming information. 7559efbabc11SVeerendranath Jakkam * @valid_links: For MLO roaming, BIT mask of the new valid links is set. 7560efbabc11SVeerendranath Jakkam * Otherwise zero. 7561efbabc11SVeerendranath Jakkam * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL. 7562efbabc11SVeerendranath Jakkam * @links : For MLO roaming, contains new link info for the valid links set in 7563efbabc11SVeerendranath Jakkam * @valid_links. For non-MLO roaming, links[0] contains the new AP info. 7564efbabc11SVeerendranath Jakkam * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL. 7565efbabc11SVeerendranath Jakkam * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO 7566efbabc11SVeerendranath Jakkam * roaming, links[0].bssid points to the BSSID of the new AP. May be 7567efbabc11SVeerendranath Jakkam * %NULL if %links.bss is set. 7568efbabc11SVeerendranath Jakkam * @links.channel: the channel of the new AP. 7569efbabc11SVeerendranath Jakkam * @links.bss: For MLO roaming, entry of new bss to which STA link got 7570efbabc11SVeerendranath Jakkam * roamed. For non-MLO roaming, links[0].bss points to entry of bss to 7571efbabc11SVeerendranath Jakkam * which STA got roamed (may be %NULL if %links.bssid is set) 757229ce6ecbSAvraham Stern */ 757329ce6ecbSAvraham Stern struct cfg80211_roam_info { 757429ce6ecbSAvraham Stern const u8 *req_ie; 757529ce6ecbSAvraham Stern size_t req_ie_len; 757629ce6ecbSAvraham Stern const u8 *resp_ie; 757729ce6ecbSAvraham Stern size_t resp_ie_len; 7578e841b7b1SArend Van Spriel struct cfg80211_fils_resp_params fils; 7579efbabc11SVeerendranath Jakkam 7580efbabc11SVeerendranath Jakkam const u8 *ap_mld_addr; 7581efbabc11SVeerendranath Jakkam u16 valid_links; 7582efbabc11SVeerendranath Jakkam struct { 7583efbabc11SVeerendranath Jakkam const u8 *addr; 7584efbabc11SVeerendranath Jakkam const u8 *bssid; 7585efbabc11SVeerendranath Jakkam struct ieee80211_channel *channel; 7586efbabc11SVeerendranath Jakkam struct cfg80211_bss *bss; 7587efbabc11SVeerendranath Jakkam } links[IEEE80211_MLD_MAX_NUM_LINKS]; 758829ce6ecbSAvraham Stern }; 758929ce6ecbSAvraham Stern 759029ce6ecbSAvraham Stern /** 7591b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 7592b23aa676SSamuel Ortiz * 7593b23aa676SSamuel Ortiz * @dev: network device 759429ce6ecbSAvraham Stern * @info: information about the new BSS. struct &cfg80211_roam_info. 7595b23aa676SSamuel Ortiz * @gfp: allocation flags 7596b23aa676SSamuel Ortiz * 759729ce6ecbSAvraham Stern * This function may be called with the driver passing either the BSSID of the 759829ce6ecbSAvraham Stern * new AP or passing the bss entry to avoid a race in timeout of the bss entry. 759929ce6ecbSAvraham Stern * It should be called by the underlying driver whenever it roamed from one AP 760029ce6ecbSAvraham Stern * to another while connected. Drivers which have roaming implemented in 760129ce6ecbSAvraham Stern * firmware should pass the bss entry to avoid a race in bss entry timeout where 760229ce6ecbSAvraham Stern * the bss entry of the new AP is seen in the driver, but gets timed out by the 760329ce6ecbSAvraham Stern * time it is accessed in __cfg80211_roamed() due to delay in scheduling 7604adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 760529ce6ecbSAvraham Stern * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be 7606e1b18549SGeert Uytterhoeven * released while disconnecting from the current bss. 7607adbde344SVasanthakumar Thiagarajan */ 760829ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, 760929ce6ecbSAvraham Stern gfp_t gfp); 7610adbde344SVasanthakumar Thiagarajan 7611adbde344SVasanthakumar Thiagarajan /** 7612503c1fb9SAvraham Stern * cfg80211_port_authorized - notify cfg80211 of successful security association 7613503c1fb9SAvraham Stern * 7614503c1fb9SAvraham Stern * @dev: network device 7615503c1fb9SAvraham Stern * @bssid: the BSSID of the AP 7616503c1fb9SAvraham Stern * @gfp: allocation flags 7617503c1fb9SAvraham Stern * 7618503c1fb9SAvraham Stern * This function should be called by a driver that supports 4 way handshake 7619503c1fb9SAvraham Stern * offload after a security association was successfully established (i.e., 7620503c1fb9SAvraham Stern * the 4 way handshake was completed successfully). The call to this function 7621503c1fb9SAvraham Stern * should be preceded with a call to cfg80211_connect_result(), 7622503c1fb9SAvraham Stern * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to 7623503c1fb9SAvraham Stern * indicate the 802.11 association. 7624503c1fb9SAvraham Stern */ 7625503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, 7626503c1fb9SAvraham Stern gfp_t gfp); 7627503c1fb9SAvraham Stern 7628503c1fb9SAvraham Stern /** 7629b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 7630b23aa676SSamuel Ortiz * 7631b23aa676SSamuel Ortiz * @dev: network device 7632b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 7633b23aa676SSamuel Ortiz * @ie_len: length of IEs 7634b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 763580279fb7SJohannes Berg * @locally_generated: disconnection was requested locally 7636b23aa676SSamuel Ortiz * @gfp: allocation flags 7637b23aa676SSamuel Ortiz * 7638b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 7639b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 7640b23aa676SSamuel Ortiz */ 7641b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 764280279fb7SJohannes Berg const u8 *ie, size_t ie_len, 764380279fb7SJohannes Berg bool locally_generated, gfp_t gfp); 7644b23aa676SSamuel Ortiz 76459588bbd5SJouni Malinen /** 76469588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 764771bbc994SJohannes Berg * @wdev: wireless device 76489588bbd5SJouni Malinen * @cookie: the request cookie 76499588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 76509588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 76519588bbd5SJouni Malinen * channel 76529588bbd5SJouni Malinen * @gfp: allocation flags 76539588bbd5SJouni Malinen */ 765471bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 76559588bbd5SJouni Malinen struct ieee80211_channel *chan, 76569588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 76579588bbd5SJouni Malinen 76589588bbd5SJouni Malinen /** 76599588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 766071bbc994SJohannes Berg * @wdev: wireless device 76619588bbd5SJouni Malinen * @cookie: the request cookie 76629588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 76639588bbd5SJouni Malinen * @gfp: allocation flags 76649588bbd5SJouni Malinen */ 766571bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 76669588bbd5SJouni Malinen struct ieee80211_channel *chan, 76679588bbd5SJouni Malinen gfp_t gfp); 7668b23aa676SSamuel Ortiz 76698689c051SArend van Spriel /** 76701c38c7f2SJames Prestwood * cfg80211_tx_mgmt_expired - tx_mgmt duration expired 76711c38c7f2SJames Prestwood * @wdev: wireless device 76721c38c7f2SJames Prestwood * @cookie: the requested cookie 76731c38c7f2SJames Prestwood * @chan: The current channel (from tx_mgmt request) 76741c38c7f2SJames Prestwood * @gfp: allocation flags 76751c38c7f2SJames Prestwood */ 76761c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, 76771c38c7f2SJames Prestwood struct ieee80211_channel *chan, gfp_t gfp); 76781c38c7f2SJames Prestwood 76791c38c7f2SJames Prestwood /** 76808689c051SArend van Spriel * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. 76818689c051SArend van Spriel * 76828689c051SArend van Spriel * @sinfo: the station information 76838689c051SArend van Spriel * @gfp: allocation flags 76848689c051SArend van Spriel */ 76858689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); 768698b62183SJohannes Berg 768798b62183SJohannes Berg /** 76887ea3e110SJohannes Berg * cfg80211_sinfo_release_content - release contents of station info 76897ea3e110SJohannes Berg * @sinfo: the station information 76907ea3e110SJohannes Berg * 76917ea3e110SJohannes Berg * Releases any potentially allocated sub-information of the station 76927ea3e110SJohannes Berg * information, but not the struct itself (since it's typically on 76937ea3e110SJohannes Berg * the stack.) 76947ea3e110SJohannes Berg */ 76957ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) 76967ea3e110SJohannes Berg { 76977ea3e110SJohannes Berg kfree(sinfo->pertid); 76987ea3e110SJohannes Berg } 76997ea3e110SJohannes Berg 77007ea3e110SJohannes Berg /** 770198b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 770298b62183SJohannes Berg * 770398b62183SJohannes Berg * @dev: the netdev 770498b62183SJohannes Berg * @mac_addr: the station's address 770598b62183SJohannes Berg * @sinfo: the station information 770698b62183SJohannes Berg * @gfp: allocation flags 770798b62183SJohannes Berg */ 770898b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 770998b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 771098b62183SJohannes Berg 7711026331c4SJouni Malinen /** 7712cf5ead82SJohannes Berg * cfg80211_del_sta_sinfo - notify userspace about deletion of a station 7713cf5ead82SJohannes Berg * @dev: the netdev 7714cf5ead82SJohannes Berg * @mac_addr: the station's address 7715cf5ead82SJohannes Berg * @sinfo: the station information/statistics 7716cf5ead82SJohannes Berg * @gfp: allocation flags 7717cf5ead82SJohannes Berg */ 7718cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, 7719cf5ead82SJohannes Berg struct station_info *sinfo, gfp_t gfp); 7720cf5ead82SJohannes Berg 7721cf5ead82SJohannes Berg /** 7722ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 7723ec15e68bSJouni Malinen * 7724ec15e68bSJouni Malinen * @dev: the netdev 7725ec15e68bSJouni Malinen * @mac_addr: the station's address 7726ec15e68bSJouni Malinen * @gfp: allocation flags 7727ec15e68bSJouni Malinen */ 7728cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev, 7729cf5ead82SJohannes Berg const u8 *mac_addr, gfp_t gfp) 7730cf5ead82SJohannes Berg { 7731cf5ead82SJohannes Berg cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp); 7732cf5ead82SJohannes Berg } 7733ec15e68bSJouni Malinen 7734ec15e68bSJouni Malinen /** 7735ed44a951SPandiyarajan Pitchaimuthu * cfg80211_conn_failed - connection request failed notification 7736ed44a951SPandiyarajan Pitchaimuthu * 7737ed44a951SPandiyarajan Pitchaimuthu * @dev: the netdev 7738ed44a951SPandiyarajan Pitchaimuthu * @mac_addr: the station's address 7739ed44a951SPandiyarajan Pitchaimuthu * @reason: the reason for connection failure 7740ed44a951SPandiyarajan Pitchaimuthu * @gfp: allocation flags 7741ed44a951SPandiyarajan Pitchaimuthu * 7742ed44a951SPandiyarajan Pitchaimuthu * Whenever a station tries to connect to an AP and if the station 7743ed44a951SPandiyarajan Pitchaimuthu * could not connect to the AP as the AP has rejected the connection 7744ed44a951SPandiyarajan Pitchaimuthu * for some reasons, this function is called. 7745ed44a951SPandiyarajan Pitchaimuthu * 7746ed44a951SPandiyarajan Pitchaimuthu * The reason for connection failure can be any of the value from 7747ed44a951SPandiyarajan Pitchaimuthu * nl80211_connect_failed_reason enum 7748ed44a951SPandiyarajan Pitchaimuthu */ 7749ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, 7750ed44a951SPandiyarajan Pitchaimuthu enum nl80211_connect_failed_reason reason, 7751ed44a951SPandiyarajan Pitchaimuthu gfp_t gfp); 7752ed44a951SPandiyarajan Pitchaimuthu 7753ed44a951SPandiyarajan Pitchaimuthu /** 7754e76fede8SThomas Pedersen * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame 7755e76fede8SThomas Pedersen * @wdev: wireless device receiving the frame 7756e76fede8SThomas Pedersen * @freq: Frequency on which the frame was received in KHz 7757e76fede8SThomas Pedersen * @sig_dbm: signal strength in dBm, or 0 if unknown 7758e76fede8SThomas Pedersen * @buf: Management frame (header + body) 7759e76fede8SThomas Pedersen * @len: length of the frame data 7760e76fede8SThomas Pedersen * @flags: flags, as defined in enum nl80211_rxmgmt_flags 7761e76fede8SThomas Pedersen * 7762e76fede8SThomas Pedersen * This function is called whenever an Action frame is received for a station 7763e76fede8SThomas Pedersen * mode interface, but is not processed in kernel. 7764e76fede8SThomas Pedersen * 7765e76fede8SThomas Pedersen * Return: %true if a user space application has registered for this frame. 7766e76fede8SThomas Pedersen * For action frames, that makes it responsible for rejecting unrecognized 7767e76fede8SThomas Pedersen * action frames; %false otherwise, in which case for action frames the 7768e76fede8SThomas Pedersen * driver is responsible for rejecting the frame. 7769e76fede8SThomas Pedersen */ 7770e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm, 7771e76fede8SThomas Pedersen const u8 *buf, size_t len, u32 flags); 7772e76fede8SThomas Pedersen 7773e76fede8SThomas Pedersen /** 77742e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 777571bbc994SJohannes Berg * @wdev: wireless device receiving the frame 7776026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 77776c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 77782e161f78SJohannes Berg * @buf: Management frame (header + body) 7779026331c4SJouni Malinen * @len: length of the frame data 778019504cf5SVladimir Kondratiev * @flags: flags, as defined in enum nl80211_rxmgmt_flags 77812e161f78SJohannes Berg * 77820ae997dcSYacine Belkadi * This function is called whenever an Action frame is received for a station 77830ae997dcSYacine Belkadi * mode interface, but is not processed in kernel. 77840ae997dcSYacine Belkadi * 77850ae997dcSYacine Belkadi * Return: %true if a user space application has registered for this frame. 77862e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 77872e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 77882e161f78SJohannes Berg * driver is responsible for rejecting the frame. 7789026331c4SJouni Malinen */ 7790e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, 7791e76fede8SThomas Pedersen int sig_dbm, const u8 *buf, size_t len, 7792e76fede8SThomas Pedersen u32 flags) 7793e76fede8SThomas Pedersen { 7794e76fede8SThomas Pedersen return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len, 7795e76fede8SThomas Pedersen flags); 7796e76fede8SThomas Pedersen } 7797026331c4SJouni Malinen 7798026331c4SJouni Malinen /** 77992e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 780071bbc994SJohannes Berg * @wdev: wireless device receiving the frame 78012e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 78022e161f78SJohannes Berg * @buf: Management frame (header + body) 7803026331c4SJouni Malinen * @len: length of the frame data 7804026331c4SJouni Malinen * @ack: Whether frame was acknowledged 7805026331c4SJouni Malinen * @gfp: context flags 7806026331c4SJouni Malinen * 78072e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 78082e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 7809026331c4SJouni Malinen * transmission attempt. 7810026331c4SJouni Malinen */ 781171bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, 7812026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 7813026331c4SJouni Malinen 7814dca9ca2dSMarkus Theil /** 7815dca9ca2dSMarkus Theil * cfg80211_control_port_tx_status - notification of TX status for control 7816dca9ca2dSMarkus Theil * port frames 7817dca9ca2dSMarkus Theil * @wdev: wireless device receiving the frame 7818dca9ca2dSMarkus Theil * @cookie: Cookie returned by cfg80211_ops::tx_control_port() 7819dca9ca2dSMarkus Theil * @buf: Data frame (header + body) 7820dca9ca2dSMarkus Theil * @len: length of the frame data 7821dca9ca2dSMarkus Theil * @ack: Whether frame was acknowledged 7822dca9ca2dSMarkus Theil * @gfp: context flags 7823dca9ca2dSMarkus Theil * 7824dca9ca2dSMarkus Theil * This function is called whenever a control port frame was requested to be 7825dca9ca2dSMarkus Theil * transmitted with cfg80211_ops::tx_control_port() to report the TX status of 7826dca9ca2dSMarkus Theil * the transmission attempt. 7827dca9ca2dSMarkus Theil */ 7828dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie, 7829dca9ca2dSMarkus Theil const u8 *buf, size_t len, bool ack, 7830dca9ca2dSMarkus Theil gfp_t gfp); 7831d6dc1a38SJuuso Oikarinen 7832d6dc1a38SJuuso Oikarinen /** 78336a671a50SDenis Kenzior * cfg80211_rx_control_port - notification about a received control port frame 78346a671a50SDenis Kenzior * @dev: The device the frame matched to 7835a948f713SDenis Kenzior * @skb: The skbuf with the control port frame. It is assumed that the skbuf 7836a948f713SDenis Kenzior * is 802.3 formatted (with 802.3 header). The skb can be non-linear. 7837a948f713SDenis Kenzior * This function does not take ownership of the skb, so the caller is 7838a948f713SDenis Kenzior * responsible for any cleanup. The caller must also ensure that 7839a948f713SDenis Kenzior * skb->protocol is set appropriately. 78406a671a50SDenis Kenzior * @unencrypted: Whether the frame was received unencrypted 78416a671a50SDenis Kenzior * 78426a671a50SDenis Kenzior * This function is used to inform userspace about a received control port 78436a671a50SDenis Kenzior * frame. It should only be used if userspace indicated it wants to receive 78446a671a50SDenis Kenzior * control port frames over nl80211. 78456a671a50SDenis Kenzior * 78466a671a50SDenis Kenzior * The frame is the data portion of the 802.3 or 802.11 data frame with all 78476a671a50SDenis Kenzior * network layer headers removed (e.g. the raw EAPoL frame). 78486a671a50SDenis Kenzior * 78496a671a50SDenis Kenzior * Return: %true if the frame was passed to userspace 78506a671a50SDenis Kenzior */ 78516a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev, 7852a948f713SDenis Kenzior struct sk_buff *skb, bool unencrypted); 78536a671a50SDenis Kenzior 78546a671a50SDenis Kenzior /** 7855d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 7856d6dc1a38SJuuso Oikarinen * @dev: network device 7857d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 7858bee427b8SAndrzej Zaborowski * @rssi_level: new RSSI level value or 0 if not available 7859d6dc1a38SJuuso Oikarinen * @gfp: context flags 7860d6dc1a38SJuuso Oikarinen * 7861d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 7862d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 7863d6dc1a38SJuuso Oikarinen */ 7864d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 7865d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 7866bee427b8SAndrzej Zaborowski s32 rssi_level, gfp_t gfp); 7867d6dc1a38SJuuso Oikarinen 7868c063dbf5SJohannes Berg /** 7869c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 7870c063dbf5SJohannes Berg * @dev: network device 7871c063dbf5SJohannes Berg * @peer: peer's MAC address 7872c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 7873c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 7874c063dbf5SJohannes Berg * threshold (to account for temporary interference) 7875c063dbf5SJohannes Berg * @gfp: context flags 7876c063dbf5SJohannes Berg */ 7877c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 7878c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 7879c063dbf5SJohannes Berg 7880e5497d76SJohannes Berg /** 788184f10708SThomas Pedersen * cfg80211_cqm_txe_notify - TX error rate event 788284f10708SThomas Pedersen * @dev: network device 788384f10708SThomas Pedersen * @peer: peer's MAC address 788484f10708SThomas Pedersen * @num_packets: how many packets were lost 788584f10708SThomas Pedersen * @rate: % of packets which failed transmission 788684f10708SThomas Pedersen * @intvl: interval (in s) over which the TX failure threshold was breached. 788784f10708SThomas Pedersen * @gfp: context flags 788884f10708SThomas Pedersen * 788984f10708SThomas Pedersen * Notify userspace when configured % TX failures over number of packets in a 789084f10708SThomas Pedersen * given interval is exceeded. 789184f10708SThomas Pedersen */ 789284f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, 789384f10708SThomas Pedersen u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 789484f10708SThomas Pedersen 789584f10708SThomas Pedersen /** 789698f03342SJohannes Berg * cfg80211_cqm_beacon_loss_notify - beacon loss event 789798f03342SJohannes Berg * @dev: network device 789898f03342SJohannes Berg * @gfp: context flags 789998f03342SJohannes Berg * 790098f03342SJohannes Berg * Notify userspace about beacon loss from the connected AP. 790198f03342SJohannes Berg */ 790298f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); 790398f03342SJohannes Berg 790498f03342SJohannes Berg /** 7905c47240cbSLorenzo Bianconi * __cfg80211_radar_event - radar detection event 79065b97f49dSJohannes Berg * @wiphy: the wiphy 79075b97f49dSJohannes Berg * @chandef: chandef for the current channel 7908c47240cbSLorenzo Bianconi * @offchan: the radar has been detected on the offchannel chain 79095b97f49dSJohannes Berg * @gfp: context flags 79105b97f49dSJohannes Berg * 79115b97f49dSJohannes Berg * This function is called when a radar is detected on the current chanenl. 79125b97f49dSJohannes Berg */ 7913c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy, 7914c47240cbSLorenzo Bianconi struct cfg80211_chan_def *chandef, 7915c47240cbSLorenzo Bianconi bool offchan, gfp_t gfp); 7916c47240cbSLorenzo Bianconi 7917c47240cbSLorenzo Bianconi static inline void 7918c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy, 7919c47240cbSLorenzo Bianconi struct cfg80211_chan_def *chandef, 7920c47240cbSLorenzo Bianconi gfp_t gfp) 7921c47240cbSLorenzo Bianconi { 7922c47240cbSLorenzo Bianconi __cfg80211_radar_event(wiphy, chandef, false, gfp); 7923c47240cbSLorenzo Bianconi } 7924c47240cbSLorenzo Bianconi 7925c47240cbSLorenzo Bianconi static inline void 7926a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy, 7927c47240cbSLorenzo Bianconi struct cfg80211_chan_def *chandef, 7928c47240cbSLorenzo Bianconi gfp_t gfp) 7929c47240cbSLorenzo Bianconi { 7930c47240cbSLorenzo Bianconi __cfg80211_radar_event(wiphy, chandef, true, gfp); 7931c47240cbSLorenzo Bianconi } 79325b97f49dSJohannes Berg 79335b97f49dSJohannes Berg /** 7934466b9936Stamizhr@codeaurora.org * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event 7935466b9936Stamizhr@codeaurora.org * @dev: network device 7936466b9936Stamizhr@codeaurora.org * @mac: MAC address of a station which opmode got modified 7937466b9936Stamizhr@codeaurora.org * @sta_opmode: station's current opmode value 7938466b9936Stamizhr@codeaurora.org * @gfp: context flags 7939466b9936Stamizhr@codeaurora.org * 7940466b9936Stamizhr@codeaurora.org * Driver should call this function when station's opmode modified via action 7941466b9936Stamizhr@codeaurora.org * frame. 7942466b9936Stamizhr@codeaurora.org */ 7943466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, 7944466b9936Stamizhr@codeaurora.org struct sta_opmode_info *sta_opmode, 7945466b9936Stamizhr@codeaurora.org gfp_t gfp); 7946466b9936Stamizhr@codeaurora.org 7947466b9936Stamizhr@codeaurora.org /** 79485b97f49dSJohannes Berg * cfg80211_cac_event - Channel availability check (CAC) event 79495b97f49dSJohannes Berg * @netdev: network device 79505b97f49dSJohannes Berg * @chandef: chandef for the current channel 79515b97f49dSJohannes Berg * @event: type of event 79525b97f49dSJohannes Berg * @gfp: context flags 79535b97f49dSJohannes Berg * 79545b97f49dSJohannes Berg * This function is called when a Channel availability check (CAC) is finished 79555b97f49dSJohannes Berg * or aborted. This must be called to notify the completion of a CAC process, 79565b97f49dSJohannes Berg * also by full-MAC drivers. 79575b97f49dSJohannes Berg */ 79585b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev, 79595b97f49dSJohannes Berg const struct cfg80211_chan_def *chandef, 79605b97f49dSJohannes Berg enum nl80211_radar_event event, gfp_t gfp); 79615b97f49dSJohannes Berg 7962bc2dfc02SLorenzo Bianconi /** 7963a95bfb87SLorenzo Bianconi * cfg80211_background_cac_abort - Channel Availability Check offchan abort event 7964bc2dfc02SLorenzo Bianconi * @wiphy: the wiphy 7965bc2dfc02SLorenzo Bianconi * 79661507b153SLorenzo Bianconi * This function is called by the driver when a Channel Availability Check 79671507b153SLorenzo Bianconi * (CAC) is aborted by a offchannel dedicated chain. 7968bc2dfc02SLorenzo Bianconi */ 7969a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy); 79705b97f49dSJohannes Berg 79715b97f49dSJohannes Berg /** 7972e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 7973e5497d76SJohannes Berg * @dev: network device 7974e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 7975e5497d76SJohannes Berg * @replay_ctr: new replay counter 7976af71ff85SJohannes Berg * @gfp: allocation flags 7977e5497d76SJohannes Berg */ 7978e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 7979e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 7980e5497d76SJohannes Berg 7981c9df56b4SJouni Malinen /** 7982c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 7983c9df56b4SJouni Malinen * @dev: network device 7984c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 7985c9df56b4SJouni Malinen * @bssid: BSSID of AP 7986c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 7987c9df56b4SJouni Malinen * @gfp: allocation flags 7988c9df56b4SJouni Malinen */ 7989c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 7990c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 7991c9df56b4SJouni Malinen 799228946da7SJohannes Berg /** 799328946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 799428946da7SJohannes Berg * @dev: The device the frame matched to 799528946da7SJohannes Berg * @addr: the transmitter address 799628946da7SJohannes Berg * @gfp: context flags 799728946da7SJohannes Berg * 799828946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 799928946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 800028946da7SJohannes Berg * sender. 80010ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 800228946da7SJohannes Berg * for a reason other than not having a subscription.) 800328946da7SJohannes Berg */ 800428946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 800528946da7SJohannes Berg const u8 *addr, gfp_t gfp); 800628946da7SJohannes Berg 80077f6cf311SJohannes Berg /** 8008b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 8009b92ab5d8SJohannes Berg * @dev: The device the frame matched to 8010b92ab5d8SJohannes Berg * @addr: the transmitter address 8011b92ab5d8SJohannes Berg * @gfp: context flags 8012b92ab5d8SJohannes Berg * 8013b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 8014b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 8015b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 8016b92ab5d8SJohannes Berg * station to avoid event flooding. 80170ae997dcSYacine Belkadi * Return: %true if the frame was passed to userspace (or this failed 8018b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 8019b92ab5d8SJohannes Berg */ 8020b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 8021b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 8022b92ab5d8SJohannes Berg 8023b92ab5d8SJohannes Berg /** 80247f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 80257f6cf311SJohannes Berg * @dev: the device the probe was sent on 80267f6cf311SJohannes Berg * @addr: the address of the peer 80277f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 80287f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 8029c4b50cd3SVenkateswara Naralasetty * @ack_signal: signal strength (in dBm) of the ACK frame. 8030c4b50cd3SVenkateswara Naralasetty * @is_valid_ack_signal: indicates the ack_signal is valid or not. 80317f6cf311SJohannes Berg * @gfp: allocation flags 80327f6cf311SJohannes Berg */ 80337f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 8034c4b50cd3SVenkateswara Naralasetty u64 cookie, bool acked, s32 ack_signal, 8035c4b50cd3SVenkateswara Naralasetty bool is_valid_ack_signal, gfp_t gfp); 80367f6cf311SJohannes Berg 80375e760230SJohannes Berg /** 8038e76fede8SThomas Pedersen * cfg80211_report_obss_beacon_khz - report beacon from other APs 8039e76fede8SThomas Pedersen * @wiphy: The wiphy that received the beacon 8040e76fede8SThomas Pedersen * @frame: the frame 8041e76fede8SThomas Pedersen * @len: length of the frame 8042e76fede8SThomas Pedersen * @freq: frequency the frame was received on in KHz 8043e76fede8SThomas Pedersen * @sig_dbm: signal strength in dBm, or 0 if unknown 8044e76fede8SThomas Pedersen * 8045e76fede8SThomas Pedersen * Use this function to report to userspace when a beacon was 8046e76fede8SThomas Pedersen * received. It is not useful to call this when there is no 8047e76fede8SThomas Pedersen * netdev that is in AP/GO mode. 8048e76fede8SThomas Pedersen */ 8049e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame, 8050e76fede8SThomas Pedersen size_t len, int freq, int sig_dbm); 8051e76fede8SThomas Pedersen 8052e76fede8SThomas Pedersen /** 80535e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 80545e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 80555e760230SJohannes Berg * @frame: the frame 80565e760230SJohannes Berg * @len: length of the frame 80575e760230SJohannes Berg * @freq: frequency the frame was received on 80586c2fb1e6SSergey Matyukevich * @sig_dbm: signal strength in dBm, or 0 if unknown 80595e760230SJohannes Berg * 80605e760230SJohannes Berg * Use this function to report to userspace when a beacon was 80615e760230SJohannes Berg * received. It is not useful to call this when there is no 80625e760230SJohannes Berg * netdev that is in AP/GO mode. 80635e760230SJohannes Berg */ 8064e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy, 80655e760230SJohannes Berg const u8 *frame, size_t len, 8066e76fede8SThomas Pedersen int freq, int sig_dbm) 8067e76fede8SThomas Pedersen { 8068e76fede8SThomas Pedersen cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq), 8069e76fede8SThomas Pedersen sig_dbm); 8070e76fede8SThomas Pedersen } 80715e760230SJohannes Berg 8072d58e7e37SJohannes Berg /** 8073683b6d3bSJohannes Berg * cfg80211_reg_can_beacon - check if beaconing is allowed 807454858ee5SAlexander Simon * @wiphy: the wiphy 8075683b6d3bSJohannes Berg * @chandef: the channel definition 8076174e0cd2SIlan Peer * @iftype: interface type 8077d58e7e37SJohannes Berg * 80780ae997dcSYacine Belkadi * Return: %true if there is no secondary channel or the secondary channel(s) 80790ae997dcSYacine Belkadi * can be used for beaconing (i.e. is not a radar channel etc.) 808054858ee5SAlexander Simon */ 8081683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 8082174e0cd2SIlan Peer struct cfg80211_chan_def *chandef, 8083174e0cd2SIlan Peer enum nl80211_iftype iftype); 808454858ee5SAlexander Simon 8085923b352fSArik Nemtsov /** 8086923b352fSArik Nemtsov * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation 8087923b352fSArik Nemtsov * @wiphy: the wiphy 8088923b352fSArik Nemtsov * @chandef: the channel definition 8089923b352fSArik Nemtsov * @iftype: interface type 8090923b352fSArik Nemtsov * 8091923b352fSArik Nemtsov * Return: %true if there is no secondary channel or the secondary channel(s) 8092923b352fSArik Nemtsov * can be used for beaconing (i.e. is not a radar channel etc.). This version 8093923b352fSArik Nemtsov * also checks if IR-relaxation conditions apply, to allow beaconing under 8094923b352fSArik Nemtsov * more permissive conditions. 8095923b352fSArik Nemtsov * 8096a05829a7SJohannes Berg * Requires the wiphy mutex to be held. 8097923b352fSArik Nemtsov */ 8098923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy, 8099923b352fSArik Nemtsov struct cfg80211_chan_def *chandef, 8100923b352fSArik Nemtsov enum nl80211_iftype iftype); 8101923b352fSArik Nemtsov 81028097e149SThomas Pedersen /* 81035314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 81045314526bSThomas Pedersen * @dev: the device which switched channels 8105683b6d3bSJohannes Berg * @chandef: the new channel definition 81067b0a0e3cSJohannes Berg * @link_id: the link ID for MLO, must be 0 for non-MLO 81075314526bSThomas Pedersen * 8108e487eaebSSimon Wunderlich * Caller must acquire wdev_lock, therefore must only be called from sleepable 8109e487eaebSSimon Wunderlich * driver context! 81105314526bSThomas Pedersen */ 8111683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev, 81127b0a0e3cSJohannes Berg struct cfg80211_chan_def *chandef, 81137b0a0e3cSJohannes Berg unsigned int link_id); 81145314526bSThomas Pedersen 8115f8d7552eSLuciano Coelho /* 8116f8d7552eSLuciano Coelho * cfg80211_ch_switch_started_notify - notify channel switch start 8117f8d7552eSLuciano Coelho * @dev: the device on which the channel switch started 8118f8d7552eSLuciano Coelho * @chandef: the future channel definition 8119f8d7552eSLuciano Coelho * @count: the number of TBTTs until the channel switch happens 8120669b8413SJohannes Berg * @quiet: whether or not immediate quiet was requested by the AP 8121f8d7552eSLuciano Coelho * 8122f8d7552eSLuciano Coelho * Inform the userspace about the channel switch that has just 8123f8d7552eSLuciano Coelho * started, so that it can take appropriate actions (eg. starting 8124f8d7552eSLuciano Coelho * channel switch on other vifs), if necessary. 8125f8d7552eSLuciano Coelho */ 8126f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev, 8127f8d7552eSLuciano Coelho struct cfg80211_chan_def *chandef, 8128669b8413SJohannes Berg u8 count, bool quiet); 8129f8d7552eSLuciano Coelho 81301ce3e82bSJohannes Berg /** 81311ce3e82bSJohannes Berg * ieee80211_operating_class_to_band - convert operating class to band 81321ce3e82bSJohannes Berg * 81331ce3e82bSJohannes Berg * @operating_class: the operating class to convert 81341ce3e82bSJohannes Berg * @band: band pointer to fill 81351ce3e82bSJohannes Berg * 81361ce3e82bSJohannes Berg * Returns %true if the conversion was successful, %false otherwise. 81371ce3e82bSJohannes Berg */ 81381ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class, 813957fbcce3SJohannes Berg enum nl80211_band *band); 81401ce3e82bSJohannes Berg 8141a38700ddSArik Nemtsov /** 8142a38700ddSArik Nemtsov * ieee80211_chandef_to_operating_class - convert chandef to operation class 8143a38700ddSArik Nemtsov * 8144a38700ddSArik Nemtsov * @chandef: the chandef to convert 8145a38700ddSArik Nemtsov * @op_class: a pointer to the resulting operating class 8146a38700ddSArik Nemtsov * 8147a38700ddSArik Nemtsov * Returns %true if the conversion was successful, %false otherwise. 8148a38700ddSArik Nemtsov */ 8149a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, 8150a38700ddSArik Nemtsov u8 *op_class); 8151a38700ddSArik Nemtsov 8152934f4c7dSThomas Pedersen /** 8153934f4c7dSThomas Pedersen * ieee80211_chandef_to_khz - convert chandef to frequency in KHz 8154934f4c7dSThomas Pedersen * 8155934f4c7dSThomas Pedersen * @chandef: the chandef to convert 8156934f4c7dSThomas Pedersen * 8157934f4c7dSThomas Pedersen * Returns the center frequency of chandef (1st segment) in KHz. 8158934f4c7dSThomas Pedersen */ 8159934f4c7dSThomas Pedersen static inline u32 8160934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef) 8161934f4c7dSThomas Pedersen { 8162934f4c7dSThomas Pedersen return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; 8163934f4c7dSThomas Pedersen } 8164934f4c7dSThomas Pedersen 81655314526bSThomas Pedersen /* 81663475b094SJouni Malinen * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 81673475b094SJouni Malinen * @dev: the device on which the operation is requested 81683475b094SJouni Malinen * @peer: the MAC address of the peer device 81693475b094SJouni Malinen * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or 81703475b094SJouni Malinen * NL80211_TDLS_TEARDOWN) 81713475b094SJouni Malinen * @reason_code: the reason code for teardown request 81723475b094SJouni Malinen * @gfp: allocation flags 81733475b094SJouni Malinen * 81743475b094SJouni Malinen * This function is used to request userspace to perform TDLS operation that 81753475b094SJouni Malinen * requires knowledge of keys, i.e., link setup or teardown when the AP 81763475b094SJouni Malinen * connection uses encryption. This is optional mechanism for the driver to use 81773475b094SJouni Malinen * if it can automatically determine when a TDLS link could be useful (e.g., 81783475b094SJouni Malinen * based on traffic and signal strength for a peer). 81793475b094SJouni Malinen */ 81803475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, 81813475b094SJouni Malinen enum nl80211_tdls_operation oper, 81823475b094SJouni Malinen u16 reason_code, gfp_t gfp); 81833475b094SJouni Malinen 81843475b094SJouni Malinen /* 81858097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 81868097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 81878097e149SThomas Pedersen * 81888097e149SThomas Pedersen * return 0 if MCS index >= 32 81898097e149SThomas Pedersen */ 81908eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate); 81918097e149SThomas Pedersen 819298104fdeSJohannes Berg /** 819398104fdeSJohannes Berg * cfg80211_unregister_wdev - remove the given wdev 819498104fdeSJohannes Berg * @wdev: struct wireless_dev to remove 819598104fdeSJohannes Berg * 81962fe8ef10SJohannes Berg * This function removes the device so it can no longer be used. It is necessary 81972fe8ef10SJohannes Berg * to call this function even when cfg80211 requests the removal of the device 81982fe8ef10SJohannes Berg * by calling the del_virtual_intf() callback. The function must also be called 81992fe8ef10SJohannes Berg * when the driver wishes to unregister the wdev, e.g. when the hardware device 82002fe8ef10SJohannes Berg * is unbound from the driver. 820198104fdeSJohannes Berg * 8202a05829a7SJohannes Berg * Requires the RTNL and wiphy mutex to be held. 820398104fdeSJohannes Berg */ 820498104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev); 820598104fdeSJohannes Berg 82060ee45355SJohannes Berg /** 82072fe8ef10SJohannes Berg * cfg80211_register_netdevice - register the given netdev 82082fe8ef10SJohannes Berg * @dev: the netdev to register 82092fe8ef10SJohannes Berg * 82102fe8ef10SJohannes Berg * Note: In contexts coming from cfg80211 callbacks, you must call this rather 82112fe8ef10SJohannes Berg * than register_netdevice(), unregister_netdev() is impossible as the RTNL is 82122fe8ef10SJohannes Berg * held. Otherwise, both register_netdevice() and register_netdev() are usable 82132fe8ef10SJohannes Berg * instead as well. 8214a05829a7SJohannes Berg * 8215a05829a7SJohannes Berg * Requires the RTNL and wiphy mutex to be held. 82162fe8ef10SJohannes Berg */ 82172fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev); 82182fe8ef10SJohannes Berg 82192fe8ef10SJohannes Berg /** 82202fe8ef10SJohannes Berg * cfg80211_unregister_netdevice - unregister the given netdev 82212fe8ef10SJohannes Berg * @dev: the netdev to register 82222fe8ef10SJohannes Berg * 82232fe8ef10SJohannes Berg * Note: In contexts coming from cfg80211 callbacks, you must call this rather 82242fe8ef10SJohannes Berg * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL 82252fe8ef10SJohannes Berg * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are 82262fe8ef10SJohannes Berg * usable instead as well. 8227a05829a7SJohannes Berg * 8228a05829a7SJohannes Berg * Requires the RTNL and wiphy mutex to be held. 82292fe8ef10SJohannes Berg */ 82302fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev) 82312fe8ef10SJohannes Berg { 8232c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211) 82332fe8ef10SJohannes Berg cfg80211_unregister_wdev(dev->ieee80211_ptr); 8234c304eddcSJakub Kicinski #endif 82352fe8ef10SJohannes Berg } 82362fe8ef10SJohannes Berg 82372fe8ef10SJohannes Berg /** 8238b1e8eb11SMauro Carvalho Chehab * struct cfg80211_ft_event_params - FT Information Elements 8239355199e0SJouni Malinen * @ies: FT IEs 8240355199e0SJouni Malinen * @ies_len: length of the FT IE in bytes 8241355199e0SJouni Malinen * @target_ap: target AP's MAC address 8242355199e0SJouni Malinen * @ric_ies: RIC IE 8243355199e0SJouni Malinen * @ric_ies_len: length of the RIC IE in bytes 8244355199e0SJouni Malinen */ 8245355199e0SJouni Malinen struct cfg80211_ft_event_params { 8246355199e0SJouni Malinen const u8 *ies; 8247355199e0SJouni Malinen size_t ies_len; 8248355199e0SJouni Malinen const u8 *target_ap; 8249355199e0SJouni Malinen const u8 *ric_ies; 8250355199e0SJouni Malinen size_t ric_ies_len; 8251355199e0SJouni Malinen }; 8252355199e0SJouni Malinen 8253355199e0SJouni Malinen /** 8254355199e0SJouni Malinen * cfg80211_ft_event - notify userspace about FT IE and RIC IE 8255355199e0SJouni Malinen * @netdev: network device 8256355199e0SJouni Malinen * @ft_event: IE information 8257355199e0SJouni Malinen */ 8258355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev, 8259355199e0SJouni Malinen struct cfg80211_ft_event_params *ft_event); 8260355199e0SJouni Malinen 8261355199e0SJouni Malinen /** 82620ee45355SJohannes Berg * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 82630ee45355SJohannes Berg * @ies: the input IE buffer 82640ee45355SJohannes Berg * @len: the input length 82650ee45355SJohannes Berg * @attr: the attribute ID to find 82660ee45355SJohannes Berg * @buf: output buffer, can be %NULL if the data isn't needed, e.g. 82670ee45355SJohannes Berg * if the function is only called to get the needed buffer size 82680ee45355SJohannes Berg * @bufsize: size of the output buffer 82690ee45355SJohannes Berg * 82700ee45355SJohannes Berg * The function finds a given P2P attribute in the (vendor) IEs and 82710ee45355SJohannes Berg * copies its contents to the given buffer. 82720ee45355SJohannes Berg * 82730ae997dcSYacine Belkadi * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is 82740ae997dcSYacine Belkadi * malformed or the attribute can't be found (respectively), or the 82750ae997dcSYacine Belkadi * length of the found attribute (which can be zero). 82760ee45355SJohannes Berg */ 8277c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, 8278c216e641SArend van Spriel enum ieee80211_p2p_attr_id attr, 8279c216e641SArend van Spriel u8 *buf, unsigned int bufsize); 82800ee45355SJohannes Berg 8281cd8f7cb4SJohannes Berg /** 828229464cccSJohannes Berg * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC) 828329464cccSJohannes Berg * @ies: the IE buffer 828429464cccSJohannes Berg * @ielen: the length of the IE buffer 828529464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 82862512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 82872512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 828829464cccSJohannes Berg * @n_ids: the size of the element ID array 828929464cccSJohannes Berg * @after_ric: array IE types that come after the RIC element 829029464cccSJohannes Berg * @n_after_ric: size of the @after_ric array 829129464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 829229464cccSJohannes Berg * 829329464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 829429464cccSJohannes Berg * variable to point to the location where the buffer should be 829529464cccSJohannes Berg * split. 829629464cccSJohannes Berg * 829729464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 829829464cccSJohannes Berg * has to be guaranteed by the caller! 829929464cccSJohannes Berg * 830029464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 830129464cccSJohannes Berg * correctly, if not the result of using this function will not 830229464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 830329464cccSJohannes Berg * 830429464cccSJohannes Berg * The function returns the offset where the next part of the 830529464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 830629464cccSJohannes Berg * of the buffer should be used. 830729464cccSJohannes Berg */ 830829464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen, 830929464cccSJohannes Berg const u8 *ids, int n_ids, 831029464cccSJohannes Berg const u8 *after_ric, int n_after_ric, 831129464cccSJohannes Berg size_t offset); 831229464cccSJohannes Berg 831329464cccSJohannes Berg /** 831429464cccSJohannes Berg * ieee80211_ie_split - split an IE buffer according to ordering 831529464cccSJohannes Berg * @ies: the IE buffer 831629464cccSJohannes Berg * @ielen: the length of the IE buffer 831729464cccSJohannes Berg * @ids: an array with element IDs that are allowed before 83182512b1b1SLiad Kaufman * the split. A WLAN_EID_EXTENSION value means that the next 83192512b1b1SLiad Kaufman * EID in the list is a sub-element of the EXTENSION IE. 832029464cccSJohannes Berg * @n_ids: the size of the element ID array 832129464cccSJohannes Berg * @offset: offset where to start splitting in the buffer 832229464cccSJohannes Berg * 832329464cccSJohannes Berg * This function splits an IE buffer by updating the @offset 832429464cccSJohannes Berg * variable to point to the location where the buffer should be 832529464cccSJohannes Berg * split. 832629464cccSJohannes Berg * 832729464cccSJohannes Berg * It assumes that the given IE buffer is well-formed, this 832829464cccSJohannes Berg * has to be guaranteed by the caller! 832929464cccSJohannes Berg * 833029464cccSJohannes Berg * It also assumes that the IEs in the buffer are ordered 833129464cccSJohannes Berg * correctly, if not the result of using this function will not 833229464cccSJohannes Berg * be ordered correctly either, i.e. it does no reordering. 833329464cccSJohannes Berg * 833429464cccSJohannes Berg * The function returns the offset where the next part of the 833529464cccSJohannes Berg * buffer starts, which may be @ielen if the entire (remainder) 833629464cccSJohannes Berg * of the buffer should be used. 833729464cccSJohannes Berg */ 83380483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 83390483eeacSJohannes Berg const u8 *ids, int n_ids, size_t offset) 83400483eeacSJohannes Berg { 83410483eeacSJohannes Berg return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset); 83420483eeacSJohannes Berg } 834329464cccSJohannes Berg 834429464cccSJohannes Berg /** 8345cd8f7cb4SJohannes Berg * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 8346cd8f7cb4SJohannes Berg * @wdev: the wireless device reporting the wakeup 8347cd8f7cb4SJohannes Berg * @wakeup: the wakeup report 8348cd8f7cb4SJohannes Berg * @gfp: allocation flags 8349cd8f7cb4SJohannes Berg * 8350cd8f7cb4SJohannes Berg * This function reports that the given device woke up. If it 8351cd8f7cb4SJohannes Berg * caused the wakeup, report the reason(s), otherwise you may 8352cd8f7cb4SJohannes Berg * pass %NULL as the @wakeup parameter to advertise that something 8353cd8f7cb4SJohannes Berg * else caused the wakeup. 8354cd8f7cb4SJohannes Berg */ 8355cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, 8356cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup *wakeup, 8357cd8f7cb4SJohannes Berg gfp_t gfp); 8358cd8f7cb4SJohannes Berg 83595de17984SArend van Spriel /** 83605de17984SArend van Spriel * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 83615de17984SArend van Spriel * 83625de17984SArend van Spriel * @wdev: the wireless device for which critical protocol is stopped. 836303f831a6SRobert P. J. Day * @gfp: allocation flags 83645de17984SArend van Spriel * 83655de17984SArend van Spriel * This function can be called by the driver to indicate it has reverted 83665de17984SArend van Spriel * operation back to normal. One reason could be that the duration given 83675de17984SArend van Spriel * by .crit_proto_start() has expired. 83685de17984SArend van Spriel */ 83695de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); 83705de17984SArend van Spriel 8371bdfbec2dSIlan Peer /** 8372bdfbec2dSIlan Peer * ieee80211_get_num_supported_channels - get number of channels device has 8373bdfbec2dSIlan Peer * @wiphy: the wiphy 8374bdfbec2dSIlan Peer * 8375bdfbec2dSIlan Peer * Return: the number of channels supported by the device. 8376bdfbec2dSIlan Peer */ 8377bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 8378bdfbec2dSIlan Peer 8379cb2d956dSLuciano Coelho /** 8380cb2d956dSLuciano Coelho * cfg80211_check_combinations - check interface combinations 8381cb2d956dSLuciano Coelho * 8382cb2d956dSLuciano Coelho * @wiphy: the wiphy 8383e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 8384cb2d956dSLuciano Coelho * 8385cb2d956dSLuciano Coelho * This function can be called by the driver to check whether a 8386cb2d956dSLuciano Coelho * combination of interfaces and their types are allowed according to 8387cb2d956dSLuciano Coelho * the interface combinations. 8388cb2d956dSLuciano Coelho */ 8389cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy, 8390e227300cSPurushottam Kushwaha struct iface_combination_params *params); 8391cb2d956dSLuciano Coelho 839265a124ddSMichal Kazior /** 839365a124ddSMichal Kazior * cfg80211_iter_combinations - iterate over matching combinations 839465a124ddSMichal Kazior * 839565a124ddSMichal Kazior * @wiphy: the wiphy 8396e227300cSPurushottam Kushwaha * @params: the interface combinations parameter 839765a124ddSMichal Kazior * @iter: function to call for each matching combination 839865a124ddSMichal Kazior * @data: pointer to pass to iter function 839965a124ddSMichal Kazior * 840065a124ddSMichal Kazior * This function can be called by the driver to check what possible 840165a124ddSMichal Kazior * combinations it fits in at a given moment, e.g. for channel switching 840265a124ddSMichal Kazior * purposes. 840365a124ddSMichal Kazior */ 840465a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy, 8405e227300cSPurushottam Kushwaha struct iface_combination_params *params, 840665a124ddSMichal Kazior void (*iter)(const struct ieee80211_iface_combination *c, 840765a124ddSMichal Kazior void *data), 840865a124ddSMichal Kazior void *data); 840965a124ddSMichal Kazior 8410f04c2203SMichal Kazior /* 8411f04c2203SMichal Kazior * cfg80211_stop_iface - trigger interface disconnection 8412f04c2203SMichal Kazior * 8413f04c2203SMichal Kazior * @wiphy: the wiphy 8414f04c2203SMichal Kazior * @wdev: wireless device 8415f04c2203SMichal Kazior * @gfp: context flags 8416f04c2203SMichal Kazior * 8417f04c2203SMichal Kazior * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA 8418f04c2203SMichal Kazior * disconnected. 8419f04c2203SMichal Kazior * 8420f04c2203SMichal Kazior * Note: This doesn't need any locks and is asynchronous. 8421f04c2203SMichal Kazior */ 8422f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, 8423f04c2203SMichal Kazior gfp_t gfp); 8424f04c2203SMichal Kazior 8425f6837ba8SJohannes Berg /** 8426f6837ba8SJohannes Berg * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy 8427f6837ba8SJohannes Berg * @wiphy: the wiphy to shut down 8428f6837ba8SJohannes Berg * 8429f6837ba8SJohannes Berg * This function shuts down all interfaces belonging to this wiphy by 8430f6837ba8SJohannes Berg * calling dev_close() (and treating non-netdev interfaces as needed). 8431f6837ba8SJohannes Berg * It shouldn't really be used unless there are some fatal device errors 8432f6837ba8SJohannes Berg * that really can't be recovered in any other way. 8433f6837ba8SJohannes Berg * 8434f6837ba8SJohannes Berg * Callers must hold the RTNL and be able to deal with callbacks into 8435f6837ba8SJohannes Berg * the driver while the function is running. 8436f6837ba8SJohannes Berg */ 8437f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 8438f6837ba8SJohannes Berg 8439d75bb06bSGautam Kumar Shukla /** 8440d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_set - set the extended feature flag 8441d75bb06bSGautam Kumar Shukla * 8442d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 8443d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 8444d75bb06bSGautam Kumar Shukla * 8445d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 8446d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 8447d75bb06bSGautam Kumar Shukla */ 8448d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy, 8449d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 8450d75bb06bSGautam Kumar Shukla { 8451d75bb06bSGautam Kumar Shukla u8 *ft_byte; 8452d75bb06bSGautam Kumar Shukla 8453d75bb06bSGautam Kumar Shukla ft_byte = &wiphy->ext_features[ftidx / 8]; 8454d75bb06bSGautam Kumar Shukla *ft_byte |= BIT(ftidx % 8); 8455d75bb06bSGautam Kumar Shukla } 8456d75bb06bSGautam Kumar Shukla 8457d75bb06bSGautam Kumar Shukla /** 8458d75bb06bSGautam Kumar Shukla * wiphy_ext_feature_isset - check the extended feature flag 8459d75bb06bSGautam Kumar Shukla * 8460d75bb06bSGautam Kumar Shukla * @wiphy: the wiphy to modify. 8461d75bb06bSGautam Kumar Shukla * @ftidx: extended feature bit index. 8462d75bb06bSGautam Kumar Shukla * 8463d75bb06bSGautam Kumar Shukla * The extended features are flagged in multiple bytes (see 8464d75bb06bSGautam Kumar Shukla * &struct wiphy.@ext_features) 8465d75bb06bSGautam Kumar Shukla */ 8466d75bb06bSGautam Kumar Shukla static inline bool 8467d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy, 8468d75bb06bSGautam Kumar Shukla enum nl80211_ext_feature_index ftidx) 8469d75bb06bSGautam Kumar Shukla { 8470d75bb06bSGautam Kumar Shukla u8 ft_byte; 8471d75bb06bSGautam Kumar Shukla 8472d75bb06bSGautam Kumar Shukla ft_byte = wiphy->ext_features[ftidx / 8]; 8473d75bb06bSGautam Kumar Shukla return (ft_byte & BIT(ftidx % 8)) != 0; 8474d75bb06bSGautam Kumar Shukla } 8475b7ffbd7eSJohannes Berg 8476a442b761SAyala Beker /** 8477a442b761SAyala Beker * cfg80211_free_nan_func - free NAN function 8478a442b761SAyala Beker * @f: NAN function that should be freed 8479a442b761SAyala Beker * 8480a442b761SAyala Beker * Frees all the NAN function and all it's allocated members. 8481a442b761SAyala Beker */ 8482a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f); 8483a442b761SAyala Beker 848450bcd31dSAyala Beker /** 848550bcd31dSAyala Beker * struct cfg80211_nan_match_params - NAN match parameters 848650bcd31dSAyala Beker * @type: the type of the function that triggered a match. If it is 848750bcd31dSAyala Beker * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber. 848850bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery 848950bcd31dSAyala Beker * result. 849050bcd31dSAyala Beker * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up. 849150bcd31dSAyala Beker * @inst_id: the local instance id 849250bcd31dSAyala Beker * @peer_inst_id: the instance id of the peer's function 849350bcd31dSAyala Beker * @addr: the MAC address of the peer 849450bcd31dSAyala Beker * @info_len: the length of the &info 849550bcd31dSAyala Beker * @info: the Service Specific Info from the peer (if any) 849650bcd31dSAyala Beker * @cookie: unique identifier of the corresponding function 849750bcd31dSAyala Beker */ 849850bcd31dSAyala Beker struct cfg80211_nan_match_params { 849950bcd31dSAyala Beker enum nl80211_nan_function_type type; 850050bcd31dSAyala Beker u8 inst_id; 850150bcd31dSAyala Beker u8 peer_inst_id; 850250bcd31dSAyala Beker const u8 *addr; 850350bcd31dSAyala Beker u8 info_len; 850450bcd31dSAyala Beker const u8 *info; 850550bcd31dSAyala Beker u64 cookie; 850650bcd31dSAyala Beker }; 850750bcd31dSAyala Beker 850850bcd31dSAyala Beker /** 850950bcd31dSAyala Beker * cfg80211_nan_match - report a match for a NAN function. 851050bcd31dSAyala Beker * @wdev: the wireless device reporting the match 851150bcd31dSAyala Beker * @match: match notification parameters 851250bcd31dSAyala Beker * @gfp: allocation flags 851350bcd31dSAyala Beker * 851450bcd31dSAyala Beker * This function reports that the a NAN function had a match. This 851550bcd31dSAyala Beker * can be a subscribe that had a match or a solicited publish that 851650bcd31dSAyala Beker * was sent. It can also be a follow up that was received. 851750bcd31dSAyala Beker */ 851850bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev, 851950bcd31dSAyala Beker struct cfg80211_nan_match_params *match, gfp_t gfp); 852050bcd31dSAyala Beker 8521368e5a7bSAyala Beker /** 8522368e5a7bSAyala Beker * cfg80211_nan_func_terminated - notify about NAN function termination. 8523368e5a7bSAyala Beker * 8524368e5a7bSAyala Beker * @wdev: the wireless device reporting the match 8525368e5a7bSAyala Beker * @inst_id: the local instance id 8526368e5a7bSAyala Beker * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*) 8527368e5a7bSAyala Beker * @cookie: unique NAN function identifier 8528368e5a7bSAyala Beker * @gfp: allocation flags 8529368e5a7bSAyala Beker * 8530368e5a7bSAyala Beker * This function reports that the a NAN function is terminated. 8531368e5a7bSAyala Beker */ 8532368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev, 8533368e5a7bSAyala Beker u8 inst_id, 8534368e5a7bSAyala Beker enum nl80211_nan_func_term_reason reason, 8535368e5a7bSAyala Beker u64 cookie, gfp_t gfp); 8536368e5a7bSAyala Beker 8537b7ffbd7eSJohannes Berg /* ethtool helper */ 8538b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); 8539b7ffbd7eSJohannes Berg 854040cbfa90SSrinivas Dasari /** 854140cbfa90SSrinivas Dasari * cfg80211_external_auth_request - userspace request for authentication 854240cbfa90SSrinivas Dasari * @netdev: network device 854340cbfa90SSrinivas Dasari * @params: External authentication parameters 854440cbfa90SSrinivas Dasari * @gfp: allocation flags 854540cbfa90SSrinivas Dasari * Returns: 0 on success, < 0 on error 854640cbfa90SSrinivas Dasari */ 854740cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev, 854840cbfa90SSrinivas Dasari struct cfg80211_external_auth_params *params, 854940cbfa90SSrinivas Dasari gfp_t gfp); 855040cbfa90SSrinivas Dasari 85519bb7e0f2SJohannes Berg /** 85529bb7e0f2SJohannes Berg * cfg80211_pmsr_report - report peer measurement result data 85539bb7e0f2SJohannes Berg * @wdev: the wireless device reporting the measurement 85549bb7e0f2SJohannes Berg * @req: the original measurement request 85559bb7e0f2SJohannes Berg * @result: the result data 85569bb7e0f2SJohannes Berg * @gfp: allocation flags 85579bb7e0f2SJohannes Berg */ 85589bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev, 85599bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *req, 85609bb7e0f2SJohannes Berg struct cfg80211_pmsr_result *result, 85619bb7e0f2SJohannes Berg gfp_t gfp); 85629bb7e0f2SJohannes Berg 85639bb7e0f2SJohannes Berg /** 85649bb7e0f2SJohannes Berg * cfg80211_pmsr_complete - report peer measurement completed 85659bb7e0f2SJohannes Berg * @wdev: the wireless device reporting the measurement 85669bb7e0f2SJohannes Berg * @req: the original measurement request 85679bb7e0f2SJohannes Berg * @gfp: allocation flags 85689bb7e0f2SJohannes Berg * 85699bb7e0f2SJohannes Berg * Report that the entire measurement completed, after this 85709bb7e0f2SJohannes Berg * the request pointer will no longer be valid. 85719bb7e0f2SJohannes Berg */ 85729bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev, 85739bb7e0f2SJohannes Berg struct cfg80211_pmsr_request *req, 85749bb7e0f2SJohannes Berg gfp_t gfp); 85759bb7e0f2SJohannes Berg 8576e6f40511SManikanta Pubbisetty /** 8577e6f40511SManikanta Pubbisetty * cfg80211_iftype_allowed - check whether the interface can be allowed 8578e6f40511SManikanta Pubbisetty * @wiphy: the wiphy 8579e6f40511SManikanta Pubbisetty * @iftype: interface type 8580e6f40511SManikanta Pubbisetty * @is_4addr: use_4addr flag, must be '0' when check_swif is '1' 8581e6f40511SManikanta Pubbisetty * @check_swif: check iftype against software interfaces 8582e6f40511SManikanta Pubbisetty * 8583e6f40511SManikanta Pubbisetty * Check whether the interface is allowed to operate; additionally, this API 8584e6f40511SManikanta Pubbisetty * can be used to check iftype against the software interfaces when 8585e6f40511SManikanta Pubbisetty * check_swif is '1'. 8586e6f40511SManikanta Pubbisetty */ 8587e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, 8588e6f40511SManikanta Pubbisetty bool is_4addr, u8 check_swif); 8589e6f40511SManikanta Pubbisetty 8590e6f40511SManikanta Pubbisetty 8591a083ee8aSIlan Peer /** 8592a083ee8aSIlan Peer * cfg80211_assoc_comeback - notification of association that was 8593a083ee8aSIlan Peer * temporarly rejected with a comeback 8594a083ee8aSIlan Peer * @netdev: network device 8595a083ee8aSIlan Peer * @bss: the bss entry with which association is in progress. 8596a083ee8aSIlan Peer * @timeout: timeout interval value TUs. 8597a083ee8aSIlan Peer * 8598a083ee8aSIlan Peer * this function may sleep. the caller must hold the corresponding wdev's mutex. 8599a083ee8aSIlan Peer */ 8600a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev, 8601a083ee8aSIlan Peer struct cfg80211_bss *bss, u32 timeout); 8602a083ee8aSIlan Peer 8603e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 8604e1db74fcSJoe Perches 8605e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 8606e1db74fcSJoe Perches 8607e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 86089c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 8609e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 86109c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 8611e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 86129c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 8613e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 86149c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 8615e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 86169c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 8617e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 86189c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 8619e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 86209c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 8621e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 86229c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 8623761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...) \ 8624761025b5SDmitry Osipenko dev_info_once(&(wiphy)->dev, format, ##args) 8625073730d7SJoe Perches 8626a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...) \ 8627a58d7525SStanislaw Gruszka dev_err_ratelimited(&(wiphy)->dev, format, ##args) 8628a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...) \ 8629a58d7525SStanislaw Gruszka dev_warn_ratelimited(&(wiphy)->dev, format, ##args) 8630a58d7525SStanislaw Gruszka 86319c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 8632e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 86339c376639SJoe Perches 8634e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 86359c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 8636e1db74fcSJoe Perches 8637e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 8638e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 8639e1db74fcSJoe Perches #else 8640e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 8641e1db74fcSJoe Perches ({ \ 8642e1db74fcSJoe Perches if (0) \ 8643e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 8644e1db74fcSJoe Perches 0; \ 8645e1db74fcSJoe Perches }) 8646e1db74fcSJoe Perches #endif 8647e1db74fcSJoe Perches 8648e1db74fcSJoe Perches /* 8649e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 8650e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 8651e1db74fcSJoe Perches * file/line information and a backtrace. 8652e1db74fcSJoe Perches */ 8653e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 8654e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 8655e1db74fcSJoe Perches 8656cb74e977SSunil Dutt /** 8657cb74e977SSunil Dutt * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space 8658cb74e977SSunil Dutt * @netdev: network device 8659cb74e977SSunil Dutt * @owe_info: peer's owe info 8660cb74e977SSunil Dutt * @gfp: allocation flags 8661cb74e977SSunil Dutt */ 8662cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev, 8663cb74e977SSunil Dutt struct cfg80211_update_owe_info *owe_info, 8664cb74e977SSunil Dutt gfp_t gfp); 8665cb74e977SSunil Dutt 86662f1805eaSEmmanuel Grumbach /** 86672f1805eaSEmmanuel Grumbach * cfg80211_bss_flush - resets all the scan entries 86682f1805eaSEmmanuel Grumbach * @wiphy: the wiphy 86692f1805eaSEmmanuel Grumbach */ 86702f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy); 86712f1805eaSEmmanuel Grumbach 86720d2ab3aeSJohn Crispin /** 86730d2ab3aeSJohn Crispin * cfg80211_bss_color_notify - notify about bss color event 86740d2ab3aeSJohn Crispin * @dev: network device 86750d2ab3aeSJohn Crispin * @gfp: allocation flags 86760d2ab3aeSJohn Crispin * @cmd: the actual event we want to notify 86770d2ab3aeSJohn Crispin * @count: the number of TBTTs until the color change happens 86780d2ab3aeSJohn Crispin * @color_bitmap: representations of the colors that the local BSS is aware of 86790d2ab3aeSJohn Crispin */ 86800d2ab3aeSJohn Crispin int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp, 86810d2ab3aeSJohn Crispin enum nl80211_commands cmd, u8 count, 86820d2ab3aeSJohn Crispin u64 color_bitmap); 86830d2ab3aeSJohn Crispin 86840d2ab3aeSJohn Crispin /** 86850d2ab3aeSJohn Crispin * cfg80211_obss_color_collision_notify - notify about bss color collision 86860d2ab3aeSJohn Crispin * @dev: network device 86870d2ab3aeSJohn Crispin * @color_bitmap: representations of the colors that the local BSS is aware of 868803895c84SLorenzo Bianconi * @gfp: allocation flags 86890d2ab3aeSJohn Crispin */ 86900d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev, 869103895c84SLorenzo Bianconi u64 color_bitmap, gfp_t gfp) 86920d2ab3aeSJohn Crispin { 869303895c84SLorenzo Bianconi return cfg80211_bss_color_notify(dev, gfp, 86940d2ab3aeSJohn Crispin NL80211_CMD_OBSS_COLOR_COLLISION, 86950d2ab3aeSJohn Crispin 0, color_bitmap); 86960d2ab3aeSJohn Crispin } 86970d2ab3aeSJohn Crispin 86980d2ab3aeSJohn Crispin /** 86990d2ab3aeSJohn Crispin * cfg80211_color_change_started_notify - notify color change start 87000d2ab3aeSJohn Crispin * @dev: the device on which the color is switched 87010d2ab3aeSJohn Crispin * @count: the number of TBTTs until the color change happens 87020d2ab3aeSJohn Crispin * 87030d2ab3aeSJohn Crispin * Inform the userspace about the color change that has started. 87040d2ab3aeSJohn Crispin */ 87050d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev, 87060d2ab3aeSJohn Crispin u8 count) 87070d2ab3aeSJohn Crispin { 87080d2ab3aeSJohn Crispin return cfg80211_bss_color_notify(dev, GFP_KERNEL, 87090d2ab3aeSJohn Crispin NL80211_CMD_COLOR_CHANGE_STARTED, 87100d2ab3aeSJohn Crispin count, 0); 87110d2ab3aeSJohn Crispin } 87120d2ab3aeSJohn Crispin 87130d2ab3aeSJohn Crispin /** 87140d2ab3aeSJohn Crispin * cfg80211_color_change_aborted_notify - notify color change abort 87150d2ab3aeSJohn Crispin * @dev: the device on which the color is switched 87160d2ab3aeSJohn Crispin * 87170d2ab3aeSJohn Crispin * Inform the userspace about the color change that has aborted. 87180d2ab3aeSJohn Crispin */ 87190d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev) 87200d2ab3aeSJohn Crispin { 87210d2ab3aeSJohn Crispin return cfg80211_bss_color_notify(dev, GFP_KERNEL, 87220d2ab3aeSJohn Crispin NL80211_CMD_COLOR_CHANGE_ABORTED, 87230d2ab3aeSJohn Crispin 0, 0); 87240d2ab3aeSJohn Crispin } 87250d2ab3aeSJohn Crispin 87260d2ab3aeSJohn Crispin /** 87270d2ab3aeSJohn Crispin * cfg80211_color_change_notify - notify color change completion 87280d2ab3aeSJohn Crispin * @dev: the device on which the color was switched 87290d2ab3aeSJohn Crispin * 87300d2ab3aeSJohn Crispin * Inform the userspace about the color change that has completed. 87310d2ab3aeSJohn Crispin */ 87320d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev) 87330d2ab3aeSJohn Crispin { 87340d2ab3aeSJohn Crispin return cfg80211_bss_color_notify(dev, GFP_KERNEL, 87350d2ab3aeSJohn Crispin NL80211_CMD_COLOR_CHANGE_COMPLETED, 87360d2ab3aeSJohn Crispin 0, 0); 87370d2ab3aeSJohn Crispin } 87380d2ab3aeSJohn Crispin 8739704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 8740