1704232c2SJohannes Berg #ifndef __NET_CFG80211_H 2704232c2SJohannes Berg #define __NET_CFG80211_H 3d3236553SJohannes Berg /* 4d3236553SJohannes Berg * 802.11 device and configuration interface 5d3236553SJohannes Berg * 6026331c4SJouni Malinen * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 7d3236553SJohannes Berg * 8d3236553SJohannes Berg * This program is free software; you can redistribute it and/or modify 9d3236553SJohannes Berg * it under the terms of the GNU General Public License version 2 as 10d3236553SJohannes Berg * published by the Free Software Foundation. 11d3236553SJohannes Berg */ 12704232c2SJohannes Berg 13d3236553SJohannes Berg #include <linux/netdevice.h> 14d3236553SJohannes Berg #include <linux/debugfs.h> 15d3236553SJohannes Berg #include <linux/list.h> 16187f1882SPaul Gortmaker #include <linux/bug.h> 17704232c2SJohannes Berg #include <linux/netlink.h> 18704232c2SJohannes Berg #include <linux/skbuff.h> 1955682965SJohannes Berg #include <linux/nl80211.h> 202a519311SJohannes Berg #include <linux/if_ether.h> 212a519311SJohannes Berg #include <linux/ieee80211.h> 22d3236553SJohannes Berg #include <net/regulatory.h> 23d3236553SJohannes Berg 24d70e9693SJohannes Berg /** 25d70e9693SJohannes Berg * DOC: Introduction 26d70e9693SJohannes Berg * 27d70e9693SJohannes Berg * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges 28d70e9693SJohannes Berg * userspace and drivers, and offers some utility functionality associated 29d70e9693SJohannes Berg * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used 30d70e9693SJohannes Berg * by all modern wireless drivers in Linux, so that they offer a consistent 31d70e9693SJohannes Berg * API through nl80211. For backward compatibility, cfg80211 also offers 32d70e9693SJohannes Berg * wireless extensions to userspace, but hides them from drivers completely. 33d70e9693SJohannes Berg * 34d70e9693SJohannes Berg * Additionally, cfg80211 contains code to help enforce regulatory spectrum 35d70e9693SJohannes Berg * use restrictions. 36d70e9693SJohannes Berg */ 37d70e9693SJohannes Berg 38d70e9693SJohannes Berg 39d70e9693SJohannes Berg /** 40d70e9693SJohannes Berg * DOC: Device registration 41d70e9693SJohannes Berg * 42d70e9693SJohannes Berg * In order for a driver to use cfg80211, it must register the hardware device 43d70e9693SJohannes Berg * with cfg80211. This happens through a number of hardware capability structs 44d70e9693SJohannes Berg * described below. 45d70e9693SJohannes Berg * 46d70e9693SJohannes Berg * The fundamental structure for each device is the 'wiphy', of which each 47d70e9693SJohannes Berg * instance describes a physical wireless device connected to the system. Each 48d70e9693SJohannes Berg * such wiphy can have zero, one, or many virtual interfaces associated with 49d70e9693SJohannes Berg * it, which need to be identified as such by pointing the network interface's 50d70e9693SJohannes Berg * @ieee80211_ptr pointer to a &struct wireless_dev which further describes 51d70e9693SJohannes Berg * the wireless part of the interface, normally this struct is embedded in the 52d70e9693SJohannes Berg * network interface's private data area. Drivers can optionally allow creating 53d70e9693SJohannes Berg * or destroying virtual interfaces on the fly, but without at least one or the 54d70e9693SJohannes Berg * ability to create some the wireless device isn't useful. 55d70e9693SJohannes Berg * 56d70e9693SJohannes Berg * Each wiphy structure contains device capability information, and also has 57d70e9693SJohannes Berg * a pointer to the various operations the driver offers. The definitions and 58d70e9693SJohannes Berg * structures here describe these capabilities in detail. 59d70e9693SJohannes Berg */ 60d70e9693SJohannes Berg 61704232c2SJohannes Berg /* 62d3236553SJohannes Berg * wireless hardware capability structures 63d3236553SJohannes Berg */ 64d3236553SJohannes Berg 65d3236553SJohannes Berg /** 66d3236553SJohannes Berg * enum ieee80211_band - supported frequency bands 67704232c2SJohannes Berg * 68d3236553SJohannes Berg * The bands are assigned this way because the supported 69d3236553SJohannes Berg * bitrates differ in these bands. 70d3236553SJohannes Berg * 71d3236553SJohannes Berg * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 72d3236553SJohannes Berg * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 73abe37c4bSJohannes Berg * @IEEE80211_NUM_BANDS: number of defined bands 74d3236553SJohannes Berg */ 75d3236553SJohannes Berg enum ieee80211_band { 7613ae75b1SJouni Malinen IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 7713ae75b1SJouni Malinen IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 78d3236553SJohannes Berg 79d3236553SJohannes Berg /* keep last */ 80d3236553SJohannes Berg IEEE80211_NUM_BANDS 81d3236553SJohannes Berg }; 82d3236553SJohannes Berg 83d3236553SJohannes Berg /** 84d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 85d3236553SJohannes Berg * 86d3236553SJohannes Berg * Channel flags set by the regulatory control code. 87d3236553SJohannes Berg * 88d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 89d3236553SJohannes Berg * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted 90d3236553SJohannes Berg * on this channel. 91d3236553SJohannes Berg * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. 92d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 93689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 94d3236553SJohannes Berg * is not permitted. 95689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 96d3236553SJohannes Berg * is not permitted. 97d3236553SJohannes Berg */ 98d3236553SJohannes Berg enum ieee80211_channel_flags { 99d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 100d3236553SJohannes Berg IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, 101d3236553SJohannes Berg IEEE80211_CHAN_NO_IBSS = 1<<2, 102d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 103689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 104689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 105d3236553SJohannes Berg }; 106d3236553SJohannes Berg 107038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 108689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 109038659e7SLuis R. Rodriguez 110d3236553SJohannes Berg /** 111d3236553SJohannes Berg * struct ieee80211_channel - channel definition 112d3236553SJohannes Berg * 113d3236553SJohannes Berg * This structure describes a single channel for use 114d3236553SJohannes Berg * with cfg80211. 115d3236553SJohannes Berg * 116d3236553SJohannes Berg * @center_freq: center frequency in MHz 117d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 118d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 119d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 120d3236553SJohannes Berg * code to support devices with additional restrictions 121d3236553SJohannes Berg * @band: band this channel belongs to. 122d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 123d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 124eccc068eSHong Wu * @max_reg_power: maximum regulatory transmission power (in dBm) 125d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 126d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 12777c2061dSWalter Goldens * to enable this, this is useful only on 5 GHz band. 128d3236553SJohannes Berg * @orig_mag: internal use 129d3236553SJohannes Berg * @orig_mpwr: internal use 130d3236553SJohannes Berg */ 131d3236553SJohannes Berg struct ieee80211_channel { 132d3236553SJohannes Berg enum ieee80211_band band; 133d3236553SJohannes Berg u16 center_freq; 134d3236553SJohannes Berg u16 hw_value; 135d3236553SJohannes Berg u32 flags; 136d3236553SJohannes Berg int max_antenna_gain; 137d3236553SJohannes Berg int max_power; 138eccc068eSHong Wu int max_reg_power; 139d3236553SJohannes Berg bool beacon_found; 140d3236553SJohannes Berg u32 orig_flags; 141d3236553SJohannes Berg int orig_mag, orig_mpwr; 142d3236553SJohannes Berg }; 143d3236553SJohannes Berg 144d3236553SJohannes Berg /** 145d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 146d3236553SJohannes Berg * 147d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 148d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 149d3236553SJohannes Berg * different bands/PHY modes. 150d3236553SJohannes Berg * 151d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 152d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 153d3236553SJohannes Berg * with CCK rates. 154d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 155d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 156d3236553SJohannes Berg * core code when registering the wiphy. 157d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 158d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 159d3236553SJohannes Berg * core code when registering the wiphy. 160d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 161d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 162d3236553SJohannes Berg * core code when registering the wiphy. 163d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 164d3236553SJohannes Berg */ 165d3236553SJohannes Berg enum ieee80211_rate_flags { 166d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 167d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 168d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 169d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 170d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 171d3236553SJohannes Berg }; 172d3236553SJohannes Berg 173d3236553SJohannes Berg /** 174d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 175d3236553SJohannes Berg * 176d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 177d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 178d3236553SJohannes Berg * are only for driver use when pointers to this structure are 179d3236553SJohannes Berg * passed around. 180d3236553SJohannes Berg * 181d3236553SJohannes Berg * @flags: rate-specific flags 182d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 183d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 184d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 185d3236553SJohannes Berg * short preamble is used 186d3236553SJohannes Berg */ 187d3236553SJohannes Berg struct ieee80211_rate { 188d3236553SJohannes Berg u32 flags; 189d3236553SJohannes Berg u16 bitrate; 190d3236553SJohannes Berg u16 hw_value, hw_value_short; 191d3236553SJohannes Berg }; 192d3236553SJohannes Berg 193d3236553SJohannes Berg /** 194d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 195d3236553SJohannes Berg * 196d3236553SJohannes Berg * This structure describes most essential parameters needed 197d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 198d3236553SJohannes Berg * 199d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 200d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 201d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 202d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 203d3236553SJohannes Berg * @mcs: Supported MCS rates 204d3236553SJohannes Berg */ 205d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 206d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 207d3236553SJohannes Berg bool ht_supported; 208d3236553SJohannes Berg u8 ampdu_factor; 209d3236553SJohannes Berg u8 ampdu_density; 210d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 211d3236553SJohannes Berg }; 212d3236553SJohannes Berg 213d3236553SJohannes Berg /** 214d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 215d3236553SJohannes Berg * 216d3236553SJohannes Berg * This structure describes a frequency band a wiphy 217d3236553SJohannes Berg * is able to operate in. 218d3236553SJohannes Berg * 219d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 220d3236553SJohannes Berg * in this band. 221d3236553SJohannes Berg * @band: the band this structure represents 222d3236553SJohannes Berg * @n_channels: Number of channels in @channels 223d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 224d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 225d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 226d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 227abe37c4bSJohannes Berg * @ht_cap: HT capabilities in this band 228d3236553SJohannes Berg */ 229d3236553SJohannes Berg struct ieee80211_supported_band { 230d3236553SJohannes Berg struct ieee80211_channel *channels; 231d3236553SJohannes Berg struct ieee80211_rate *bitrates; 232d3236553SJohannes Berg enum ieee80211_band band; 233d3236553SJohannes Berg int n_channels; 234d3236553SJohannes Berg int n_bitrates; 235d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 236d3236553SJohannes Berg }; 237d3236553SJohannes Berg 238d3236553SJohannes Berg /* 239d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 240704232c2SJohannes Berg */ 241704232c2SJohannes Berg 2422ec600d6SLuis Carlos Cobo /** 243d70e9693SJohannes Berg * DOC: Actions and configuration 244d70e9693SJohannes Berg * 245d70e9693SJohannes Berg * Each wireless device and each virtual interface offer a set of configuration 246d70e9693SJohannes Berg * operations and other actions that are invoked by userspace. Each of these 247d70e9693SJohannes Berg * actions is described in the operations structure, and the parameters these 248d70e9693SJohannes Berg * operations use are described separately. 249d70e9693SJohannes Berg * 250d70e9693SJohannes Berg * Additionally, some operations are asynchronous and expect to get status 251d70e9693SJohannes Berg * information via some functions that drivers need to call. 252d70e9693SJohannes Berg * 253d70e9693SJohannes Berg * Scanning and BSS list handling with its associated functionality is described 254d70e9693SJohannes Berg * in a separate chapter. 255d70e9693SJohannes Berg */ 256d70e9693SJohannes Berg 257d70e9693SJohannes Berg /** 2582ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 2598b787643SFelix Fietkau * @use_4addr: use 4-address frames 2602ec600d6SLuis Carlos Cobo */ 2612ec600d6SLuis Carlos Cobo struct vif_params { 2628b787643SFelix Fietkau int use_4addr; 2632ec600d6SLuis Carlos Cobo }; 2642ec600d6SLuis Carlos Cobo 26541ade00fSJohannes Berg /** 26641ade00fSJohannes Berg * struct key_params - key information 26741ade00fSJohannes Berg * 26841ade00fSJohannes Berg * Information about a key 26941ade00fSJohannes Berg * 27041ade00fSJohannes Berg * @key: key material 27141ade00fSJohannes Berg * @key_len: length of key material 27241ade00fSJohannes Berg * @cipher: cipher suite selector 27341ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 27441ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 27541ade00fSJohannes Berg * length given by @seq_len. 276abe37c4bSJohannes Berg * @seq_len: length of @seq. 27741ade00fSJohannes Berg */ 27841ade00fSJohannes Berg struct key_params { 27941ade00fSJohannes Berg u8 *key; 28041ade00fSJohannes Berg u8 *seq; 28141ade00fSJohannes Berg int key_len; 28241ade00fSJohannes Berg int seq_len; 28341ade00fSJohannes Berg u32 cipher; 28441ade00fSJohannes Berg }; 28541ade00fSJohannes Berg 286ed1b6cc7SJohannes Berg /** 28761fa713cSHolger Schurig * enum survey_info_flags - survey information flags 28861fa713cSHolger Schurig * 289abe37c4bSJohannes Berg * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 29017e5a808SFelix Fietkau * @SURVEY_INFO_IN_USE: channel is currently being used 2918610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in 2928610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in 2938610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in 2948610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in 2958610c29aSFelix Fietkau * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in 296abe37c4bSJohannes Berg * 29761fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 29861fa713cSHolger Schurig * it has filled in during the get_survey(). 29961fa713cSHolger Schurig */ 30061fa713cSHolger Schurig enum survey_info_flags { 30161fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 30217e5a808SFelix Fietkau SURVEY_INFO_IN_USE = 1<<1, 3038610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME = 1<<2, 3048610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, 3058610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, 3068610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, 3078610c29aSFelix Fietkau SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, 30861fa713cSHolger Schurig }; 30961fa713cSHolger Schurig 31061fa713cSHolger Schurig /** 31161fa713cSHolger Schurig * struct survey_info - channel survey response 31261fa713cSHolger Schurig * 31361fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 31461fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 31561fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 31661fa713cSHolger Schurig * optional 3178610c29aSFelix Fietkau * @channel_time: amount of time in ms the radio spent on the channel 3188610c29aSFelix Fietkau * @channel_time_busy: amount of time the primary channel was sensed busy 3198610c29aSFelix Fietkau * @channel_time_ext_busy: amount of time the extension channel was sensed busy 3208610c29aSFelix Fietkau * @channel_time_rx: amount of time the radio spent receiving data 3218610c29aSFelix Fietkau * @channel_time_tx: amount of time the radio spent transmitting data 32261fa713cSHolger Schurig * 323abe37c4bSJohannes Berg * Used by dump_survey() to report back per-channel survey information. 324abe37c4bSJohannes Berg * 32561fa713cSHolger Schurig * This structure can later be expanded with things like 32661fa713cSHolger Schurig * channel duty cycle etc. 32761fa713cSHolger Schurig */ 32861fa713cSHolger Schurig struct survey_info { 32961fa713cSHolger Schurig struct ieee80211_channel *channel; 3308610c29aSFelix Fietkau u64 channel_time; 3318610c29aSFelix Fietkau u64 channel_time_busy; 3328610c29aSFelix Fietkau u64 channel_time_ext_busy; 3338610c29aSFelix Fietkau u64 channel_time_rx; 3348610c29aSFelix Fietkau u64 channel_time_tx; 33561fa713cSHolger Schurig u32 filled; 33661fa713cSHolger Schurig s8 noise; 33761fa713cSHolger Schurig }; 33861fa713cSHolger Schurig 33961fa713cSHolger Schurig /** 3405fb628e9SJouni Malinen * struct cfg80211_crypto_settings - Crypto settings 3415fb628e9SJouni Malinen * @wpa_versions: indicates which, if any, WPA versions are enabled 3425fb628e9SJouni Malinen * (from enum nl80211_wpa_versions) 3435fb628e9SJouni Malinen * @cipher_group: group key cipher suite (or 0 if unset) 3445fb628e9SJouni Malinen * @n_ciphers_pairwise: number of AP supported unicast ciphers 3455fb628e9SJouni Malinen * @ciphers_pairwise: unicast key cipher suites 3465fb628e9SJouni Malinen * @n_akm_suites: number of AKM suites 3475fb628e9SJouni Malinen * @akm_suites: AKM suites 3485fb628e9SJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 3495fb628e9SJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 3505fb628e9SJouni Malinen * required to assume that the port is unauthorized until authorized by 3515fb628e9SJouni Malinen * user space. Otherwise, port is marked authorized by default. 3525fb628e9SJouni Malinen * @control_port_ethertype: the control port protocol that should be 3535fb628e9SJouni Malinen * allowed through even on unauthorized ports 3545fb628e9SJouni Malinen * @control_port_no_encrypt: TRUE to prevent encryption of control port 3555fb628e9SJouni Malinen * protocol frames. 3565fb628e9SJouni Malinen */ 3575fb628e9SJouni Malinen struct cfg80211_crypto_settings { 3585fb628e9SJouni Malinen u32 wpa_versions; 3595fb628e9SJouni Malinen u32 cipher_group; 3605fb628e9SJouni Malinen int n_ciphers_pairwise; 3615fb628e9SJouni Malinen u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 3625fb628e9SJouni Malinen int n_akm_suites; 3635fb628e9SJouni Malinen u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 3645fb628e9SJouni Malinen bool control_port; 3655fb628e9SJouni Malinen __be16 control_port_ethertype; 3665fb628e9SJouni Malinen bool control_port_no_encrypt; 3675fb628e9SJouni Malinen }; 3685fb628e9SJouni Malinen 3695fb628e9SJouni Malinen /** 3708860020eSJohannes Berg * struct cfg80211_beacon_data - beacon data 371ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 372ed1b6cc7SJohannes Berg * or %NULL if not changed 373ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 374ed1b6cc7SJohannes Berg * or %NULL if not changed 375ed1b6cc7SJohannes Berg * @head_len: length of @head 376ed1b6cc7SJohannes Berg * @tail_len: length of @tail 3779946ecfbSJouni Malinen * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 3789946ecfbSJouni Malinen * @beacon_ies_len: length of beacon_ies in octets 3799946ecfbSJouni Malinen * @proberesp_ies: extra information element(s) to add into Probe Response 3809946ecfbSJouni Malinen * frames or %NULL 3819946ecfbSJouni Malinen * @proberesp_ies_len: length of proberesp_ies in octets 3829946ecfbSJouni Malinen * @assocresp_ies: extra information element(s) to add into (Re)Association 3839946ecfbSJouni Malinen * Response frames or %NULL 3849946ecfbSJouni Malinen * @assocresp_ies_len: length of assocresp_ies in octets 38500f740e1SArik Nemtsov * @probe_resp_len: length of probe response template (@probe_resp) 38600f740e1SArik Nemtsov * @probe_resp: probe response template (AP mode only) 387ed1b6cc7SJohannes Berg */ 3888860020eSJohannes Berg struct cfg80211_beacon_data { 3898860020eSJohannes Berg const u8 *head, *tail; 3908860020eSJohannes Berg const u8 *beacon_ies; 3918860020eSJohannes Berg const u8 *proberesp_ies; 3928860020eSJohannes Berg const u8 *assocresp_ies; 3938860020eSJohannes Berg const u8 *probe_resp; 3948860020eSJohannes Berg 3958860020eSJohannes Berg size_t head_len, tail_len; 3968860020eSJohannes Berg size_t beacon_ies_len; 3978860020eSJohannes Berg size_t proberesp_ies_len; 3988860020eSJohannes Berg size_t assocresp_ies_len; 3998860020eSJohannes Berg size_t probe_resp_len; 4008860020eSJohannes Berg }; 4018860020eSJohannes Berg 4028860020eSJohannes Berg /** 4038860020eSJohannes Berg * struct cfg80211_ap_settings - AP configuration 4048860020eSJohannes Berg * 4058860020eSJohannes Berg * Used to configure an AP interface. 4068860020eSJohannes Berg * 4078860020eSJohannes Berg * @beacon: beacon data 4088860020eSJohannes Berg * @beacon_interval: beacon interval 4098860020eSJohannes Berg * @dtim_period: DTIM period 4108860020eSJohannes Berg * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from 4118860020eSJohannes Berg * user space) 4128860020eSJohannes Berg * @ssid_len: length of @ssid 4138860020eSJohannes Berg * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames 4148860020eSJohannes Berg * @crypto: crypto settings 4158860020eSJohannes Berg * @privacy: the BSS uses privacy 4168860020eSJohannes Berg * @auth_type: Authentication type (algorithm) 4171b658f11SVasanthakumar Thiagarajan * @inactivity_timeout: time in seconds to determine station's inactivity. 4188860020eSJohannes Berg */ 4198860020eSJohannes Berg struct cfg80211_ap_settings { 4208860020eSJohannes Berg struct cfg80211_beacon_data beacon; 4218860020eSJohannes Berg 4228860020eSJohannes Berg int beacon_interval, dtim_period; 42332e9de84SJouni Malinen const u8 *ssid; 42432e9de84SJouni Malinen size_t ssid_len; 42532e9de84SJouni Malinen enum nl80211_hidden_ssid hidden_ssid; 4265fb628e9SJouni Malinen struct cfg80211_crypto_settings crypto; 4275fb628e9SJouni Malinen bool privacy; 4285fb628e9SJouni Malinen enum nl80211_auth_type auth_type; 4291b658f11SVasanthakumar Thiagarajan int inactivity_timeout; 430ed1b6cc7SJohannes Berg }; 431ed1b6cc7SJohannes Berg 4325727ef1bSJohannes Berg /** 4332ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 4342ec600d6SLuis Carlos Cobo * 4352ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 4362ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 437abe37c4bSJohannes Berg * @PLINK_ACTION_BLOCK: block traffic from this mesh peer 4382ec600d6SLuis Carlos Cobo */ 4392ec600d6SLuis Carlos Cobo enum plink_actions { 4402ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 4412ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 4422ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 4432ec600d6SLuis Carlos Cobo }; 4442ec600d6SLuis Carlos Cobo 4452ec600d6SLuis Carlos Cobo /** 4463b9ce80cSJohannes Berg * enum station_parameters_apply_mask - station parameter values to apply 4473b9ce80cSJohannes Berg * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 4483b9ce80cSJohannes Berg * 4493b9ce80cSJohannes Berg * Not all station parameters have in-band "no change" signalling, 4503b9ce80cSJohannes Berg * for those that don't these flags will are used. 4513b9ce80cSJohannes Berg */ 4523b9ce80cSJohannes Berg enum station_parameters_apply_mask { 4533b9ce80cSJohannes Berg STATION_PARAM_APPLY_UAPSD = BIT(0), 4543b9ce80cSJohannes Berg }; 4553b9ce80cSJohannes Berg 4563b9ce80cSJohannes Berg /** 4575727ef1bSJohannes Berg * struct station_parameters - station parameters 4585727ef1bSJohannes Berg * 4595727ef1bSJohannes Berg * Used to change and create a new station. 4605727ef1bSJohannes Berg * 4615727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 4625727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 4635727ef1bSJohannes Berg * (or NULL for no change) 4645727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 465eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 466eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 467eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 468eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 4695727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 4705727ef1bSJohannes Berg * @aid: AID or zero for no change 471abe37c4bSJohannes Berg * @plink_action: plink action to take 4729c3990aaSJavier Cardona * @plink_state: set the peer link state for a station 473abe37c4bSJohannes Berg * @ht_capa: HT capabilities of station 474910868dbSEliad Peller * @uapsd_queues: bitmap of queues configured for uapsd. same format 475910868dbSEliad Peller * as the AC bitmap in the QoS info field 476910868dbSEliad Peller * @max_sp: max Service Period. same format as the MAX_SP in the 477910868dbSEliad Peller * QoS info field (but already shifted down) 478c26887d2SJohannes Berg * @sta_modify_mask: bitmap indicating which parameters changed 479c26887d2SJohannes Berg * (for those that don't have a natural "no change" value), 480c26887d2SJohannes Berg * see &enum station_parameters_apply_mask 4815727ef1bSJohannes Berg */ 4825727ef1bSJohannes Berg struct station_parameters { 4835727ef1bSJohannes Berg u8 *supported_rates; 4845727ef1bSJohannes Berg struct net_device *vlan; 485eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 4863b9ce80cSJohannes Berg u32 sta_modify_mask; 4875727ef1bSJohannes Berg int listen_interval; 4885727ef1bSJohannes Berg u16 aid; 4895727ef1bSJohannes Berg u8 supported_rates_len; 4902ec600d6SLuis Carlos Cobo u8 plink_action; 4919c3990aaSJavier Cardona u8 plink_state; 49236aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 493c75786c9SEliad Peller u8 uapsd_queues; 494c75786c9SEliad Peller u8 max_sp; 4955727ef1bSJohannes Berg }; 4965727ef1bSJohannes Berg 497fd5b74dcSJohannes Berg /** 4982ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 499fd5b74dcSJohannes Berg * 5002ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 5012ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 502fd5b74dcSJohannes Berg * 5032ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 5042ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 5052ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 5062ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 5072ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 5082ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 509420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 510c8dcfd8aSFelix Fietkau * @STATION_INFO_TX_BITRATE: @txrate fields are filled 511420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 51298c8a60aSJouni Malinen * @STATION_INFO_RX_PACKETS: @rx_packets filled 51398c8a60aSJouni Malinen * @STATION_INFO_TX_PACKETS: @tx_packets filled 514b206b4efSBruno Randolf * @STATION_INFO_TX_RETRIES: @tx_retries filled 515b206b4efSBruno Randolf * @STATION_INFO_TX_FAILED: @tx_failed filled 5165a5c731aSBen Greear * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 517541a45a1SBruno Randolf * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 518c8dcfd8aSFelix Fietkau * @STATION_INFO_RX_BITRATE: @rxrate fields are filled 519f4263c98SPaul Stewart * @STATION_INFO_BSS_PARAM: @bss_param filled 520ebe27c91SMohammed Shafi Shajakhan * @STATION_INFO_CONNECTED_TIME: @connected_time filled 521040bdf71SFelix Fietkau * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 522bb6e753eSHelmut Schaa * @STATION_INFO_STA_FLAGS: @sta_flags filled 523a85e1d55SPaul Stewart * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 524d299a1f2SJavier Cardona * @STATION_INFO_T_OFFSET: @t_offset filled 525fd5b74dcSJohannes Berg */ 5262ec600d6SLuis Carlos Cobo enum station_info_flags { 5272ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 5282ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 5292ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 5302ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 5312ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 5322ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 533420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 534420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 53598c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 53698c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 537b206b4efSBruno Randolf STATION_INFO_TX_RETRIES = 1<<10, 538b206b4efSBruno Randolf STATION_INFO_TX_FAILED = 1<<11, 5395a5c731aSBen Greear STATION_INFO_RX_DROP_MISC = 1<<12, 540541a45a1SBruno Randolf STATION_INFO_SIGNAL_AVG = 1<<13, 541c8dcfd8aSFelix Fietkau STATION_INFO_RX_BITRATE = 1<<14, 542f4263c98SPaul Stewart STATION_INFO_BSS_PARAM = 1<<15, 543040bdf71SFelix Fietkau STATION_INFO_CONNECTED_TIME = 1<<16, 544bb6e753eSHelmut Schaa STATION_INFO_ASSOC_REQ_IES = 1<<17, 545a85e1d55SPaul Stewart STATION_INFO_STA_FLAGS = 1<<18, 546d299a1f2SJavier Cardona STATION_INFO_BEACON_LOSS_COUNT = 1<<19, 547d299a1f2SJavier Cardona STATION_INFO_T_OFFSET = 1<<20, 548420e7fabSHenning Rogge }; 549420e7fabSHenning Rogge 550420e7fabSHenning Rogge /** 551420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 552420e7fabSHenning Rogge * 553420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 554420e7fabSHenning Rogge * type for 802.11n transmissions. 555420e7fabSHenning Rogge * 556420e7fabSHenning Rogge * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 557420e7fabSHenning Rogge * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 558420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 559420e7fabSHenning Rogge */ 560420e7fabSHenning Rogge enum rate_info_flags { 561420e7fabSHenning Rogge RATE_INFO_FLAGS_MCS = 1<<0, 562420e7fabSHenning Rogge RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 563420e7fabSHenning Rogge RATE_INFO_FLAGS_SHORT_GI = 1<<2, 564420e7fabSHenning Rogge }; 565420e7fabSHenning Rogge 566420e7fabSHenning Rogge /** 567420e7fabSHenning Rogge * struct rate_info - bitrate information 568420e7fabSHenning Rogge * 569420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 570420e7fabSHenning Rogge * 571420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 572420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 573420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 574420e7fabSHenning Rogge */ 575420e7fabSHenning Rogge struct rate_info { 576420e7fabSHenning Rogge u8 flags; 577420e7fabSHenning Rogge u8 mcs; 578420e7fabSHenning Rogge u16 legacy; 579fd5b74dcSJohannes Berg }; 580fd5b74dcSJohannes Berg 581fd5b74dcSJohannes Berg /** 582f4263c98SPaul Stewart * enum station_info_rate_flags - bitrate info flags 583f4263c98SPaul Stewart * 584f4263c98SPaul Stewart * Used by the driver to indicate the specific rate transmission 585f4263c98SPaul Stewart * type for 802.11n transmissions. 586f4263c98SPaul Stewart * 587f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled 588f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled 589f4263c98SPaul Stewart * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled 590f4263c98SPaul Stewart */ 591f4263c98SPaul Stewart enum bss_param_flags { 592f4263c98SPaul Stewart BSS_PARAM_FLAGS_CTS_PROT = 1<<0, 593f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, 594f4263c98SPaul Stewart BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, 595f4263c98SPaul Stewart }; 596f4263c98SPaul Stewart 597f4263c98SPaul Stewart /** 598f4263c98SPaul Stewart * struct sta_bss_parameters - BSS parameters for the attached station 599f4263c98SPaul Stewart * 600f4263c98SPaul Stewart * Information about the currently associated BSS 601f4263c98SPaul Stewart * 602f4263c98SPaul Stewart * @flags: bitflag of flags from &enum bss_param_flags 603f4263c98SPaul Stewart * @dtim_period: DTIM period for the BSS 604f4263c98SPaul Stewart * @beacon_interval: beacon interval 605f4263c98SPaul Stewart */ 606f4263c98SPaul Stewart struct sta_bss_parameters { 607f4263c98SPaul Stewart u8 flags; 608f4263c98SPaul Stewart u8 dtim_period; 609f4263c98SPaul Stewart u16 beacon_interval; 610f4263c98SPaul Stewart }; 611f4263c98SPaul Stewart 612f4263c98SPaul Stewart /** 6132ec600d6SLuis Carlos Cobo * struct station_info - station information 614fd5b74dcSJohannes Berg * 6152ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 616fd5b74dcSJohannes Berg * 6172ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 618ebe27c91SMohammed Shafi Shajakhan * @connected_time: time(in secs) since a station is last connected 619fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 620fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 621fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 6222ec600d6SLuis Carlos Cobo * @llid: mesh local link id 6232ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 6242ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 62566266b3aSJohn W. Linville * @signal: the signal strength, type depends on the wiphy's signal_type 62666266b3aSJohn W. Linville NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 62766266b3aSJohn W. Linville * @signal_avg: avg signal strength, type depends on the wiphy's signal_type 62866266b3aSJohn W. Linville NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 629858022aaSRandy Dunlap * @txrate: current unicast bitrate from this station 630858022aaSRandy Dunlap * @rxrate: current unicast bitrate to this station 63198c8a60aSJouni Malinen * @rx_packets: packets received from this station 63298c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 633b206b4efSBruno Randolf * @tx_retries: cumulative retry counts 634b206b4efSBruno Randolf * @tx_failed: number of failed transmissions (retries exceeded, no ACK) 6355a5c731aSBen Greear * @rx_dropped_misc: Dropped for un-specified reason. 6361ba01458SRandy Dunlap * @bss_param: current BSS parameters 637f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 638f5ea9120SJohannes Berg * This number should increase every time the list of stations 639f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 640f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 64150d3dfb7SJouni Malinen * @assoc_req_ies: IEs from (Re)Association Request. 64250d3dfb7SJouni Malinen * This is used only when in AP mode with drivers that do not use 64350d3dfb7SJouni Malinen * user space MLME/SME implementation. The information is provided for 64450d3dfb7SJouni Malinen * the cfg80211_new_sta() calls to notify user space of the IEs. 64550d3dfb7SJouni Malinen * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 646c26887d2SJohannes Berg * @sta_flags: station flags mask & values 647a85e1d55SPaul Stewart * @beacon_loss_count: Number of times beacon loss event has triggered. 648d299a1f2SJavier Cardona * @t_offset: Time offset of the station relative to this host. 649fd5b74dcSJohannes Berg */ 6502ec600d6SLuis Carlos Cobo struct station_info { 651fd5b74dcSJohannes Berg u32 filled; 652ebe27c91SMohammed Shafi Shajakhan u32 connected_time; 653fd5b74dcSJohannes Berg u32 inactive_time; 654fd5b74dcSJohannes Berg u32 rx_bytes; 655fd5b74dcSJohannes Berg u32 tx_bytes; 6562ec600d6SLuis Carlos Cobo u16 llid; 6572ec600d6SLuis Carlos Cobo u16 plid; 6582ec600d6SLuis Carlos Cobo u8 plink_state; 659420e7fabSHenning Rogge s8 signal; 660541a45a1SBruno Randolf s8 signal_avg; 661420e7fabSHenning Rogge struct rate_info txrate; 662c8dcfd8aSFelix Fietkau struct rate_info rxrate; 66398c8a60aSJouni Malinen u32 rx_packets; 66498c8a60aSJouni Malinen u32 tx_packets; 665b206b4efSBruno Randolf u32 tx_retries; 666b206b4efSBruno Randolf u32 tx_failed; 6675a5c731aSBen Greear u32 rx_dropped_misc; 668f4263c98SPaul Stewart struct sta_bss_parameters bss_param; 669bb6e753eSHelmut Schaa struct nl80211_sta_flag_update sta_flags; 670f5ea9120SJohannes Berg 671f5ea9120SJohannes Berg int generation; 67250d3dfb7SJouni Malinen 67350d3dfb7SJouni Malinen const u8 *assoc_req_ies; 67450d3dfb7SJouni Malinen size_t assoc_req_ies_len; 675f612cedfSJouni Malinen 676a85e1d55SPaul Stewart u32 beacon_loss_count; 677d299a1f2SJavier Cardona s64 t_offset; 678a85e1d55SPaul Stewart 679f612cedfSJouni Malinen /* 680f612cedfSJouni Malinen * Note: Add a new enum station_info_flags value for each new field and 681f612cedfSJouni Malinen * use it to check which fields are initialized. 682f612cedfSJouni Malinen */ 683fd5b74dcSJohannes Berg }; 684fd5b74dcSJohannes Berg 68566f7ac50SMichael Wu /** 68666f7ac50SMichael Wu * enum monitor_flags - monitor flags 68766f7ac50SMichael Wu * 68866f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 68966f7ac50SMichael Wu * according to the nl80211 flags. 69066f7ac50SMichael Wu * 69166f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 69266f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 69366f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 69466f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 69566f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 69666f7ac50SMichael Wu */ 69766f7ac50SMichael Wu enum monitor_flags { 69866f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 69966f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 70066f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 70166f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 70266f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 70366f7ac50SMichael Wu }; 70466f7ac50SMichael Wu 7052ec600d6SLuis Carlos Cobo /** 7062ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 7072ec600d6SLuis Carlos Cobo * 7082ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 7092ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 7102ec600d6SLuis Carlos Cobo * 711abe37c4bSJohannes Berg * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled 712abe37c4bSJohannes Berg * @MPATH_INFO_SN: @sn filled 713abe37c4bSJohannes Berg * @MPATH_INFO_METRIC: @metric filled 714abe37c4bSJohannes Berg * @MPATH_INFO_EXPTIME: @exptime filled 715abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 716abe37c4bSJohannes Berg * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 717abe37c4bSJohannes Berg * @MPATH_INFO_FLAGS: @flags filled 7182ec600d6SLuis Carlos Cobo */ 7192ec600d6SLuis Carlos Cobo enum mpath_info_flags { 7202ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 721d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 7222ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 7232ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 7242ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 7252ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 7262ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 7272ec600d6SLuis Carlos Cobo }; 7282ec600d6SLuis Carlos Cobo 7292ec600d6SLuis Carlos Cobo /** 7302ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 7312ec600d6SLuis Carlos Cobo * 7322ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 7332ec600d6SLuis Carlos Cobo * 7342ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 7352ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 736d19b3bf6SRui Paulo * @sn: target sequence number 7372ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 7382ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 7392ec600d6SLuis Carlos Cobo * @flags: mesh path flags 7402ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 7412ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 742f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 743f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 744f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 745f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 7462ec600d6SLuis Carlos Cobo */ 7472ec600d6SLuis Carlos Cobo struct mpath_info { 7482ec600d6SLuis Carlos Cobo u32 filled; 7492ec600d6SLuis Carlos Cobo u32 frame_qlen; 750d19b3bf6SRui Paulo u32 sn; 7512ec600d6SLuis Carlos Cobo u32 metric; 7522ec600d6SLuis Carlos Cobo u32 exptime; 7532ec600d6SLuis Carlos Cobo u32 discovery_timeout; 7542ec600d6SLuis Carlos Cobo u8 discovery_retries; 7552ec600d6SLuis Carlos Cobo u8 flags; 756f5ea9120SJohannes Berg 757f5ea9120SJohannes Berg int generation; 7582ec600d6SLuis Carlos Cobo }; 7592ec600d6SLuis Carlos Cobo 7609f1ba906SJouni Malinen /** 7619f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 7629f1ba906SJouni Malinen * 7639f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 7649f1ba906SJouni Malinen * 7659f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 7669f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 7679f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 7689f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 7699f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 7709f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 77190c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 77290c97a04SJouni Malinen * (or NULL for no change) 77390c97a04SJouni Malinen * @basic_rates_len: number of basic rates 774fd8aaaf3SFelix Fietkau * @ap_isolate: do not forward packets between connected stations 77550b12f59SHelmut Schaa * @ht_opmode: HT Operation mode 77650b12f59SHelmut Schaa * (u16 = opmode, -1 = do not change) 7779f1ba906SJouni Malinen */ 7789f1ba906SJouni Malinen struct bss_parameters { 7799f1ba906SJouni Malinen int use_cts_prot; 7809f1ba906SJouni Malinen int use_short_preamble; 7819f1ba906SJouni Malinen int use_short_slot_time; 78290c97a04SJouni Malinen u8 *basic_rates; 78390c97a04SJouni Malinen u8 basic_rates_len; 784fd8aaaf3SFelix Fietkau int ap_isolate; 78550b12f59SHelmut Schaa int ht_opmode; 7869f1ba906SJouni Malinen }; 7872ec600d6SLuis Carlos Cobo 78829cbe68cSJohannes Berg /* 78929cbe68cSJohannes Berg * struct mesh_config - 802.11s mesh configuration 79029cbe68cSJohannes Berg * 79129cbe68cSJohannes Berg * These parameters can be changed while the mesh is active. 79229cbe68cSJohannes Berg */ 79393da9cc1Scolin@cozybit.com struct mesh_config { 79493da9cc1Scolin@cozybit.com /* Timeouts in ms */ 79593da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 79693da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 79793da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 79893da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 79993da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 80093da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 80193da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 80245904f21SJavier Cardona /* ttl used in path selection information elements */ 80345904f21SJavier Cardona u8 element_ttl; 80493da9cc1Scolin@cozybit.com bool auto_open_plinks; 805d299a1f2SJavier Cardona /* neighbor offset synchronization */ 806d299a1f2SJavier Cardona u32 dot11MeshNbrOffsetMaxNeighbor; 80793da9cc1Scolin@cozybit.com /* HWMP parameters */ 80893da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 80993da9cc1Scolin@cozybit.com u32 path_refresh_time; 81093da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 81193da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 81293da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 813dca7e943SThomas Pedersen u16 dot11MeshHWMPperrMinInterval; 81493da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 81563c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 8160507e159SJavier Cardona u16 dot11MeshHWMPRannInterval; 81716dd7267SJavier Cardona /* This is missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol 81816dd7267SJavier Cardona * set to true only means that the station will announce others it's a 81916dd7267SJavier Cardona * mesh gate, but not necessarily using the gate announcement protocol. 82016dd7267SJavier Cardona * Still keeping the same nomenclature to be in sync with the spec. */ 82116dd7267SJavier Cardona bool dot11MeshGateAnnouncementProtocol; 82294f90656SChun-Yeow Yeoh bool dot11MeshForwarding; 82355335137SAshok Nagarajan s32 rssi_threshold; 82470c33eaaSAshok Nagarajan u16 ht_opmode; 82593da9cc1Scolin@cozybit.com }; 82693da9cc1Scolin@cozybit.com 82731888487SJouni Malinen /** 82829cbe68cSJohannes Berg * struct mesh_setup - 802.11s mesh setup configuration 82929cbe68cSJohannes Berg * @mesh_id: the mesh ID 83029cbe68cSJohannes Berg * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 831d299a1f2SJavier Cardona * @sync_method: which synchronization method to use 832c80d545dSJavier Cardona * @path_sel_proto: which path selection protocol to use 833c80d545dSJavier Cardona * @path_metric: which metric to use 834581a8b0fSJavier Cardona * @ie: vendor information elements (optional) 835581a8b0fSJavier Cardona * @ie_len: length of vendor information elements 836b130e5ceSJavier Cardona * @is_authenticated: this mesh requires authentication 837b130e5ceSJavier Cardona * @is_secure: this mesh uses security 8384bb62344SChun-Yeow Yeoh * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 83929cbe68cSJohannes Berg * 84029cbe68cSJohannes Berg * These parameters are fixed when the mesh is created. 84129cbe68cSJohannes Berg */ 84229cbe68cSJohannes Berg struct mesh_setup { 84329cbe68cSJohannes Berg const u8 *mesh_id; 84429cbe68cSJohannes Berg u8 mesh_id_len; 845d299a1f2SJavier Cardona u8 sync_method; 846c80d545dSJavier Cardona u8 path_sel_proto; 847c80d545dSJavier Cardona u8 path_metric; 848581a8b0fSJavier Cardona const u8 *ie; 849581a8b0fSJavier Cardona u8 ie_len; 850b130e5ceSJavier Cardona bool is_authenticated; 85115d5dda6SJavier Cardona bool is_secure; 8524bb62344SChun-Yeow Yeoh int mcast_rate[IEEE80211_NUM_BANDS]; 85329cbe68cSJohannes Berg }; 85429cbe68cSJohannes Berg 85529cbe68cSJohannes Berg /** 85631888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 857a3304b0aSJohannes Berg * @ac: AC identifier 85831888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 85931888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 86031888487SJouni Malinen * 1..32767] 86131888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 86231888487SJouni Malinen * 1..32767] 86331888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 86431888487SJouni Malinen */ 86531888487SJouni Malinen struct ieee80211_txq_params { 866a3304b0aSJohannes Berg enum nl80211_ac ac; 86731888487SJouni Malinen u16 txop; 86831888487SJouni Malinen u16 cwmin; 86931888487SJouni Malinen u16 cwmax; 87031888487SJouni Malinen u8 aifs; 87131888487SJouni Malinen }; 87231888487SJouni Malinen 873704232c2SJohannes Berg /* from net/wireless.h */ 874704232c2SJohannes Berg struct wiphy; 875704232c2SJohannes Berg 876d70e9693SJohannes Berg /** 877d70e9693SJohannes Berg * DOC: Scanning and BSS list handling 878d70e9693SJohannes Berg * 879d70e9693SJohannes Berg * The scanning process itself is fairly simple, but cfg80211 offers quite 880d70e9693SJohannes Berg * a bit of helper functionality. To start a scan, the scan operation will 881d70e9693SJohannes Berg * be invoked with a scan definition. This scan definition contains the 882d70e9693SJohannes Berg * channels to scan, and the SSIDs to send probe requests for (including the 883d70e9693SJohannes Berg * wildcard, if desired). A passive scan is indicated by having no SSIDs to 884d70e9693SJohannes Berg * probe. Additionally, a scan request may contain extra information elements 885d70e9693SJohannes Berg * that should be added to the probe request. The IEs are guaranteed to be 886d70e9693SJohannes Berg * well-formed, and will not exceed the maximum length the driver advertised 887d70e9693SJohannes Berg * in the wiphy structure. 888d70e9693SJohannes Berg * 889d70e9693SJohannes Berg * When scanning finds a BSS, cfg80211 needs to be notified of that, because 890d70e9693SJohannes Berg * it is responsible for maintaining the BSS list; the driver should not 891d70e9693SJohannes Berg * maintain a list itself. For this notification, various functions exist. 892d70e9693SJohannes Berg * 893d70e9693SJohannes Berg * Since drivers do not maintain a BSS list, there are also a number of 894d70e9693SJohannes Berg * functions to search for a BSS and obtain information about it from the 895d70e9693SJohannes Berg * BSS structure cfg80211 maintains. The BSS list is also made available 896d70e9693SJohannes Berg * to userspace. 897d70e9693SJohannes Berg */ 89872bdcf34SJouni Malinen 899704232c2SJohannes Berg /** 9002a519311SJohannes Berg * struct cfg80211_ssid - SSID description 9012a519311SJohannes Berg * @ssid: the SSID 9022a519311SJohannes Berg * @ssid_len: length of the ssid 9032a519311SJohannes Berg */ 9042a519311SJohannes Berg struct cfg80211_ssid { 9052a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 9062a519311SJohannes Berg u8 ssid_len; 9072a519311SJohannes Berg }; 9082a519311SJohannes Berg 9092a519311SJohannes Berg /** 9102a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 9112a519311SJohannes Berg * 9122a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 9132a519311SJohannes Berg * @n_ssids: number of SSIDs 9142a519311SJohannes Berg * @channels: channels to scan on. 915ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 91670692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 91770692ad2SJouni Malinen * @ie_len: length of ie in octets 91834850ab2SJohannes Berg * @rates: bitmap of rates to advertise for each band 9192a519311SJohannes Berg * @wiphy: the wiphy this was for 920463d0183SJohannes Berg * @dev: the interface 921abe37c4bSJohannes Berg * @aborted: (internal) scan request was notified as aborted 922e9f935e3SRajkumar Manoharan * @no_cck: used to send probe requests at non CCK rate in 2GHz band 9232a519311SJohannes Berg */ 9242a519311SJohannes Berg struct cfg80211_scan_request { 9252a519311SJohannes Berg struct cfg80211_ssid *ssids; 9262a519311SJohannes Berg int n_ssids; 9272a519311SJohannes Berg u32 n_channels; 928de95a54bSJohannes Berg const u8 *ie; 92970692ad2SJouni Malinen size_t ie_len; 9302a519311SJohannes Berg 93134850ab2SJohannes Berg u32 rates[IEEE80211_NUM_BANDS]; 93234850ab2SJohannes Berg 9332a519311SJohannes Berg /* internal */ 9342a519311SJohannes Berg struct wiphy *wiphy; 935463d0183SJohannes Berg struct net_device *dev; 936667503ddSJohannes Berg bool aborted; 937e9f935e3SRajkumar Manoharan bool no_cck; 9385ba63533SJohannes Berg 9395ba63533SJohannes Berg /* keep last */ 9405ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 9412a519311SJohannes Berg }; 9422a519311SJohannes Berg 9432a519311SJohannes Berg /** 944a1f1c21cSLuciano Coelho * struct cfg80211_match_set - sets of attributes to match 945a1f1c21cSLuciano Coelho * 946a1f1c21cSLuciano Coelho * @ssid: SSID to be matched 947a1f1c21cSLuciano Coelho */ 948a1f1c21cSLuciano Coelho struct cfg80211_match_set { 949a1f1c21cSLuciano Coelho struct cfg80211_ssid ssid; 950a1f1c21cSLuciano Coelho }; 951a1f1c21cSLuciano Coelho 952a1f1c21cSLuciano Coelho /** 953807f8a8cSLuciano Coelho * struct cfg80211_sched_scan_request - scheduled scan request description 954807f8a8cSLuciano Coelho * 955807f8a8cSLuciano Coelho * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) 956807f8a8cSLuciano Coelho * @n_ssids: number of SSIDs 957807f8a8cSLuciano Coelho * @n_channels: total number of channels to scan 958bbe6ad6dSLuciano Coelho * @interval: interval between each scheduled scan cycle 959807f8a8cSLuciano Coelho * @ie: optional information element(s) to add into Probe Request or %NULL 960807f8a8cSLuciano Coelho * @ie_len: length of ie in octets 961a1f1c21cSLuciano Coelho * @match_sets: sets of parameters to be matched for a scan result 962a1f1c21cSLuciano Coelho * entry to be considered valid and to be passed to the host 963a1f1c21cSLuciano Coelho * (others are filtered out). 964a1f1c21cSLuciano Coelho * If ommited, all results are passed. 965a1f1c21cSLuciano Coelho * @n_match_sets: number of match sets 966807f8a8cSLuciano Coelho * @wiphy: the wiphy this was for 967807f8a8cSLuciano Coelho * @dev: the interface 968807f8a8cSLuciano Coelho * @channels: channels to scan 969807f8a8cSLuciano Coelho */ 970807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request { 971807f8a8cSLuciano Coelho struct cfg80211_ssid *ssids; 972807f8a8cSLuciano Coelho int n_ssids; 973807f8a8cSLuciano Coelho u32 n_channels; 974bbe6ad6dSLuciano Coelho u32 interval; 975807f8a8cSLuciano Coelho const u8 *ie; 976807f8a8cSLuciano Coelho size_t ie_len; 977a1f1c21cSLuciano Coelho struct cfg80211_match_set *match_sets; 978a1f1c21cSLuciano Coelho int n_match_sets; 979807f8a8cSLuciano Coelho 980807f8a8cSLuciano Coelho /* internal */ 981807f8a8cSLuciano Coelho struct wiphy *wiphy; 982807f8a8cSLuciano Coelho struct net_device *dev; 983807f8a8cSLuciano Coelho 984807f8a8cSLuciano Coelho /* keep last */ 985807f8a8cSLuciano Coelho struct ieee80211_channel *channels[0]; 986807f8a8cSLuciano Coelho }; 987807f8a8cSLuciano Coelho 988807f8a8cSLuciano Coelho /** 9892a519311SJohannes Berg * enum cfg80211_signal_type - signal type 9902a519311SJohannes Berg * 9912a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 9922a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 9932a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 9942a519311SJohannes Berg */ 9952a519311SJohannes Berg enum cfg80211_signal_type { 9962a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 9972a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 9982a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 9992a519311SJohannes Berg }; 10002a519311SJohannes Berg 10012a519311SJohannes Berg /** 10022a519311SJohannes Berg * struct cfg80211_bss - BSS description 10032a519311SJohannes Berg * 10042a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 10052a519311SJohannes Berg * for use in scan results and similar. 10062a519311SJohannes Berg * 1007abe37c4bSJohannes Berg * @channel: channel this BSS is on 10082a519311SJohannes Berg * @bssid: BSSID of the BSS 10092a519311SJohannes Berg * @tsf: timestamp of last received update 10102a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 10112a519311SJohannes Berg * @capability: the capability field in host byte order 10122a519311SJohannes Berg * @information_elements: the information elements (Note that there 101334a6eddbSJouni Malinen * is no guarantee that these are well-formed!); this is a pointer to 101434a6eddbSJouni Malinen * either the beacon_ies or proberesp_ies depending on whether Probe 101534a6eddbSJouni Malinen * Response frame has been received 10162a519311SJohannes Berg * @len_information_elements: total length of the information elements 101734a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 101834a6eddbSJouni Malinen * @len_beacon_ies: total length of the beacon_ies 101934a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 102034a6eddbSJouni Malinen * @len_proberesp_ies: total length of the proberesp_ies 102177965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 102278c1c7e1SJohannes Berg * @free_priv: function pointer to free private data 10232a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 10242a519311SJohannes Berg */ 10252a519311SJohannes Berg struct cfg80211_bss { 10262a519311SJohannes Berg struct ieee80211_channel *channel; 10272a519311SJohannes Berg 10282a519311SJohannes Berg u8 bssid[ETH_ALEN]; 10292a519311SJohannes Berg u64 tsf; 10302a519311SJohannes Berg u16 beacon_interval; 10312a519311SJohannes Berg u16 capability; 10322a519311SJohannes Berg u8 *information_elements; 10332a519311SJohannes Berg size_t len_information_elements; 103434a6eddbSJouni Malinen u8 *beacon_ies; 103534a6eddbSJouni Malinen size_t len_beacon_ies; 103634a6eddbSJouni Malinen u8 *proberesp_ies; 103734a6eddbSJouni Malinen size_t len_proberesp_ies; 10382a519311SJohannes Berg 10392a519311SJohannes Berg s32 signal; 10402a519311SJohannes Berg 104178c1c7e1SJohannes Berg void (*free_priv)(struct cfg80211_bss *bss); 10422a519311SJohannes Berg u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 10432a519311SJohannes Berg }; 10442a519311SJohannes Berg 10452a519311SJohannes Berg /** 1046517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 1047517357c6SJohannes Berg * @bss: the bss to search 1048517357c6SJohannes Berg * @ie: the IE ID 1049517357c6SJohannes Berg * Returns %NULL if not found. 1050517357c6SJohannes Berg */ 1051517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1052517357c6SJohannes Berg 1053517357c6SJohannes Berg 1054517357c6SJohannes Berg /** 1055636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 1056636a5d36SJouni Malinen * 1057636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1058636a5d36SJouni Malinen * authentication. 1059636a5d36SJouni Malinen * 106019957bb3SJohannes Berg * @bss: The BSS to authenticate with. 1061636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 1062636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 1063636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1064fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1065fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1066fffd0934SJohannes Berg * @key: WEP key for shared key authentication 1067636a5d36SJouni Malinen */ 1068636a5d36SJouni Malinen struct cfg80211_auth_request { 106919957bb3SJohannes Berg struct cfg80211_bss *bss; 1070636a5d36SJouni Malinen const u8 *ie; 1071636a5d36SJouni Malinen size_t ie_len; 107219957bb3SJohannes Berg enum nl80211_auth_type auth_type; 1073fffd0934SJohannes Berg const u8 *key; 1074fffd0934SJohannes Berg u8 key_len, key_idx; 1075636a5d36SJouni Malinen }; 1076636a5d36SJouni Malinen 1077636a5d36SJouni Malinen /** 10787e7c8926SBen Greear * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 10797e7c8926SBen Greear * 10807e7c8926SBen Greear * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 10817e7c8926SBen Greear */ 10827e7c8926SBen Greear enum cfg80211_assoc_req_flags { 10837e7c8926SBen Greear ASSOC_REQ_DISABLE_HT = BIT(0), 10847e7c8926SBen Greear }; 10857e7c8926SBen Greear 10867e7c8926SBen Greear /** 1087636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 1088636a5d36SJouni Malinen * 1089636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1090636a5d36SJouni Malinen * (re)association. 109195de817bSJohannes Berg * @bss: The BSS to associate with. If the call is successful the driver 109295de817bSJohannes Berg * is given a reference that it must release, normally via a call to 109395de817bSJohannes Berg * cfg80211_send_rx_assoc(), or, if association timed out, with a 109495de817bSJohannes Berg * call to cfg80211_put_bss() (in addition to calling 109595de817bSJohannes Berg * cfg80211_send_assoc_timeout()) 1096636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1097636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 1098dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1099b23aa676SSamuel Ortiz * @crypto: crypto settings 11003e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 11017e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 11027e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 11037e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 11047e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1105636a5d36SJouni Malinen */ 1106636a5d36SJouni Malinen struct cfg80211_assoc_request { 110719957bb3SJohannes Berg struct cfg80211_bss *bss; 11083e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 1109636a5d36SJouni Malinen size_t ie_len; 1110b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 111119957bb3SJohannes Berg bool use_mfp; 11127e7c8926SBen Greear u32 flags; 11137e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 11147e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1115636a5d36SJouni Malinen }; 1116636a5d36SJouni Malinen 1117636a5d36SJouni Malinen /** 1118636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 1119636a5d36SJouni Malinen * 1120636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1121636a5d36SJouni Malinen * deauthentication. 1122636a5d36SJouni Malinen * 112395de817bSJohannes Berg * @bssid: the BSSID of the BSS to deauthenticate from 1124636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 1125636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 112619957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 1127636a5d36SJouni Malinen */ 1128636a5d36SJouni Malinen struct cfg80211_deauth_request { 112995de817bSJohannes Berg const u8 *bssid; 1130636a5d36SJouni Malinen const u8 *ie; 1131636a5d36SJouni Malinen size_t ie_len; 113219957bb3SJohannes Berg u16 reason_code; 1133636a5d36SJouni Malinen }; 1134636a5d36SJouni Malinen 1135636a5d36SJouni Malinen /** 1136636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 1137636a5d36SJouni Malinen * 1138636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 1139636a5d36SJouni Malinen * disassocation. 1140636a5d36SJouni Malinen * 114119957bb3SJohannes Berg * @bss: the BSS to disassociate from 1142636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 1143636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 114419957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 1145d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 1146d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 1147636a5d36SJouni Malinen */ 1148636a5d36SJouni Malinen struct cfg80211_disassoc_request { 114919957bb3SJohannes Berg struct cfg80211_bss *bss; 1150636a5d36SJouni Malinen const u8 *ie; 1151636a5d36SJouni Malinen size_t ie_len; 115219957bb3SJohannes Berg u16 reason_code; 1153d5cdfacbSJouni Malinen bool local_state_change; 1154636a5d36SJouni Malinen }; 1155636a5d36SJouni Malinen 1156636a5d36SJouni Malinen /** 115704a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 115804a773adSJohannes Berg * 115904a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 116004a773adSJohannes Berg * method. 116104a773adSJohannes Berg * 116204a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 116304a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 116404a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 116504a773adSJohannes Berg * search for IBSSs with a different BSSID. 116604a773adSJohannes Berg * @channel: The channel to use if no IBSS can be found to join. 116715f0ebc2SRandy Dunlap * @channel_type: channel type (HT mode) 116804a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 116904a773adSJohannes Berg * IBSSs to join on other channels. 117004a773adSJohannes Berg * @ie: information element(s) to include in the beacon 117104a773adSJohannes Berg * @ie_len: length of that 11728e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 1173fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 1174fffd0934SJohannes Berg * after joining 1175267335d6SAntonio Quartulli * @control_port: whether user space controls IEEE 802.1X port, i.e., 1176267335d6SAntonio Quartulli * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1177267335d6SAntonio Quartulli * required to assume that the port is unauthorized until authorized by 1178267335d6SAntonio Quartulli * user space. Otherwise, port is marked authorized by default. 1179fbd2c8dcSTeemu Paasikivi * @basic_rates: bitmap of basic rates to use when creating the IBSS 1180dd5b4cc7SFelix Fietkau * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 118104a773adSJohannes Berg */ 118204a773adSJohannes Berg struct cfg80211_ibss_params { 118304a773adSJohannes Berg u8 *ssid; 118404a773adSJohannes Berg u8 *bssid; 118504a773adSJohannes Berg struct ieee80211_channel *channel; 118654858ee5SAlexander Simon enum nl80211_channel_type channel_type; 118704a773adSJohannes Berg u8 *ie; 118804a773adSJohannes Berg u8 ssid_len, ie_len; 11898e30bc55SJohannes Berg u16 beacon_interval; 1190fbd2c8dcSTeemu Paasikivi u32 basic_rates; 119104a773adSJohannes Berg bool channel_fixed; 1192fffd0934SJohannes Berg bool privacy; 1193267335d6SAntonio Quartulli bool control_port; 1194dd5b4cc7SFelix Fietkau int mcast_rate[IEEE80211_NUM_BANDS]; 119504a773adSJohannes Berg }; 119604a773adSJohannes Berg 119704a773adSJohannes Berg /** 1198b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 1199b23aa676SSamuel Ortiz * 1200b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 1201b23aa676SSamuel Ortiz * authentication and association. 1202b23aa676SSamuel Ortiz * 1203b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 1204b23aa676SSamuel Ortiz * on scan results) 1205b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1206b23aa676SSamuel Ortiz * results) 1207b23aa676SSamuel Ortiz * @ssid: SSID 1208b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 1209b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 1210abe37c4bSJohannes Berg * @ie: IEs for association request 1211abe37c4bSJohannes Berg * @ie_len: Length of assoc_ie in octets 1212b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 1213b23aa676SSamuel Ortiz * @crypto: crypto settings 1214fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 1215fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 1216fffd0934SJohannes Berg * @key: WEP key for shared key authentication 12177e7c8926SBen Greear * @flags: See &enum cfg80211_assoc_req_flags 12184486ea98SBala Shanmugam * @bg_scan_period: Background scan period in seconds 12194486ea98SBala Shanmugam * or -1 to indicate that default value is to be used. 12207e7c8926SBen Greear * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 12217e7c8926SBen Greear * will be used in ht_capa. Un-supported values will be ignored. 12227e7c8926SBen Greear * @ht_capa_mask: The bits of ht_capa which are to be used. 1223b23aa676SSamuel Ortiz */ 1224b23aa676SSamuel Ortiz struct cfg80211_connect_params { 1225b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 1226b23aa676SSamuel Ortiz u8 *bssid; 1227b23aa676SSamuel Ortiz u8 *ssid; 1228b23aa676SSamuel Ortiz size_t ssid_len; 1229b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 1230b23aa676SSamuel Ortiz u8 *ie; 1231b23aa676SSamuel Ortiz size_t ie_len; 1232b23aa676SSamuel Ortiz bool privacy; 1233b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 1234fffd0934SJohannes Berg const u8 *key; 1235fffd0934SJohannes Berg u8 key_len, key_idx; 12367e7c8926SBen Greear u32 flags; 12374486ea98SBala Shanmugam int bg_scan_period; 12387e7c8926SBen Greear struct ieee80211_ht_cap ht_capa; 12397e7c8926SBen Greear struct ieee80211_ht_cap ht_capa_mask; 1240b23aa676SSamuel Ortiz }; 1241b23aa676SSamuel Ortiz 1242b23aa676SSamuel Ortiz /** 1243b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 1244abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 1245abe37c4bSJohannes Berg * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 1246abe37c4bSJohannes Berg * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1247abe37c4bSJohannes Berg * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1248abe37c4bSJohannes Berg * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 1249b9a5f8caSJouni Malinen */ 1250b9a5f8caSJouni Malinen enum wiphy_params_flags { 1251b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1252b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 1253b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1254b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 125581077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 1256b9a5f8caSJouni Malinen }; 1257b9a5f8caSJouni Malinen 12589930380fSJohannes Berg /* 12599930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 12609930380fSJohannes Berg */ 12619930380fSJohannes Berg struct cfg80211_bitrate_mask { 12629930380fSJohannes Berg struct { 12639930380fSJohannes Berg u32 legacy; 126424db78c0SSimon Wunderlich u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 12659930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 12669930380fSJohannes Berg }; 126767fbb16bSSamuel Ortiz /** 126867fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 126967fbb16bSSamuel Ortiz * 127067fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 127167fbb16bSSamuel Ortiz * caching. 127267fbb16bSSamuel Ortiz * 127367fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 127467fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 127567fbb16bSSamuel Ortiz */ 127667fbb16bSSamuel Ortiz struct cfg80211_pmksa { 127767fbb16bSSamuel Ortiz u8 *bssid; 127867fbb16bSSamuel Ortiz u8 *pmkid; 127967fbb16bSSamuel Ortiz }; 12809930380fSJohannes Berg 12817643a2c3SJohannes Berg /** 1282ff1b6e69SJohannes Berg * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern 1283ff1b6e69SJohannes Berg * @mask: bitmask where to match pattern and where to ignore bytes, 1284ff1b6e69SJohannes Berg * one bit per byte, in same format as nl80211 1285ff1b6e69SJohannes Berg * @pattern: bytes to match where bitmask is 1 1286ff1b6e69SJohannes Berg * @pattern_len: length of pattern (in bytes) 1287ff1b6e69SJohannes Berg * 1288ff1b6e69SJohannes Berg * Internal note: @mask and @pattern are allocated in one chunk of 1289ff1b6e69SJohannes Berg * memory, free @mask only! 1290ff1b6e69SJohannes Berg */ 1291ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern { 1292ff1b6e69SJohannes Berg u8 *mask, *pattern; 1293ff1b6e69SJohannes Berg int pattern_len; 1294ff1b6e69SJohannes Berg }; 1295ff1b6e69SJohannes Berg 1296ff1b6e69SJohannes Berg /** 1297ff1b6e69SJohannes Berg * struct cfg80211_wowlan - Wake on Wireless-LAN support info 1298ff1b6e69SJohannes Berg * 1299ff1b6e69SJohannes Berg * This structure defines the enabled WoWLAN triggers for the device. 1300ff1b6e69SJohannes Berg * @any: wake up on any activity -- special trigger if device continues 1301ff1b6e69SJohannes Berg * operating as normal during suspend 1302ff1b6e69SJohannes Berg * @disconnect: wake up if getting disconnected 1303ff1b6e69SJohannes Berg * @magic_pkt: wake up on receiving magic packet 1304ff1b6e69SJohannes Berg * @patterns: wake up on receiving packet matching a pattern 1305ff1b6e69SJohannes Berg * @n_patterns: number of patterns 130677dbbb13SJohannes Berg * @gtk_rekey_failure: wake up on GTK rekey failure 130777dbbb13SJohannes Berg * @eap_identity_req: wake up on EAP identity request packet 130877dbbb13SJohannes Berg * @four_way_handshake: wake up on 4-way handshake 130977dbbb13SJohannes Berg * @rfkill_release: wake up when rfkill is released 1310ff1b6e69SJohannes Berg */ 1311ff1b6e69SJohannes Berg struct cfg80211_wowlan { 131277dbbb13SJohannes Berg bool any, disconnect, magic_pkt, gtk_rekey_failure, 131377dbbb13SJohannes Berg eap_identity_req, four_way_handshake, 131477dbbb13SJohannes Berg rfkill_release; 1315ff1b6e69SJohannes Berg struct cfg80211_wowlan_trig_pkt_pattern *patterns; 1316ff1b6e69SJohannes Berg int n_patterns; 1317ff1b6e69SJohannes Berg }; 1318ff1b6e69SJohannes Berg 1319ff1b6e69SJohannes Berg /** 1320e5497d76SJohannes Berg * struct cfg80211_gtk_rekey_data - rekey data 1321e5497d76SJohannes Berg * @kek: key encryption key 1322e5497d76SJohannes Berg * @kck: key confirmation key 1323e5497d76SJohannes Berg * @replay_ctr: replay counter 1324e5497d76SJohannes Berg */ 1325e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data { 1326e5497d76SJohannes Berg u8 kek[NL80211_KEK_LEN]; 1327e5497d76SJohannes Berg u8 kck[NL80211_KCK_LEN]; 1328e5497d76SJohannes Berg u8 replay_ctr[NL80211_REPLAY_CTR_LEN]; 1329e5497d76SJohannes Berg }; 1330e5497d76SJohannes Berg 1331e5497d76SJohannes Berg /** 1332704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 1333704232c2SJohannes Berg * 1334704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 1335704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 1336704232c2SJohannes Berg * 1337704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 1338704232c2SJohannes Berg * on success or a negative error code. 1339704232c2SJohannes Berg * 134043fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 134143fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 134243fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 134343fb45cbSJohannes Berg * 1344ff1b6e69SJohannes Berg * @suspend: wiphy device needs to be suspended. The variable @wow will 1345ff1b6e69SJohannes Berg * be %NULL or contain the enabled Wake-on-Wireless triggers that are 1346ff1b6e69SJohannes Berg * configured for the device. 13470378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 13486d52563fSJohannes Berg * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback 13496d52563fSJohannes Berg * to call device_set_wakeup_enable() to enable/disable wakeup from 13506d52563fSJohannes Berg * the device. 13510378b3f1SJohannes Berg * 135260719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 1353463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 1354f9e10ce4SJohannes Berg * the new netdev in the wiphy's network namespace! Returns the netdev, 1355f9e10ce4SJohannes Berg * or an ERR_PTR. 1356704232c2SJohannes Berg * 1357704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 135855682965SJohannes Berg * 135960719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 136060719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 136155682965SJohannes Berg * 136241ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 136341ade00fSJohannes Berg * when adding a group key. 136441ade00fSJohannes Berg * 136541ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 136641ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 136741ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 1368e3da574aSJohannes Berg * after it returns. This function should return an error if it is 1369e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 137041ade00fSJohannes Berg * 137141ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 1372e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 137341ade00fSJohannes Berg * 137441ade00fSJohannes Berg * @set_default_key: set the default key on an interface 1375ed1b6cc7SJohannes Berg * 13763cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 13773cfcf6acSJouni Malinen * 1378e5497d76SJohannes Berg * @set_rekey_data: give the data necessary for GTK rekeying to the driver 1379e5497d76SJohannes Berg * 1380c04a4ff7SJohannes Berg * @start_ap: Start acting in AP mode defined by the parameters. 1381c04a4ff7SJohannes Berg * @change_beacon: Change the beacon parameters for an access point mode 1382c04a4ff7SJohannes Berg * interface. This should reject the call when AP mode wasn't started. 1383c04a4ff7SJohannes Berg * @stop_ap: Stop being an AP, including stopping beaconing. 13845727ef1bSJohannes Berg * 13855727ef1bSJohannes Berg * @add_station: Add a new station. 13865727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 1387bdd90d5eSJohannes Berg * @change_station: Modify a given station. Note that flags changes are not much 1388bdd90d5eSJohannes Berg * validated in cfg80211, in particular the auth/assoc/authorized flags 1389bdd90d5eSJohannes Berg * might come to the driver in invalid combinations -- make sure to check 1390bdd90d5eSJohannes Berg * them, also against the existing state! Also, supported_rates changes are 1391bdd90d5eSJohannes Berg * not checked in station mode -- drivers need to reject (or ignore) them 1392bdd90d5eSJohannes Berg * for anything but TDLS peers. 1393abe37c4bSJohannes Berg * @get_station: get station information for the station identified by @mac 1394abe37c4bSJohannes Berg * @dump_station: dump station callback -- resume dump at index @idx 1395abe37c4bSJohannes Berg * 1396abe37c4bSJohannes Berg * @add_mpath: add a fixed mesh path 1397abe37c4bSJohannes Berg * @del_mpath: delete a given mesh path 1398abe37c4bSJohannes Berg * @change_mpath: change a given mesh path 1399abe37c4bSJohannes Berg * @get_mpath: get a mesh path for the given parameters 1400abe37c4bSJohannes Berg * @dump_mpath: dump mesh path callback -- resume dump at index @idx 1401f52555a4SJohannes Berg * @join_mesh: join the mesh network with the specified parameters 1402f52555a4SJohannes Berg * @leave_mesh: leave the current mesh network 14032ec600d6SLuis Carlos Cobo * 140424bdd9f4SJavier Cardona * @get_mesh_config: Get the current mesh configuration 140593da9cc1Scolin@cozybit.com * 140624bdd9f4SJavier Cardona * @update_mesh_config: Update mesh parameters on a running mesh. 140793da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 140893da9cc1Scolin@cozybit.com * set, and which to leave alone. 140993da9cc1Scolin@cozybit.com * 14109f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 141131888487SJouni Malinen * 141231888487SJouni Malinen * @set_txq_params: Set TX queue parameters 141372bdcf34SJouni Malinen * 1414f444de05SJohannes Berg * @set_channel: Set channel for a given wireless interface. Some devices 1415f444de05SJohannes Berg * may support multi-channel operation (by channel hopping) so cfg80211 1416f444de05SJohannes Berg * doesn't verify much. Note, however, that the passed netdev may be 1417f444de05SJohannes Berg * %NULL as well if the user requested changing the channel for the 1418f444de05SJohannes Berg * device itself, or for a monitor interface. 1419e999882aSJohannes Berg * @get_channel: Get the current operating channel, should return %NULL if 1420e999882aSJohannes Berg * there's no single defined operating channel if for example the 1421e999882aSJohannes Berg * device implements channel hopping for multi-channel virtual interfaces. 14229aed3cc1SJouni Malinen * 14232a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 14242a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 14252a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 14262a519311SJohannes Berg * the scan/scan_done bracket too. 1427636a5d36SJouni Malinen * 1428636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 1429636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 1430636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 1431636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 143204a773adSJohannes Berg * 1433b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 1434b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 1435b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 1436b23aa676SSamuel Ortiz * with the status from the AP. 1437b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 1438b23aa676SSamuel Ortiz * 143904a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 144004a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 144104a773adSJohannes Berg * to a merge. 144204a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 1443b9a5f8caSJouni Malinen * 1444b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 1445b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 1446b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 1447b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 14487643a2c3SJohannes Berg * 14491432de07SLuis R. Rodriguez * @set_tx_power: set the transmit power according to the parameters, 14501432de07SLuis R. Rodriguez * the power passed is in mBm, to get dBm use MBM_TO_DBM(). 14517643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 14521f87f7d3SJohannes Berg * return 0 if successful 14531f87f7d3SJohannes Berg * 1454abe37c4bSJohannes Berg * @set_wds_peer: set the WDS peer for a WDS interface 1455abe37c4bSJohannes Berg * 14561f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 14571f87f7d3SJohannes Berg * functions to adjust rfkill hw state 1458aff89a9bSJohannes Berg * 145961fa713cSHolger Schurig * @dump_survey: get site survey information. 146061fa713cSHolger Schurig * 14619588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 14629588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 14639588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 14649588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 14659588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 14669588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 14679588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 14689588bbd5SJouni Malinen * the duration value. 1469f7ca38dfSJohannes Berg * @mgmt_tx: Transmit a management frame. 1470f7ca38dfSJohannes Berg * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 1471f7ca38dfSJohannes Berg * frame on another channel 14729588bbd5SJouni Malinen * 1473aff89a9bSJohannes Berg * @testmode_cmd: run a test mode command 147471063f0eSWey-Yi Guy * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be 147571063f0eSWey-Yi Guy * used by the function, but 0 and 1 must not be touched. Additionally, 147671063f0eSWey-Yi Guy * return error codes other than -ENOBUFS and -ENOENT will terminate the 147771063f0eSWey-Yi Guy * dump and return to userspace with an error, so be careful. If any data 147871063f0eSWey-Yi Guy * was passed in from userspace then the data/len arguments will be present 147971063f0eSWey-Yi Guy * and point to the data contained in %NL80211_ATTR_TESTDATA. 148067fbb16bSSamuel Ortiz * 1481abe37c4bSJohannes Berg * @set_bitrate_mask: set the bitrate mask configuration 1482abe37c4bSJohannes Berg * 148367fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 148467fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 148567fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 148667fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 148767fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 14889043f3b8SJuuso Oikarinen * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 14899043f3b8SJuuso Oikarinen * allows the driver to adjust the dynamic ps timeout value. 1490d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 1491807f8a8cSLuciano Coelho * @sched_scan_start: Tell the driver to start a scheduled scan. 1492807f8a8cSLuciano Coelho * @sched_scan_stop: Tell the driver to stop an ongoing scheduled 1493807f8a8cSLuciano Coelho * scan. The driver_initiated flag specifies whether the driver 1494807f8a8cSLuciano Coelho * itself has informed that the scan has stopped. 149567fbb16bSSamuel Ortiz * 1496271733cfSJohannes Berg * @mgmt_frame_register: Notify driver that a management frame type was 1497271733cfSJohannes Berg * registered. Note that this callback may not sleep, and cannot run 1498271733cfSJohannes Berg * concurrently with itself. 1499547025d5SBruno Randolf * 1500547025d5SBruno Randolf * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 1501547025d5SBruno Randolf * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 1502547025d5SBruno Randolf * reject TX/RX mask combinations they cannot support by returning -EINVAL 1503547025d5SBruno Randolf * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 1504547025d5SBruno Randolf * 1505547025d5SBruno Randolf * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 15063677713bSJohn W. Linville * 15073677713bSJohn W. Linville * @set_ringparam: Set tx and rx ring sizes. 15083677713bSJohn W. Linville * 15093677713bSJohn W. Linville * @get_ringparam: Get tx and rx ring current and maximum sizes. 1510109086ceSArik Nemtsov * 1511109086ceSArik Nemtsov * @tdls_mgmt: Transmit a TDLS management frame. 1512109086ceSArik Nemtsov * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 15137f6cf311SJohannes Berg * 15147f6cf311SJohannes Berg * @probe_client: probe an associated client, must return a cookie that it 15157f6cf311SJohannes Berg * later passes to cfg80211_probe_status(). 15161d9d9213SSimon Wunderlich * 15171d9d9213SSimon Wunderlich * @set_noack_map: Set the NoAck Map for the TIDs. 1518d6199218SBen Greear * 1519d6199218SBen Greear * @get_et_sset_count: Ethtool API to get string-set count. 1520d6199218SBen Greear * See @ethtool_ops.get_sset_count 1521d6199218SBen Greear * 1522d6199218SBen Greear * @get_et_stats: Ethtool API to get a set of u64 stats. 1523d6199218SBen Greear * See @ethtool_ops.get_ethtool_stats 1524d6199218SBen Greear * 1525d6199218SBen Greear * @get_et_strings: Ethtool API to get a set of strings to describe stats 1526d6199218SBen Greear * and perhaps other supported types of ethtool data-sets. 1527d6199218SBen Greear * See @ethtool_ops.get_strings 1528704232c2SJohannes Berg */ 1529704232c2SJohannes Berg struct cfg80211_ops { 1530ff1b6e69SJohannes Berg int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 15310378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 15326d52563fSJohannes Berg void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 15330378b3f1SJohannes Berg 1534f9e10ce4SJohannes Berg struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1535f9e10ce4SJohannes Berg char *name, 1536f9e10ce4SJohannes Berg enum nl80211_iftype type, 1537f9e10ce4SJohannes Berg u32 *flags, 15382ec600d6SLuis Carlos Cobo struct vif_params *params); 1539463d0183SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 1540e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 1541e36d56b6SJohannes Berg struct net_device *dev, 15422ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 15432ec600d6SLuis Carlos Cobo struct vif_params *params); 154441ade00fSJohannes Berg 154541ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 1546e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 154741ade00fSJohannes Berg struct key_params *params); 154841ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 1549e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr, 1550e31b8213SJohannes Berg void *cookie, 155141ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 155241ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 1553e31b8213SJohannes Berg u8 key_index, bool pairwise, const u8 *mac_addr); 155441ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 155541ade00fSJohannes Berg struct net_device *netdev, 1556dbd2fd65SJohannes Berg u8 key_index, bool unicast, bool multicast); 15573cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 15583cfcf6acSJouni Malinen struct net_device *netdev, 15593cfcf6acSJouni Malinen u8 key_index); 1560ed1b6cc7SJohannes Berg 15618860020eSJohannes Berg int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, 15628860020eSJohannes Berg struct cfg80211_ap_settings *settings); 15638860020eSJohannes Berg int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, 15648860020eSJohannes Berg struct cfg80211_beacon_data *info); 15658860020eSJohannes Berg int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); 15665727ef1bSJohannes Berg 15675727ef1bSJohannes Berg 15685727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 15695727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 15705727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 15715727ef1bSJohannes Berg u8 *mac); 15725727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 15735727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 1574fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 15752ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 15762ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 15772ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 15782ec600d6SLuis Carlos Cobo 15792ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 15802ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 15812ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 15822ec600d6SLuis Carlos Cobo u8 *dst); 15832ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 15842ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 15852ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 15862ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 15872ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 15882ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 15892ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 15902ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 159124bdd9f4SJavier Cardona int (*get_mesh_config)(struct wiphy *wiphy, 159293da9cc1Scolin@cozybit.com struct net_device *dev, 159393da9cc1Scolin@cozybit.com struct mesh_config *conf); 159424bdd9f4SJavier Cardona int (*update_mesh_config)(struct wiphy *wiphy, 159529cbe68cSJohannes Berg struct net_device *dev, u32 mask, 159629cbe68cSJohannes Berg const struct mesh_config *nconf); 159729cbe68cSJohannes Berg int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 159829cbe68cSJohannes Berg const struct mesh_config *conf, 159929cbe68cSJohannes Berg const struct mesh_setup *setup); 160029cbe68cSJohannes Berg int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 160129cbe68cSJohannes Berg 16029f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 16039f1ba906SJouni Malinen struct bss_parameters *params); 160431888487SJouni Malinen 1605f70f01c2SEliad Peller int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, 160631888487SJouni Malinen struct ieee80211_txq_params *params); 160772bdcf34SJouni Malinen 1608f444de05SJohannes Berg int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, 160972bdcf34SJouni Malinen struct ieee80211_channel *chan, 1610094d05dcSSujith enum nl80211_channel_type channel_type); 16119aed3cc1SJouni Malinen 16122a519311SJohannes Berg int (*scan)(struct wiphy *wiphy, struct net_device *dev, 16132a519311SJohannes Berg struct cfg80211_scan_request *request); 1614636a5d36SJouni Malinen 1615636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1616636a5d36SJouni Malinen struct cfg80211_auth_request *req); 1617636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1618636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 1619636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 162063c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 1621636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 162263c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 162304a773adSJohannes Berg 1624b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1625b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 1626b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 1627b23aa676SSamuel Ortiz u16 reason_code); 1628b23aa676SSamuel Ortiz 162904a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 163004a773adSJohannes Berg struct cfg80211_ibss_params *params); 163104a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1632b9a5f8caSJouni Malinen 1633b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 16347643a2c3SJohannes Berg 16357643a2c3SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, 1636fa61cf70SJuuso Oikarinen enum nl80211_tx_power_setting type, int mbm); 16377643a2c3SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 16381f87f7d3SJohannes Berg 1639ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1640388ac775SJohannes Berg const u8 *addr); 1641ab737a4fSJohannes Berg 16421f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 1643aff89a9bSJohannes Berg 1644aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 1645aff89a9bSJohannes Berg int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 164671063f0eSWey-Yi Guy int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, 164771063f0eSWey-Yi Guy struct netlink_callback *cb, 164871063f0eSWey-Yi Guy void *data, int len); 1649aff89a9bSJohannes Berg #endif 1650bc92afd9SJohannes Berg 16519930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 16529930380fSJohannes Berg struct net_device *dev, 16539930380fSJohannes Berg const u8 *peer, 16549930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 16559930380fSJohannes Berg 165661fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 165761fa713cSHolger Schurig int idx, struct survey_info *info); 165861fa713cSHolger Schurig 165967fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 166067fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 166167fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 166267fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 166367fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 166467fbb16bSSamuel Ortiz 16659588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 16669588bbd5SJouni Malinen struct net_device *dev, 16679588bbd5SJouni Malinen struct ieee80211_channel *chan, 16689588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 16699588bbd5SJouni Malinen unsigned int duration, 16709588bbd5SJouni Malinen u64 *cookie); 16719588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 16729588bbd5SJouni Malinen struct net_device *dev, 16739588bbd5SJouni Malinen u64 cookie); 16749588bbd5SJouni Malinen 16752e161f78SJohannes Berg int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1676f7ca38dfSJohannes Berg struct ieee80211_channel *chan, bool offchan, 1677026331c4SJouni Malinen enum nl80211_channel_type channel_type, 1678f7ca38dfSJohannes Berg bool channel_type_valid, unsigned int wait, 1679e9f935e3SRajkumar Manoharan const u8 *buf, size_t len, bool no_cck, 1680e247bd90SJohannes Berg bool dont_wait_for_ack, u64 *cookie); 1681f7ca38dfSJohannes Berg int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1682f7ca38dfSJohannes Berg struct net_device *dev, 1683f7ca38dfSJohannes Berg u64 cookie); 1684026331c4SJouni Malinen 1685bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1686bc92afd9SJohannes Berg bool enabled, int timeout); 1687d6dc1a38SJuuso Oikarinen 1688d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 1689d6dc1a38SJuuso Oikarinen struct net_device *dev, 1690d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 1691271733cfSJohannes Berg 1692271733cfSJohannes Berg void (*mgmt_frame_register)(struct wiphy *wiphy, 1693271733cfSJohannes Berg struct net_device *dev, 1694271733cfSJohannes Berg u16 frame_type, bool reg); 1695afe0cbf8SBruno Randolf 1696afe0cbf8SBruno Randolf int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 1697afe0cbf8SBruno Randolf int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 16983677713bSJohn W. Linville 16993677713bSJohn W. Linville int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); 17003677713bSJohn W. Linville void (*get_ringparam)(struct wiphy *wiphy, 17013677713bSJohn W. Linville u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); 1702807f8a8cSLuciano Coelho 1703807f8a8cSLuciano Coelho int (*sched_scan_start)(struct wiphy *wiphy, 1704807f8a8cSLuciano Coelho struct net_device *dev, 1705807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request *request); 170685a9994aSLuciano Coelho int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); 1707e5497d76SJohannes Berg 1708e5497d76SJohannes Berg int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, 1709e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data *data); 1710109086ceSArik Nemtsov 1711109086ceSArik Nemtsov int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1712109086ceSArik Nemtsov u8 *peer, u8 action_code, u8 dialog_token, 1713109086ceSArik Nemtsov u16 status_code, const u8 *buf, size_t len); 1714109086ceSArik Nemtsov int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 1715109086ceSArik Nemtsov u8 *peer, enum nl80211_tdls_operation oper); 17167f6cf311SJohannes Berg 17177f6cf311SJohannes Berg int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 17187f6cf311SJohannes Berg const u8 *peer, u64 *cookie); 1719e999882aSJohannes Berg 17201d9d9213SSimon Wunderlich int (*set_noack_map)(struct wiphy *wiphy, 17211d9d9213SSimon Wunderlich struct net_device *dev, 17221d9d9213SSimon Wunderlich u16 noack_map); 17231d9d9213SSimon Wunderlich 1724d91df0e3SPontus Fuchs struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy, 1725d91df0e3SPontus Fuchs enum nl80211_channel_type *type); 1726d6199218SBen Greear 1727d6199218SBen Greear int (*get_et_sset_count)(struct wiphy *wiphy, 1728d6199218SBen Greear struct net_device *dev, int sset); 1729d6199218SBen Greear void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev, 1730d6199218SBen Greear struct ethtool_stats *stats, u64 *data); 1731d6199218SBen Greear void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev, 1732d6199218SBen Greear u32 sset, u8 *data); 1733704232c2SJohannes Berg }; 1734704232c2SJohannes Berg 1735d3236553SJohannes Berg /* 1736d3236553SJohannes Berg * wireless hardware and networking interfaces structures 1737d3236553SJohannes Berg * and registration/helper functions 1738d3236553SJohannes Berg */ 1739d3236553SJohannes Berg 1740d3236553SJohannes Berg /** 17415be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 17425be83de5SJohannes Berg * 17435be83de5SJohannes Berg * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device 1744d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 1745d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1746d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 1747d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 17485be83de5SJohannes Berg * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will 17495be83de5SJohannes Berg * ignore regulatory domain settings until it gets its own regulatory 1750749b527bSLuis R. Rodriguez * domain via its regulatory_hint() unless the regulatory hint is 1751749b527bSLuis R. Rodriguez * from a country IE. After its gets its own regulatory domain it will 1752749b527bSLuis R. Rodriguez * only allow further regulatory domain settings to further enhance 1753749b527bSLuis R. Rodriguez * compliance. For example if channel 13 and 14 are disabled by this 1754749b527bSLuis R. Rodriguez * regulatory domain no user regulatory domain can enable these channels 1755749b527bSLuis R. Rodriguez * at a later time. This can be used for devices which do not have 1756749b527bSLuis R. Rodriguez * calibration information guaranteed for frequencies or settings 1757061acaaeSLuis R. Rodriguez * outside of its regulatory domain. If used in combination with 1758061acaaeSLuis R. Rodriguez * WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings 1759061acaaeSLuis R. Rodriguez * will be followed. 17605be83de5SJohannes Berg * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure 17615be83de5SJohannes Berg * that passive scan flags and beaconing flags may not be lifted by 17625be83de5SJohannes Berg * cfg80211 due to regulatory beacon hints. For more information on beacon 176337184244SLuis R. Rodriguez * hints read the documenation for regulatory_hint_found_beacon() 17645be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 17655be83de5SJohannes Berg * wiphy at all 17665be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 17675be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 17685be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 17695be83de5SJohannes Berg * reason to override the default 17709bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 17719bc383deSJohannes Berg * on a VLAN interface) 17729bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 1773c0692b8fSJohannes Berg * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the 1774c0692b8fSJohannes Berg * control port protocol ethertype. The device also honours the 1775c0692b8fSJohannes Berg * control_port_no_encrypt flag. 1776e31b8213SJohannes Berg * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. 177715d5dda6SJavier Cardona * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing 177815d5dda6SJavier Cardona * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. 17791ba01458SRandy Dunlap * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. 1780f4b34b55SVivek Natarajan * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the 1781f4b34b55SVivek Natarajan * firmware. 1782cedb5412SEliad Peller * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. 1783109086ceSArik Nemtsov * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. 1784109086ceSArik Nemtsov * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) 1785109086ceSArik Nemtsov * link setup/discovery operations internally. Setup, discovery and 1786109086ceSArik Nemtsov * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 1787109086ceSArik Nemtsov * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 1788109086ceSArik Nemtsov * used for asking the driver/firmware to perform a TDLS operation. 1789562a7480SJohannes Berg * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME 17905e760230SJohannes Berg * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes 17915e760230SJohannes Berg * when there are virtual interfaces in AP mode by calling 17925e760230SJohannes Berg * cfg80211_report_obss_beacon(). 179387bbbe22SArik Nemtsov * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device 179487bbbe22SArik Nemtsov * responds to probe-requests in hardware. 17957c4ef712SJohannes Berg * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 17967c4ef712SJohannes Berg * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 17975be83de5SJohannes Berg */ 17985be83de5SJohannes Berg enum wiphy_flags { 17995be83de5SJohannes Berg WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 18005be83de5SJohannes Berg WIPHY_FLAG_STRICT_REGULATORY = BIT(1), 18015be83de5SJohannes Berg WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), 18025be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 18035be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 18049bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 18059bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 1806c0692b8fSJohannes Berg WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), 1807309075cfSJussi Kivilinna WIPHY_FLAG_IBSS_RSN = BIT(8), 180815d5dda6SJavier Cardona WIPHY_FLAG_MESH_AUTH = BIT(10), 1809807f8a8cSLuciano Coelho WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 18108e8b41f9SJohannes Berg /* use hole at 12 */ 1811f4b34b55SVivek Natarajan WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 1812cedb5412SEliad Peller WIPHY_FLAG_AP_UAPSD = BIT(14), 1813109086ceSArik Nemtsov WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 1814109086ceSArik Nemtsov WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 1815562a7480SJohannes Berg WIPHY_FLAG_HAVE_AP_SME = BIT(17), 18165e760230SJohannes Berg WIPHY_FLAG_REPORTS_OBSS = BIT(18), 181787bbbe22SArik Nemtsov WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 18187c4ef712SJohannes Berg WIPHY_FLAG_OFFCHAN_TX = BIT(20), 18197c4ef712SJohannes Berg WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 18207527a782SJohannes Berg }; 18217527a782SJohannes Berg 18227527a782SJohannes Berg /** 18237527a782SJohannes Berg * struct ieee80211_iface_limit - limit on certain interface types 18247527a782SJohannes Berg * @max: maximum number of interfaces of these types 18257527a782SJohannes Berg * @types: interface types (bits) 18267527a782SJohannes Berg */ 18277527a782SJohannes Berg struct ieee80211_iface_limit { 18287527a782SJohannes Berg u16 max; 18297527a782SJohannes Berg u16 types; 18307527a782SJohannes Berg }; 18317527a782SJohannes Berg 18327527a782SJohannes Berg /** 18337527a782SJohannes Berg * struct ieee80211_iface_combination - possible interface combination 18347527a782SJohannes Berg * @limits: limits for the given interface types 18357527a782SJohannes Berg * @n_limits: number of limitations 18367527a782SJohannes Berg * @num_different_channels: can use up to this many different channels 18377527a782SJohannes Berg * @max_interfaces: maximum number of interfaces in total allowed in this 18387527a782SJohannes Berg * group 18397527a782SJohannes Berg * @beacon_int_infra_match: In this combination, the beacon intervals 18407527a782SJohannes Berg * between infrastructure and AP types must match. This is required 18417527a782SJohannes Berg * only in special cases. 18427527a782SJohannes Berg * 18437527a782SJohannes Berg * These examples can be expressed as follows: 18447527a782SJohannes Berg * 18457527a782SJohannes Berg * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 18467527a782SJohannes Berg * 18477527a782SJohannes Berg * struct ieee80211_iface_limit limits1[] = { 18487527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 18497527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, 18507527a782SJohannes Berg * }; 18517527a782SJohannes Berg * struct ieee80211_iface_combination combination1 = { 18527527a782SJohannes Berg * .limits = limits1, 18537527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits1), 18547527a782SJohannes Berg * .max_interfaces = 2, 18557527a782SJohannes Berg * .beacon_int_infra_match = true, 18567527a782SJohannes Berg * }; 18577527a782SJohannes Berg * 18587527a782SJohannes Berg * 18597527a782SJohannes Berg * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 18607527a782SJohannes Berg * 18617527a782SJohannes Berg * struct ieee80211_iface_limit limits2[] = { 18627527a782SJohannes Berg * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 18637527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_GO), }, 18647527a782SJohannes Berg * }; 18657527a782SJohannes Berg * struct ieee80211_iface_combination combination2 = { 18667527a782SJohannes Berg * .limits = limits2, 18677527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits2), 18687527a782SJohannes Berg * .max_interfaces = 8, 18697527a782SJohannes Berg * .num_different_channels = 1, 18707527a782SJohannes Berg * }; 18717527a782SJohannes Berg * 18727527a782SJohannes Berg * 18737527a782SJohannes Berg * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 18747527a782SJohannes Berg * This allows for an infrastructure connection and three P2P connections. 18757527a782SJohannes Berg * 18767527a782SJohannes Berg * struct ieee80211_iface_limit limits3[] = { 18777527a782SJohannes Berg * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 18787527a782SJohannes Berg * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | 18797527a782SJohannes Berg * BIT(NL80211_IFTYPE_P2P_CLIENT), }, 18807527a782SJohannes Berg * }; 18817527a782SJohannes Berg * struct ieee80211_iface_combination combination3 = { 18827527a782SJohannes Berg * .limits = limits3, 18837527a782SJohannes Berg * .n_limits = ARRAY_SIZE(limits3), 18847527a782SJohannes Berg * .max_interfaces = 4, 18857527a782SJohannes Berg * .num_different_channels = 2, 18867527a782SJohannes Berg * }; 18877527a782SJohannes Berg */ 18887527a782SJohannes Berg struct ieee80211_iface_combination { 18897527a782SJohannes Berg const struct ieee80211_iface_limit *limits; 18907527a782SJohannes Berg u32 num_different_channels; 18917527a782SJohannes Berg u16 max_interfaces; 18927527a782SJohannes Berg u8 n_limits; 18937527a782SJohannes Berg bool beacon_int_infra_match; 18945be83de5SJohannes Berg }; 18955be83de5SJohannes Berg 1896ef15aac6SJohannes Berg struct mac_address { 1897ef15aac6SJohannes Berg u8 addr[ETH_ALEN]; 1898ef15aac6SJohannes Berg }; 1899ef15aac6SJohannes Berg 19002e161f78SJohannes Berg struct ieee80211_txrx_stypes { 19012e161f78SJohannes Berg u16 tx, rx; 19022e161f78SJohannes Berg }; 19032e161f78SJohannes Berg 19045be83de5SJohannes Berg /** 1905ff1b6e69SJohannes Berg * enum wiphy_wowlan_support_flags - WoWLAN support flags 1906ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" 1907ff1b6e69SJohannes Berg * trigger that keeps the device operating as-is and 1908ff1b6e69SJohannes Berg * wakes up the host on any activity, for example a 1909ff1b6e69SJohannes Berg * received packet that passed filtering; note that the 1910ff1b6e69SJohannes Berg * packet should be preserved in that case 1911ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet 1912ff1b6e69SJohannes Berg * (see nl80211.h) 1913ff1b6e69SJohannes Berg * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect 191477dbbb13SJohannes Berg * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep 191577dbbb13SJohannes Berg * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure 191677dbbb13SJohannes Berg * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 191777dbbb13SJohannes Berg * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 191877dbbb13SJohannes Berg * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 1919ff1b6e69SJohannes Berg */ 1920ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags { 1921ff1b6e69SJohannes Berg WIPHY_WOWLAN_ANY = BIT(0), 1922ff1b6e69SJohannes Berg WIPHY_WOWLAN_MAGIC_PKT = BIT(1), 1923ff1b6e69SJohannes Berg WIPHY_WOWLAN_DISCONNECT = BIT(2), 192477dbbb13SJohannes Berg WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), 192577dbbb13SJohannes Berg WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), 192677dbbb13SJohannes Berg WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 192777dbbb13SJohannes Berg WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 192877dbbb13SJohannes Berg WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 1929ff1b6e69SJohannes Berg }; 1930ff1b6e69SJohannes Berg 1931ff1b6e69SJohannes Berg /** 1932ff1b6e69SJohannes Berg * struct wiphy_wowlan_support - WoWLAN support data 1933ff1b6e69SJohannes Berg * @flags: see &enum wiphy_wowlan_support_flags 1934ff1b6e69SJohannes Berg * @n_patterns: number of supported wakeup patterns 1935ff1b6e69SJohannes Berg * (see nl80211.h for the pattern definition) 1936ff1b6e69SJohannes Berg * @pattern_max_len: maximum length of each pattern 1937ff1b6e69SJohannes Berg * @pattern_min_len: minimum length of each pattern 1938ff1b6e69SJohannes Berg */ 1939ff1b6e69SJohannes Berg struct wiphy_wowlan_support { 1940ff1b6e69SJohannes Berg u32 flags; 1941ff1b6e69SJohannes Berg int n_patterns; 1942ff1b6e69SJohannes Berg int pattern_max_len; 1943ff1b6e69SJohannes Berg int pattern_min_len; 1944ff1b6e69SJohannes Berg }; 1945ff1b6e69SJohannes Berg 1946ff1b6e69SJohannes Berg /** 19475be83de5SJohannes Berg * struct wiphy - wireless hardware description 19482784fe91SLuis R. Rodriguez * @reg_notifier: the driver's regulatory notification callback, 19492784fe91SLuis R. Rodriguez * note that if your driver uses wiphy_apply_custom_regulatory() 19502784fe91SLuis R. Rodriguez * the reg_notifier's request can be passed as NULL 1951d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 1952d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 1953d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 1954d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 1955d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 1956d3236553SJohannes Berg * @cipher_suites: supported cipher suites 1957d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 1958b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 1959b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 1960b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1961b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 1962b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1963abe37c4bSJohannes Berg * @_net: the network namespace this wiphy currently lives in 1964ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 1965ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 1966ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 1967ef15aac6SJohannes Berg * four bits are variable then set it to 00:...:00:0f. The actual 1968ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 1969ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 1970ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 1971ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 1972ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 1973ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 1974ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 1975ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 1976fd235913SRandy Dunlap * @registered: protects ->resume and ->suspend sysfs callbacks against 1977fd235913SRandy Dunlap * unregister hardware 1978abe37c4bSJohannes Berg * @debugfsdir: debugfs directory used for this wiphy, will be renamed 1979abe37c4bSJohannes Berg * automatically on wiphy renames 1980abe37c4bSJohannes Berg * @dev: (virtual) struct device for this wiphy 19814a711a85SStanislaw Gruszka * @registered: helps synchronize suspend/resume with wiphy unregister 1982abe37c4bSJohannes Berg * @wext: wireless extension handlers 1983abe37c4bSJohannes Berg * @priv: driver private data (sized according to wiphy_new() parameter) 1984abe37c4bSJohannes Berg * @interface_modes: bitmask of interfaces types valid for this wiphy, 1985abe37c4bSJohannes Berg * must be set by driver 19867527a782SJohannes Berg * @iface_combinations: Valid interface combinations array, should not 19877527a782SJohannes Berg * list single interface types. 19887527a782SJohannes Berg * @n_iface_combinations: number of entries in @iface_combinations array. 19897527a782SJohannes Berg * @software_iftypes: bitmask of software interface types, these are not 19907527a782SJohannes Berg * subject to any restrictions since they are purely managed in SW. 1991abe37c4bSJohannes Berg * @flags: wiphy flags, see &enum wiphy_flags 19921f074bd8SJohannes Berg * @features: features advertised to nl80211, see &enum nl80211_feature_flags. 1993abe37c4bSJohannes Berg * @bss_priv_size: each BSS struct has private data allocated with it, 1994abe37c4bSJohannes Berg * this variable determines its size 1995abe37c4bSJohannes Berg * @max_scan_ssids: maximum number of SSIDs the device can scan for in 1996abe37c4bSJohannes Berg * any given scan 199793b6aa69SLuciano Coelho * @max_sched_scan_ssids: maximum number of SSIDs the device can scan 199893b6aa69SLuciano Coelho * for in any given scheduled scan 1999a1f1c21cSLuciano Coelho * @max_match_sets: maximum number of match sets the device can handle 2000a1f1c21cSLuciano Coelho * when performing a scheduled scan, 0 if filtering is not 2001a1f1c21cSLuciano Coelho * supported. 2002abe37c4bSJohannes Berg * @max_scan_ie_len: maximum length of user-controlled IEs device can 2003abe37c4bSJohannes Berg * add to probe request frames transmitted during a scan, must not 2004abe37c4bSJohannes Berg * include fixed IEs like supported rates 20055a865badSLuciano Coelho * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled 20065a865badSLuciano Coelho * scans 2007abe37c4bSJohannes Berg * @coverage_class: current coverage class 2008abe37c4bSJohannes Berg * @fw_version: firmware version for ethtool reporting 2009abe37c4bSJohannes Berg * @hw_version: hardware version for ethtool reporting 2010abe37c4bSJohannes Berg * @max_num_pmkids: maximum number of PMKIDs supported by device 2011abe37c4bSJohannes Berg * @privid: a pointer that drivers can use to identify if an arbitrary 2012abe37c4bSJohannes Berg * wiphy is theirs, e.g. in global notifiers 2013abe37c4bSJohannes Berg * @bands: information about bands/channels supported by this device 20142e161f78SJohannes Berg * 20152e161f78SJohannes Berg * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or 20162e161f78SJohannes Berg * transmitted through nl80211, points to an array indexed by interface 20172e161f78SJohannes Berg * type 2018a7ffac95SBruno Randolf * 20197f531e03SBruno Randolf * @available_antennas_tx: bitmap of antennas which are available to be 20207f531e03SBruno Randolf * configured as TX antennas. Antenna configuration commands will be 20217f531e03SBruno Randolf * rejected unless this or @available_antennas_rx is set. 20227f531e03SBruno Randolf * 20237f531e03SBruno Randolf * @available_antennas_rx: bitmap of antennas which are available to be 20247f531e03SBruno Randolf * configured as RX antennas. Antenna configuration commands will be 20257f531e03SBruno Randolf * rejected unless this or @available_antennas_tx is set. 2026a293911dSJohannes Berg * 202715f0ebc2SRandy Dunlap * @probe_resp_offload: 202815f0ebc2SRandy Dunlap * Bitmap of supported protocols for probe response offloading. 202915f0ebc2SRandy Dunlap * See &enum nl80211_probe_resp_offload_support_attr. Only valid 203015f0ebc2SRandy Dunlap * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 203115f0ebc2SRandy Dunlap * 2032a293911dSJohannes Berg * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 2033a293911dSJohannes Berg * may request, if implemented. 2034ff1b6e69SJohannes Berg * 2035ff1b6e69SJohannes Berg * @wowlan: WoWLAN support information 2036562a7480SJohannes Berg * 2037562a7480SJohannes Berg * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 20387e7c8926SBen Greear * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 20397e7c8926SBen Greear * If null, then none can be over-ridden. 2040d3236553SJohannes Berg */ 2041d3236553SJohannes Berg struct wiphy { 2042d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 2043d3236553SJohannes Berg 2044ef15aac6SJohannes Berg /* permanent MAC address(es) */ 2045d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 2046ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 2047ef15aac6SJohannes Berg 2048ef15aac6SJohannes Berg struct mac_address *addresses; 2049d3236553SJohannes Berg 20502e161f78SJohannes Berg const struct ieee80211_txrx_stypes *mgmt_stypes; 20512e161f78SJohannes Berg 20527527a782SJohannes Berg const struct ieee80211_iface_combination *iface_combinations; 20537527a782SJohannes Berg int n_iface_combinations; 20547527a782SJohannes Berg u16 software_iftypes; 20557527a782SJohannes Berg 20562e161f78SJohannes Berg u16 n_addresses; 20572e161f78SJohannes Berg 2058d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 2059d3236553SJohannes Berg u16 interface_modes; 2060d3236553SJohannes Berg 20611f074bd8SJohannes Berg u32 flags, features; 2062463d0183SJohannes Berg 2063562a7480SJohannes Berg u32 ap_sme_capa; 2064562a7480SJohannes Berg 2065d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 2066d3236553SJohannes Berg 2067d3236553SJohannes Berg int bss_priv_size; 2068d3236553SJohannes Berg u8 max_scan_ssids; 206993b6aa69SLuciano Coelho u8 max_sched_scan_ssids; 2070a1f1c21cSLuciano Coelho u8 max_match_sets; 2071d3236553SJohannes Berg u16 max_scan_ie_len; 20725a865badSLuciano Coelho u16 max_sched_scan_ie_len; 2073d3236553SJohannes Berg 2074d3236553SJohannes Berg int n_cipher_suites; 2075d3236553SJohannes Berg const u32 *cipher_suites; 2076d3236553SJohannes Berg 2077b9a5f8caSJouni Malinen u8 retry_short; 2078b9a5f8caSJouni Malinen u8 retry_long; 2079b9a5f8caSJouni Malinen u32 frag_threshold; 2080b9a5f8caSJouni Malinen u32 rts_threshold; 208181077e82SLukáš Turek u8 coverage_class; 2082b9a5f8caSJouni Malinen 2083dfce95f5SKalle Valo char fw_version[ETHTOOL_BUSINFO_LEN]; 2084dfce95f5SKalle Valo u32 hw_version; 2085dfce95f5SKalle Valo 2086ff1b6e69SJohannes Berg struct wiphy_wowlan_support wowlan; 2087ff1b6e69SJohannes Berg 2088a293911dSJohannes Berg u16 max_remain_on_channel_duration; 2089a293911dSJohannes Berg 209067fbb16bSSamuel Ortiz u8 max_num_pmkids; 209167fbb16bSSamuel Ortiz 20927f531e03SBruno Randolf u32 available_antennas_tx; 20937f531e03SBruno Randolf u32 available_antennas_rx; 2094a7ffac95SBruno Randolf 209587bbbe22SArik Nemtsov /* 209687bbbe22SArik Nemtsov * Bitmap of supported protocols for probe response offloading 209787bbbe22SArik Nemtsov * see &enum nl80211_probe_resp_offload_support_attr. Only valid 209887bbbe22SArik Nemtsov * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. 209987bbbe22SArik Nemtsov */ 210087bbbe22SArik Nemtsov u32 probe_resp_offload; 210187bbbe22SArik Nemtsov 2102d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 2103d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 2104d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 2105d3236553SJohannes Berg * or not. Assign this to something global to your driver to 2106d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 2107cf5aa2f1SDavid Kilroy const void *privid; 2108d3236553SJohannes Berg 2109d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 2110d3236553SJohannes Berg 2111d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 2112d3236553SJohannes Berg int (*reg_notifier)(struct wiphy *wiphy, 2113d3236553SJohannes Berg struct regulatory_request *request); 2114d3236553SJohannes Berg 2115d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 2116d3236553SJohannes Berg 2117d3236553SJohannes Berg const struct ieee80211_regdomain *regd; 2118d3236553SJohannes Berg 2119d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 2120d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 2121d3236553SJohannes Berg struct device dev; 2122d3236553SJohannes Berg 2123ecb44335SStanislaw Gruszka /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ 2124ecb44335SStanislaw Gruszka bool registered; 2125ecb44335SStanislaw Gruszka 2126d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 2127d3236553SJohannes Berg struct dentry *debugfsdir; 2128d3236553SJohannes Berg 21297e7c8926SBen Greear const struct ieee80211_ht_cap *ht_capa_mod_mask; 21307e7c8926SBen Greear 2131463d0183SJohannes Berg #ifdef CONFIG_NET_NS 2132463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 2133463d0183SJohannes Berg struct net *_net; 2134463d0183SJohannes Berg #endif 2135463d0183SJohannes Berg 21363d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 21373d23e349SJohannes Berg const struct iw_handler_def *wext; 21383d23e349SJohannes Berg #endif 21393d23e349SJohannes Berg 2140d3236553SJohannes Berg char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 2141d3236553SJohannes Berg }; 2142d3236553SJohannes Berg 2143463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 2144463d0183SJohannes Berg { 2145c2d9ba9bSEric Dumazet return read_pnet(&wiphy->_net); 2146463d0183SJohannes Berg } 2147463d0183SJohannes Berg 2148463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 2149463d0183SJohannes Berg { 2150c2d9ba9bSEric Dumazet write_pnet(&wiphy->_net, net); 2151463d0183SJohannes Berg } 2152463d0183SJohannes Berg 2153d3236553SJohannes Berg /** 2154d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 2155d3236553SJohannes Berg * 2156d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 2157d3236553SJohannes Berg */ 2158d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 2159d3236553SJohannes Berg { 2160d3236553SJohannes Berg BUG_ON(!wiphy); 2161d3236553SJohannes Berg return &wiphy->priv; 2162d3236553SJohannes Berg } 2163d3236553SJohannes Berg 2164d3236553SJohannes Berg /** 2165f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 2166f1f74825SDavid Kilroy * 2167f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 2168f1f74825SDavid Kilroy */ 2169f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 2170f1f74825SDavid Kilroy { 2171f1f74825SDavid Kilroy BUG_ON(!priv); 2172f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 2173f1f74825SDavid Kilroy } 2174f1f74825SDavid Kilroy 2175f1f74825SDavid Kilroy /** 2176d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 2177d3236553SJohannes Berg * 2178d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 2179d3236553SJohannes Berg * @dev: The device to parent it to 2180d3236553SJohannes Berg */ 2181d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 2182d3236553SJohannes Berg { 2183d3236553SJohannes Berg wiphy->dev.parent = dev; 2184d3236553SJohannes Berg } 2185d3236553SJohannes Berg 2186d3236553SJohannes Berg /** 2187d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 2188d3236553SJohannes Berg * 2189d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 2190d3236553SJohannes Berg */ 2191d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 2192d3236553SJohannes Berg { 2193d3236553SJohannes Berg return wiphy->dev.parent; 2194d3236553SJohannes Berg } 2195d3236553SJohannes Berg 2196d3236553SJohannes Berg /** 2197d3236553SJohannes Berg * wiphy_name - get wiphy name 2198d3236553SJohannes Berg * 2199d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 2200d3236553SJohannes Berg */ 2201e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy) 2202d3236553SJohannes Berg { 2203d3236553SJohannes Berg return dev_name(&wiphy->dev); 2204d3236553SJohannes Berg } 2205d3236553SJohannes Berg 2206d3236553SJohannes Berg /** 2207d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 2208d3236553SJohannes Berg * 2209d3236553SJohannes Berg * @ops: The configuration operations for this device 2210d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 2211d3236553SJohannes Berg * 2212d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 2213d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 2214d3236553SJohannes Berg * 2215d3236553SJohannes Berg * The returned pointer must be assigned to each netdev's 2216d3236553SJohannes Berg * ieee80211_ptr for proper operation. 2217d3236553SJohannes Berg */ 22183dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 2219d3236553SJohannes Berg 2220d3236553SJohannes Berg /** 2221d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 2222d3236553SJohannes Berg * 2223d3236553SJohannes Berg * @wiphy: The wiphy to register. 2224d3236553SJohannes Berg * 2225d3236553SJohannes Berg * Returns a non-negative wiphy index or a negative error code. 2226d3236553SJohannes Berg */ 2227d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 2228d3236553SJohannes Berg 2229d3236553SJohannes Berg /** 2230d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 2231d3236553SJohannes Berg * 2232d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 2233d3236553SJohannes Berg * 2234d3236553SJohannes Berg * After this call, no more requests can be made with this priv 2235d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 2236d3236553SJohannes Berg * request that is being handled. 2237d3236553SJohannes Berg */ 2238d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 2239d3236553SJohannes Berg 2240d3236553SJohannes Berg /** 2241d3236553SJohannes Berg * wiphy_free - free wiphy 2242d3236553SJohannes Berg * 2243d3236553SJohannes Berg * @wiphy: The wiphy to free 2244d3236553SJohannes Berg */ 2245d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 2246d3236553SJohannes Berg 2247fffd0934SJohannes Berg /* internal structs */ 22486829c878SJohannes Berg struct cfg80211_conn; 224919957bb3SJohannes Berg struct cfg80211_internal_bss; 2250fffd0934SJohannes Berg struct cfg80211_cached_keys; 225119957bb3SJohannes Berg 2252d3236553SJohannes Berg /** 2253d3236553SJohannes Berg * struct wireless_dev - wireless per-netdev state 2254d3236553SJohannes Berg * 2255d3236553SJohannes Berg * This structure must be allocated by the driver/stack 2256d3236553SJohannes Berg * that uses the ieee80211_ptr field in struct net_device 2257d3236553SJohannes Berg * (this is intentional so it can be allocated along with 2258d3236553SJohannes Berg * the netdev.) 2259d3236553SJohannes Berg * 2260d3236553SJohannes Berg * @wiphy: pointer to hardware description 2261d3236553SJohannes Berg * @iftype: interface type 2262d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 2263d3236553SJohannes Berg * @netdev: (private) Used to reference back to the netdev 2264d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 2265f444de05SJohannes Berg * @channel: (private) Used by the internal configuration code to track 2266f444de05SJohannes Berg * user-set AP, monitor and WDS channels for wireless extensions 2267d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 2268d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 2269d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 227029cbe68cSJohannes Berg * @mesh_id_len: (private) Used by the internal configuration code 227129cbe68cSJohannes Berg * @mesh_id_up_len: (private) Used by the internal configuration code 2272d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 22739bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 22749bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 22759bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 22769bc383deSJohannes Berg * by cfg80211 on change_interface 22772e161f78SJohannes Berg * @mgmt_registrations: list of registrations for management frames 22782e161f78SJohannes Berg * @mgmt_registrations_lock: lock for the list 2279abe37c4bSJohannes Berg * @mtx: mutex used to lock data in this struct 2280abe37c4bSJohannes Berg * @cleanup_work: work struct used for cleanup that can't be done directly 228156d1893dSJohannes Berg * @beacon_interval: beacon interval used on this device for transmitting 228256d1893dSJohannes Berg * beacons, 0 when not valid 2283d3236553SJohannes Berg */ 2284d3236553SJohannes Berg struct wireless_dev { 2285d3236553SJohannes Berg struct wiphy *wiphy; 2286d3236553SJohannes Berg enum nl80211_iftype iftype; 2287d3236553SJohannes Berg 2288667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 2289d3236553SJohannes Berg struct list_head list; 2290d3236553SJohannes Berg struct net_device *netdev; 2291d3236553SJohannes Berg 22922e161f78SJohannes Berg struct list_head mgmt_registrations; 22932e161f78SJohannes Berg spinlock_t mgmt_registrations_lock; 2294026331c4SJouni Malinen 2295667503ddSJohannes Berg struct mutex mtx; 2296667503ddSJohannes Berg 2297ad002395SJohannes Berg struct work_struct cleanup_work; 2298ad002395SJohannes Berg 22999bc383deSJohannes Berg bool use_4addr; 23009bc383deSJohannes Berg 2301b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 2302d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 230329cbe68cSJohannes Berg u8 ssid_len, mesh_id_len, mesh_id_up_len; 2304b23aa676SSamuel Ortiz enum { 2305b23aa676SSamuel Ortiz CFG80211_SME_IDLE, 23066829c878SJohannes Berg CFG80211_SME_CONNECTING, 2307b23aa676SSamuel Ortiz CFG80211_SME_CONNECTED, 2308b23aa676SSamuel Ortiz } sme_state; 23096829c878SJohannes Berg struct cfg80211_conn *conn; 2310fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 2311d3236553SJohannes Berg 2312667503ddSJohannes Berg struct list_head event_list; 2313667503ddSJohannes Berg spinlock_t event_lock; 2314667503ddSJohannes Berg 231519957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2316f444de05SJohannes Berg struct ieee80211_channel *channel; 231719957bb3SJohannes Berg 2318ffb9eb3dSKalle Valo bool ps; 2319ffb9eb3dSKalle Valo int ps_timeout; 2320ffb9eb3dSKalle Valo 232156d1893dSJohannes Berg int beacon_interval; 232256d1893dSJohannes Berg 232328946da7SJohannes Berg u32 ap_unexpected_nlpid; 232428946da7SJohannes Berg 23253d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 2326d3236553SJohannes Berg /* wext data */ 2327cbe8fa9cSJohannes Berg struct { 2328cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 2329f2129354SJohannes Berg struct cfg80211_connect_params connect; 2330fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 2331f2129354SJohannes Berg u8 *ie; 2332f2129354SJohannes Berg size_t ie_len; 2333f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 2334f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 233508645126SJohannes Berg s8 default_key, default_mgmt_key; 2336ffb9eb3dSKalle Valo bool prev_bssid_valid; 2337cbe8fa9cSJohannes Berg } wext; 2338d3236553SJohannes Berg #endif 2339d3236553SJohannes Berg }; 2340d3236553SJohannes Berg 2341d3236553SJohannes Berg /** 2342d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 2343d3236553SJohannes Berg * 2344d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 2345d3236553SJohannes Berg */ 2346d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 2347d3236553SJohannes Berg { 2348d3236553SJohannes Berg BUG_ON(!wdev); 2349d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 2350d3236553SJohannes Berg } 2351d3236553SJohannes Berg 2352d70e9693SJohannes Berg /** 2353d70e9693SJohannes Berg * DOC: Utility functions 2354d70e9693SJohannes Berg * 2355d70e9693SJohannes Berg * cfg80211 offers a number of utility functions that can be useful. 2356d3236553SJohannes Berg */ 2357d3236553SJohannes Berg 2358d3236553SJohannes Berg /** 2359d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 2360abe37c4bSJohannes Berg * @chan: channel number 236159eb21a6SBruno Randolf * @band: band, necessary due to channel number overlap 2362d3236553SJohannes Berg */ 236359eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); 2364d3236553SJohannes Berg 2365d3236553SJohannes Berg /** 2366d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 2367abe37c4bSJohannes Berg * @freq: center frequency 2368d3236553SJohannes Berg */ 2369d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 2370d3236553SJohannes Berg 2371d3236553SJohannes Berg /* 2372d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 2373d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 2374d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 2375d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 2376d3236553SJohannes Berg * clash. 2377d3236553SJohannes Berg */ 2378d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 2379d3236553SJohannes Berg int freq); 2380d3236553SJohannes Berg /** 2381d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 2382abe37c4bSJohannes Berg * @wiphy: the struct wiphy to get the channel for 2383abe37c4bSJohannes Berg * @freq: the center frequency of the channel 2384d3236553SJohannes Berg */ 2385d3236553SJohannes Berg static inline struct ieee80211_channel * 2386d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 2387d3236553SJohannes Berg { 2388d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 2389d3236553SJohannes Berg } 2390d3236553SJohannes Berg 2391d3236553SJohannes Berg /** 2392d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 2393d3236553SJohannes Berg * 2394d3236553SJohannes Berg * @sband: the band to look for rates in 2395d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 2396d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 2397d3236553SJohannes Berg * 2398d3236553SJohannes Berg * This function returns the basic rate corresponding to a given 2399d3236553SJohannes Berg * bitrate, that is the next lower bitrate contained in the basic 2400d3236553SJohannes Berg * rate map, which is, for this function, given as a bitmap of 2401d3236553SJohannes Berg * indices of rates in the band's bitrate table. 2402d3236553SJohannes Berg */ 2403d3236553SJohannes Berg struct ieee80211_rate * 2404d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 2405d3236553SJohannes Berg u32 basic_rates, int bitrate); 2406d3236553SJohannes Berg 2407d3236553SJohannes Berg /* 2408d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 2409d3236553SJohannes Berg * 2410d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 2411d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 2412d3236553SJohannes Berg */ 2413d3236553SJohannes Berg 241433e5a2f7SJohannes Berg struct radiotap_align_size { 241533e5a2f7SJohannes Berg uint8_t align:4, size:4; 241633e5a2f7SJohannes Berg }; 241733e5a2f7SJohannes Berg 241833e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 241933e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 242033e5a2f7SJohannes Berg int n_bits; 242133e5a2f7SJohannes Berg uint32_t oui; 242233e5a2f7SJohannes Berg uint8_t subns; 242333e5a2f7SJohannes Berg }; 242433e5a2f7SJohannes Berg 242533e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 242633e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 242733e5a2f7SJohannes Berg int n_ns; 242833e5a2f7SJohannes Berg }; 242933e5a2f7SJohannes Berg 2430d3236553SJohannes Berg /** 2431d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 243233e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 243333e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 243433e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 243533e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 243633e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 243733e5a2f7SJohannes Berg * the beginning of the actual data portion 243833e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 243933e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 244033e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 244133e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 244233e5a2f7SJohannes Berg * radiotap namespace or not 244333e5a2f7SJohannes Berg * 244433e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 244533e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 244633e5a2f7SJohannes Berg * @_arg_index: next argument index 244733e5a2f7SJohannes Berg * @_arg: next argument pointer 244833e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 244933e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 245033e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 245133e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 245233e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 245333e5a2f7SJohannes Berg * next bitmap word 245433e5a2f7SJohannes Berg * 245533e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 245633e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 2457d3236553SJohannes Berg */ 2458d3236553SJohannes Berg 2459d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 246033e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 246133e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 246233e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 2463d3236553SJohannes Berg 246433e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 246567272440SJohannes Berg __le32 *_next_bitmap; 246633e5a2f7SJohannes Berg 246733e5a2f7SJohannes Berg unsigned char *this_arg; 246833e5a2f7SJohannes Berg int this_arg_index; 246933e5a2f7SJohannes Berg int this_arg_size; 247033e5a2f7SJohannes Berg 247133e5a2f7SJohannes Berg int is_radiotap_ns; 247233e5a2f7SJohannes Berg 247333e5a2f7SJohannes Berg int _max_length; 247433e5a2f7SJohannes Berg int _arg_index; 247533e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 247633e5a2f7SJohannes Berg int _reset_on_ext; 2477d3236553SJohannes Berg }; 2478d3236553SJohannes Berg 2479d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 2480d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 2481d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 248233e5a2f7SJohannes Berg int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); 2483d3236553SJohannes Berg 2484d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 2485d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 2486d3236553SJohannes Berg 248733e5a2f7SJohannes Berg 2488e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 2489e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 2490e31a16d6SZhu Yi 2491e31a16d6SZhu Yi /** 2492e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 2493e31a16d6SZhu Yi * 2494e31a16d6SZhu Yi * Given an skb with a raw 802.11 header at the data pointer this function 2495e31a16d6SZhu Yi * returns the 802.11 header length in bytes (not including encryption 2496e31a16d6SZhu Yi * headers). If the data in the sk_buff is too short to contain a valid 802.11 2497e31a16d6SZhu Yi * header the function returns 0. 2498e31a16d6SZhu Yi * 2499e31a16d6SZhu Yi * @skb: the frame 2500e31a16d6SZhu Yi */ 2501e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 2502e31a16d6SZhu Yi 2503e31a16d6SZhu Yi /** 2504e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 2505e31a16d6SZhu Yi * @fc: frame control field in little-endian format 2506e31a16d6SZhu Yi */ 2507633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); 2508e31a16d6SZhu Yi 2509e31a16d6SZhu Yi /** 2510d70e9693SJohannes Berg * DOC: Data path helpers 2511d70e9693SJohannes Berg * 2512d70e9693SJohannes Berg * In addition to generic utilities, cfg80211 also offers 2513d70e9693SJohannes Berg * functions that help implement the data path for devices 2514d70e9693SJohannes Berg * that do not do the 802.11/802.3 conversion on the device. 2515d70e9693SJohannes Berg */ 2516d70e9693SJohannes Berg 2517d70e9693SJohannes Berg /** 2518e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 2519e31a16d6SZhu Yi * @skb: the 802.11 data frame 2520e31a16d6SZhu Yi * @addr: the device MAC address 2521e31a16d6SZhu Yi * @iftype: the virtual interface type 2522e31a16d6SZhu Yi */ 2523eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 2524e31a16d6SZhu Yi enum nl80211_iftype iftype); 2525e31a16d6SZhu Yi 2526e31a16d6SZhu Yi /** 2527e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 2528e31a16d6SZhu Yi * @skb: the 802.3 frame 2529e31a16d6SZhu Yi * @addr: the device MAC address 2530e31a16d6SZhu Yi * @iftype: the virtual interface type 2531e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 2532e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 2533e31a16d6SZhu Yi */ 2534eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 2535e31a16d6SZhu Yi enum nl80211_iftype iftype, u8 *bssid, bool qos); 2536e31a16d6SZhu Yi 2537e31a16d6SZhu Yi /** 2538eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 2539eaf85ca7SZhu Yi * 2540eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 2541eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 2542eaf85ca7SZhu Yi * @skb is consumed after the function returns. 2543eaf85ca7SZhu Yi * 2544eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 2545eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 2546eaf85ca7SZhu Yi * initialized by by the caller. 2547eaf85ca7SZhu Yi * @addr: The device MAC address. 2548eaf85ca7SZhu Yi * @iftype: The device interface type. 2549eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 25508b3becadSYogesh Ashok Powar * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. 2551eaf85ca7SZhu Yi */ 2552eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 2553eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 25548b3becadSYogesh Ashok Powar const unsigned int extra_headroom, 25558b3becadSYogesh Ashok Powar bool has_80211_header); 2556eaf85ca7SZhu Yi 2557eaf85ca7SZhu Yi /** 2558e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 2559e31a16d6SZhu Yi * @skb: the data frame 2560e31a16d6SZhu Yi */ 2561e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb); 2562e31a16d6SZhu Yi 2563c21dbf92SJohannes Berg /** 2564c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 2565c21dbf92SJohannes Berg * 2566c21dbf92SJohannes Berg * @eid: element ID 2567c21dbf92SJohannes Berg * @ies: data consisting of IEs 2568c21dbf92SJohannes Berg * @len: length of data 2569c21dbf92SJohannes Berg * 2570c21dbf92SJohannes Berg * This function will return %NULL if the element ID could 2571c21dbf92SJohannes Berg * not be found or if the element is invalid (claims to be 2572c21dbf92SJohannes Berg * longer than the given data), or a pointer to the first byte 2573c21dbf92SJohannes Berg * of the requested element, that is the byte containing the 2574c21dbf92SJohannes Berg * element ID. There are no checks on the element length 2575c21dbf92SJohannes Berg * other than having to fit into the given data. 2576c21dbf92SJohannes Berg */ 2577c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 2578c21dbf92SJohannes Berg 2579d70e9693SJohannes Berg /** 25800c28ec58SEliad Peller * cfg80211_find_vendor_ie - find vendor specific information element in data 25810c28ec58SEliad Peller * 25820c28ec58SEliad Peller * @oui: vendor OUI 25830c28ec58SEliad Peller * @oui_type: vendor-specific OUI type 25840c28ec58SEliad Peller * @ies: data consisting of IEs 25850c28ec58SEliad Peller * @len: length of data 25860c28ec58SEliad Peller * 25870c28ec58SEliad Peller * This function will return %NULL if the vendor specific element ID 25880c28ec58SEliad Peller * could not be found or if the element is invalid (claims to be 25890c28ec58SEliad Peller * longer than the given data), or a pointer to the first byte 25900c28ec58SEliad Peller * of the requested element, that is the byte containing the 25910c28ec58SEliad Peller * element ID. There are no checks on the element length 25920c28ec58SEliad Peller * other than having to fit into the given data. 25930c28ec58SEliad Peller */ 25940c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 25950c28ec58SEliad Peller const u8 *ies, int len); 25960c28ec58SEliad Peller 25970c28ec58SEliad Peller /** 2598d70e9693SJohannes Berg * DOC: Regulatory enforcement infrastructure 2599d70e9693SJohannes Berg * 2600d70e9693SJohannes Berg * TODO 2601d3236553SJohannes Berg */ 2602d3236553SJohannes Berg 2603d3236553SJohannes Berg /** 2604d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 2605d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 2606d3236553SJohannes Berg * conflicts) 2607d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 2608d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 2609d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 2610d3236553SJohannes Berg * alpha2. 2611d3236553SJohannes Berg * 2612d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 2613d3236553SJohannes Berg * what it believes should be the current regulatory domain by 2614d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 2615d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 2616d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 2617d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 2618d3236553SJohannes Berg * 2619d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 2620d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 2621d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 2622d3236553SJohannes Berg * 2623d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 2624d3236553SJohannes Berg * an -ENOMEM. 2625d3236553SJohannes Berg */ 2626d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 2627d3236553SJohannes Berg 2628d3236553SJohannes Berg /** 2629d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 2630d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 2631d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 2632d3236553SJohannes Berg * 2633d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 2634d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 2635d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 2636d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 2637d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 2638d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 2639d3236553SJohannes Berg */ 2640d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 2641d3236553SJohannes Berg struct wiphy *wiphy, 2642d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 2643d3236553SJohannes Berg 2644d3236553SJohannes Berg /** 2645d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 2646d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 2647d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 2648038659e7SLuis R. Rodriguez * @desired_bw_khz: the desired max bandwidth you want to use per 2649038659e7SLuis R. Rodriguez * channel. Note that this is still 20 MHz if you want to use HT40 2650038659e7SLuis R. Rodriguez * as HT40 makes use of two channels for its 40 MHz width bandwidth. 2651038659e7SLuis R. Rodriguez * If set to 0 we'll assume you want the standard 20 MHz. 2652d3236553SJohannes Berg * @reg_rule: the regulatory rule which we have for this frequency 2653d3236553SJohannes Berg * 2654d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 2655d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 2656d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 2657d3236553SJohannes Berg * and processed already. 2658d3236553SJohannes Berg * 2659d3236553SJohannes Berg * Returns 0 if it was able to find a valid regulatory rule which does 2660d3236553SJohannes Berg * apply to the given center_freq otherwise it returns non-zero. It will 2661d3236553SJohannes Berg * also return -ERANGE if we determine the given center_freq does not even have 2662d3236553SJohannes Berg * a regulatory rule for a frequency range in the center_freq's band. See 2663d3236553SJohannes Berg * freq_in_rule_band() for our current definition of a band -- this is purely 2664d3236553SJohannes Berg * subjective and right now its 802.11 specific. 2665d3236553SJohannes Berg */ 2666038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy, 2667038659e7SLuis R. Rodriguez u32 center_freq, 2668038659e7SLuis R. Rodriguez u32 desired_bw_khz, 2669d3236553SJohannes Berg const struct ieee80211_reg_rule **reg_rule); 2670d3236553SJohannes Berg 2671d3236553SJohannes Berg /* 2672d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 2673d3236553SJohannes Berg * functions and BSS handling helpers 2674d3236553SJohannes Berg */ 2675d3236553SJohannes Berg 26762a519311SJohannes Berg /** 26772a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 26782a519311SJohannes Berg * 26792a519311SJohannes Berg * @request: the corresponding scan request 26802a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 26812a519311SJohannes Berg * userspace will be notified of that 26822a519311SJohannes Berg */ 26832a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 26842a519311SJohannes Berg 26852a519311SJohannes Berg /** 2686807f8a8cSLuciano Coelho * cfg80211_sched_scan_results - notify that new scan results are available 2687807f8a8cSLuciano Coelho * 2688807f8a8cSLuciano Coelho * @wiphy: the wiphy which got scheduled scan results 2689807f8a8cSLuciano Coelho */ 2690807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy); 2691807f8a8cSLuciano Coelho 2692807f8a8cSLuciano Coelho /** 2693807f8a8cSLuciano Coelho * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped 2694807f8a8cSLuciano Coelho * 2695807f8a8cSLuciano Coelho * @wiphy: the wiphy on which the scheduled scan stopped 2696807f8a8cSLuciano Coelho * 2697807f8a8cSLuciano Coelho * The driver can call this function to inform cfg80211 that the 2698807f8a8cSLuciano Coelho * scheduled scan had to be stopped, for whatever reason. The driver 2699807f8a8cSLuciano Coelho * is then called back via the sched_scan_stop operation when done. 2700807f8a8cSLuciano Coelho */ 2701807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 2702807f8a8cSLuciano Coelho 2703807f8a8cSLuciano Coelho /** 2704abe37c4bSJohannes Berg * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame 27052a519311SJohannes Berg * 27062a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 2707abe37c4bSJohannes Berg * @channel: The channel the frame was received on 2708abe37c4bSJohannes Berg * @mgmt: the management frame (probe response or beacon) 2709abe37c4bSJohannes Berg * @len: length of the management frame 271077965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 27112a519311SJohannes Berg * @gfp: context flags 27122a519311SJohannes Berg * 27132a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 27142a519311SJohannes Berg * the BSS should be updated/added. 2715ef100682SJohannes Berg * 2716ef100682SJohannes Berg * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! 27172a519311SJohannes Berg */ 2718ef100682SJohannes Berg struct cfg80211_bss * __must_check 27192a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 27202a519311SJohannes Berg struct ieee80211_channel *channel, 27212a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 272277965c97SJohannes Berg s32 signal, gfp_t gfp); 27232a519311SJohannes Berg 2724abe37c4bSJohannes Berg /** 2725abe37c4bSJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 2726abe37c4bSJohannes Berg * 2727abe37c4bSJohannes Berg * @wiphy: the wiphy reporting the BSS 2728abe37c4bSJohannes Berg * @channel: The channel the frame was received on 2729abe37c4bSJohannes Berg * @bssid: the BSSID of the BSS 27307b8bcff2SJohannes Berg * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 2731abe37c4bSJohannes Berg * @capability: the capability field sent by the peer 2732abe37c4bSJohannes Berg * @beacon_interval: the beacon interval announced by the peer 2733abe37c4bSJohannes Berg * @ie: additional IEs sent by the peer 2734abe37c4bSJohannes Berg * @ielen: length of the additional IEs 2735abe37c4bSJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 2736abe37c4bSJohannes Berg * @gfp: context flags 2737abe37c4bSJohannes Berg * 2738abe37c4bSJohannes Berg * This informs cfg80211 that BSS information was found and 2739abe37c4bSJohannes Berg * the BSS should be updated/added. 2740ef100682SJohannes Berg * 2741ef100682SJohannes Berg * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! 2742abe37c4bSJohannes Berg */ 2743ef100682SJohannes Berg struct cfg80211_bss * __must_check 274406aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 274506aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 27467b8bcff2SJohannes Berg const u8 *bssid, u64 tsf, u16 capability, 27477b8bcff2SJohannes Berg u16 beacon_interval, const u8 *ie, size_t ielen, 274806aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 274906aa7afaSJussi Kivilinna 27502a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 27512a519311SJohannes Berg struct ieee80211_channel *channel, 27522a519311SJohannes Berg const u8 *bssid, 275379420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 275479420f09SJohannes Berg u16 capa_mask, u16 capa_val); 275579420f09SJohannes Berg static inline struct cfg80211_bss * 275679420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 275779420f09SJohannes Berg struct ieee80211_channel *channel, 275879420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 275979420f09SJohannes Berg { 276079420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 276179420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 276279420f09SJohannes Berg } 276379420f09SJohannes Berg 27642a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 27652a519311SJohannes Berg struct ieee80211_channel *channel, 27662a519311SJohannes Berg const u8 *meshid, size_t meshidlen, 27672a519311SJohannes Berg const u8 *meshcfg); 27684c0c0b75SJohannes Berg /** 27694c0c0b75SJohannes Berg * cfg80211_ref_bss - reference BSS struct 27704c0c0b75SJohannes Berg * @bss: the BSS struct to reference 27714c0c0b75SJohannes Berg * 27724c0c0b75SJohannes Berg * Increments the refcount of the given BSS struct. 27734c0c0b75SJohannes Berg */ 27744c0c0b75SJohannes Berg void cfg80211_ref_bss(struct cfg80211_bss *bss); 27754c0c0b75SJohannes Berg 27764c0c0b75SJohannes Berg /** 27774c0c0b75SJohannes Berg * cfg80211_put_bss - unref BSS struct 27784c0c0b75SJohannes Berg * @bss: the BSS struct 27794c0c0b75SJohannes Berg * 27804c0c0b75SJohannes Berg * Decrements the refcount of the given BSS struct. 27814c0c0b75SJohannes Berg */ 27822a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss); 2783d3236553SJohannes Berg 2784d491af19SJohannes Berg /** 2785d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 2786d491af19SJohannes Berg * @wiphy: the wiphy 2787d491af19SJohannes Berg * @bss: the bss to remove 2788d491af19SJohannes Berg * 2789d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 2790d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 2791d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 2792d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 2793d491af19SJohannes Berg */ 2794d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 2795fee52678SJohannes Berg 27966039f6d2SJouni Malinen /** 27976039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 27986039f6d2SJouni Malinen * @dev: network device 27996039f6d2SJouni Malinen * @buf: authentication frame (header + body) 28006039f6d2SJouni Malinen * @len: length of the frame data 28016039f6d2SJouni Malinen * 28026039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 28031965c853SJouni Malinen * station mode. The driver is required to call either this function or 28041965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 2805cb0b4bebSJohannes Berg * call. This function may sleep. 28066039f6d2SJouni Malinen */ 2807cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 28086039f6d2SJouni Malinen 28096039f6d2SJouni Malinen /** 28101965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 28111965c853SJouni Malinen * @dev: network device 28121965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 2813cb0b4bebSJohannes Berg * 2814cb0b4bebSJohannes Berg * This function may sleep. 28151965c853SJouni Malinen */ 2816cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 28171965c853SJouni Malinen 28181965c853SJouni Malinen /** 28196039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 28206039f6d2SJouni Malinen * @dev: network device 282195de817bSJohannes Berg * @bss: the BSS struct association was requested for, the struct reference 282295de817bSJohannes Berg * is owned by cfg80211 after this call 28236039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 28246039f6d2SJouni Malinen * @len: length of the frame data 28256039f6d2SJouni Malinen * 28266039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 28271965c853SJouni Malinen * processed in station mode. The driver is required to call either this 28281965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 2829cb0b4bebSJohannes Berg * cfg80211_ops::assoc() call. This function may sleep. 28306039f6d2SJouni Malinen */ 283195de817bSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, 283295de817bSJohannes Berg const u8 *buf, size_t len); 28336039f6d2SJouni Malinen 28346039f6d2SJouni Malinen /** 28351965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 28361965c853SJouni Malinen * @dev: network device 28371965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 2838cb0b4bebSJohannes Berg * 2839cb0b4bebSJohannes Berg * This function may sleep. 28401965c853SJouni Malinen */ 2841cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 28421965c853SJouni Malinen 28431965c853SJouni Malinen /** 284453b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 28456039f6d2SJouni Malinen * @dev: network device 28466039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 28476039f6d2SJouni Malinen * @len: length of the frame data 28486039f6d2SJouni Malinen * 28496039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 285053b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 2851cb0b4bebSJohannes Berg * locally generated ones. This function may sleep. 28526039f6d2SJouni Malinen */ 2853ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 2854ce470613SHolger Schurig 2855ce470613SHolger Schurig /** 2856ce470613SHolger Schurig * __cfg80211_send_deauth - notification of processed deauthentication 2857ce470613SHolger Schurig * @dev: network device 2858ce470613SHolger Schurig * @buf: deauthentication frame (header + body) 2859ce470613SHolger Schurig * @len: length of the frame data 2860ce470613SHolger Schurig * 2861ce470613SHolger Schurig * Like cfg80211_send_deauth(), but doesn't take the wdev lock. 2862ce470613SHolger Schurig */ 2863ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 28646039f6d2SJouni Malinen 28656039f6d2SJouni Malinen /** 286653b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 28676039f6d2SJouni Malinen * @dev: network device 28686039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 28696039f6d2SJouni Malinen * @len: length of the frame data 28706039f6d2SJouni Malinen * 28716039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 287253b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 2873cb0b4bebSJohannes Berg * generated ones. This function may sleep. 28746039f6d2SJouni Malinen */ 2875ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); 2876ce470613SHolger Schurig 2877ce470613SHolger Schurig /** 2878ce470613SHolger Schurig * __cfg80211_send_disassoc - notification of processed disassociation 2879ce470613SHolger Schurig * @dev: network device 2880ce470613SHolger Schurig * @buf: disassociation response frame (header + body) 2881ce470613SHolger Schurig * @len: length of the frame data 2882ce470613SHolger Schurig * 2883ce470613SHolger Schurig * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. 2884ce470613SHolger Schurig */ 2885ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 2886ce470613SHolger Schurig size_t len); 28876039f6d2SJouni Malinen 2888a08c1c1aSKalle Valo /** 2889cf4e594eSJouni Malinen * cfg80211_send_unprot_deauth - notification of unprotected deauthentication 2890cf4e594eSJouni Malinen * @dev: network device 2891cf4e594eSJouni Malinen * @buf: deauthentication frame (header + body) 2892cf4e594eSJouni Malinen * @len: length of the frame data 2893cf4e594eSJouni Malinen * 2894cf4e594eSJouni Malinen * This function is called whenever a received Deauthentication frame has been 2895cf4e594eSJouni Malinen * dropped in station mode because of MFP being used but the Deauthentication 2896cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 2897cf4e594eSJouni Malinen */ 2898cf4e594eSJouni Malinen void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, 2899cf4e594eSJouni Malinen size_t len); 2900cf4e594eSJouni Malinen 2901cf4e594eSJouni Malinen /** 2902cf4e594eSJouni Malinen * cfg80211_send_unprot_disassoc - notification of unprotected disassociation 2903cf4e594eSJouni Malinen * @dev: network device 2904cf4e594eSJouni Malinen * @buf: disassociation frame (header + body) 2905cf4e594eSJouni Malinen * @len: length of the frame data 2906cf4e594eSJouni Malinen * 2907cf4e594eSJouni Malinen * This function is called whenever a received Disassociation frame has been 2908cf4e594eSJouni Malinen * dropped in station mode because of MFP being used but the Disassociation 2909cf4e594eSJouni Malinen * frame was not protected. This function may sleep. 2910cf4e594eSJouni Malinen */ 2911cf4e594eSJouni Malinen void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, 2912cf4e594eSJouni Malinen size_t len); 2913cf4e594eSJouni Malinen 2914cf4e594eSJouni Malinen /** 2915a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 2916a3b8b056SJouni Malinen * @dev: network device 2917a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 2918a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 2919a66b98dbSArik Nemtsov * @key_id: Key identifier (0..3). Can be -1 if missing. 2920a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 2921e6d6e342SJohannes Berg * @gfp: allocation flags 2922a3b8b056SJouni Malinen * 2923a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 2924a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 2925a3b8b056SJouni Malinen * primitive. 2926a3b8b056SJouni Malinen */ 2927a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 2928a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 2929e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 2930a3b8b056SJouni Malinen 293104a773adSJohannes Berg /** 293204a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 293304a773adSJohannes Berg * 293404a773adSJohannes Berg * @dev: network device 293504a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 293604a773adSJohannes Berg * @gfp: allocation flags 293704a773adSJohannes Berg * 293804a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 293904a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 294004a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 294104a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 294204a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 294304a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 294404a773adSJohannes Berg */ 294504a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 294604a773adSJohannes Berg 29471f87f7d3SJohannes Berg /** 2948c93b5e71SJavier Cardona * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 2949c93b5e71SJavier Cardona * 2950c93b5e71SJavier Cardona * @dev: network device 2951c93b5e71SJavier Cardona * @macaddr: the MAC address of the new candidate 2952c93b5e71SJavier Cardona * @ie: information elements advertised by the peer candidate 2953c93b5e71SJavier Cardona * @ie_len: lenght of the information elements buffer 2954c93b5e71SJavier Cardona * @gfp: allocation flags 2955c93b5e71SJavier Cardona * 2956c93b5e71SJavier Cardona * This function notifies cfg80211 that the mesh peer candidate has been 2957c93b5e71SJavier Cardona * detected, most likely via a beacon or, less likely, via a probe response. 2958c93b5e71SJavier Cardona * cfg80211 then sends a notification to userspace. 2959c93b5e71SJavier Cardona */ 2960c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev, 2961c93b5e71SJavier Cardona const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); 2962c93b5e71SJavier Cardona 2963c93b5e71SJavier Cardona /** 2964d70e9693SJohannes Berg * DOC: RFkill integration 2965d70e9693SJohannes Berg * 2966d70e9693SJohannes Berg * RFkill integration in cfg80211 is almost invisible to drivers, 2967d70e9693SJohannes Berg * as cfg80211 automatically registers an rfkill instance for each 2968d70e9693SJohannes Berg * wireless device it knows about. Soft kill is also translated 2969d70e9693SJohannes Berg * into disconnecting and turning all interfaces off, drivers are 2970d70e9693SJohannes Berg * expected to turn off the device when all interfaces are down. 2971d70e9693SJohannes Berg * 2972d70e9693SJohannes Berg * However, devices may have a hard RFkill line, in which case they 2973d70e9693SJohannes Berg * also need to interact with the rfkill subsystem, via cfg80211. 2974d70e9693SJohannes Berg * They can do this with a few helper functions documented here. 2975d70e9693SJohannes Berg */ 2976d70e9693SJohannes Berg 2977d70e9693SJohannes Berg /** 29781f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 29791f87f7d3SJohannes Berg * @wiphy: the wiphy 29801f87f7d3SJohannes Berg * @blocked: block status 29811f87f7d3SJohannes Berg */ 29821f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 29831f87f7d3SJohannes Berg 29841f87f7d3SJohannes Berg /** 29851f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 29861f87f7d3SJohannes Berg * @wiphy: the wiphy 29871f87f7d3SJohannes Berg */ 29881f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 29891f87f7d3SJohannes Berg 29901f87f7d3SJohannes Berg /** 29911f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 29921f87f7d3SJohannes Berg * @wiphy: the wiphy 29931f87f7d3SJohannes Berg */ 29941f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 29951f87f7d3SJohannes Berg 2996aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2997aff89a9bSJohannes Berg /** 2998d70e9693SJohannes Berg * DOC: Test mode 2999d70e9693SJohannes Berg * 3000d70e9693SJohannes Berg * Test mode is a set of utility functions to allow drivers to 3001d70e9693SJohannes Berg * interact with driver-specific tools to aid, for instance, 3002d70e9693SJohannes Berg * factory programming. 3003d70e9693SJohannes Berg * 3004d70e9693SJohannes Berg * This chapter describes how drivers interact with it, for more 3005d70e9693SJohannes Berg * information see the nl80211 book's chapter on it. 3006d70e9693SJohannes Berg */ 3007d70e9693SJohannes Berg 3008d70e9693SJohannes Berg /** 3009aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 3010aff89a9bSJohannes Berg * @wiphy: the wiphy 3011aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 3012aff89a9bSJohannes Berg * be put into the skb 3013aff89a9bSJohannes Berg * 3014aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 3015aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 3016aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 3017aff89a9bSJohannes Berg * 3018aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is pre-filled 3019aff89a9bSJohannes Berg * with the wiphy index and set up in a way that any data that is 3020aff89a9bSJohannes Berg * put into the skb (with skb_put(), nla_put() or similar) will end 3021aff89a9bSJohannes Berg * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 3022aff89a9bSJohannes Berg * needs to be done with the skb is adding data for the corresponding 3023aff89a9bSJohannes Berg * userspace tool which can then read that data out of the testdata 3024aff89a9bSJohannes Berg * attribute. You must not modify the skb in any other way. 3025aff89a9bSJohannes Berg * 3026aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 3027aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 3028aff89a9bSJohannes Berg */ 3029aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 3030aff89a9bSJohannes Berg int approxlen); 3031aff89a9bSJohannes Berg 3032aff89a9bSJohannes Berg /** 3033aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 3034aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 3035aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 3036aff89a9bSJohannes Berg * 3037aff89a9bSJohannes Berg * Returns an error code or 0 on success, since calling this 3038aff89a9bSJohannes Berg * function will usually be the last thing before returning 3039aff89a9bSJohannes Berg * from the @testmode_cmd you should return the error code. 3040aff89a9bSJohannes Berg * Note that this function consumes the skb regardless of the 3041aff89a9bSJohannes Berg * return value. 3042aff89a9bSJohannes Berg */ 3043aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb); 3044aff89a9bSJohannes Berg 3045aff89a9bSJohannes Berg /** 3046aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 3047aff89a9bSJohannes Berg * @wiphy: the wiphy 3048aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 3049aff89a9bSJohannes Berg * be put into the skb 3050aff89a9bSJohannes Berg * @gfp: allocation flags 3051aff89a9bSJohannes Berg * 3052aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 3053aff89a9bSJohannes Berg * testmode multicast group. 3054aff89a9bSJohannes Berg * 3055aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is set up in the 3056aff89a9bSJohannes Berg * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 3057aff89a9bSJohannes Berg * for an event. As there, you should simply add data to it that will 3058aff89a9bSJohannes Berg * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 3059aff89a9bSJohannes Berg * not modify the skb in any other way. 3060aff89a9bSJohannes Berg * 3061aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 3062aff89a9bSJohannes Berg * skb to send the event. 3063aff89a9bSJohannes Berg */ 3064aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 3065aff89a9bSJohannes Berg int approxlen, gfp_t gfp); 3066aff89a9bSJohannes Berg 3067aff89a9bSJohannes Berg /** 3068aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 3069aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 3070aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 3071aff89a9bSJohannes Berg * @gfp: allocation flags 3072aff89a9bSJohannes Berg * 3073aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 3074aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 3075aff89a9bSJohannes Berg * consumes it. 3076aff89a9bSJohannes Berg */ 3077aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 3078aff89a9bSJohannes Berg 3079aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 308071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 3081aff89a9bSJohannes Berg #else 3082aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 308371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd) 3084aff89a9bSJohannes Berg #endif 3085aff89a9bSJohannes Berg 3086b23aa676SSamuel Ortiz /** 3087b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 3088b23aa676SSamuel Ortiz * 3089b23aa676SSamuel Ortiz * @dev: network device 3090b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 3091b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 3092b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 3093b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 3094b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 3095b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 3096b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 3097b23aa676SSamuel Ortiz * the real status code for failures. 3098b23aa676SSamuel Ortiz * @gfp: allocation flags 3099b23aa676SSamuel Ortiz * 3100b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 3101b23aa676SSamuel Ortiz * succeeded. 3102b23aa676SSamuel Ortiz */ 3103b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 3104b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 3105b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 3106b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 3107b23aa676SSamuel Ortiz 3108b23aa676SSamuel Ortiz /** 3109b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 3110b23aa676SSamuel Ortiz * 3111b23aa676SSamuel Ortiz * @dev: network device 3112ed9d0102SJouni Malinen * @channel: the channel of the new AP 3113b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 3114b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 3115b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 3116b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 3117b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 3118b23aa676SSamuel Ortiz * @gfp: allocation flags 3119b23aa676SSamuel Ortiz * 3120b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 3121b23aa676SSamuel Ortiz * from one AP to another while connected. 3122b23aa676SSamuel Ortiz */ 3123ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev, 3124ed9d0102SJouni Malinen struct ieee80211_channel *channel, 3125ed9d0102SJouni Malinen const u8 *bssid, 3126b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 3127b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 3128b23aa676SSamuel Ortiz 3129b23aa676SSamuel Ortiz /** 3130adbde344SVasanthakumar Thiagarajan * cfg80211_roamed_bss - notify cfg80211 of roaming 3131adbde344SVasanthakumar Thiagarajan * 3132adbde344SVasanthakumar Thiagarajan * @dev: network device 3133adbde344SVasanthakumar Thiagarajan * @bss: entry of bss to which STA got roamed 3134adbde344SVasanthakumar Thiagarajan * @req_ie: association request IEs (maybe be %NULL) 3135adbde344SVasanthakumar Thiagarajan * @req_ie_len: association request IEs length 3136adbde344SVasanthakumar Thiagarajan * @resp_ie: association response IEs (may be %NULL) 3137adbde344SVasanthakumar Thiagarajan * @resp_ie_len: assoc response IEs length 3138adbde344SVasanthakumar Thiagarajan * @gfp: allocation flags 3139adbde344SVasanthakumar Thiagarajan * 3140adbde344SVasanthakumar Thiagarajan * This is just a wrapper to notify cfg80211 of roaming event with driver 3141adbde344SVasanthakumar Thiagarajan * passing bss to avoid a race in timeout of the bss entry. It should be 3142adbde344SVasanthakumar Thiagarajan * called by the underlying driver whenever it roamed from one AP to another 3143adbde344SVasanthakumar Thiagarajan * while connected. Drivers which have roaming implemented in firmware 3144adbde344SVasanthakumar Thiagarajan * may use this function to avoid a race in bss entry timeout where the bss 3145adbde344SVasanthakumar Thiagarajan * entry of the new AP is seen in the driver, but gets timed out by the time 3146adbde344SVasanthakumar Thiagarajan * it is accessed in __cfg80211_roamed() due to delay in scheduling 3147adbde344SVasanthakumar Thiagarajan * rdev->event_work. In case of any failures, the reference is released 3148adbde344SVasanthakumar Thiagarajan * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, 3149adbde344SVasanthakumar Thiagarajan * it will be released while diconneting from the current bss. 3150adbde344SVasanthakumar Thiagarajan */ 3151adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, 3152adbde344SVasanthakumar Thiagarajan const u8 *req_ie, size_t req_ie_len, 3153adbde344SVasanthakumar Thiagarajan const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 3154adbde344SVasanthakumar Thiagarajan 3155adbde344SVasanthakumar Thiagarajan /** 3156b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 3157b23aa676SSamuel Ortiz * 3158b23aa676SSamuel Ortiz * @dev: network device 3159b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 3160b23aa676SSamuel Ortiz * @ie_len: length of IEs 3161b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 3162b23aa676SSamuel Ortiz * @gfp: allocation flags 3163b23aa676SSamuel Ortiz * 3164b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 3165b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 3166b23aa676SSamuel Ortiz */ 3167b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 3168b23aa676SSamuel Ortiz u8 *ie, size_t ie_len, gfp_t gfp); 3169b23aa676SSamuel Ortiz 31709588bbd5SJouni Malinen /** 31719588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 31729588bbd5SJouni Malinen * @dev: network device 31739588bbd5SJouni Malinen * @cookie: the request cookie 31749588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 31759588bbd5SJouni Malinen * @channel_type: Channel type 31769588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 31779588bbd5SJouni Malinen * channel 31789588bbd5SJouni Malinen * @gfp: allocation flags 31799588bbd5SJouni Malinen */ 31809588bbd5SJouni Malinen void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 31819588bbd5SJouni Malinen struct ieee80211_channel *chan, 31829588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 31839588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 31849588bbd5SJouni Malinen 31859588bbd5SJouni Malinen /** 31869588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 31879588bbd5SJouni Malinen * @dev: network device 31889588bbd5SJouni Malinen * @cookie: the request cookie 31899588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 31909588bbd5SJouni Malinen * @channel_type: Channel type 31919588bbd5SJouni Malinen * @gfp: allocation flags 31929588bbd5SJouni Malinen */ 31939588bbd5SJouni Malinen void cfg80211_remain_on_channel_expired(struct net_device *dev, 31949588bbd5SJouni Malinen u64 cookie, 31959588bbd5SJouni Malinen struct ieee80211_channel *chan, 31969588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 31979588bbd5SJouni Malinen gfp_t gfp); 3198b23aa676SSamuel Ortiz 319998b62183SJohannes Berg 320098b62183SJohannes Berg /** 320198b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 320298b62183SJohannes Berg * 320398b62183SJohannes Berg * @dev: the netdev 320498b62183SJohannes Berg * @mac_addr: the station's address 320598b62183SJohannes Berg * @sinfo: the station information 320698b62183SJohannes Berg * @gfp: allocation flags 320798b62183SJohannes Berg */ 320898b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 320998b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 321098b62183SJohannes Berg 3211026331c4SJouni Malinen /** 3212ec15e68bSJouni Malinen * cfg80211_del_sta - notify userspace about deletion of a station 3213ec15e68bSJouni Malinen * 3214ec15e68bSJouni Malinen * @dev: the netdev 3215ec15e68bSJouni Malinen * @mac_addr: the station's address 3216ec15e68bSJouni Malinen * @gfp: allocation flags 3217ec15e68bSJouni Malinen */ 3218ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 3219ec15e68bSJouni Malinen 3220ec15e68bSJouni Malinen /** 32212e161f78SJohannes Berg * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3222026331c4SJouni Malinen * @dev: network device 3223026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 3224804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 32252e161f78SJohannes Berg * @buf: Management frame (header + body) 3226026331c4SJouni Malinen * @len: length of the frame data 3227026331c4SJouni Malinen * @gfp: context flags 32282e161f78SJohannes Berg * 32292e161f78SJohannes Berg * Returns %true if a user space application has registered for this frame. 32302e161f78SJohannes Berg * For action frames, that makes it responsible for rejecting unrecognized 32312e161f78SJohannes Berg * action frames; %false otherwise, in which case for action frames the 32322e161f78SJohannes Berg * driver is responsible for rejecting the frame. 3233026331c4SJouni Malinen * 3234026331c4SJouni Malinen * This function is called whenever an Action frame is received for a station 3235026331c4SJouni Malinen * mode interface, but is not processed in kernel. 3236026331c4SJouni Malinen */ 3237804483e9SJohannes Berg bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, 3238804483e9SJohannes Berg const u8 *buf, size_t len, gfp_t gfp); 3239026331c4SJouni Malinen 3240026331c4SJouni Malinen /** 32412e161f78SJohannes Berg * cfg80211_mgmt_tx_status - notification of TX status for management frame 3242026331c4SJouni Malinen * @dev: network device 32432e161f78SJohannes Berg * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 32442e161f78SJohannes Berg * @buf: Management frame (header + body) 3245026331c4SJouni Malinen * @len: length of the frame data 3246026331c4SJouni Malinen * @ack: Whether frame was acknowledged 3247026331c4SJouni Malinen * @gfp: context flags 3248026331c4SJouni Malinen * 32492e161f78SJohannes Berg * This function is called whenever a management frame was requested to be 32502e161f78SJohannes Berg * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 3251026331c4SJouni Malinen * transmission attempt. 3252026331c4SJouni Malinen */ 32532e161f78SJohannes Berg void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, 3254026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 3255026331c4SJouni Malinen 3256d6dc1a38SJuuso Oikarinen 3257d6dc1a38SJuuso Oikarinen /** 3258d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 3259d6dc1a38SJuuso Oikarinen * @dev: network device 3260d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 3261d6dc1a38SJuuso Oikarinen * @gfp: context flags 3262d6dc1a38SJuuso Oikarinen * 3263d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 3264d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 3265d6dc1a38SJuuso Oikarinen */ 3266d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 3267d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 3268d6dc1a38SJuuso Oikarinen gfp_t gfp); 3269d6dc1a38SJuuso Oikarinen 3270c063dbf5SJohannes Berg /** 3271c063dbf5SJohannes Berg * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 3272c063dbf5SJohannes Berg * @dev: network device 3273c063dbf5SJohannes Berg * @peer: peer's MAC address 3274c063dbf5SJohannes Berg * @num_packets: how many packets were lost -- should be a fixed threshold 3275c063dbf5SJohannes Berg * but probably no less than maybe 50, or maybe a throughput dependent 3276c063dbf5SJohannes Berg * threshold (to account for temporary interference) 3277c063dbf5SJohannes Berg * @gfp: context flags 3278c063dbf5SJohannes Berg */ 3279c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev, 3280c063dbf5SJohannes Berg const u8 *peer, u32 num_packets, gfp_t gfp); 3281c063dbf5SJohannes Berg 3282e5497d76SJohannes Berg /** 3283e5497d76SJohannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 3284e5497d76SJohannes Berg * @dev: network device 3285e5497d76SJohannes Berg * @bssid: BSSID of AP (to avoid races) 3286e5497d76SJohannes Berg * @replay_ctr: new replay counter 3287af71ff85SJohannes Berg * @gfp: allocation flags 3288e5497d76SJohannes Berg */ 3289e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, 3290e5497d76SJohannes Berg const u8 *replay_ctr, gfp_t gfp); 3291e5497d76SJohannes Berg 3292c9df56b4SJouni Malinen /** 3293c9df56b4SJouni Malinen * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate 3294c9df56b4SJouni Malinen * @dev: network device 3295c9df56b4SJouni Malinen * @index: candidate index (the smaller the index, the higher the priority) 3296c9df56b4SJouni Malinen * @bssid: BSSID of AP 3297c9df56b4SJouni Malinen * @preauth: Whether AP advertises support for RSN pre-authentication 3298c9df56b4SJouni Malinen * @gfp: allocation flags 3299c9df56b4SJouni Malinen */ 3300c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 3301c9df56b4SJouni Malinen const u8 *bssid, bool preauth, gfp_t gfp); 3302c9df56b4SJouni Malinen 330328946da7SJohannes Berg /** 330428946da7SJohannes Berg * cfg80211_rx_spurious_frame - inform userspace about a spurious frame 330528946da7SJohannes Berg * @dev: The device the frame matched to 330628946da7SJohannes Berg * @addr: the transmitter address 330728946da7SJohannes Berg * @gfp: context flags 330828946da7SJohannes Berg * 330928946da7SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 331028946da7SJohannes Berg * a spurious class 3 frame was received, to be able to deauth the 331128946da7SJohannes Berg * sender. 331228946da7SJohannes Berg * Returns %true if the frame was passed to userspace (or this failed 331328946da7SJohannes Berg * for a reason other than not having a subscription.) 331428946da7SJohannes Berg */ 331528946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev, 331628946da7SJohannes Berg const u8 *addr, gfp_t gfp); 331728946da7SJohannes Berg 33187f6cf311SJohannes Berg /** 3319b92ab5d8SJohannes Berg * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame 3320b92ab5d8SJohannes Berg * @dev: The device the frame matched to 3321b92ab5d8SJohannes Berg * @addr: the transmitter address 3322b92ab5d8SJohannes Berg * @gfp: context flags 3323b92ab5d8SJohannes Berg * 3324b92ab5d8SJohannes Berg * This function is used in AP mode (only!) to inform userspace that 3325b92ab5d8SJohannes Berg * an associated station sent a 4addr frame but that wasn't expected. 3326b92ab5d8SJohannes Berg * It is allowed and desirable to send this event only once for each 3327b92ab5d8SJohannes Berg * station to avoid event flooding. 3328b92ab5d8SJohannes Berg * Returns %true if the frame was passed to userspace (or this failed 3329b92ab5d8SJohannes Berg * for a reason other than not having a subscription.) 3330b92ab5d8SJohannes Berg */ 3331b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, 3332b92ab5d8SJohannes Berg const u8 *addr, gfp_t gfp); 3333b92ab5d8SJohannes Berg 3334b92ab5d8SJohannes Berg /** 33357f6cf311SJohannes Berg * cfg80211_probe_status - notify userspace about probe status 33367f6cf311SJohannes Berg * @dev: the device the probe was sent on 33377f6cf311SJohannes Berg * @addr: the address of the peer 33387f6cf311SJohannes Berg * @cookie: the cookie filled in @probe_client previously 33397f6cf311SJohannes Berg * @acked: indicates whether probe was acked or not 33407f6cf311SJohannes Berg * @gfp: allocation flags 33417f6cf311SJohannes Berg */ 33427f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr, 33437f6cf311SJohannes Berg u64 cookie, bool acked, gfp_t gfp); 33447f6cf311SJohannes Berg 33455e760230SJohannes Berg /** 33465e760230SJohannes Berg * cfg80211_report_obss_beacon - report beacon from other APs 33475e760230SJohannes Berg * @wiphy: The wiphy that received the beacon 33485e760230SJohannes Berg * @frame: the frame 33495e760230SJohannes Berg * @len: length of the frame 33505e760230SJohannes Berg * @freq: frequency the frame was received on 3351804483e9SJohannes Berg * @sig_dbm: signal strength in mBm, or 0 if unknown 33525e760230SJohannes Berg * @gfp: allocation flags 33535e760230SJohannes Berg * 33545e760230SJohannes Berg * Use this function to report to userspace when a beacon was 33555e760230SJohannes Berg * received. It is not useful to call this when there is no 33565e760230SJohannes Berg * netdev that is in AP/GO mode. 33575e760230SJohannes Berg */ 33585e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy, 33595e760230SJohannes Berg const u8 *frame, size_t len, 3360804483e9SJohannes Berg int freq, int sig_dbm, gfp_t gfp); 33615e760230SJohannes Berg 336254858ee5SAlexander Simon /* 336354858ee5SAlexander Simon * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 336454858ee5SAlexander Simon * @wiphy: the wiphy 336554858ee5SAlexander Simon * @chan: main channel 336654858ee5SAlexander Simon * @channel_type: HT mode 336754858ee5SAlexander Simon */ 3368*294a20e0SJohannes Berg bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, 336954858ee5SAlexander Simon struct ieee80211_channel *chan, 337054858ee5SAlexander Simon enum nl80211_channel_type channel_type); 337154858ee5SAlexander Simon 33728097e149SThomas Pedersen /* 33735314526bSThomas Pedersen * cfg80211_ch_switch_notify - update wdev channel and notify userspace 33745314526bSThomas Pedersen * @dev: the device which switched channels 33755314526bSThomas Pedersen * @freq: new channel frequency (in MHz) 33765314526bSThomas Pedersen * @type: channel type 33775314526bSThomas Pedersen * 33785314526bSThomas Pedersen * Acquires wdev_lock, so must only be called from sleepable driver context! 33795314526bSThomas Pedersen */ 33805314526bSThomas Pedersen void cfg80211_ch_switch_notify(struct net_device *dev, int freq, 33815314526bSThomas Pedersen enum nl80211_channel_type type); 33825314526bSThomas Pedersen 33835314526bSThomas Pedersen /* 33848097e149SThomas Pedersen * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 33858097e149SThomas Pedersen * @rate: given rate_info to calculate bitrate from 33868097e149SThomas Pedersen * 33878097e149SThomas Pedersen * return 0 if MCS index >= 32 33888097e149SThomas Pedersen */ 33898097e149SThomas Pedersen u16 cfg80211_calculate_bitrate(struct rate_info *rate); 33908097e149SThomas Pedersen 3391e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */ 3392e1db74fcSJoe Perches 3393e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */ 3394e1db74fcSJoe Perches 3395e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...) \ 33969c376639SJoe Perches dev_printk(level, &(wiphy)->dev, format, ##args) 3397e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...) \ 33989c376639SJoe Perches dev_emerg(&(wiphy)->dev, format, ##args) 3399e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...) \ 34009c376639SJoe Perches dev_alert(&(wiphy)->dev, format, ##args) 3401e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...) \ 34029c376639SJoe Perches dev_crit(&(wiphy)->dev, format, ##args) 3403e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...) \ 34049c376639SJoe Perches dev_err(&(wiphy)->dev, format, ##args) 3405e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...) \ 34069c376639SJoe Perches dev_warn(&(wiphy)->dev, format, ##args) 3407e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...) \ 34089c376639SJoe Perches dev_notice(&(wiphy)->dev, format, ##args) 3409e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...) \ 34109c376639SJoe Perches dev_info(&(wiphy)->dev, format, ##args) 3411073730d7SJoe Perches 34129c376639SJoe Perches #define wiphy_debug(wiphy, format, args...) \ 3413e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args) 34149c376639SJoe Perches 3415e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...) \ 34169c376639SJoe Perches dev_dbg(&(wiphy)->dev, format, ##args) 3417e1db74fcSJoe Perches 3418e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG) 3419e1db74fcSJoe Perches #define wiphy_vdbg wiphy_dbg 3420e1db74fcSJoe Perches #else 3421e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...) \ 3422e1db74fcSJoe Perches ({ \ 3423e1db74fcSJoe Perches if (0) \ 3424e1db74fcSJoe Perches wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ 3425e1db74fcSJoe Perches 0; \ 3426e1db74fcSJoe Perches }) 3427e1db74fcSJoe Perches #endif 3428e1db74fcSJoe Perches 3429e1db74fcSJoe Perches /* 3430e1db74fcSJoe Perches * wiphy_WARN() acts like wiphy_printk(), but with the key difference 3431e1db74fcSJoe Perches * of using a WARN/WARN_ON to get the message out, including the 3432e1db74fcSJoe Perches * file/line information and a backtrace. 3433e1db74fcSJoe Perches */ 3434e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...) \ 3435e1db74fcSJoe Perches WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); 3436e1db74fcSJoe Perches 3437704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 3438