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> 16704232c2SJohannes Berg #include <linux/netlink.h> 17704232c2SJohannes Berg #include <linux/skbuff.h> 1855682965SJohannes Berg #include <linux/nl80211.h> 192a519311SJohannes Berg #include <linux/if_ether.h> 202a519311SJohannes Berg #include <linux/ieee80211.h> 21d3236553SJohannes Berg #include <net/regulatory.h> 22d3236553SJohannes Berg 23fee52678SJohannes Berg /* remove once we remove the wext stuff */ 24d3236553SJohannes Berg #include <net/iw_handler.h> 25d3236553SJohannes Berg #include <linux/wireless.h> 26d3236553SJohannes Berg 27704232c2SJohannes Berg 28704232c2SJohannes Berg /* 29d3236553SJohannes Berg * wireless hardware capability structures 30d3236553SJohannes Berg */ 31d3236553SJohannes Berg 32d3236553SJohannes Berg /** 33d3236553SJohannes Berg * enum ieee80211_band - supported frequency bands 34704232c2SJohannes Berg * 35d3236553SJohannes Berg * The bands are assigned this way because the supported 36d3236553SJohannes Berg * bitrates differ in these bands. 37d3236553SJohannes Berg * 38d3236553SJohannes Berg * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 39d3236553SJohannes Berg * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 40d3236553SJohannes Berg */ 41d3236553SJohannes Berg enum ieee80211_band { 4213ae75b1SJouni Malinen IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 4313ae75b1SJouni Malinen IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 44d3236553SJohannes Berg 45d3236553SJohannes Berg /* keep last */ 46d3236553SJohannes Berg IEEE80211_NUM_BANDS 47d3236553SJohannes Berg }; 48d3236553SJohannes Berg 49d3236553SJohannes Berg /** 50d3236553SJohannes Berg * enum ieee80211_channel_flags - channel flags 51d3236553SJohannes Berg * 52d3236553SJohannes Berg * Channel flags set by the regulatory control code. 53d3236553SJohannes Berg * 54d3236553SJohannes Berg * @IEEE80211_CHAN_DISABLED: This channel is disabled. 55d3236553SJohannes Berg * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted 56d3236553SJohannes Berg * on this channel. 57d3236553SJohannes Berg * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. 58d3236553SJohannes Berg * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 59689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 60d3236553SJohannes Berg * is not permitted. 61689da1b3SLuis R. Rodriguez * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 62d3236553SJohannes Berg * is not permitted. 63d3236553SJohannes Berg */ 64d3236553SJohannes Berg enum ieee80211_channel_flags { 65d3236553SJohannes Berg IEEE80211_CHAN_DISABLED = 1<<0, 66d3236553SJohannes Berg IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, 67d3236553SJohannes Berg IEEE80211_CHAN_NO_IBSS = 1<<2, 68d3236553SJohannes Berg IEEE80211_CHAN_RADAR = 1<<3, 69689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 70689da1b3SLuis R. Rodriguez IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 71d3236553SJohannes Berg }; 72d3236553SJohannes Berg 73038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \ 74689da1b3SLuis R. Rodriguez (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 75038659e7SLuis R. Rodriguez 76d3236553SJohannes Berg /** 77d3236553SJohannes Berg * struct ieee80211_channel - channel definition 78d3236553SJohannes Berg * 79d3236553SJohannes Berg * This structure describes a single channel for use 80d3236553SJohannes Berg * with cfg80211. 81d3236553SJohannes Berg * 82d3236553SJohannes Berg * @center_freq: center frequency in MHz 83d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 84d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 85d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 86d3236553SJohannes Berg * code to support devices with additional restrictions 87d3236553SJohannes Berg * @band: band this channel belongs to. 88d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 89d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 90d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 91d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 92d3236553SJohannes Berg * to enable this, this is is useful only on 5 GHz band. 93d3236553SJohannes Berg * @orig_mag: internal use 94d3236553SJohannes Berg * @orig_mpwr: internal use 95d3236553SJohannes Berg */ 96d3236553SJohannes Berg struct ieee80211_channel { 97d3236553SJohannes Berg enum ieee80211_band band; 98d3236553SJohannes Berg u16 center_freq; 99d3236553SJohannes Berg u16 hw_value; 100d3236553SJohannes Berg u32 flags; 101d3236553SJohannes Berg int max_antenna_gain; 102d3236553SJohannes Berg int max_power; 103d3236553SJohannes Berg bool beacon_found; 104d3236553SJohannes Berg u32 orig_flags; 105d3236553SJohannes Berg int orig_mag, orig_mpwr; 106d3236553SJohannes Berg }; 107d3236553SJohannes Berg 108d3236553SJohannes Berg /** 109d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 110d3236553SJohannes Berg * 111d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 112d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 113d3236553SJohannes Berg * different bands/PHY modes. 114d3236553SJohannes Berg * 115d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 116d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 117d3236553SJohannes Berg * with CCK rates. 118d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 119d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 120d3236553SJohannes Berg * core code when registering the wiphy. 121d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 122d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 123d3236553SJohannes Berg * core code when registering the wiphy. 124d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 125d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 126d3236553SJohannes Berg * core code when registering the wiphy. 127d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 128d3236553SJohannes Berg */ 129d3236553SJohannes Berg enum ieee80211_rate_flags { 130d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 131d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 132d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 133d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 134d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 135d3236553SJohannes Berg }; 136d3236553SJohannes Berg 137d3236553SJohannes Berg /** 138d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 139d3236553SJohannes Berg * 140d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 141d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 142d3236553SJohannes Berg * are only for driver use when pointers to this structure are 143d3236553SJohannes Berg * passed around. 144d3236553SJohannes Berg * 145d3236553SJohannes Berg * @flags: rate-specific flags 146d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 147d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 148d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 149d3236553SJohannes Berg * short preamble is used 150d3236553SJohannes Berg */ 151d3236553SJohannes Berg struct ieee80211_rate { 152d3236553SJohannes Berg u32 flags; 153d3236553SJohannes Berg u16 bitrate; 154d3236553SJohannes Berg u16 hw_value, hw_value_short; 155d3236553SJohannes Berg }; 156d3236553SJohannes Berg 157d3236553SJohannes Berg /** 158d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 159d3236553SJohannes Berg * 160d3236553SJohannes Berg * This structure describes most essential parameters needed 161d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 162d3236553SJohannes Berg * 163d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 164d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 165d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 166d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 167d3236553SJohannes Berg * @mcs: Supported MCS rates 168d3236553SJohannes Berg */ 169d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 170d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 171d3236553SJohannes Berg bool ht_supported; 172d3236553SJohannes Berg u8 ampdu_factor; 173d3236553SJohannes Berg u8 ampdu_density; 174d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 175d3236553SJohannes Berg }; 176d3236553SJohannes Berg 177d3236553SJohannes Berg /** 178d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 179d3236553SJohannes Berg * 180d3236553SJohannes Berg * This structure describes a frequency band a wiphy 181d3236553SJohannes Berg * is able to operate in. 182d3236553SJohannes Berg * 183d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 184d3236553SJohannes Berg * in this band. 185d3236553SJohannes Berg * @band: the band this structure represents 186d3236553SJohannes Berg * @n_channels: Number of channels in @channels 187d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 188d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 189d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 190d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 191d3236553SJohannes Berg */ 192d3236553SJohannes Berg struct ieee80211_supported_band { 193d3236553SJohannes Berg struct ieee80211_channel *channels; 194d3236553SJohannes Berg struct ieee80211_rate *bitrates; 195d3236553SJohannes Berg enum ieee80211_band band; 196d3236553SJohannes Berg int n_channels; 197d3236553SJohannes Berg int n_bitrates; 198d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 199d3236553SJohannes Berg }; 200d3236553SJohannes Berg 201d3236553SJohannes Berg /* 202d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 203704232c2SJohannes Berg */ 204704232c2SJohannes Berg 2052ec600d6SLuis Carlos Cobo /** 2062ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 2072ec600d6SLuis Carlos Cobo * @mesh_id: mesh ID to use 2082ec600d6SLuis Carlos Cobo * @mesh_id_len: length of the mesh ID 2098b787643SFelix Fietkau * @use_4addr: use 4-address frames 2102ec600d6SLuis Carlos Cobo */ 2112ec600d6SLuis Carlos Cobo struct vif_params { 2122ec600d6SLuis Carlos Cobo u8 *mesh_id; 2132ec600d6SLuis Carlos Cobo int mesh_id_len; 2148b787643SFelix Fietkau int use_4addr; 2152ec600d6SLuis Carlos Cobo }; 2162ec600d6SLuis Carlos Cobo 21741ade00fSJohannes Berg /** 21841ade00fSJohannes Berg * struct key_params - key information 21941ade00fSJohannes Berg * 22041ade00fSJohannes Berg * Information about a key 22141ade00fSJohannes Berg * 22241ade00fSJohannes Berg * @key: key material 22341ade00fSJohannes Berg * @key_len: length of key material 22441ade00fSJohannes Berg * @cipher: cipher suite selector 22541ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 22641ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 22741ade00fSJohannes Berg * length given by @seq_len. 22841ade00fSJohannes Berg */ 22941ade00fSJohannes Berg struct key_params { 23041ade00fSJohannes Berg u8 *key; 23141ade00fSJohannes Berg u8 *seq; 23241ade00fSJohannes Berg int key_len; 23341ade00fSJohannes Berg int seq_len; 23441ade00fSJohannes Berg u32 cipher; 23541ade00fSJohannes Berg }; 23641ade00fSJohannes Berg 237ed1b6cc7SJohannes Berg /** 23861fa713cSHolger Schurig * enum survey_info_flags - survey information flags 23961fa713cSHolger Schurig * 24061fa713cSHolger Schurig * Used by the driver to indicate which info in &struct survey_info 24161fa713cSHolger Schurig * it has filled in during the get_survey(). 24261fa713cSHolger Schurig */ 24361fa713cSHolger Schurig enum survey_info_flags { 24461fa713cSHolger Schurig SURVEY_INFO_NOISE_DBM = 1<<0, 24561fa713cSHolger Schurig }; 24661fa713cSHolger Schurig 24761fa713cSHolger Schurig /** 24861fa713cSHolger Schurig * struct survey_info - channel survey response 24961fa713cSHolger Schurig * 25061fa713cSHolger Schurig * Used by dump_survey() to report back per-channel survey information. 25161fa713cSHolger Schurig * 25261fa713cSHolger Schurig * @channel: the channel this survey record reports, mandatory 25361fa713cSHolger Schurig * @filled: bitflag of flags from &enum survey_info_flags 25461fa713cSHolger Schurig * @noise: channel noise in dBm. This and all following fields are 25561fa713cSHolger Schurig * optional 25661fa713cSHolger Schurig * 25761fa713cSHolger Schurig * This structure can later be expanded with things like 25861fa713cSHolger Schurig * channel duty cycle etc. 25961fa713cSHolger Schurig */ 26061fa713cSHolger Schurig struct survey_info { 26161fa713cSHolger Schurig struct ieee80211_channel *channel; 26261fa713cSHolger Schurig u32 filled; 26361fa713cSHolger Schurig s8 noise; 26461fa713cSHolger Schurig }; 26561fa713cSHolger Schurig 26661fa713cSHolger Schurig /** 267ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 268ed1b6cc7SJohannes Berg * 269ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 270ed1b6cc7SJohannes Berg * 271ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 272ed1b6cc7SJohannes Berg * or %NULL if not changed 273ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 274ed1b6cc7SJohannes Berg * or %NULL if not changed 275ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 276ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 277ed1b6cc7SJohannes Berg * @head_len: length of @head 278ed1b6cc7SJohannes Berg * @tail_len: length of @tail 279ed1b6cc7SJohannes Berg */ 280ed1b6cc7SJohannes Berg struct beacon_parameters { 281ed1b6cc7SJohannes Berg u8 *head, *tail; 282ed1b6cc7SJohannes Berg int interval, dtim_period; 283ed1b6cc7SJohannes Berg int head_len, tail_len; 284ed1b6cc7SJohannes Berg }; 285ed1b6cc7SJohannes Berg 2865727ef1bSJohannes Berg /** 2872ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 2882ec600d6SLuis Carlos Cobo * 2892ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 2902ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 2912ec600d6SLuis Carlos Cobo * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 2922ec600d6SLuis Carlos Cobo */ 2932ec600d6SLuis Carlos Cobo enum plink_actions { 2942ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 2952ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 2962ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 2972ec600d6SLuis Carlos Cobo }; 2982ec600d6SLuis Carlos Cobo 2992ec600d6SLuis Carlos Cobo /** 3005727ef1bSJohannes Berg * struct station_parameters - station parameters 3015727ef1bSJohannes Berg * 3025727ef1bSJohannes Berg * Used to change and create a new station. 3035727ef1bSJohannes Berg * 3045727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 3055727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 3065727ef1bSJohannes Berg * (or NULL for no change) 3075727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 308eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 309eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 310eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 311eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 3125727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 3135727ef1bSJohannes Berg * @aid: AID or zero for no change 3145727ef1bSJohannes Berg */ 3155727ef1bSJohannes Berg struct station_parameters { 3165727ef1bSJohannes Berg u8 *supported_rates; 3175727ef1bSJohannes Berg struct net_device *vlan; 318eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 3195727ef1bSJohannes Berg int listen_interval; 3205727ef1bSJohannes Berg u16 aid; 3215727ef1bSJohannes Berg u8 supported_rates_len; 3222ec600d6SLuis Carlos Cobo u8 plink_action; 32336aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 3245727ef1bSJohannes Berg }; 3255727ef1bSJohannes Berg 326fd5b74dcSJohannes Berg /** 3272ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 328fd5b74dcSJohannes Berg * 3292ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 3302ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 331fd5b74dcSJohannes Berg * 3322ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 3332ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 3342ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 3352ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 3362ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 3372ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 338420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 339420e7fabSHenning Rogge * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 340420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 34198c8a60aSJouni Malinen * @STATION_INFO_RX_PACKETS: @rx_packets filled 34298c8a60aSJouni Malinen * @STATION_INFO_TX_PACKETS: @tx_packets filled 343fd5b74dcSJohannes Berg */ 3442ec600d6SLuis Carlos Cobo enum station_info_flags { 3452ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 3462ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 3472ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 3482ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 3492ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 3502ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 351420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 352420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 35398c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 35498c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 355420e7fabSHenning Rogge }; 356420e7fabSHenning Rogge 357420e7fabSHenning Rogge /** 358420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 359420e7fabSHenning Rogge * 360420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 361420e7fabSHenning Rogge * type for 802.11n transmissions. 362420e7fabSHenning Rogge * 363420e7fabSHenning Rogge * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 364420e7fabSHenning Rogge * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 365420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 366420e7fabSHenning Rogge */ 367420e7fabSHenning Rogge enum rate_info_flags { 368420e7fabSHenning Rogge RATE_INFO_FLAGS_MCS = 1<<0, 369420e7fabSHenning Rogge RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 370420e7fabSHenning Rogge RATE_INFO_FLAGS_SHORT_GI = 1<<2, 371420e7fabSHenning Rogge }; 372420e7fabSHenning Rogge 373420e7fabSHenning Rogge /** 374420e7fabSHenning Rogge * struct rate_info - bitrate information 375420e7fabSHenning Rogge * 376420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 377420e7fabSHenning Rogge * 378420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 379420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 380420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 381420e7fabSHenning Rogge */ 382420e7fabSHenning Rogge struct rate_info { 383420e7fabSHenning Rogge u8 flags; 384420e7fabSHenning Rogge u8 mcs; 385420e7fabSHenning Rogge u16 legacy; 386fd5b74dcSJohannes Berg }; 387fd5b74dcSJohannes Berg 388fd5b74dcSJohannes Berg /** 3892ec600d6SLuis Carlos Cobo * struct station_info - station information 390fd5b74dcSJohannes Berg * 3912ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 392fd5b74dcSJohannes Berg * 3932ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 394fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 395fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 396fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 3972ec600d6SLuis Carlos Cobo * @llid: mesh local link id 3982ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 3992ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 400420e7fabSHenning Rogge * @signal: signal strength of last received packet in dBm 401420e7fabSHenning Rogge * @txrate: current unicast bitrate to this station 40298c8a60aSJouni Malinen * @rx_packets: packets received from this station 40398c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 404f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 405f5ea9120SJohannes Berg * This number should increase every time the list of stations 406f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 407f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 408fd5b74dcSJohannes Berg */ 4092ec600d6SLuis Carlos Cobo struct station_info { 410fd5b74dcSJohannes Berg u32 filled; 411fd5b74dcSJohannes Berg u32 inactive_time; 412fd5b74dcSJohannes Berg u32 rx_bytes; 413fd5b74dcSJohannes Berg u32 tx_bytes; 4142ec600d6SLuis Carlos Cobo u16 llid; 4152ec600d6SLuis Carlos Cobo u16 plid; 4162ec600d6SLuis Carlos Cobo u8 plink_state; 417420e7fabSHenning Rogge s8 signal; 418420e7fabSHenning Rogge struct rate_info txrate; 41998c8a60aSJouni Malinen u32 rx_packets; 42098c8a60aSJouni Malinen u32 tx_packets; 421f5ea9120SJohannes Berg 422f5ea9120SJohannes Berg int generation; 423fd5b74dcSJohannes Berg }; 424fd5b74dcSJohannes Berg 42566f7ac50SMichael Wu /** 42666f7ac50SMichael Wu * enum monitor_flags - monitor flags 42766f7ac50SMichael Wu * 42866f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 42966f7ac50SMichael Wu * according to the nl80211 flags. 43066f7ac50SMichael Wu * 43166f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 43266f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 43366f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 43466f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 43566f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 43666f7ac50SMichael Wu */ 43766f7ac50SMichael Wu enum monitor_flags { 43866f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 43966f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 44066f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 44166f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 44266f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 44366f7ac50SMichael Wu }; 44466f7ac50SMichael Wu 4452ec600d6SLuis Carlos Cobo /** 4462ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 4472ec600d6SLuis Carlos Cobo * 4482ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 4492ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 4502ec600d6SLuis Carlos Cobo * 4512ec600d6SLuis Carlos Cobo * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 452d19b3bf6SRui Paulo * MPATH_INFO_SN: @sn filled 4532ec600d6SLuis Carlos Cobo * MPATH_INFO_METRIC: @metric filled 4542ec600d6SLuis Carlos Cobo * MPATH_INFO_EXPTIME: @exptime filled 4552ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 4562ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 4572ec600d6SLuis Carlos Cobo * MPATH_INFO_FLAGS: @flags filled 4582ec600d6SLuis Carlos Cobo */ 4592ec600d6SLuis Carlos Cobo enum mpath_info_flags { 4602ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 461d19b3bf6SRui Paulo MPATH_INFO_SN = BIT(1), 4622ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 4632ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 4642ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 4652ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 4662ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 4672ec600d6SLuis Carlos Cobo }; 4682ec600d6SLuis Carlos Cobo 4692ec600d6SLuis Carlos Cobo /** 4702ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 4712ec600d6SLuis Carlos Cobo * 4722ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 4732ec600d6SLuis Carlos Cobo * 4742ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 4752ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 476d19b3bf6SRui Paulo * @sn: target sequence number 4772ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 4782ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 4792ec600d6SLuis Carlos Cobo * @flags: mesh path flags 4802ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 4812ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 482f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 483f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 484f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 485f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 4862ec600d6SLuis Carlos Cobo */ 4872ec600d6SLuis Carlos Cobo struct mpath_info { 4882ec600d6SLuis Carlos Cobo u32 filled; 4892ec600d6SLuis Carlos Cobo u32 frame_qlen; 490d19b3bf6SRui Paulo u32 sn; 4912ec600d6SLuis Carlos Cobo u32 metric; 4922ec600d6SLuis Carlos Cobo u32 exptime; 4932ec600d6SLuis Carlos Cobo u32 discovery_timeout; 4942ec600d6SLuis Carlos Cobo u8 discovery_retries; 4952ec600d6SLuis Carlos Cobo u8 flags; 496f5ea9120SJohannes Berg 497f5ea9120SJohannes Berg int generation; 4982ec600d6SLuis Carlos Cobo }; 4992ec600d6SLuis Carlos Cobo 5009f1ba906SJouni Malinen /** 5019f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 5029f1ba906SJouni Malinen * 5039f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 5049f1ba906SJouni Malinen * 5059f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 5069f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 5079f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 5089f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 5099f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 5109f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 51190c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 51290c97a04SJouni Malinen * (or NULL for no change) 51390c97a04SJouni Malinen * @basic_rates_len: number of basic rates 5149f1ba906SJouni Malinen */ 5159f1ba906SJouni Malinen struct bss_parameters { 5169f1ba906SJouni Malinen int use_cts_prot; 5179f1ba906SJouni Malinen int use_short_preamble; 5189f1ba906SJouni Malinen int use_short_slot_time; 51990c97a04SJouni Malinen u8 *basic_rates; 52090c97a04SJouni Malinen u8 basic_rates_len; 5219f1ba906SJouni Malinen }; 5222ec600d6SLuis Carlos Cobo 52393da9cc1Scolin@cozybit.com struct mesh_config { 52493da9cc1Scolin@cozybit.com /* Timeouts in ms */ 52593da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 52693da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 52793da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 52893da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 52993da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 53093da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 53193da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 53293da9cc1Scolin@cozybit.com bool auto_open_plinks; 53393da9cc1Scolin@cozybit.com /* HWMP parameters */ 53493da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 53593da9cc1Scolin@cozybit.com u32 path_refresh_time; 53693da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 53793da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 53893da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 53993da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 54063c5723bSRui Paulo u8 dot11MeshHWMPRootMode; 54193da9cc1Scolin@cozybit.com }; 54293da9cc1Scolin@cozybit.com 54331888487SJouni Malinen /** 54431888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 54531888487SJouni Malinen * @queue: TX queue identifier (NL80211_TXQ_Q_*) 54631888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 54731888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 54831888487SJouni Malinen * 1..32767] 54931888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 55031888487SJouni Malinen * 1..32767] 55131888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 55231888487SJouni Malinen */ 55331888487SJouni Malinen struct ieee80211_txq_params { 55431888487SJouni Malinen enum nl80211_txq_q queue; 55531888487SJouni Malinen u16 txop; 55631888487SJouni Malinen u16 cwmin; 55731888487SJouni Malinen u16 cwmax; 55831888487SJouni Malinen u8 aifs; 55931888487SJouni Malinen }; 56031888487SJouni Malinen 561704232c2SJohannes Berg /* from net/wireless.h */ 562704232c2SJohannes Berg struct wiphy; 563704232c2SJohannes Berg 56472bdcf34SJouni Malinen /* from net/ieee80211.h */ 56572bdcf34SJouni Malinen struct ieee80211_channel; 56672bdcf34SJouni Malinen 567704232c2SJohannes Berg /** 5682a519311SJohannes Berg * struct cfg80211_ssid - SSID description 5692a519311SJohannes Berg * @ssid: the SSID 5702a519311SJohannes Berg * @ssid_len: length of the ssid 5712a519311SJohannes Berg */ 5722a519311SJohannes Berg struct cfg80211_ssid { 5732a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 5742a519311SJohannes Berg u8 ssid_len; 5752a519311SJohannes Berg }; 5762a519311SJohannes Berg 5772a519311SJohannes Berg /** 5782a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 5792a519311SJohannes Berg * 5802a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 5812a519311SJohannes Berg * @n_ssids: number of SSIDs 5822a519311SJohannes Berg * @channels: channels to scan on. 583ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 58470692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 58570692ad2SJouni Malinen * @ie_len: length of ie in octets 5862a519311SJohannes Berg * @wiphy: the wiphy this was for 587463d0183SJohannes Berg * @dev: the interface 5882a519311SJohannes Berg */ 5892a519311SJohannes Berg struct cfg80211_scan_request { 5902a519311SJohannes Berg struct cfg80211_ssid *ssids; 5912a519311SJohannes Berg int n_ssids; 5922a519311SJohannes Berg u32 n_channels; 593de95a54bSJohannes Berg const u8 *ie; 59470692ad2SJouni Malinen size_t ie_len; 5952a519311SJohannes Berg 5962a519311SJohannes Berg /* internal */ 5972a519311SJohannes Berg struct wiphy *wiphy; 598463d0183SJohannes Berg struct net_device *dev; 599667503ddSJohannes Berg bool aborted; 6005ba63533SJohannes Berg 6015ba63533SJohannes Berg /* keep last */ 6025ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 6032a519311SJohannes Berg }; 6042a519311SJohannes Berg 6052a519311SJohannes Berg /** 6062a519311SJohannes Berg * enum cfg80211_signal_type - signal type 6072a519311SJohannes Berg * 6082a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 6092a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 6102a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 6112a519311SJohannes Berg */ 6122a519311SJohannes Berg enum cfg80211_signal_type { 6132a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 6142a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 6152a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 6162a519311SJohannes Berg }; 6172a519311SJohannes Berg 6182a519311SJohannes Berg /** 6192a519311SJohannes Berg * struct cfg80211_bss - BSS description 6202a519311SJohannes Berg * 6212a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 6222a519311SJohannes Berg * for use in scan results and similar. 6232a519311SJohannes Berg * 6242a519311SJohannes Berg * @bssid: BSSID of the BSS 6252a519311SJohannes Berg * @tsf: timestamp of last received update 6262a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 6272a519311SJohannes Berg * @capability: the capability field in host byte order 6282a519311SJohannes Berg * @information_elements: the information elements (Note that there 62934a6eddbSJouni Malinen * is no guarantee that these are well-formed!); this is a pointer to 63034a6eddbSJouni Malinen * either the beacon_ies or proberesp_ies depending on whether Probe 63134a6eddbSJouni Malinen * Response frame has been received 6322a519311SJohannes Berg * @len_information_elements: total length of the information elements 63334a6eddbSJouni Malinen * @beacon_ies: the information elements from the last Beacon frame 63434a6eddbSJouni Malinen * @len_beacon_ies: total length of the beacon_ies 63534a6eddbSJouni Malinen * @proberesp_ies: the information elements from the last Probe Response frame 63634a6eddbSJouni Malinen * @len_proberesp_ies: total length of the proberesp_ies 63777965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 63878c1c7e1SJohannes Berg * @free_priv: function pointer to free private data 6392a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 6402a519311SJohannes Berg */ 6412a519311SJohannes Berg struct cfg80211_bss { 6422a519311SJohannes Berg struct ieee80211_channel *channel; 6432a519311SJohannes Berg 6442a519311SJohannes Berg u8 bssid[ETH_ALEN]; 6452a519311SJohannes Berg u64 tsf; 6462a519311SJohannes Berg u16 beacon_interval; 6472a519311SJohannes Berg u16 capability; 6482a519311SJohannes Berg u8 *information_elements; 6492a519311SJohannes Berg size_t len_information_elements; 65034a6eddbSJouni Malinen u8 *beacon_ies; 65134a6eddbSJouni Malinen size_t len_beacon_ies; 65234a6eddbSJouni Malinen u8 *proberesp_ies; 65334a6eddbSJouni Malinen size_t len_proberesp_ies; 6542a519311SJohannes Berg 6552a519311SJohannes Berg s32 signal; 6562a519311SJohannes Berg 65778c1c7e1SJohannes Berg void (*free_priv)(struct cfg80211_bss *bss); 6582a519311SJohannes Berg u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 6592a519311SJohannes Berg }; 6602a519311SJohannes Berg 6612a519311SJohannes Berg /** 662517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 663517357c6SJohannes Berg * @bss: the bss to search 664517357c6SJohannes Berg * @ie: the IE ID 665517357c6SJohannes Berg * Returns %NULL if not found. 666517357c6SJohannes Berg */ 667517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 668517357c6SJohannes Berg 669517357c6SJohannes Berg 670517357c6SJohannes Berg /** 671b23aa676SSamuel Ortiz * struct cfg80211_crypto_settings - Crypto settings 672b23aa676SSamuel Ortiz * @wpa_versions: indicates which, if any, WPA versions are enabled 673b23aa676SSamuel Ortiz * (from enum nl80211_wpa_versions) 674b23aa676SSamuel Ortiz * @cipher_group: group key cipher suite (or 0 if unset) 675b23aa676SSamuel Ortiz * @n_ciphers_pairwise: number of AP supported unicast ciphers 676b23aa676SSamuel Ortiz * @ciphers_pairwise: unicast key cipher suites 677b23aa676SSamuel Ortiz * @n_akm_suites: number of AKM suites 678b23aa676SSamuel Ortiz * @akm_suites: AKM suites 679b23aa676SSamuel Ortiz * @control_port: Whether user space controls IEEE 802.1X port, i.e., 680b23aa676SSamuel Ortiz * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 681b23aa676SSamuel Ortiz * required to assume that the port is unauthorized until authorized by 682b23aa676SSamuel Ortiz * user space. Otherwise, port is marked authorized by default. 683b23aa676SSamuel Ortiz */ 684b23aa676SSamuel Ortiz struct cfg80211_crypto_settings { 685b23aa676SSamuel Ortiz u32 wpa_versions; 686b23aa676SSamuel Ortiz u32 cipher_group; 687b23aa676SSamuel Ortiz int n_ciphers_pairwise; 688b23aa676SSamuel Ortiz u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 689b23aa676SSamuel Ortiz int n_akm_suites; 690b23aa676SSamuel Ortiz u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 691b23aa676SSamuel Ortiz bool control_port; 692b23aa676SSamuel Ortiz }; 693b23aa676SSamuel Ortiz 694b23aa676SSamuel Ortiz /** 695636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 696636a5d36SJouni Malinen * 697636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 698636a5d36SJouni Malinen * authentication. 699636a5d36SJouni Malinen * 70019957bb3SJohannes Berg * @bss: The BSS to authenticate with. 701636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 702636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 703636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 704fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 705fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 706fffd0934SJohannes Berg * @key: WEP key for shared key authentication 707d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 708d5cdfacbSJouni Malinen * Authentication frame is to be transmitted and authentication state is 709d5cdfacbSJouni Malinen * to be changed without having to wait for a response from the peer STA 710d5cdfacbSJouni Malinen * (AP). 711636a5d36SJouni Malinen */ 712636a5d36SJouni Malinen struct cfg80211_auth_request { 71319957bb3SJohannes Berg struct cfg80211_bss *bss; 714636a5d36SJouni Malinen const u8 *ie; 715636a5d36SJouni Malinen size_t ie_len; 71619957bb3SJohannes Berg enum nl80211_auth_type auth_type; 717fffd0934SJohannes Berg const u8 *key; 718fffd0934SJohannes Berg u8 key_len, key_idx; 719d5cdfacbSJouni Malinen bool local_state_change; 720636a5d36SJouni Malinen }; 721636a5d36SJouni Malinen 722636a5d36SJouni Malinen /** 723636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 724636a5d36SJouni Malinen * 725636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 726636a5d36SJouni Malinen * (re)association. 72719957bb3SJohannes Berg * @bss: The BSS to associate with. 728636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 729636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 730dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 731b23aa676SSamuel Ortiz * @crypto: crypto settings 7323e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 733636a5d36SJouni Malinen */ 734636a5d36SJouni Malinen struct cfg80211_assoc_request { 73519957bb3SJohannes Berg struct cfg80211_bss *bss; 7363e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 737636a5d36SJouni Malinen size_t ie_len; 738b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 73919957bb3SJohannes Berg bool use_mfp; 740636a5d36SJouni Malinen }; 741636a5d36SJouni Malinen 742636a5d36SJouni Malinen /** 743636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 744636a5d36SJouni Malinen * 745636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 746636a5d36SJouni Malinen * deauthentication. 747636a5d36SJouni Malinen * 74819957bb3SJohannes Berg * @bss: the BSS to deauthenticate from 749636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 750636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 75119957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 752d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 753d5cdfacbSJouni Malinen * Deauthentication frame is to be transmitted. 754636a5d36SJouni Malinen */ 755636a5d36SJouni Malinen struct cfg80211_deauth_request { 75619957bb3SJohannes Berg struct cfg80211_bss *bss; 757636a5d36SJouni Malinen const u8 *ie; 758636a5d36SJouni Malinen size_t ie_len; 75919957bb3SJohannes Berg u16 reason_code; 760d5cdfacbSJouni Malinen bool local_state_change; 761636a5d36SJouni Malinen }; 762636a5d36SJouni Malinen 763636a5d36SJouni Malinen /** 764636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 765636a5d36SJouni Malinen * 766636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 767636a5d36SJouni Malinen * disassocation. 768636a5d36SJouni Malinen * 76919957bb3SJohannes Berg * @bss: the BSS to disassociate from 770636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 771636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 77219957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 773d5cdfacbSJouni Malinen * @local_state_change: This is a request for a local state only, i.e., no 774d5cdfacbSJouni Malinen * Disassociation frame is to be transmitted. 775636a5d36SJouni Malinen */ 776636a5d36SJouni Malinen struct cfg80211_disassoc_request { 77719957bb3SJohannes Berg struct cfg80211_bss *bss; 778636a5d36SJouni Malinen const u8 *ie; 779636a5d36SJouni Malinen size_t ie_len; 78019957bb3SJohannes Berg u16 reason_code; 781d5cdfacbSJouni Malinen bool local_state_change; 782636a5d36SJouni Malinen }; 783636a5d36SJouni Malinen 784636a5d36SJouni Malinen /** 78504a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 78604a773adSJohannes Berg * 78704a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 78804a773adSJohannes Berg * method. 78904a773adSJohannes Berg * 79004a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 79104a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 79204a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 79304a773adSJohannes Berg * search for IBSSs with a different BSSID. 79404a773adSJohannes Berg * @channel: The channel to use if no IBSS can be found to join. 79504a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 79604a773adSJohannes Berg * IBSSs to join on other channels. 79704a773adSJohannes Berg * @ie: information element(s) to include in the beacon 79804a773adSJohannes Berg * @ie_len: length of that 7998e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 800fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 801fffd0934SJohannes Berg * after joining 80204a773adSJohannes Berg */ 80304a773adSJohannes Berg struct cfg80211_ibss_params { 80404a773adSJohannes Berg u8 *ssid; 80504a773adSJohannes Berg u8 *bssid; 80604a773adSJohannes Berg struct ieee80211_channel *channel; 80704a773adSJohannes Berg u8 *ie; 80804a773adSJohannes Berg u8 ssid_len, ie_len; 8098e30bc55SJohannes Berg u16 beacon_interval; 81004a773adSJohannes Berg bool channel_fixed; 811fffd0934SJohannes Berg bool privacy; 81204a773adSJohannes Berg }; 81304a773adSJohannes Berg 81404a773adSJohannes Berg /** 815b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 816b23aa676SSamuel Ortiz * 817b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 818b23aa676SSamuel Ortiz * authentication and association. 819b23aa676SSamuel Ortiz * 820b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 821b23aa676SSamuel Ortiz * on scan results) 822b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 823b23aa676SSamuel Ortiz * results) 824b23aa676SSamuel Ortiz * @ssid: SSID 825b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 826b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 827b23aa676SSamuel Ortiz * @assoc_ie: IEs for association request 828b23aa676SSamuel Ortiz * @assoc_ie_len: Length of assoc_ie in octets 829b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 830b23aa676SSamuel Ortiz * @crypto: crypto settings 831fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 832fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 833fffd0934SJohannes Berg * @key: WEP key for shared key authentication 834b23aa676SSamuel Ortiz */ 835b23aa676SSamuel Ortiz struct cfg80211_connect_params { 836b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 837b23aa676SSamuel Ortiz u8 *bssid; 838b23aa676SSamuel Ortiz u8 *ssid; 839b23aa676SSamuel Ortiz size_t ssid_len; 840b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 841b23aa676SSamuel Ortiz u8 *ie; 842b23aa676SSamuel Ortiz size_t ie_len; 843b23aa676SSamuel Ortiz bool privacy; 844b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 845fffd0934SJohannes Berg const u8 *key; 846fffd0934SJohannes Berg u8 key_len, key_idx; 847b23aa676SSamuel Ortiz }; 848b23aa676SSamuel Ortiz 849b23aa676SSamuel Ortiz /** 850b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 851b9a5f8caSJouni Malinen * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 852b9a5f8caSJouni Malinen * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 853b9a5f8caSJouni Malinen * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 854b9a5f8caSJouni Malinen * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 855b9a5f8caSJouni Malinen */ 856b9a5f8caSJouni Malinen enum wiphy_params_flags { 857b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 858b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 859b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 860b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 86181077e82SLukáš Turek WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 862b9a5f8caSJouni Malinen }; 863b9a5f8caSJouni Malinen 864b9a5f8caSJouni Malinen /** 8657643a2c3SJohannes Berg * enum tx_power_setting - TX power adjustment 8667643a2c3SJohannes Berg * 8677643a2c3SJohannes Berg * @TX_POWER_AUTOMATIC: the dbm parameter is ignored 8687643a2c3SJohannes Berg * @TX_POWER_LIMITED: limit TX power by the dbm parameter 8697643a2c3SJohannes Berg * @TX_POWER_FIXED: fix TX power to the dbm parameter 8707643a2c3SJohannes Berg */ 8717643a2c3SJohannes Berg enum tx_power_setting { 8727643a2c3SJohannes Berg TX_POWER_AUTOMATIC, 8737643a2c3SJohannes Berg TX_POWER_LIMITED, 8747643a2c3SJohannes Berg TX_POWER_FIXED, 8757643a2c3SJohannes Berg }; 8767643a2c3SJohannes Berg 8779930380fSJohannes Berg /* 8789930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 8799930380fSJohannes Berg */ 8809930380fSJohannes Berg struct cfg80211_bitrate_mask { 8819930380fSJohannes Berg struct { 8829930380fSJohannes Berg u32 legacy; 88337eb0b16SJouni Malinen /* TODO: add support for masking MCS rates; e.g.: */ 88437eb0b16SJouni Malinen /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ 8859930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 8869930380fSJohannes Berg }; 88767fbb16bSSamuel Ortiz /** 88867fbb16bSSamuel Ortiz * struct cfg80211_pmksa - PMK Security Association 88967fbb16bSSamuel Ortiz * 89067fbb16bSSamuel Ortiz * This structure is passed to the set/del_pmksa() method for PMKSA 89167fbb16bSSamuel Ortiz * caching. 89267fbb16bSSamuel Ortiz * 89367fbb16bSSamuel Ortiz * @bssid: The AP's BSSID. 89467fbb16bSSamuel Ortiz * @pmkid: The PMK material itself. 89567fbb16bSSamuel Ortiz */ 89667fbb16bSSamuel Ortiz struct cfg80211_pmksa { 89767fbb16bSSamuel Ortiz u8 *bssid; 89867fbb16bSSamuel Ortiz u8 *pmkid; 89967fbb16bSSamuel Ortiz }; 9009930380fSJohannes Berg 9017643a2c3SJohannes Berg /** 902704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 903704232c2SJohannes Berg * 904704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 905704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 906704232c2SJohannes Berg * 907704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 908704232c2SJohannes Berg * on success or a negative error code. 909704232c2SJohannes Berg * 91043fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 91143fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 91243fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 91343fb45cbSJohannes Berg * 9140378b3f1SJohannes Berg * @suspend: wiphy device needs to be suspended 9150378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 9160378b3f1SJohannes Berg * 91760719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 918463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 919463d0183SJohannes Berg * the new netdev in the wiphy's network namespace! 920704232c2SJohannes Berg * 921704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 92255682965SJohannes Berg * 92360719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 92460719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 92555682965SJohannes Berg * 92641ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 92741ade00fSJohannes Berg * when adding a group key. 92841ade00fSJohannes Berg * 92941ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 93041ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 93141ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 932e3da574aSJohannes Berg * after it returns. This function should return an error if it is 933e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 93441ade00fSJohannes Berg * 93541ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 936e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 93741ade00fSJohannes Berg * 93841ade00fSJohannes Berg * @set_default_key: set the default key on an interface 939ed1b6cc7SJohannes Berg * 9403cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 9413cfcf6acSJouni Malinen * 942ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 943ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 944ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 945ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 946ed1b6cc7SJohannes Berg * configured. 947ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 9485727ef1bSJohannes Berg * 9495727ef1bSJohannes Berg * @add_station: Add a new station. 9505727ef1bSJohannes Berg * 9515727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 9525727ef1bSJohannes Berg * 9535727ef1bSJohannes Berg * @change_station: Modify a given station. 9542ec600d6SLuis Carlos Cobo * 95593da9cc1Scolin@cozybit.com * @get_mesh_params: Put the current mesh parameters into *params 95693da9cc1Scolin@cozybit.com * 95793da9cc1Scolin@cozybit.com * @set_mesh_params: Set mesh parameters. 95893da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 95993da9cc1Scolin@cozybit.com * set, and which to leave alone. 96093da9cc1Scolin@cozybit.com * 9612ec600d6SLuis Carlos Cobo * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 9629f1ba906SJouni Malinen * 9639f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 96431888487SJouni Malinen * 96531888487SJouni Malinen * @set_txq_params: Set TX queue parameters 96672bdcf34SJouni Malinen * 96772bdcf34SJouni Malinen * @set_channel: Set channel 9689aed3cc1SJouni Malinen * 9692a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 9702a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 9712a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 9722a519311SJohannes Berg * the scan/scan_done bracket too. 973636a5d36SJouni Malinen * 974636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 975636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 976636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 977636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 97804a773adSJohannes Berg * 979b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 980b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 981b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 982b23aa676SSamuel Ortiz * with the status from the AP. 983b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 984b23aa676SSamuel Ortiz * 98504a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 98604a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 98704a773adSJohannes Berg * to a merge. 98804a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 989b9a5f8caSJouni Malinen * 990b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 991b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 992b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 993b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 9947643a2c3SJohannes Berg * 9957643a2c3SJohannes Berg * @set_tx_power: set the transmit power according to the parameters 9967643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 9971f87f7d3SJohannes Berg * return 0 if successful 9981f87f7d3SJohannes Berg * 9991f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 10001f87f7d3SJohannes Berg * functions to adjust rfkill hw state 1001aff89a9bSJohannes Berg * 100261fa713cSHolger Schurig * @dump_survey: get site survey information. 100361fa713cSHolger Schurig * 10049588bbd5SJouni Malinen * @remain_on_channel: Request the driver to remain awake on the specified 10059588bbd5SJouni Malinen * channel for the specified duration to complete an off-channel 10069588bbd5SJouni Malinen * operation (e.g., public action frame exchange). When the driver is 10079588bbd5SJouni Malinen * ready on the requested channel, it must indicate this with an event 10089588bbd5SJouni Malinen * notification by calling cfg80211_ready_on_channel(). 10099588bbd5SJouni Malinen * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 10109588bbd5SJouni Malinen * This allows the operation to be terminated prior to timeout based on 10119588bbd5SJouni Malinen * the duration value. 1012026331c4SJouni Malinen * @action: Transmit an action frame 10139588bbd5SJouni Malinen * 1014aff89a9bSJohannes Berg * @testmode_cmd: run a test mode command 101567fbb16bSSamuel Ortiz * 101667fbb16bSSamuel Ortiz * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 101767fbb16bSSamuel Ortiz * devices running firmwares capable of generating the (re) association 101867fbb16bSSamuel Ortiz * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 101967fbb16bSSamuel Ortiz * @del_pmksa: Delete a cached PMKID. 102067fbb16bSSamuel Ortiz * @flush_pmksa: Flush all cached PMKIDs. 1021d6dc1a38SJuuso Oikarinen * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. 102267fbb16bSSamuel Ortiz * 1023704232c2SJohannes Berg */ 1024704232c2SJohannes Berg struct cfg80211_ops { 10250378b3f1SJohannes Berg int (*suspend)(struct wiphy *wiphy); 10260378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 10270378b3f1SJohannes Berg 1028704232c2SJohannes Berg int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 10292ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 10302ec600d6SLuis Carlos Cobo struct vif_params *params); 1031463d0183SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 1032e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 1033e36d56b6SJohannes Berg struct net_device *dev, 10342ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 10352ec600d6SLuis Carlos Cobo struct vif_params *params); 103641ade00fSJohannes Berg 103741ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 10384e943900SJohannes Berg u8 key_index, const u8 *mac_addr, 103941ade00fSJohannes Berg struct key_params *params); 104041ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 10414e943900SJohannes Berg u8 key_index, const u8 *mac_addr, void *cookie, 104241ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 104341ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 10444e943900SJohannes Berg u8 key_index, const u8 *mac_addr); 104541ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 104641ade00fSJohannes Berg struct net_device *netdev, 104741ade00fSJohannes Berg u8 key_index); 10483cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 10493cfcf6acSJouni Malinen struct net_device *netdev, 10503cfcf6acSJouni Malinen u8 key_index); 1051ed1b6cc7SJohannes Berg 1052ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1053ed1b6cc7SJohannes Berg struct beacon_parameters *info); 1054ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1055ed1b6cc7SJohannes Berg struct beacon_parameters *info); 1056ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 10575727ef1bSJohannes Berg 10585727ef1bSJohannes Berg 10595727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 10605727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 10615727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 10625727ef1bSJohannes Berg u8 *mac); 10635727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 10645727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 1065fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 10662ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 10672ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 10682ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 10692ec600d6SLuis Carlos Cobo 10702ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 10712ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 10722ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 10732ec600d6SLuis Carlos Cobo u8 *dst); 10742ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 10752ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 10762ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 10772ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 10782ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 10792ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 10802ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 10812ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 108293da9cc1Scolin@cozybit.com int (*get_mesh_params)(struct wiphy *wiphy, 108393da9cc1Scolin@cozybit.com struct net_device *dev, 108493da9cc1Scolin@cozybit.com struct mesh_config *conf); 108593da9cc1Scolin@cozybit.com int (*set_mesh_params)(struct wiphy *wiphy, 108693da9cc1Scolin@cozybit.com struct net_device *dev, 108793da9cc1Scolin@cozybit.com const struct mesh_config *nconf, u32 mask); 10889f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 10899f1ba906SJouni Malinen struct bss_parameters *params); 109031888487SJouni Malinen 109131888487SJouni Malinen int (*set_txq_params)(struct wiphy *wiphy, 109231888487SJouni Malinen struct ieee80211_txq_params *params); 109372bdcf34SJouni Malinen 109472bdcf34SJouni Malinen int (*set_channel)(struct wiphy *wiphy, 109572bdcf34SJouni Malinen struct ieee80211_channel *chan, 1096094d05dcSSujith enum nl80211_channel_type channel_type); 10979aed3cc1SJouni Malinen 10982a519311SJohannes Berg int (*scan)(struct wiphy *wiphy, struct net_device *dev, 10992a519311SJohannes Berg struct cfg80211_scan_request *request); 1100636a5d36SJouni Malinen 1101636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1102636a5d36SJouni Malinen struct cfg80211_auth_request *req); 1103636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1104636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 1105636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1106667503ddSJohannes Berg struct cfg80211_deauth_request *req, 1107667503ddSJohannes Berg void *cookie); 1108636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1109667503ddSJohannes Berg struct cfg80211_disassoc_request *req, 1110667503ddSJohannes Berg void *cookie); 111104a773adSJohannes Berg 1112b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1113b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 1114b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 1115b23aa676SSamuel Ortiz u16 reason_code); 1116b23aa676SSamuel Ortiz 111704a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 111804a773adSJohannes Berg struct cfg80211_ibss_params *params); 111904a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1120b9a5f8caSJouni Malinen 1121b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 11227643a2c3SJohannes Berg 11237643a2c3SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, 11247643a2c3SJohannes Berg enum tx_power_setting type, int dbm); 11257643a2c3SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 11261f87f7d3SJohannes Berg 1127ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1128ab737a4fSJohannes Berg u8 *addr); 1129ab737a4fSJohannes Berg 11301f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 1131aff89a9bSJohannes Berg 1132aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 1133aff89a9bSJohannes Berg int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 1134aff89a9bSJohannes Berg #endif 1135bc92afd9SJohannes Berg 11369930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 11379930380fSJohannes Berg struct net_device *dev, 11389930380fSJohannes Berg const u8 *peer, 11399930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 11409930380fSJohannes Berg 114161fa713cSHolger Schurig int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, 114261fa713cSHolger Schurig int idx, struct survey_info *info); 114361fa713cSHolger Schurig 114467fbb16bSSamuel Ortiz int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 114567fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 114667fbb16bSSamuel Ortiz int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, 114767fbb16bSSamuel Ortiz struct cfg80211_pmksa *pmksa); 114867fbb16bSSamuel Ortiz int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 114967fbb16bSSamuel Ortiz 11509588bbd5SJouni Malinen int (*remain_on_channel)(struct wiphy *wiphy, 11519588bbd5SJouni Malinen struct net_device *dev, 11529588bbd5SJouni Malinen struct ieee80211_channel *chan, 11539588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 11549588bbd5SJouni Malinen unsigned int duration, 11559588bbd5SJouni Malinen u64 *cookie); 11569588bbd5SJouni Malinen int (*cancel_remain_on_channel)(struct wiphy *wiphy, 11579588bbd5SJouni Malinen struct net_device *dev, 11589588bbd5SJouni Malinen u64 cookie); 11599588bbd5SJouni Malinen 1160026331c4SJouni Malinen int (*action)(struct wiphy *wiphy, struct net_device *dev, 1161026331c4SJouni Malinen struct ieee80211_channel *chan, 1162026331c4SJouni Malinen enum nl80211_channel_type channel_type, 1163026331c4SJouni Malinen const u8 *buf, size_t len, u64 *cookie); 1164026331c4SJouni Malinen 1165bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1166bc92afd9SJohannes Berg bool enabled, int timeout); 1167d6dc1a38SJuuso Oikarinen 1168d6dc1a38SJuuso Oikarinen int (*set_cqm_rssi_config)(struct wiphy *wiphy, 1169d6dc1a38SJuuso Oikarinen struct net_device *dev, 1170d6dc1a38SJuuso Oikarinen s32 rssi_thold, u32 rssi_hyst); 1171704232c2SJohannes Berg }; 1172704232c2SJohannes Berg 1173d3236553SJohannes Berg /* 1174d3236553SJohannes Berg * wireless hardware and networking interfaces structures 1175d3236553SJohannes Berg * and registration/helper functions 1176d3236553SJohannes Berg */ 1177d3236553SJohannes Berg 1178d3236553SJohannes Berg /** 11795be83de5SJohannes Berg * enum wiphy_flags - wiphy capability flags 11805be83de5SJohannes Berg * 11815be83de5SJohannes Berg * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device 1182d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 1183d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1184d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 1185d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 11865be83de5SJohannes Berg * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will 11875be83de5SJohannes Berg * ignore regulatory domain settings until it gets its own regulatory 11885be83de5SJohannes Berg * domain via its regulatory_hint(). After its gets its own regulatory 11895be83de5SJohannes Berg * domain it will only allow further regulatory domain settings to 11905be83de5SJohannes Berg * further enhance compliance. For example if channel 13 and 14 are 11915be83de5SJohannes Berg * disabled by this regulatory domain no user regulatory domain can 11925be83de5SJohannes Berg * enable these channels at a later time. This can be used for devices 11935be83de5SJohannes Berg * which do not have calibration information gauranteed for frequencies 11945be83de5SJohannes Berg * or settings outside of its regulatory domain. 11955be83de5SJohannes Berg * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure 11965be83de5SJohannes Berg * that passive scan flags and beaconing flags may not be lifted by 11975be83de5SJohannes Berg * cfg80211 due to regulatory beacon hints. For more information on beacon 119837184244SLuis R. Rodriguez * hints read the documenation for regulatory_hint_found_beacon() 11995be83de5SJohannes Berg * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 12005be83de5SJohannes Berg * wiphy at all 12015be83de5SJohannes Berg * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 12025be83de5SJohannes Berg * by default -- this flag will be set depending on the kernel's default 12035be83de5SJohannes Berg * on wiphy_new(), but can be changed by the driver if it has a good 12045be83de5SJohannes Berg * reason to override the default 12059bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station 12069bc383deSJohannes Berg * on a VLAN interface) 12079bc383deSJohannes Berg * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station 12085be83de5SJohannes Berg */ 12095be83de5SJohannes Berg enum wiphy_flags { 12105be83de5SJohannes Berg WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 12115be83de5SJohannes Berg WIPHY_FLAG_STRICT_REGULATORY = BIT(1), 12125be83de5SJohannes Berg WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), 12135be83de5SJohannes Berg WIPHY_FLAG_NETNS_OK = BIT(3), 12145be83de5SJohannes Berg WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), 12159bc383deSJohannes Berg WIPHY_FLAG_4ADDR_AP = BIT(5), 12169bc383deSJohannes Berg WIPHY_FLAG_4ADDR_STATION = BIT(6), 12175be83de5SJohannes Berg }; 12185be83de5SJohannes Berg 1219ef15aac6SJohannes Berg struct mac_address { 1220ef15aac6SJohannes Berg u8 addr[ETH_ALEN]; 1221ef15aac6SJohannes Berg }; 1222ef15aac6SJohannes Berg 12235be83de5SJohannes Berg /** 12245be83de5SJohannes Berg * struct wiphy - wireless hardware description 12255be83de5SJohannes Berg * @idx: the wiphy index assigned to this item 12265be83de5SJohannes Berg * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 1227d3236553SJohannes Berg * @reg_notifier: the driver's regulatory notification callback 1228d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 1229d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 1230d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 1231d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 1232d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 1233d3236553SJohannes Berg * @cipher_suites: supported cipher suites 1234d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 1235b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 1236b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 1237b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1238b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 1239b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1240463d0183SJohannes Berg * @net: the network namespace this wiphy currently lives in 1241ef15aac6SJohannes Berg * @perm_addr: permanent MAC address of this device 1242ef15aac6SJohannes Berg * @addr_mask: If the device supports multiple MAC addresses by masking, 1243ef15aac6SJohannes Berg * set this to a mask with variable bits set to 1, e.g. if the last 1244ef15aac6SJohannes Berg * four bits are variable then set it to 00:...:00:0f. The actual 1245ef15aac6SJohannes Berg * variable bits shall be determined by the interfaces added, with 1246ef15aac6SJohannes Berg * interfaces not matching the mask being rejected to be brought up. 1247ef15aac6SJohannes Berg * @n_addresses: number of addresses in @addresses. 1248ef15aac6SJohannes Berg * @addresses: If the device has more than one address, set this pointer 1249ef15aac6SJohannes Berg * to a list of addresses (6 bytes each). The first one will be used 1250ef15aac6SJohannes Berg * by default for perm_addr. In this case, the mask should be set to 1251ef15aac6SJohannes Berg * all-zeroes. In this case it is assumed that the device can handle 1252ef15aac6SJohannes Berg * the same number of arbitrary MAC addresses. 1253d3236553SJohannes Berg */ 1254d3236553SJohannes Berg struct wiphy { 1255d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 1256d3236553SJohannes Berg 1257ef15aac6SJohannes Berg /* permanent MAC address(es) */ 1258d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 1259ef15aac6SJohannes Berg u8 addr_mask[ETH_ALEN]; 1260ef15aac6SJohannes Berg 1261ef15aac6SJohannes Berg u16 n_addresses; 1262ef15aac6SJohannes Berg struct mac_address *addresses; 1263d3236553SJohannes Berg 1264d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1265d3236553SJohannes Berg u16 interface_modes; 1266d3236553SJohannes Berg 12675be83de5SJohannes Berg u32 flags; 1268463d0183SJohannes Berg 1269d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 1270d3236553SJohannes Berg 1271d3236553SJohannes Berg int bss_priv_size; 1272d3236553SJohannes Berg u8 max_scan_ssids; 1273d3236553SJohannes Berg u16 max_scan_ie_len; 1274d3236553SJohannes Berg 1275d3236553SJohannes Berg int n_cipher_suites; 1276d3236553SJohannes Berg const u32 *cipher_suites; 1277d3236553SJohannes Berg 1278b9a5f8caSJouni Malinen u8 retry_short; 1279b9a5f8caSJouni Malinen u8 retry_long; 1280b9a5f8caSJouni Malinen u32 frag_threshold; 1281b9a5f8caSJouni Malinen u32 rts_threshold; 128281077e82SLukáš Turek u8 coverage_class; 1283b9a5f8caSJouni Malinen 1284dfce95f5SKalle Valo char fw_version[ETHTOOL_BUSINFO_LEN]; 1285dfce95f5SKalle Valo u32 hw_version; 1286dfce95f5SKalle Valo 128767fbb16bSSamuel Ortiz u8 max_num_pmkids; 128867fbb16bSSamuel Ortiz 1289d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 1290d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 1291d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 1292d3236553SJohannes Berg * or not. Assign this to something global to your driver to 1293d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 1294cf5aa2f1SDavid Kilroy const void *privid; 1295d3236553SJohannes Berg 1296d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 1297d3236553SJohannes Berg 1298d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 1299d3236553SJohannes Berg int (*reg_notifier)(struct wiphy *wiphy, 1300d3236553SJohannes Berg struct regulatory_request *request); 1301d3236553SJohannes Berg 1302d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 1303d3236553SJohannes Berg 1304d3236553SJohannes Berg const struct ieee80211_regdomain *regd; 1305d3236553SJohannes Berg 1306d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 1307d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 1308d3236553SJohannes Berg struct device dev; 1309d3236553SJohannes Berg 1310d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 1311d3236553SJohannes Berg struct dentry *debugfsdir; 1312d3236553SJohannes Berg 1313463d0183SJohannes Berg #ifdef CONFIG_NET_NS 1314463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 1315463d0183SJohannes Berg struct net *_net; 1316463d0183SJohannes Berg #endif 1317463d0183SJohannes Berg 13183d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 13193d23e349SJohannes Berg const struct iw_handler_def *wext; 13203d23e349SJohannes Berg #endif 13213d23e349SJohannes Berg 1322d3236553SJohannes Berg char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1323d3236553SJohannes Berg }; 1324d3236553SJohannes Berg 1325463d0183SJohannes Berg #ifdef CONFIG_NET_NS 1326463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 1327463d0183SJohannes Berg { 1328463d0183SJohannes Berg return wiphy->_net; 1329463d0183SJohannes Berg } 1330463d0183SJohannes Berg 1331463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1332463d0183SJohannes Berg { 1333463d0183SJohannes Berg wiphy->_net = net; 1334463d0183SJohannes Berg } 1335463d0183SJohannes Berg #else 1336463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 1337463d0183SJohannes Berg { 1338463d0183SJohannes Berg return &init_net; 1339463d0183SJohannes Berg } 1340463d0183SJohannes Berg 1341463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1342463d0183SJohannes Berg { 1343463d0183SJohannes Berg } 1344463d0183SJohannes Berg #endif 1345463d0183SJohannes Berg 1346d3236553SJohannes Berg /** 1347d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 1348d3236553SJohannes Berg * 1349d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 1350d3236553SJohannes Berg */ 1351d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 1352d3236553SJohannes Berg { 1353d3236553SJohannes Berg BUG_ON(!wiphy); 1354d3236553SJohannes Berg return &wiphy->priv; 1355d3236553SJohannes Berg } 1356d3236553SJohannes Berg 1357d3236553SJohannes Berg /** 1358f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 1359f1f74825SDavid Kilroy * 1360f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 1361f1f74825SDavid Kilroy */ 1362f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 1363f1f74825SDavid Kilroy { 1364f1f74825SDavid Kilroy BUG_ON(!priv); 1365f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 1366f1f74825SDavid Kilroy } 1367f1f74825SDavid Kilroy 1368f1f74825SDavid Kilroy /** 1369d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 1370d3236553SJohannes Berg * 1371d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 1372d3236553SJohannes Berg * @dev: The device to parent it to 1373d3236553SJohannes Berg */ 1374d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1375d3236553SJohannes Berg { 1376d3236553SJohannes Berg wiphy->dev.parent = dev; 1377d3236553SJohannes Berg } 1378d3236553SJohannes Berg 1379d3236553SJohannes Berg /** 1380d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 1381d3236553SJohannes Berg * 1382d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 1383d3236553SJohannes Berg */ 1384d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 1385d3236553SJohannes Berg { 1386d3236553SJohannes Berg return wiphy->dev.parent; 1387d3236553SJohannes Berg } 1388d3236553SJohannes Berg 1389d3236553SJohannes Berg /** 1390d3236553SJohannes Berg * wiphy_name - get wiphy name 1391d3236553SJohannes Berg * 1392d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 1393d3236553SJohannes Berg */ 1394d3236553SJohannes Berg static inline const char *wiphy_name(struct wiphy *wiphy) 1395d3236553SJohannes Berg { 1396d3236553SJohannes Berg return dev_name(&wiphy->dev); 1397d3236553SJohannes Berg } 1398d3236553SJohannes Berg 1399d3236553SJohannes Berg /** 1400d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 1401d3236553SJohannes Berg * 1402d3236553SJohannes Berg * @ops: The configuration operations for this device 1403d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 1404d3236553SJohannes Berg * 1405d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 1406d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 1407d3236553SJohannes Berg * 1408d3236553SJohannes Berg * The returned pointer must be assigned to each netdev's 1409d3236553SJohannes Berg * ieee80211_ptr for proper operation. 1410d3236553SJohannes Berg */ 14113dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 1412d3236553SJohannes Berg 1413d3236553SJohannes Berg /** 1414d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 1415d3236553SJohannes Berg * 1416d3236553SJohannes Berg * @wiphy: The wiphy to register. 1417d3236553SJohannes Berg * 1418d3236553SJohannes Berg * Returns a non-negative wiphy index or a negative error code. 1419d3236553SJohannes Berg */ 1420d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 1421d3236553SJohannes Berg 1422d3236553SJohannes Berg /** 1423d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 1424d3236553SJohannes Berg * 1425d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 1426d3236553SJohannes Berg * 1427d3236553SJohannes Berg * After this call, no more requests can be made with this priv 1428d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 1429d3236553SJohannes Berg * request that is being handled. 1430d3236553SJohannes Berg */ 1431d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 1432d3236553SJohannes Berg 1433d3236553SJohannes Berg /** 1434d3236553SJohannes Berg * wiphy_free - free wiphy 1435d3236553SJohannes Berg * 1436d3236553SJohannes Berg * @wiphy: The wiphy to free 1437d3236553SJohannes Berg */ 1438d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 1439d3236553SJohannes Berg 1440fffd0934SJohannes Berg /* internal structs */ 14416829c878SJohannes Berg struct cfg80211_conn; 144219957bb3SJohannes Berg struct cfg80211_internal_bss; 1443fffd0934SJohannes Berg struct cfg80211_cached_keys; 144419957bb3SJohannes Berg 144519957bb3SJohannes Berg #define MAX_AUTH_BSSES 4 14466829c878SJohannes Berg 1447d3236553SJohannes Berg /** 1448d3236553SJohannes Berg * struct wireless_dev - wireless per-netdev state 1449d3236553SJohannes Berg * 1450d3236553SJohannes Berg * This structure must be allocated by the driver/stack 1451d3236553SJohannes Berg * that uses the ieee80211_ptr field in struct net_device 1452d3236553SJohannes Berg * (this is intentional so it can be allocated along with 1453d3236553SJohannes Berg * the netdev.) 1454d3236553SJohannes Berg * 1455d3236553SJohannes Berg * @wiphy: pointer to hardware description 1456d3236553SJohannes Berg * @iftype: interface type 1457d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 1458d3236553SJohannes Berg * @netdev: (private) Used to reference back to the netdev 1459d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 1460d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 1461d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 1462d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 1463d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 1464d3236553SJohannes Berg * @wext_bssid: (private) Used by the internal wireless extensions compat code 14659bc383deSJohannes Berg * @use_4addr: indicates 4addr mode is used on this interface, must be 14669bc383deSJohannes Berg * set by driver (if supported) on add_interface BEFORE registering the 14679bc383deSJohannes Berg * netdev and may otherwise be used by driver read-only, will be update 14689bc383deSJohannes Berg * by cfg80211 on change_interface 1469026331c4SJouni Malinen * @action_registrations: list of registrations for action frames 1470026331c4SJouni Malinen * @action_registrations_lock: lock for the list 1471d3236553SJohannes Berg */ 1472d3236553SJohannes Berg struct wireless_dev { 1473d3236553SJohannes Berg struct wiphy *wiphy; 1474d3236553SJohannes Berg enum nl80211_iftype iftype; 1475d3236553SJohannes Berg 1476667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 1477d3236553SJohannes Berg struct list_head list; 1478d3236553SJohannes Berg struct net_device *netdev; 1479d3236553SJohannes Berg 1480026331c4SJouni Malinen struct list_head action_registrations; 1481026331c4SJouni Malinen spinlock_t action_registrations_lock; 1482026331c4SJouni Malinen 1483667503ddSJohannes Berg struct mutex mtx; 1484667503ddSJohannes Berg 1485ad002395SJohannes Berg struct work_struct cleanup_work; 1486ad002395SJohannes Berg 14879bc383deSJohannes Berg bool use_4addr; 14889bc383deSJohannes Berg 1489b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 1490d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 1491d3236553SJohannes Berg u8 ssid_len; 1492b23aa676SSamuel Ortiz enum { 1493b23aa676SSamuel Ortiz CFG80211_SME_IDLE, 14946829c878SJohannes Berg CFG80211_SME_CONNECTING, 1495b23aa676SSamuel Ortiz CFG80211_SME_CONNECTED, 1496b23aa676SSamuel Ortiz } sme_state; 14976829c878SJohannes Berg struct cfg80211_conn *conn; 1498fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 1499d3236553SJohannes Berg 1500667503ddSJohannes Berg struct list_head event_list; 1501667503ddSJohannes Berg spinlock_t event_lock; 1502667503ddSJohannes Berg 150319957bb3SJohannes Berg struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 150419957bb3SJohannes Berg struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 150519957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 150619957bb3SJohannes Berg 1507ffb9eb3dSKalle Valo bool ps; 1508ffb9eb3dSKalle Valo int ps_timeout; 1509ffb9eb3dSKalle Valo 15103d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT 1511d3236553SJohannes Berg /* wext data */ 1512cbe8fa9cSJohannes Berg struct { 1513cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 1514f2129354SJohannes Berg struct cfg80211_connect_params connect; 1515fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 1516f2129354SJohannes Berg u8 *ie; 1517f2129354SJohannes Berg size_t ie_len; 1518f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1519f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 152008645126SJohannes Berg s8 default_key, default_mgmt_key; 1521ffb9eb3dSKalle Valo bool prev_bssid_valid; 1522cbe8fa9cSJohannes Berg } wext; 1523d3236553SJohannes Berg #endif 1524d3236553SJohannes Berg }; 1525d3236553SJohannes Berg 1526d3236553SJohannes Berg /** 1527d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 1528d3236553SJohannes Berg * 1529d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 1530d3236553SJohannes Berg */ 1531d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 1532d3236553SJohannes Berg { 1533d3236553SJohannes Berg BUG_ON(!wdev); 1534d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 1535d3236553SJohannes Berg } 1536d3236553SJohannes Berg 1537d3236553SJohannes Berg /* 1538d3236553SJohannes Berg * Utility functions 1539d3236553SJohannes Berg */ 1540d3236553SJohannes Berg 1541d3236553SJohannes Berg /** 1542d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 1543d3236553SJohannes Berg */ 1544d3236553SJohannes Berg extern int ieee80211_channel_to_frequency(int chan); 1545d3236553SJohannes Berg 1546d3236553SJohannes Berg /** 1547d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 1548d3236553SJohannes Berg */ 1549d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 1550d3236553SJohannes Berg 1551d3236553SJohannes Berg /* 1552d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 1553d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 1554d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 1555d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 1556d3236553SJohannes Berg * clash. 1557d3236553SJohannes Berg */ 1558d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 1559d3236553SJohannes Berg int freq); 1560d3236553SJohannes Berg /** 1561d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1562d3236553SJohannes Berg */ 1563d3236553SJohannes Berg static inline struct ieee80211_channel * 1564d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 1565d3236553SJohannes Berg { 1566d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 1567d3236553SJohannes Berg } 1568d3236553SJohannes Berg 1569d3236553SJohannes Berg /** 1570d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 1571d3236553SJohannes Berg * 1572d3236553SJohannes Berg * @sband: the band to look for rates in 1573d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 1574d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 1575d3236553SJohannes Berg * 1576d3236553SJohannes Berg * This function returns the basic rate corresponding to a given 1577d3236553SJohannes Berg * bitrate, that is the next lower bitrate contained in the basic 1578d3236553SJohannes Berg * rate map, which is, for this function, given as a bitmap of 1579d3236553SJohannes Berg * indices of rates in the band's bitrate table. 1580d3236553SJohannes Berg */ 1581d3236553SJohannes Berg struct ieee80211_rate * 1582d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 1583d3236553SJohannes Berg u32 basic_rates, int bitrate); 1584d3236553SJohannes Berg 1585d3236553SJohannes Berg /* 1586d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 1587d3236553SJohannes Berg * 1588d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 1589d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 1590d3236553SJohannes Berg */ 1591d3236553SJohannes Berg 159233e5a2f7SJohannes Berg struct radiotap_align_size { 159333e5a2f7SJohannes Berg uint8_t align:4, size:4; 159433e5a2f7SJohannes Berg }; 159533e5a2f7SJohannes Berg 159633e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace { 159733e5a2f7SJohannes Berg const struct radiotap_align_size *align_size; 159833e5a2f7SJohannes Berg int n_bits; 159933e5a2f7SJohannes Berg uint32_t oui; 160033e5a2f7SJohannes Berg uint8_t subns; 160133e5a2f7SJohannes Berg }; 160233e5a2f7SJohannes Berg 160333e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces { 160433e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *ns; 160533e5a2f7SJohannes Berg int n_ns; 160633e5a2f7SJohannes Berg }; 160733e5a2f7SJohannes Berg 1608d3236553SJohannes Berg /** 1609d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 161033e5a2f7SJohannes Berg * @this_arg_index: index of current arg, valid after each successful call 161133e5a2f7SJohannes Berg * to ieee80211_radiotap_iterator_next() 161233e5a2f7SJohannes Berg * @this_arg: pointer to current radiotap arg; it is valid after each 161333e5a2f7SJohannes Berg * call to ieee80211_radiotap_iterator_next() but also after 161433e5a2f7SJohannes Berg * ieee80211_radiotap_iterator_init() where it will point to 161533e5a2f7SJohannes Berg * the beginning of the actual data portion 161633e5a2f7SJohannes Berg * @this_arg_size: length of the current arg, for convenience 161733e5a2f7SJohannes Berg * @current_namespace: pointer to the current namespace definition 161833e5a2f7SJohannes Berg * (or internally %NULL if the current namespace is unknown) 161933e5a2f7SJohannes Berg * @is_radiotap_ns: indicates whether the current namespace is the default 162033e5a2f7SJohannes Berg * radiotap namespace or not 162133e5a2f7SJohannes Berg * 162233e5a2f7SJohannes Berg * @overrides: override standard radiotap fields 162333e5a2f7SJohannes Berg * @n_overrides: number of overrides 162433e5a2f7SJohannes Berg * 162533e5a2f7SJohannes Berg * @_rtheader: pointer to the radiotap header we are walking through 162633e5a2f7SJohannes Berg * @_max_length: length of radiotap header in cpu byte ordering 162733e5a2f7SJohannes Berg * @_arg_index: next argument index 162833e5a2f7SJohannes Berg * @_arg: next argument pointer 162933e5a2f7SJohannes Berg * @_next_bitmap: internal pointer to next present u32 163033e5a2f7SJohannes Berg * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 163133e5a2f7SJohannes Berg * @_vns: vendor namespace definitions 163233e5a2f7SJohannes Berg * @_next_ns_data: beginning of the next namespace's data 163333e5a2f7SJohannes Berg * @_reset_on_ext: internal; reset the arg index to 0 when going to the 163433e5a2f7SJohannes Berg * next bitmap word 163533e5a2f7SJohannes Berg * 163633e5a2f7SJohannes Berg * Describes the radiotap parser state. Fields prefixed with an underscore 163733e5a2f7SJohannes Berg * must not be used by users of the parser, only by the parser internally. 1638d3236553SJohannes Berg */ 1639d3236553SJohannes Berg 1640d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 164133e5a2f7SJohannes Berg struct ieee80211_radiotap_header *_rtheader; 164233e5a2f7SJohannes Berg const struct ieee80211_radiotap_vendor_namespaces *_vns; 164333e5a2f7SJohannes Berg const struct ieee80211_radiotap_namespace *current_namespace; 1644d3236553SJohannes Berg 164533e5a2f7SJohannes Berg unsigned char *_arg, *_next_ns_data; 1646*67272440SJohannes Berg __le32 *_next_bitmap; 164733e5a2f7SJohannes Berg 164833e5a2f7SJohannes Berg unsigned char *this_arg; 164933e5a2f7SJohannes Berg int this_arg_index; 165033e5a2f7SJohannes Berg int this_arg_size; 165133e5a2f7SJohannes Berg 165233e5a2f7SJohannes Berg int is_radiotap_ns; 165333e5a2f7SJohannes Berg 165433e5a2f7SJohannes Berg int _max_length; 165533e5a2f7SJohannes Berg int _arg_index; 165633e5a2f7SJohannes Berg uint32_t _bitmap_shifter; 165733e5a2f7SJohannes Berg int _reset_on_ext; 1658d3236553SJohannes Berg }; 1659d3236553SJohannes Berg 1660d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 1661d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 1662d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 166333e5a2f7SJohannes Berg int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); 1664d3236553SJohannes Berg 1665d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 1666d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 1667d3236553SJohannes Berg 166833e5a2f7SJohannes Berg 1669e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 1670e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 1671e31a16d6SZhu Yi 1672e31a16d6SZhu Yi /** 1673e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 1674e31a16d6SZhu Yi * 1675e31a16d6SZhu Yi * Given an skb with a raw 802.11 header at the data pointer this function 1676e31a16d6SZhu Yi * returns the 802.11 header length in bytes (not including encryption 1677e31a16d6SZhu Yi * headers). If the data in the sk_buff is too short to contain a valid 802.11 1678e31a16d6SZhu Yi * header the function returns 0. 1679e31a16d6SZhu Yi * 1680e31a16d6SZhu Yi * @skb: the frame 1681e31a16d6SZhu Yi */ 1682e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1683e31a16d6SZhu Yi 1684e31a16d6SZhu Yi /** 1685e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 1686e31a16d6SZhu Yi * @fc: frame control field in little-endian format 1687e31a16d6SZhu Yi */ 1688e31a16d6SZhu Yi unsigned int ieee80211_hdrlen(__le16 fc); 1689e31a16d6SZhu Yi 1690e31a16d6SZhu Yi /** 1691e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 1692e31a16d6SZhu Yi * @skb: the 802.11 data frame 1693e31a16d6SZhu Yi * @addr: the device MAC address 1694e31a16d6SZhu Yi * @iftype: the virtual interface type 1695e31a16d6SZhu Yi */ 1696eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, 1697e31a16d6SZhu Yi enum nl80211_iftype iftype); 1698e31a16d6SZhu Yi 1699e31a16d6SZhu Yi /** 1700e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 1701e31a16d6SZhu Yi * @skb: the 802.3 frame 1702e31a16d6SZhu Yi * @addr: the device MAC address 1703e31a16d6SZhu Yi * @iftype: the virtual interface type 1704e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1705e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 1706e31a16d6SZhu Yi */ 1707eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 1708e31a16d6SZhu Yi enum nl80211_iftype iftype, u8 *bssid, bool qos); 1709e31a16d6SZhu Yi 1710e31a16d6SZhu Yi /** 1711eaf85ca7SZhu Yi * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 1712eaf85ca7SZhu Yi * 1713eaf85ca7SZhu Yi * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of 1714eaf85ca7SZhu Yi * 802.3 frames. The @list will be empty if the decode fails. The 1715eaf85ca7SZhu Yi * @skb is consumed after the function returns. 1716eaf85ca7SZhu Yi * 1717eaf85ca7SZhu Yi * @skb: The input IEEE 802.11n A-MSDU frame. 1718eaf85ca7SZhu Yi * @list: The output list of 802.3 frames. It must be allocated and 1719eaf85ca7SZhu Yi * initialized by by the caller. 1720eaf85ca7SZhu Yi * @addr: The device MAC address. 1721eaf85ca7SZhu Yi * @iftype: The device interface type. 1722eaf85ca7SZhu Yi * @extra_headroom: The hardware extra headroom for SKBs in the @list. 1723eaf85ca7SZhu Yi */ 1724eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, 1725eaf85ca7SZhu Yi const u8 *addr, enum nl80211_iftype iftype, 1726eaf85ca7SZhu Yi const unsigned int extra_headroom); 1727eaf85ca7SZhu Yi 1728eaf85ca7SZhu Yi /** 1729e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1730e31a16d6SZhu Yi * @skb: the data frame 1731e31a16d6SZhu Yi */ 1732e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1733e31a16d6SZhu Yi 1734c21dbf92SJohannes Berg /** 1735c21dbf92SJohannes Berg * cfg80211_find_ie - find information element in data 1736c21dbf92SJohannes Berg * 1737c21dbf92SJohannes Berg * @eid: element ID 1738c21dbf92SJohannes Berg * @ies: data consisting of IEs 1739c21dbf92SJohannes Berg * @len: length of data 1740c21dbf92SJohannes Berg * 1741c21dbf92SJohannes Berg * This function will return %NULL if the element ID could 1742c21dbf92SJohannes Berg * not be found or if the element is invalid (claims to be 1743c21dbf92SJohannes Berg * longer than the given data), or a pointer to the first byte 1744c21dbf92SJohannes Berg * of the requested element, that is the byte containing the 1745c21dbf92SJohannes Berg * element ID. There are no checks on the element length 1746c21dbf92SJohannes Berg * other than having to fit into the given data. 1747c21dbf92SJohannes Berg */ 1748c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); 1749c21dbf92SJohannes Berg 1750d3236553SJohannes Berg /* 1751d3236553SJohannes Berg * Regulatory helper functions for wiphys 1752d3236553SJohannes Berg */ 1753d3236553SJohannes Berg 1754d3236553SJohannes Berg /** 1755d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 1756d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 1757d3236553SJohannes Berg * conflicts) 1758d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 1759d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 1760d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 1761d3236553SJohannes Berg * alpha2. 1762d3236553SJohannes Berg * 1763d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 1764d3236553SJohannes Berg * what it believes should be the current regulatory domain by 1765d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 1766d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 1767d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 1768d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 1769d3236553SJohannes Berg * 1770d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 1771d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 1772d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 1773d3236553SJohannes Berg * 1774d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 1775d3236553SJohannes Berg * an -ENOMEM. 1776d3236553SJohannes Berg */ 1777d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1778d3236553SJohannes Berg 1779d3236553SJohannes Berg /** 1780d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1781d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 1782d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 1783d3236553SJohannes Berg * 1784d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 1785d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 1786d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 1787d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 1788d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 1789d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 1790d3236553SJohannes Berg */ 1791d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 1792d3236553SJohannes Berg struct wiphy *wiphy, 1793d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 1794d3236553SJohannes Berg 1795d3236553SJohannes Berg /** 1796d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 1797d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 1798d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 1799038659e7SLuis R. Rodriguez * @desired_bw_khz: the desired max bandwidth you want to use per 1800038659e7SLuis R. Rodriguez * channel. Note that this is still 20 MHz if you want to use HT40 1801038659e7SLuis R. Rodriguez * as HT40 makes use of two channels for its 40 MHz width bandwidth. 1802038659e7SLuis R. Rodriguez * If set to 0 we'll assume you want the standard 20 MHz. 1803d3236553SJohannes Berg * @reg_rule: the regulatory rule which we have for this frequency 1804d3236553SJohannes Berg * 1805d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 1806d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 1807d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 1808d3236553SJohannes Berg * and processed already. 1809d3236553SJohannes Berg * 1810d3236553SJohannes Berg * Returns 0 if it was able to find a valid regulatory rule which does 1811d3236553SJohannes Berg * apply to the given center_freq otherwise it returns non-zero. It will 1812d3236553SJohannes Berg * also return -ERANGE if we determine the given center_freq does not even have 1813d3236553SJohannes Berg * a regulatory rule for a frequency range in the center_freq's band. See 1814d3236553SJohannes Berg * freq_in_rule_band() for our current definition of a band -- this is purely 1815d3236553SJohannes Berg * subjective and right now its 802.11 specific. 1816d3236553SJohannes Berg */ 1817038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy, 1818038659e7SLuis R. Rodriguez u32 center_freq, 1819038659e7SLuis R. Rodriguez u32 desired_bw_khz, 1820d3236553SJohannes Berg const struct ieee80211_reg_rule **reg_rule); 1821d3236553SJohannes Berg 1822d3236553SJohannes Berg /* 1823d3236553SJohannes Berg * Temporary wext handlers & helper functions 1824d3236553SJohannes Berg * 1825d3236553SJohannes Berg * In the future cfg80211 will simply assign the entire wext handler 1826d3236553SJohannes Berg * structure to netdevs it manages, but we're not there yet. 1827d3236553SJohannes Berg */ 1828fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev, 1829fee52678SJohannes Berg struct iw_request_info *info, 1830fee52678SJohannes Berg char *name, char *extra); 1831e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 1832e60c7744SJohannes Berg u32 *mode, char *extra); 1833e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 1834e60c7744SJohannes Berg u32 *mode, char *extra); 18352a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev, 18362a519311SJohannes Berg struct iw_request_info *info, 18372a519311SJohannes Berg union iwreq_data *wrqu, char *extra); 18382a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev, 18392a519311SJohannes Berg struct iw_request_info *info, 18402a519311SJohannes Berg struct iw_point *data, char *extra); 1841691597cbSJohannes Berg int cfg80211_wext_siwmlme(struct net_device *dev, 1842691597cbSJohannes Berg struct iw_request_info *info, 1843691597cbSJohannes Berg struct iw_point *data, char *extra); 18444aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev, 18454aa188e1SJohannes Berg struct iw_request_info *info, 18464aa188e1SJohannes Berg struct iw_point *data, char *extra); 1847f2129354SJohannes Berg int cfg80211_wext_siwgenie(struct net_device *dev, 1848f2129354SJohannes Berg struct iw_request_info *info, 1849f2129354SJohannes Berg struct iw_point *data, char *extra); 1850f2129354SJohannes Berg int cfg80211_wext_siwauth(struct net_device *dev, 1851f2129354SJohannes Berg struct iw_request_info *info, 1852f2129354SJohannes Berg struct iw_param *data, char *extra); 1853f2129354SJohannes Berg int cfg80211_wext_giwauth(struct net_device *dev, 1854f2129354SJohannes Berg struct iw_request_info *info, 1855f2129354SJohannes Berg struct iw_param *data, char *extra); 1856f2129354SJohannes Berg 18570e82ffe3SJohannes Berg int cfg80211_wext_siwfreq(struct net_device *dev, 18580e82ffe3SJohannes Berg struct iw_request_info *info, 18590e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 18600e82ffe3SJohannes Berg int cfg80211_wext_giwfreq(struct net_device *dev, 18610e82ffe3SJohannes Berg struct iw_request_info *info, 18620e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 18631f9298f9SJohannes Berg int cfg80211_wext_siwessid(struct net_device *dev, 18641f9298f9SJohannes Berg struct iw_request_info *info, 18651f9298f9SJohannes Berg struct iw_point *data, char *ssid); 18661f9298f9SJohannes Berg int cfg80211_wext_giwessid(struct net_device *dev, 18671f9298f9SJohannes Berg struct iw_request_info *info, 18681f9298f9SJohannes Berg struct iw_point *data, char *ssid); 18699930380fSJohannes Berg int cfg80211_wext_siwrate(struct net_device *dev, 18709930380fSJohannes Berg struct iw_request_info *info, 18719930380fSJohannes Berg struct iw_param *rate, char *extra); 18729930380fSJohannes Berg int cfg80211_wext_giwrate(struct net_device *dev, 18739930380fSJohannes Berg struct iw_request_info *info, 18749930380fSJohannes Berg struct iw_param *rate, char *extra); 18759930380fSJohannes Berg 1876b9a5f8caSJouni Malinen int cfg80211_wext_siwrts(struct net_device *dev, 1877b9a5f8caSJouni Malinen struct iw_request_info *info, 1878b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 1879b9a5f8caSJouni Malinen int cfg80211_wext_giwrts(struct net_device *dev, 1880b9a5f8caSJouni Malinen struct iw_request_info *info, 1881b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 1882b9a5f8caSJouni Malinen int cfg80211_wext_siwfrag(struct net_device *dev, 1883b9a5f8caSJouni Malinen struct iw_request_info *info, 1884b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 1885b9a5f8caSJouni Malinen int cfg80211_wext_giwfrag(struct net_device *dev, 1886b9a5f8caSJouni Malinen struct iw_request_info *info, 1887b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 1888b9a5f8caSJouni Malinen int cfg80211_wext_siwretry(struct net_device *dev, 1889b9a5f8caSJouni Malinen struct iw_request_info *info, 1890b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 1891b9a5f8caSJouni Malinen int cfg80211_wext_giwretry(struct net_device *dev, 1892b9a5f8caSJouni Malinen struct iw_request_info *info, 1893b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 189408645126SJohannes Berg int cfg80211_wext_siwencodeext(struct net_device *dev, 189508645126SJohannes Berg struct iw_request_info *info, 189608645126SJohannes Berg struct iw_point *erq, char *extra); 189708645126SJohannes Berg int cfg80211_wext_siwencode(struct net_device *dev, 189808645126SJohannes Berg struct iw_request_info *info, 189908645126SJohannes Berg struct iw_point *erq, char *keybuf); 190008645126SJohannes Berg int cfg80211_wext_giwencode(struct net_device *dev, 190108645126SJohannes Berg struct iw_request_info *info, 190208645126SJohannes Berg struct iw_point *erq, char *keybuf); 19037643a2c3SJohannes Berg int cfg80211_wext_siwtxpower(struct net_device *dev, 19047643a2c3SJohannes Berg struct iw_request_info *info, 19057643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 19067643a2c3SJohannes Berg int cfg80211_wext_giwtxpower(struct net_device *dev, 19077643a2c3SJohannes Berg struct iw_request_info *info, 19087643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 19098990646dSJohannes Berg struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev); 1910b9a5f8caSJouni Malinen 1911bc92afd9SJohannes Berg int cfg80211_wext_siwpower(struct net_device *dev, 1912bc92afd9SJohannes Berg struct iw_request_info *info, 1913bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 1914bc92afd9SJohannes Berg int cfg80211_wext_giwpower(struct net_device *dev, 1915bc92afd9SJohannes Berg struct iw_request_info *info, 1916bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 1917bc92afd9SJohannes Berg 1918562e4822SJohannes Berg int cfg80211_wext_siwap(struct net_device *dev, 1919ab737a4fSJohannes Berg struct iw_request_info *info, 1920562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 1921562e4822SJohannes Berg int cfg80211_wext_giwap(struct net_device *dev, 1922ab737a4fSJohannes Berg struct iw_request_info *info, 1923562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 1924ab737a4fSJohannes Berg 1925d3236553SJohannes Berg /* 1926d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 1927d3236553SJohannes Berg * functions and BSS handling helpers 1928d3236553SJohannes Berg */ 1929d3236553SJohannes Berg 19302a519311SJohannes Berg /** 19312a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 19322a519311SJohannes Berg * 19332a519311SJohannes Berg * @request: the corresponding scan request 19342a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 19352a519311SJohannes Berg * userspace will be notified of that 19362a519311SJohannes Berg */ 19372a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 19382a519311SJohannes Berg 19392a519311SJohannes Berg /** 19402a519311SJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 19412a519311SJohannes Berg * 19422a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 19432a519311SJohannes Berg * @bss: the found BSS 194477965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 19452a519311SJohannes Berg * @gfp: context flags 19462a519311SJohannes Berg * 19472a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 19482a519311SJohannes Berg * the BSS should be updated/added. 19492a519311SJohannes Berg */ 19502a519311SJohannes Berg struct cfg80211_bss* 19512a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 19522a519311SJohannes Berg struct ieee80211_channel *channel, 19532a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 195477965c97SJohannes Berg s32 signal, gfp_t gfp); 19552a519311SJohannes Berg 195606aa7afaSJussi Kivilinna struct cfg80211_bss* 195706aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 195806aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 195906aa7afaSJussi Kivilinna const u8 *bssid, 196006aa7afaSJussi Kivilinna u64 timestamp, u16 capability, u16 beacon_interval, 196106aa7afaSJussi Kivilinna const u8 *ie, size_t ielen, 196206aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 196306aa7afaSJussi Kivilinna 19642a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 19652a519311SJohannes Berg struct ieee80211_channel *channel, 19662a519311SJohannes Berg const u8 *bssid, 196779420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 196879420f09SJohannes Berg u16 capa_mask, u16 capa_val); 196979420f09SJohannes Berg static inline struct cfg80211_bss * 197079420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 197179420f09SJohannes Berg struct ieee80211_channel *channel, 197279420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 197379420f09SJohannes Berg { 197479420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 197579420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 197679420f09SJohannes Berg } 197779420f09SJohannes Berg 19782a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 19792a519311SJohannes Berg struct ieee80211_channel *channel, 19802a519311SJohannes Berg const u8 *meshid, size_t meshidlen, 19812a519311SJohannes Berg const u8 *meshcfg); 19822a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss); 1983d3236553SJohannes Berg 1984d491af19SJohannes Berg /** 1985d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 1986d491af19SJohannes Berg * @wiphy: the wiphy 1987d491af19SJohannes Berg * @bss: the bss to remove 1988d491af19SJohannes Berg * 1989d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 1990d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 1991d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 1992d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 1993d491af19SJohannes Berg */ 1994d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 1995fee52678SJohannes Berg 19966039f6d2SJouni Malinen /** 19976039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 19986039f6d2SJouni Malinen * @dev: network device 19996039f6d2SJouni Malinen * @buf: authentication frame (header + body) 20006039f6d2SJouni Malinen * @len: length of the frame data 20016039f6d2SJouni Malinen * 20026039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 20031965c853SJouni Malinen * station mode. The driver is required to call either this function or 20041965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 2005cb0b4bebSJohannes Berg * call. This function may sleep. 20066039f6d2SJouni Malinen */ 2007cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 20086039f6d2SJouni Malinen 20096039f6d2SJouni Malinen /** 20101965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 20111965c853SJouni Malinen * @dev: network device 20121965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 2013cb0b4bebSJohannes Berg * 2014cb0b4bebSJohannes Berg * This function may sleep. 20151965c853SJouni Malinen */ 2016cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 20171965c853SJouni Malinen 20181965c853SJouni Malinen /** 2019a58ce43fSJohannes Berg * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled 2020a58ce43fSJohannes Berg * @dev: network device 2021a58ce43fSJohannes Berg * @addr: The MAC address of the device with which the authentication timed out 2022a58ce43fSJohannes Berg * 2023a58ce43fSJohannes Berg * When a pending authentication had no action yet, the driver may decide 2024a58ce43fSJohannes Berg * to not send a deauth frame, but in that case must calls this function 2025a58ce43fSJohannes Berg * to tell cfg80211 about this decision. It is only valid to call this 2026a58ce43fSJohannes Berg * function within the deauth() callback. 2027a58ce43fSJohannes Berg */ 2028a58ce43fSJohannes Berg void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); 2029a58ce43fSJohannes Berg 2030a58ce43fSJohannes Berg /** 20316039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 20326039f6d2SJouni Malinen * @dev: network device 20336039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 20346039f6d2SJouni Malinen * @len: length of the frame data 20356039f6d2SJouni Malinen * 20366039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 20371965c853SJouni Malinen * processed in station mode. The driver is required to call either this 20381965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 2039cb0b4bebSJohannes Berg * cfg80211_ops::assoc() call. This function may sleep. 20406039f6d2SJouni Malinen */ 2041cb0b4bebSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 20426039f6d2SJouni Malinen 20436039f6d2SJouni Malinen /** 20441965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 20451965c853SJouni Malinen * @dev: network device 20461965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 2047cb0b4bebSJohannes Berg * 2048cb0b4bebSJohannes Berg * This function may sleep. 20491965c853SJouni Malinen */ 2050cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 20511965c853SJouni Malinen 20521965c853SJouni Malinen /** 205353b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 20546039f6d2SJouni Malinen * @dev: network device 20556039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 20566039f6d2SJouni Malinen * @len: length of the frame data 20576039f6d2SJouni Malinen * 20586039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 205953b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 2060cb0b4bebSJohannes Berg * locally generated ones. This function may sleep. 20616039f6d2SJouni Malinen */ 2062ce470613SHolger Schurig void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 2063ce470613SHolger Schurig 2064ce470613SHolger Schurig /** 2065ce470613SHolger Schurig * __cfg80211_send_deauth - notification of processed deauthentication 2066ce470613SHolger Schurig * @dev: network device 2067ce470613SHolger Schurig * @buf: deauthentication frame (header + body) 2068ce470613SHolger Schurig * @len: length of the frame data 2069ce470613SHolger Schurig * 2070ce470613SHolger Schurig * Like cfg80211_send_deauth(), but doesn't take the wdev lock. 2071ce470613SHolger Schurig */ 2072ce470613SHolger Schurig void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 20736039f6d2SJouni Malinen 20746039f6d2SJouni Malinen /** 207553b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 20766039f6d2SJouni Malinen * @dev: network device 20776039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 20786039f6d2SJouni Malinen * @len: length of the frame data 20796039f6d2SJouni Malinen * 20806039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 208153b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 2082cb0b4bebSJohannes Berg * generated ones. This function may sleep. 20836039f6d2SJouni Malinen */ 2084ce470613SHolger Schurig void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); 2085ce470613SHolger Schurig 2086ce470613SHolger Schurig /** 2087ce470613SHolger Schurig * __cfg80211_send_disassoc - notification of processed disassociation 2088ce470613SHolger Schurig * @dev: network device 2089ce470613SHolger Schurig * @buf: disassociation response frame (header + body) 2090ce470613SHolger Schurig * @len: length of the frame data 2091ce470613SHolger Schurig * 2092ce470613SHolger Schurig * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. 2093ce470613SHolger Schurig */ 2094ce470613SHolger Schurig void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 2095ce470613SHolger Schurig size_t len); 20966039f6d2SJouni Malinen 2097a08c1c1aSKalle Valo /** 2098a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 2099a3b8b056SJouni Malinen * @dev: network device 2100a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 2101a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 2102a3b8b056SJouni Malinen * @key_id: Key identifier (0..3) 2103a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 2104e6d6e342SJohannes Berg * @gfp: allocation flags 2105a3b8b056SJouni Malinen * 2106a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 2107a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 2108a3b8b056SJouni Malinen * primitive. 2109a3b8b056SJouni Malinen */ 2110a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 2111a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 2112e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 2113a3b8b056SJouni Malinen 211404a773adSJohannes Berg /** 211504a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 211604a773adSJohannes Berg * 211704a773adSJohannes Berg * @dev: network device 211804a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 211904a773adSJohannes Berg * @gfp: allocation flags 212004a773adSJohannes Berg * 212104a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 212204a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 212304a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 212404a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 212504a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 212604a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 212704a773adSJohannes Berg */ 212804a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 212904a773adSJohannes Berg 21301f87f7d3SJohannes Berg /** 21311f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 21321f87f7d3SJohannes Berg * @wiphy: the wiphy 21331f87f7d3SJohannes Berg * @blocked: block status 21341f87f7d3SJohannes Berg */ 21351f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 21361f87f7d3SJohannes Berg 21371f87f7d3SJohannes Berg /** 21381f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 21391f87f7d3SJohannes Berg * @wiphy: the wiphy 21401f87f7d3SJohannes Berg */ 21411f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 21421f87f7d3SJohannes Berg 21431f87f7d3SJohannes Berg /** 21441f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 21451f87f7d3SJohannes Berg * @wiphy: the wiphy 21461f87f7d3SJohannes Berg */ 21471f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 21481f87f7d3SJohannes Berg 2149aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 2150aff89a9bSJohannes Berg /** 2151aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 2152aff89a9bSJohannes Berg * @wiphy: the wiphy 2153aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 2154aff89a9bSJohannes Berg * be put into the skb 2155aff89a9bSJohannes Berg * 2156aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 2157aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 2158aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 2159aff89a9bSJohannes Berg * 2160aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is pre-filled 2161aff89a9bSJohannes Berg * with the wiphy index and set up in a way that any data that is 2162aff89a9bSJohannes Berg * put into the skb (with skb_put(), nla_put() or similar) will end 2163aff89a9bSJohannes Berg * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 2164aff89a9bSJohannes Berg * needs to be done with the skb is adding data for the corresponding 2165aff89a9bSJohannes Berg * userspace tool which can then read that data out of the testdata 2166aff89a9bSJohannes Berg * attribute. You must not modify the skb in any other way. 2167aff89a9bSJohannes Berg * 2168aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 2169aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 2170aff89a9bSJohannes Berg */ 2171aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 2172aff89a9bSJohannes Berg int approxlen); 2173aff89a9bSJohannes Berg 2174aff89a9bSJohannes Berg /** 2175aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 2176aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 2177aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 2178aff89a9bSJohannes Berg * 2179aff89a9bSJohannes Berg * Returns an error code or 0 on success, since calling this 2180aff89a9bSJohannes Berg * function will usually be the last thing before returning 2181aff89a9bSJohannes Berg * from the @testmode_cmd you should return the error code. 2182aff89a9bSJohannes Berg * Note that this function consumes the skb regardless of the 2183aff89a9bSJohannes Berg * return value. 2184aff89a9bSJohannes Berg */ 2185aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb); 2186aff89a9bSJohannes Berg 2187aff89a9bSJohannes Berg /** 2188aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 2189aff89a9bSJohannes Berg * @wiphy: the wiphy 2190aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 2191aff89a9bSJohannes Berg * be put into the skb 2192aff89a9bSJohannes Berg * @gfp: allocation flags 2193aff89a9bSJohannes Berg * 2194aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 2195aff89a9bSJohannes Berg * testmode multicast group. 2196aff89a9bSJohannes Berg * 2197aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is set up in the 2198aff89a9bSJohannes Berg * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 2199aff89a9bSJohannes Berg * for an event. As there, you should simply add data to it that will 2200aff89a9bSJohannes Berg * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 2201aff89a9bSJohannes Berg * not modify the skb in any other way. 2202aff89a9bSJohannes Berg * 2203aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 2204aff89a9bSJohannes Berg * skb to send the event. 2205aff89a9bSJohannes Berg */ 2206aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 2207aff89a9bSJohannes Berg int approxlen, gfp_t gfp); 2208aff89a9bSJohannes Berg 2209aff89a9bSJohannes Berg /** 2210aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 2211aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 2212aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 2213aff89a9bSJohannes Berg * @gfp: allocation flags 2214aff89a9bSJohannes Berg * 2215aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 2216aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 2217aff89a9bSJohannes Berg * consumes it. 2218aff89a9bSJohannes Berg */ 2219aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 2220aff89a9bSJohannes Berg 2221aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 2222aff89a9bSJohannes Berg #else 2223aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 2224aff89a9bSJohannes Berg #endif 2225aff89a9bSJohannes Berg 2226b23aa676SSamuel Ortiz /** 2227b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 2228b23aa676SSamuel Ortiz * 2229b23aa676SSamuel Ortiz * @dev: network device 2230b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 2231b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 2232b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 2233b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 2234b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 2235b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 2236b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 2237b23aa676SSamuel Ortiz * the real status code for failures. 2238b23aa676SSamuel Ortiz * @gfp: allocation flags 2239b23aa676SSamuel Ortiz * 2240b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 2241b23aa676SSamuel Ortiz * succeeded. 2242b23aa676SSamuel Ortiz */ 2243b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 2244b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 2245b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 2246b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 2247b23aa676SSamuel Ortiz 2248b23aa676SSamuel Ortiz /** 2249b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 2250b23aa676SSamuel Ortiz * 2251b23aa676SSamuel Ortiz * @dev: network device 2252b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 2253b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 2254b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 2255b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 2256b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 2257b23aa676SSamuel Ortiz * @gfp: allocation flags 2258b23aa676SSamuel Ortiz * 2259b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 2260b23aa676SSamuel Ortiz * from one AP to another while connected. 2261b23aa676SSamuel Ortiz */ 2262b23aa676SSamuel Ortiz void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 2263b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 2264b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 2265b23aa676SSamuel Ortiz 2266b23aa676SSamuel Ortiz /** 2267b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 2268b23aa676SSamuel Ortiz * 2269b23aa676SSamuel Ortiz * @dev: network device 2270b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 2271b23aa676SSamuel Ortiz * @ie_len: length of IEs 2272b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 2273b23aa676SSamuel Ortiz * @gfp: allocation flags 2274b23aa676SSamuel Ortiz * 2275b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 2276b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 2277b23aa676SSamuel Ortiz */ 2278b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 2279b23aa676SSamuel Ortiz u8 *ie, size_t ie_len, gfp_t gfp); 2280b23aa676SSamuel Ortiz 22819588bbd5SJouni Malinen /** 22829588bbd5SJouni Malinen * cfg80211_ready_on_channel - notification of remain_on_channel start 22839588bbd5SJouni Malinen * @dev: network device 22849588bbd5SJouni Malinen * @cookie: the request cookie 22859588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 22869588bbd5SJouni Malinen * @channel_type: Channel type 22879588bbd5SJouni Malinen * @duration: Duration in milliseconds that the driver intents to remain on the 22889588bbd5SJouni Malinen * channel 22899588bbd5SJouni Malinen * @gfp: allocation flags 22909588bbd5SJouni Malinen */ 22919588bbd5SJouni Malinen void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 22929588bbd5SJouni Malinen struct ieee80211_channel *chan, 22939588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 22949588bbd5SJouni Malinen unsigned int duration, gfp_t gfp); 22959588bbd5SJouni Malinen 22969588bbd5SJouni Malinen /** 22979588bbd5SJouni Malinen * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 22989588bbd5SJouni Malinen * @dev: network device 22999588bbd5SJouni Malinen * @cookie: the request cookie 23009588bbd5SJouni Malinen * @chan: The current channel (from remain_on_channel request) 23019588bbd5SJouni Malinen * @channel_type: Channel type 23029588bbd5SJouni Malinen * @gfp: allocation flags 23039588bbd5SJouni Malinen */ 23049588bbd5SJouni Malinen void cfg80211_remain_on_channel_expired(struct net_device *dev, 23059588bbd5SJouni Malinen u64 cookie, 23069588bbd5SJouni Malinen struct ieee80211_channel *chan, 23079588bbd5SJouni Malinen enum nl80211_channel_type channel_type, 23089588bbd5SJouni Malinen gfp_t gfp); 2309b23aa676SSamuel Ortiz 231098b62183SJohannes Berg 231198b62183SJohannes Berg /** 231298b62183SJohannes Berg * cfg80211_new_sta - notify userspace about station 231398b62183SJohannes Berg * 231498b62183SJohannes Berg * @dev: the netdev 231598b62183SJohannes Berg * @mac_addr: the station's address 231698b62183SJohannes Berg * @sinfo: the station information 231798b62183SJohannes Berg * @gfp: allocation flags 231898b62183SJohannes Berg */ 231998b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 232098b62183SJohannes Berg struct station_info *sinfo, gfp_t gfp); 232198b62183SJohannes Berg 2322026331c4SJouni Malinen /** 2323026331c4SJouni Malinen * cfg80211_rx_action - notification of received, unprocessed Action frame 2324026331c4SJouni Malinen * @dev: network device 2325026331c4SJouni Malinen * @freq: Frequency on which the frame was received in MHz 2326026331c4SJouni Malinen * @buf: Action frame (header + body) 2327026331c4SJouni Malinen * @len: length of the frame data 2328026331c4SJouni Malinen * @gfp: context flags 2329026331c4SJouni Malinen * Returns %true if a user space application is responsible for rejecting the 2330026331c4SJouni Malinen * unrecognized Action frame; %false if no such application is registered 2331026331c4SJouni Malinen * (i.e., the driver is responsible for rejecting the unrecognized Action 2332026331c4SJouni Malinen * frame) 2333026331c4SJouni Malinen * 2334026331c4SJouni Malinen * This function is called whenever an Action frame is received for a station 2335026331c4SJouni Malinen * mode interface, but is not processed in kernel. 2336026331c4SJouni Malinen */ 2337026331c4SJouni Malinen bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, 2338026331c4SJouni Malinen size_t len, gfp_t gfp); 2339026331c4SJouni Malinen 2340026331c4SJouni Malinen /** 2341026331c4SJouni Malinen * cfg80211_action_tx_status - notification of TX status for Action frame 2342026331c4SJouni Malinen * @dev: network device 2343026331c4SJouni Malinen * @cookie: Cookie returned by cfg80211_ops::action() 2344026331c4SJouni Malinen * @buf: Action frame (header + body) 2345026331c4SJouni Malinen * @len: length of the frame data 2346026331c4SJouni Malinen * @ack: Whether frame was acknowledged 2347026331c4SJouni Malinen * @gfp: context flags 2348026331c4SJouni Malinen * 2349026331c4SJouni Malinen * This function is called whenever an Action frame was requested to be 2350026331c4SJouni Malinen * transmitted with cfg80211_ops::action() to report the TX status of the 2351026331c4SJouni Malinen * transmission attempt. 2352026331c4SJouni Malinen */ 2353026331c4SJouni Malinen void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, 2354026331c4SJouni Malinen const u8 *buf, size_t len, bool ack, gfp_t gfp); 2355026331c4SJouni Malinen 2356d6dc1a38SJuuso Oikarinen 2357d6dc1a38SJuuso Oikarinen /** 2358d6dc1a38SJuuso Oikarinen * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event 2359d6dc1a38SJuuso Oikarinen * @dev: network device 2360d6dc1a38SJuuso Oikarinen * @rssi_event: the triggered RSSI event 2361d6dc1a38SJuuso Oikarinen * @gfp: context flags 2362d6dc1a38SJuuso Oikarinen * 2363d6dc1a38SJuuso Oikarinen * This function is called when a configured connection quality monitoring 2364d6dc1a38SJuuso Oikarinen * rssi threshold reached event occurs. 2365d6dc1a38SJuuso Oikarinen */ 2366d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev, 2367d6dc1a38SJuuso Oikarinen enum nl80211_cqm_rssi_threshold_event rssi_event, 2368d6dc1a38SJuuso Oikarinen gfp_t gfp); 2369d6dc1a38SJuuso Oikarinen 2370704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 2371