1704232c2SJohannes Berg #ifndef __NET_CFG80211_H 2704232c2SJohannes Berg #define __NET_CFG80211_H 3d3236553SJohannes Berg /* 4d3236553SJohannes Berg * 802.11 device and configuration interface 5d3236553SJohannes Berg * 6d3236553SJohannes Berg * Copyright 2006-2009 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 { 42d3236553SJohannes Berg IEEE80211_BAND_2GHZ, 43d3236553SJohannes Berg IEEE80211_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 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz 84d3236553SJohannes Berg * @hw_value: hardware-specific value for the channel 85d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 86d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 87d3236553SJohannes Berg * code to support devices with additional restrictions 88d3236553SJohannes Berg * @band: band this channel belongs to. 89d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 90d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 91d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 92d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 93d3236553SJohannes Berg * to enable this, this is is useful only on 5 GHz band. 94d3236553SJohannes Berg * @orig_mag: internal use 95d3236553SJohannes Berg * @orig_mpwr: internal use 96d3236553SJohannes Berg */ 97d3236553SJohannes Berg struct ieee80211_channel { 98d3236553SJohannes Berg enum ieee80211_band band; 99d3236553SJohannes Berg u16 center_freq; 100d3236553SJohannes Berg u8 max_bandwidth; 101d3236553SJohannes Berg u16 hw_value; 102d3236553SJohannes Berg u32 flags; 103d3236553SJohannes Berg int max_antenna_gain; 104d3236553SJohannes Berg int max_power; 105d3236553SJohannes Berg bool beacon_found; 106d3236553SJohannes Berg u32 orig_flags; 107d3236553SJohannes Berg int orig_mag, orig_mpwr; 108d3236553SJohannes Berg }; 109d3236553SJohannes Berg 110d3236553SJohannes Berg /** 111d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 112d3236553SJohannes Berg * 113d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 114d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 115d3236553SJohannes Berg * different bands/PHY modes. 116d3236553SJohannes Berg * 117d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 118d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 119d3236553SJohannes Berg * with CCK rates. 120d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 121d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 122d3236553SJohannes Berg * core code when registering the wiphy. 123d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 124d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 125d3236553SJohannes Berg * core code when registering the wiphy. 126d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 127d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 128d3236553SJohannes Berg * core code when registering the wiphy. 129d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 130d3236553SJohannes Berg */ 131d3236553SJohannes Berg enum ieee80211_rate_flags { 132d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 133d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 134d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 135d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 136d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 137d3236553SJohannes Berg }; 138d3236553SJohannes Berg 139d3236553SJohannes Berg /** 140d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 141d3236553SJohannes Berg * 142d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 143d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 144d3236553SJohannes Berg * are only for driver use when pointers to this structure are 145d3236553SJohannes Berg * passed around. 146d3236553SJohannes Berg * 147d3236553SJohannes Berg * @flags: rate-specific flags 148d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 149d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 150d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 151d3236553SJohannes Berg * short preamble is used 152d3236553SJohannes Berg */ 153d3236553SJohannes Berg struct ieee80211_rate { 154d3236553SJohannes Berg u32 flags; 155d3236553SJohannes Berg u16 bitrate; 156d3236553SJohannes Berg u16 hw_value, hw_value_short; 157d3236553SJohannes Berg }; 158d3236553SJohannes Berg 159d3236553SJohannes Berg /** 160d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 161d3236553SJohannes Berg * 162d3236553SJohannes Berg * This structure describes most essential parameters needed 163d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 164d3236553SJohannes Berg * 165d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 166d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 167d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 168d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 169d3236553SJohannes Berg * @mcs: Supported MCS rates 170d3236553SJohannes Berg */ 171d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 172d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 173d3236553SJohannes Berg bool ht_supported; 174d3236553SJohannes Berg u8 ampdu_factor; 175d3236553SJohannes Berg u8 ampdu_density; 176d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 177d3236553SJohannes Berg }; 178d3236553SJohannes Berg 179d3236553SJohannes Berg /** 180d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 181d3236553SJohannes Berg * 182d3236553SJohannes Berg * This structure describes a frequency band a wiphy 183d3236553SJohannes Berg * is able to operate in. 184d3236553SJohannes Berg * 185d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 186d3236553SJohannes Berg * in this band. 187d3236553SJohannes Berg * @band: the band this structure represents 188d3236553SJohannes Berg * @n_channels: Number of channels in @channels 189d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 190d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 191d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 192d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 193d3236553SJohannes Berg */ 194d3236553SJohannes Berg struct ieee80211_supported_band { 195d3236553SJohannes Berg struct ieee80211_channel *channels; 196d3236553SJohannes Berg struct ieee80211_rate *bitrates; 197d3236553SJohannes Berg enum ieee80211_band band; 198d3236553SJohannes Berg int n_channels; 199d3236553SJohannes Berg int n_bitrates; 200d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 201d3236553SJohannes Berg }; 202d3236553SJohannes Berg 203d3236553SJohannes Berg /* 204d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 205704232c2SJohannes Berg */ 206704232c2SJohannes Berg 2072ec600d6SLuis Carlos Cobo /** 2082ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 2092ec600d6SLuis Carlos Cobo * @mesh_id: mesh ID to use 2102ec600d6SLuis Carlos Cobo * @mesh_id_len: length of the mesh ID 2112ec600d6SLuis Carlos Cobo */ 2122ec600d6SLuis Carlos Cobo struct vif_params { 2132ec600d6SLuis Carlos Cobo u8 *mesh_id; 2142ec600d6SLuis Carlos Cobo int mesh_id_len; 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 /** 238ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 239ed1b6cc7SJohannes Berg * 240ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 241ed1b6cc7SJohannes Berg * 242ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 243ed1b6cc7SJohannes Berg * or %NULL if not changed 244ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 245ed1b6cc7SJohannes Berg * or %NULL if not changed 246ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 247ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 248ed1b6cc7SJohannes Berg * @head_len: length of @head 249ed1b6cc7SJohannes Berg * @tail_len: length of @tail 250ed1b6cc7SJohannes Berg */ 251ed1b6cc7SJohannes Berg struct beacon_parameters { 252ed1b6cc7SJohannes Berg u8 *head, *tail; 253ed1b6cc7SJohannes Berg int interval, dtim_period; 254ed1b6cc7SJohannes Berg int head_len, tail_len; 255ed1b6cc7SJohannes Berg }; 256ed1b6cc7SJohannes Berg 2575727ef1bSJohannes Berg /** 2582ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 2592ec600d6SLuis Carlos Cobo * 2602ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 2612ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 2622ec600d6SLuis Carlos Cobo * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 2632ec600d6SLuis Carlos Cobo */ 2642ec600d6SLuis Carlos Cobo enum plink_actions { 2652ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 2662ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 2672ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 2682ec600d6SLuis Carlos Cobo }; 2692ec600d6SLuis Carlos Cobo 2702ec600d6SLuis Carlos Cobo /** 2715727ef1bSJohannes Berg * struct station_parameters - station parameters 2725727ef1bSJohannes Berg * 2735727ef1bSJohannes Berg * Used to change and create a new station. 2745727ef1bSJohannes Berg * 2755727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 2765727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 2775727ef1bSJohannes Berg * (or NULL for no change) 2785727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 279eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 280eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 281eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 282eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 2835727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 2845727ef1bSJohannes Berg * @aid: AID or zero for no change 2855727ef1bSJohannes Berg */ 2865727ef1bSJohannes Berg struct station_parameters { 2875727ef1bSJohannes Berg u8 *supported_rates; 2885727ef1bSJohannes Berg struct net_device *vlan; 289eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 2905727ef1bSJohannes Berg int listen_interval; 2915727ef1bSJohannes Berg u16 aid; 2925727ef1bSJohannes Berg u8 supported_rates_len; 2932ec600d6SLuis Carlos Cobo u8 plink_action; 29436aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 2955727ef1bSJohannes Berg }; 2965727ef1bSJohannes Berg 297fd5b74dcSJohannes Berg /** 2982ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 299fd5b74dcSJohannes Berg * 3002ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 3012ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 302fd5b74dcSJohannes Berg * 3032ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 3042ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 3052ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 3062ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 3072ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 3082ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 309420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 310420e7fabSHenning Rogge * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 311420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 31298c8a60aSJouni Malinen * @STATION_INFO_RX_PACKETS: @rx_packets filled 31398c8a60aSJouni Malinen * @STATION_INFO_TX_PACKETS: @tx_packets filled 314fd5b74dcSJohannes Berg */ 3152ec600d6SLuis Carlos Cobo enum station_info_flags { 3162ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 3172ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 3182ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 3192ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 3202ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 3212ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 322420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 323420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 32498c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 32598c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 326420e7fabSHenning Rogge }; 327420e7fabSHenning Rogge 328420e7fabSHenning Rogge /** 329420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 330420e7fabSHenning Rogge * 331420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 332420e7fabSHenning Rogge * type for 802.11n transmissions. 333420e7fabSHenning Rogge * 334420e7fabSHenning Rogge * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 335420e7fabSHenning Rogge * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 336420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 337420e7fabSHenning Rogge */ 338420e7fabSHenning Rogge enum rate_info_flags { 339420e7fabSHenning Rogge RATE_INFO_FLAGS_MCS = 1<<0, 340420e7fabSHenning Rogge RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 341420e7fabSHenning Rogge RATE_INFO_FLAGS_SHORT_GI = 1<<2, 342420e7fabSHenning Rogge }; 343420e7fabSHenning Rogge 344420e7fabSHenning Rogge /** 345420e7fabSHenning Rogge * struct rate_info - bitrate information 346420e7fabSHenning Rogge * 347420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 348420e7fabSHenning Rogge * 349420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 350420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 351420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 352420e7fabSHenning Rogge */ 353420e7fabSHenning Rogge struct rate_info { 354420e7fabSHenning Rogge u8 flags; 355420e7fabSHenning Rogge u8 mcs; 356420e7fabSHenning Rogge u16 legacy; 357fd5b74dcSJohannes Berg }; 358fd5b74dcSJohannes Berg 359fd5b74dcSJohannes Berg /** 3602ec600d6SLuis Carlos Cobo * struct station_info - station information 361fd5b74dcSJohannes Berg * 3622ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 363fd5b74dcSJohannes Berg * 3642ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 365fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 366fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 367fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 3682ec600d6SLuis Carlos Cobo * @llid: mesh local link id 3692ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 3702ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 371420e7fabSHenning Rogge * @signal: signal strength of last received packet in dBm 372420e7fabSHenning Rogge * @txrate: current unicast bitrate to this station 37398c8a60aSJouni Malinen * @rx_packets: packets received from this station 37498c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 375fd5b74dcSJohannes Berg */ 3762ec600d6SLuis Carlos Cobo struct station_info { 377fd5b74dcSJohannes Berg u32 filled; 378fd5b74dcSJohannes Berg u32 inactive_time; 379fd5b74dcSJohannes Berg u32 rx_bytes; 380fd5b74dcSJohannes Berg u32 tx_bytes; 3812ec600d6SLuis Carlos Cobo u16 llid; 3822ec600d6SLuis Carlos Cobo u16 plid; 3832ec600d6SLuis Carlos Cobo u8 plink_state; 384420e7fabSHenning Rogge s8 signal; 385420e7fabSHenning Rogge struct rate_info txrate; 38698c8a60aSJouni Malinen u32 rx_packets; 38798c8a60aSJouni Malinen u32 tx_packets; 388fd5b74dcSJohannes Berg }; 389fd5b74dcSJohannes Berg 39066f7ac50SMichael Wu /** 39166f7ac50SMichael Wu * enum monitor_flags - monitor flags 39266f7ac50SMichael Wu * 39366f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 39466f7ac50SMichael Wu * according to the nl80211 flags. 39566f7ac50SMichael Wu * 39666f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 39766f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 39866f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 39966f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 40066f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 40166f7ac50SMichael Wu */ 40266f7ac50SMichael Wu enum monitor_flags { 40366f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 40466f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 40566f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 40666f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 40766f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 40866f7ac50SMichael Wu }; 40966f7ac50SMichael Wu 4102ec600d6SLuis Carlos Cobo /** 4112ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 4122ec600d6SLuis Carlos Cobo * 4132ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 4142ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 4152ec600d6SLuis Carlos Cobo * 4162ec600d6SLuis Carlos Cobo * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 4172ec600d6SLuis Carlos Cobo * MPATH_INFO_DSN: @dsn filled 4182ec600d6SLuis Carlos Cobo * MPATH_INFO_METRIC: @metric filled 4192ec600d6SLuis Carlos Cobo * MPATH_INFO_EXPTIME: @exptime filled 4202ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 4212ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 4222ec600d6SLuis Carlos Cobo * MPATH_INFO_FLAGS: @flags filled 4232ec600d6SLuis Carlos Cobo */ 4242ec600d6SLuis Carlos Cobo enum mpath_info_flags { 4252ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 4262ec600d6SLuis Carlos Cobo MPATH_INFO_DSN = BIT(1), 4272ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 4282ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 4292ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 4302ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 4312ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 4322ec600d6SLuis Carlos Cobo }; 4332ec600d6SLuis Carlos Cobo 4342ec600d6SLuis Carlos Cobo /** 4352ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 4362ec600d6SLuis Carlos Cobo * 4372ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 4382ec600d6SLuis Carlos Cobo * 4392ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 4402ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 4412ec600d6SLuis Carlos Cobo * @dsn: destination sequence number 4422ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 4432ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 4442ec600d6SLuis Carlos Cobo * @flags: mesh path flags 4452ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 4462ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 4472ec600d6SLuis Carlos Cobo */ 4482ec600d6SLuis Carlos Cobo struct mpath_info { 4492ec600d6SLuis Carlos Cobo u32 filled; 4502ec600d6SLuis Carlos Cobo u32 frame_qlen; 4512ec600d6SLuis Carlos Cobo u32 dsn; 4522ec600d6SLuis Carlos Cobo u32 metric; 4532ec600d6SLuis Carlos Cobo u32 exptime; 4542ec600d6SLuis Carlos Cobo u32 discovery_timeout; 4552ec600d6SLuis Carlos Cobo u8 discovery_retries; 4562ec600d6SLuis Carlos Cobo u8 flags; 4572ec600d6SLuis Carlos Cobo }; 4582ec600d6SLuis Carlos Cobo 4599f1ba906SJouni Malinen /** 4609f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 4619f1ba906SJouni Malinen * 4629f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 4639f1ba906SJouni Malinen * 4649f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 4659f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 4669f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 4679f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 4689f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 4699f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 47090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 47190c97a04SJouni Malinen * (or NULL for no change) 47290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 4739f1ba906SJouni Malinen */ 4749f1ba906SJouni Malinen struct bss_parameters { 4759f1ba906SJouni Malinen int use_cts_prot; 4769f1ba906SJouni Malinen int use_short_preamble; 4779f1ba906SJouni Malinen int use_short_slot_time; 47890c97a04SJouni Malinen u8 *basic_rates; 47990c97a04SJouni Malinen u8 basic_rates_len; 4809f1ba906SJouni Malinen }; 4812ec600d6SLuis Carlos Cobo 48293da9cc1Scolin@cozybit.com struct mesh_config { 48393da9cc1Scolin@cozybit.com /* Timeouts in ms */ 48493da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 48593da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 48693da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 48793da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 48893da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 48993da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 49093da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 49193da9cc1Scolin@cozybit.com bool auto_open_plinks; 49293da9cc1Scolin@cozybit.com /* HWMP parameters */ 49393da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 49493da9cc1Scolin@cozybit.com u32 path_refresh_time; 49593da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 49693da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 49793da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 49893da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 49993da9cc1Scolin@cozybit.com }; 50093da9cc1Scolin@cozybit.com 50131888487SJouni Malinen /** 50231888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 50331888487SJouni Malinen * @queue: TX queue identifier (NL80211_TXQ_Q_*) 50431888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 50531888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 50631888487SJouni Malinen * 1..32767] 50731888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 50831888487SJouni Malinen * 1..32767] 50931888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 51031888487SJouni Malinen */ 51131888487SJouni Malinen struct ieee80211_txq_params { 51231888487SJouni Malinen enum nl80211_txq_q queue; 51331888487SJouni Malinen u16 txop; 51431888487SJouni Malinen u16 cwmin; 51531888487SJouni Malinen u16 cwmax; 51631888487SJouni Malinen u8 aifs; 51731888487SJouni Malinen }; 51831888487SJouni Malinen 519704232c2SJohannes Berg /* from net/wireless.h */ 520704232c2SJohannes Berg struct wiphy; 521704232c2SJohannes Berg 52272bdcf34SJouni Malinen /* from net/ieee80211.h */ 52372bdcf34SJouni Malinen struct ieee80211_channel; 52472bdcf34SJouni Malinen 525704232c2SJohannes Berg /** 5262a519311SJohannes Berg * struct cfg80211_ssid - SSID description 5272a519311SJohannes Berg * @ssid: the SSID 5282a519311SJohannes Berg * @ssid_len: length of the ssid 5292a519311SJohannes Berg */ 5302a519311SJohannes Berg struct cfg80211_ssid { 5312a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 5322a519311SJohannes Berg u8 ssid_len; 5332a519311SJohannes Berg }; 5342a519311SJohannes Berg 5352a519311SJohannes Berg /** 5362a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 5372a519311SJohannes Berg * 5382a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 5392a519311SJohannes Berg * @n_ssids: number of SSIDs 5402a519311SJohannes Berg * @channels: channels to scan on. 5412a519311SJohannes Berg * @n_channels: number of channels for each band 54270692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 54370692ad2SJouni Malinen * @ie_len: length of ie in octets 5442a519311SJohannes Berg * @wiphy: the wiphy this was for 5452a519311SJohannes Berg * @ifidx: the interface index 5462a519311SJohannes Berg */ 5472a519311SJohannes Berg struct cfg80211_scan_request { 5482a519311SJohannes Berg struct cfg80211_ssid *ssids; 5492a519311SJohannes Berg int n_ssids; 5502a519311SJohannes Berg struct ieee80211_channel **channels; 5512a519311SJohannes Berg u32 n_channels; 552de95a54bSJohannes Berg const u8 *ie; 55370692ad2SJouni Malinen size_t ie_len; 5542a519311SJohannes Berg 5552a519311SJohannes Berg /* internal */ 5562a519311SJohannes Berg struct wiphy *wiphy; 5572a519311SJohannes Berg int ifidx; 5582a519311SJohannes Berg }; 5592a519311SJohannes Berg 5602a519311SJohannes Berg /** 5612a519311SJohannes Berg * enum cfg80211_signal_type - signal type 5622a519311SJohannes Berg * 5632a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 5642a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 5652a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 5662a519311SJohannes Berg */ 5672a519311SJohannes Berg enum cfg80211_signal_type { 5682a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 5692a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 5702a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 5712a519311SJohannes Berg }; 5722a519311SJohannes Berg 5732a519311SJohannes Berg /** 5742a519311SJohannes Berg * struct cfg80211_bss - BSS description 5752a519311SJohannes Berg * 5762a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 5772a519311SJohannes Berg * for use in scan results and similar. 5782a519311SJohannes Berg * 5792a519311SJohannes Berg * @bssid: BSSID of the BSS 5802a519311SJohannes Berg * @tsf: timestamp of last received update 5812a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 5822a519311SJohannes Berg * @capability: the capability field in host byte order 5832a519311SJohannes Berg * @information_elements: the information elements (Note that there 5842a519311SJohannes Berg * is no guarantee that these are well-formed!) 5852a519311SJohannes Berg * @len_information_elements: total length of the information elements 58677965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 587a08c1c1aSKalle Valo * @hold: BSS should not expire 58878c1c7e1SJohannes Berg * @free_priv: function pointer to free private data 5892a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 5902a519311SJohannes Berg */ 5912a519311SJohannes Berg struct cfg80211_bss { 5922a519311SJohannes Berg struct ieee80211_channel *channel; 5932a519311SJohannes Berg 5942a519311SJohannes Berg u8 bssid[ETH_ALEN]; 5952a519311SJohannes Berg u64 tsf; 5962a519311SJohannes Berg u16 beacon_interval; 5972a519311SJohannes Berg u16 capability; 5982a519311SJohannes Berg u8 *information_elements; 5992a519311SJohannes Berg size_t len_information_elements; 6002a519311SJohannes Berg 6012a519311SJohannes Berg s32 signal; 6022a519311SJohannes Berg 60378c1c7e1SJohannes Berg void (*free_priv)(struct cfg80211_bss *bss); 6042a519311SJohannes Berg u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 6052a519311SJohannes Berg }; 6062a519311SJohannes Berg 6072a519311SJohannes Berg /** 608636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 609636a5d36SJouni Malinen * 610636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 611636a5d36SJouni Malinen * authentication. 612636a5d36SJouni Malinen * NOTE: This structure will likely change when more code from mac80211 is 613636a5d36SJouni Malinen * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. 614636a5d36SJouni Malinen * Before using this in a driver that does not use mac80211, it would be better 615636a5d36SJouni Malinen * to check the status of that work and better yet, volunteer to work on it. 616636a5d36SJouni Malinen * 617636a5d36SJouni Malinen * @chan: The channel to use or %NULL if not specified (auto-select based on 618636a5d36SJouni Malinen * scan results) 619636a5d36SJouni Malinen * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case); 620636a5d36SJouni Malinen * this field is required to be present; if the driver wants to help with 621636a5d36SJouni Malinen * BSS selection, it should use (yet to be added) MLME event to allow user 622636a5d36SJouni Malinen * space SME to be notified of roaming candidate, so that the SME can then 623636a5d36SJouni Malinen * use the authentication request with the recommended BSSID and whatever 624636a5d36SJouni Malinen * other data may be needed for authentication/association 625636a5d36SJouni Malinen * @ssid: SSID or %NULL if not yet available 626636a5d36SJouni Malinen * @ssid_len: Length of ssid in octets 627636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 628636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 629636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 630636a5d36SJouni Malinen */ 631636a5d36SJouni Malinen struct cfg80211_auth_request { 632636a5d36SJouni Malinen struct ieee80211_channel *chan; 633636a5d36SJouni Malinen u8 *peer_addr; 634636a5d36SJouni Malinen const u8 *ssid; 635636a5d36SJouni Malinen size_t ssid_len; 636636a5d36SJouni Malinen enum nl80211_auth_type auth_type; 637636a5d36SJouni Malinen const u8 *ie; 638636a5d36SJouni Malinen size_t ie_len; 639636a5d36SJouni Malinen }; 640636a5d36SJouni Malinen 641636a5d36SJouni Malinen /** 642636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 643636a5d36SJouni Malinen * 644636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 645636a5d36SJouni Malinen * (re)association. 646636a5d36SJouni Malinen * NOTE: This structure will likely change when more code from mac80211 is 647636a5d36SJouni Malinen * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. 648636a5d36SJouni Malinen * Before using this in a driver that does not use mac80211, it would be better 649636a5d36SJouni Malinen * to check the status of that work and better yet, volunteer to work on it. 650636a5d36SJouni Malinen * 651636a5d36SJouni Malinen * @chan: The channel to use or %NULL if not specified (auto-select based on 652636a5d36SJouni Malinen * scan results) 653636a5d36SJouni Malinen * @peer_addr: The address of the peer STA (AP BSSID); this field is required 654636a5d36SJouni Malinen * to be present and the STA must be in State 2 (authenticated) with the 655636a5d36SJouni Malinen * peer STA 656636a5d36SJouni Malinen * @ssid: SSID 657636a5d36SJouni Malinen * @ssid_len: Length of ssid in octets 658636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 659636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 660dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 6613f77316cSJouni Malinen * @control_port: Whether user space controls IEEE 802.1X port, i.e., 6623f77316cSJouni Malinen * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 6633f77316cSJouni Malinen * required to assume that the port is unauthorized until authorized by 6643f77316cSJouni Malinen * user space. Otherwise, port is marked authorized by default. 665636a5d36SJouni Malinen */ 666636a5d36SJouni Malinen struct cfg80211_assoc_request { 667636a5d36SJouni Malinen struct ieee80211_channel *chan; 668636a5d36SJouni Malinen u8 *peer_addr; 669636a5d36SJouni Malinen const u8 *ssid; 670636a5d36SJouni Malinen size_t ssid_len; 671636a5d36SJouni Malinen const u8 *ie; 672636a5d36SJouni Malinen size_t ie_len; 673dc6382ceSJouni Malinen bool use_mfp; 6743f77316cSJouni Malinen bool control_port; 675636a5d36SJouni Malinen }; 676636a5d36SJouni Malinen 677636a5d36SJouni Malinen /** 678636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 679636a5d36SJouni Malinen * 680636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 681636a5d36SJouni Malinen * deauthentication. 682636a5d36SJouni Malinen * 683636a5d36SJouni Malinen * @peer_addr: The address of the peer STA (AP BSSID); this field is required 684636a5d36SJouni Malinen * to be present and the STA must be authenticated with the peer STA 685636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 686636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 687636a5d36SJouni Malinen */ 688636a5d36SJouni Malinen struct cfg80211_deauth_request { 689636a5d36SJouni Malinen u8 *peer_addr; 690636a5d36SJouni Malinen u16 reason_code; 691636a5d36SJouni Malinen const u8 *ie; 692636a5d36SJouni Malinen size_t ie_len; 693636a5d36SJouni Malinen }; 694636a5d36SJouni Malinen 695636a5d36SJouni Malinen /** 696636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 697636a5d36SJouni Malinen * 698636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 699636a5d36SJouni Malinen * disassocation. 700636a5d36SJouni Malinen * 701636a5d36SJouni Malinen * @peer_addr: The address of the peer STA (AP BSSID); this field is required 702636a5d36SJouni Malinen * to be present and the STA must be associated with the peer STA 703636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 704636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 705636a5d36SJouni Malinen */ 706636a5d36SJouni Malinen struct cfg80211_disassoc_request { 707636a5d36SJouni Malinen u8 *peer_addr; 708636a5d36SJouni Malinen u16 reason_code; 709636a5d36SJouni Malinen const u8 *ie; 710636a5d36SJouni Malinen size_t ie_len; 711636a5d36SJouni Malinen }; 712636a5d36SJouni Malinen 713636a5d36SJouni Malinen /** 71404a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 71504a773adSJohannes Berg * 71604a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 71704a773adSJohannes Berg * method. 71804a773adSJohannes Berg * 71904a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 72004a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 72104a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 72204a773adSJohannes Berg * search for IBSSs with a different BSSID. 72304a773adSJohannes Berg * @channel: The channel to use if no IBSS can be found to join. 72404a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 72504a773adSJohannes Berg * IBSSs to join on other channels. 72604a773adSJohannes Berg * @ie: information element(s) to include in the beacon 72704a773adSJohannes Berg * @ie_len: length of that 7288e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 72904a773adSJohannes Berg */ 73004a773adSJohannes Berg struct cfg80211_ibss_params { 73104a773adSJohannes Berg u8 *ssid; 73204a773adSJohannes Berg u8 *bssid; 73304a773adSJohannes Berg struct ieee80211_channel *channel; 73404a773adSJohannes Berg u8 *ie; 73504a773adSJohannes Berg u8 ssid_len, ie_len; 7368e30bc55SJohannes Berg u16 beacon_interval; 73704a773adSJohannes Berg bool channel_fixed; 73804a773adSJohannes Berg }; 73904a773adSJohannes Berg 74004a773adSJohannes Berg /** 741b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 742b9a5f8caSJouni Malinen * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 743b9a5f8caSJouni Malinen * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 744b9a5f8caSJouni Malinen * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 745b9a5f8caSJouni Malinen * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 746b9a5f8caSJouni Malinen */ 747b9a5f8caSJouni Malinen enum wiphy_params_flags { 748b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 749b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 750b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 751b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 752b9a5f8caSJouni Malinen }; 753b9a5f8caSJouni Malinen 754b9a5f8caSJouni Malinen /** 755704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 756704232c2SJohannes Berg * 757704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 758704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 759704232c2SJohannes Berg * 760704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 761704232c2SJohannes Berg * on success or a negative error code. 762704232c2SJohannes Berg * 76343fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 76443fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 76543fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 76643fb45cbSJohannes Berg * 7670378b3f1SJohannes Berg * @suspend: wiphy device needs to be suspended 7680378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 7690378b3f1SJohannes Berg * 77060719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 77160719ffdSJohannes Berg * must set the struct wireless_dev's iftype. 772704232c2SJohannes Berg * 773704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 77455682965SJohannes Berg * 77560719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 77660719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 77755682965SJohannes Berg * 77841ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 77941ade00fSJohannes Berg * when adding a group key. 78041ade00fSJohannes Berg * 78141ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 78241ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 78341ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 78441ade00fSJohannes Berg * after it returns. 78541ade00fSJohannes Berg * 78641ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 78741ade00fSJohannes Berg * and @key_index 78841ade00fSJohannes Berg * 78941ade00fSJohannes Berg * @set_default_key: set the default key on an interface 790ed1b6cc7SJohannes Berg * 7913cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 7923cfcf6acSJouni Malinen * 793ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 794ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 795ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 796ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 797ed1b6cc7SJohannes Berg * configured. 798ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 7995727ef1bSJohannes Berg * 8005727ef1bSJohannes Berg * @add_station: Add a new station. 8015727ef1bSJohannes Berg * 8025727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 8035727ef1bSJohannes Berg * 8045727ef1bSJohannes Berg * @change_station: Modify a given station. 8052ec600d6SLuis Carlos Cobo * 80693da9cc1Scolin@cozybit.com * @get_mesh_params: Put the current mesh parameters into *params 80793da9cc1Scolin@cozybit.com * 80893da9cc1Scolin@cozybit.com * @set_mesh_params: Set mesh parameters. 80993da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 81093da9cc1Scolin@cozybit.com * set, and which to leave alone. 81193da9cc1Scolin@cozybit.com * 8122ec600d6SLuis Carlos Cobo * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 8139f1ba906SJouni Malinen * 8149f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 81531888487SJouni Malinen * 81631888487SJouni Malinen * @set_txq_params: Set TX queue parameters 81772bdcf34SJouni Malinen * 81872bdcf34SJouni Malinen * @set_channel: Set channel 8199aed3cc1SJouni Malinen * 8202a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 8212a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 8222a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 8232a519311SJohannes Berg * the scan/scan_done bracket too. 824636a5d36SJouni Malinen * 825636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 826636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 827636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 828636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 82904a773adSJohannes Berg * 83004a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 83104a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 83204a773adSJohannes Berg * to a merge. 83304a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 834b9a5f8caSJouni Malinen * 835b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 836b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 837b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 838b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 839704232c2SJohannes Berg */ 840704232c2SJohannes Berg struct cfg80211_ops { 8410378b3f1SJohannes Berg int (*suspend)(struct wiphy *wiphy); 8420378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 8430378b3f1SJohannes Berg 844704232c2SJohannes Berg int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 8452ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 8462ec600d6SLuis Carlos Cobo struct vif_params *params); 847704232c2SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 84855682965SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 8492ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 8502ec600d6SLuis Carlos Cobo struct vif_params *params); 85141ade00fSJohannes Berg 85241ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 8534e943900SJohannes Berg u8 key_index, const u8 *mac_addr, 85441ade00fSJohannes Berg struct key_params *params); 85541ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 8564e943900SJohannes Berg u8 key_index, const u8 *mac_addr, void *cookie, 85741ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 85841ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 8594e943900SJohannes Berg u8 key_index, const u8 *mac_addr); 86041ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 86141ade00fSJohannes Berg struct net_device *netdev, 86241ade00fSJohannes Berg u8 key_index); 8633cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 8643cfcf6acSJouni Malinen struct net_device *netdev, 8653cfcf6acSJouni Malinen u8 key_index); 866ed1b6cc7SJohannes Berg 867ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 868ed1b6cc7SJohannes Berg struct beacon_parameters *info); 869ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 870ed1b6cc7SJohannes Berg struct beacon_parameters *info); 871ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 8725727ef1bSJohannes Berg 8735727ef1bSJohannes Berg 8745727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 8755727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 8765727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 8775727ef1bSJohannes Berg u8 *mac); 8785727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 8795727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 880fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 8812ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 8822ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 8832ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 8842ec600d6SLuis Carlos Cobo 8852ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 8862ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 8872ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 8882ec600d6SLuis Carlos Cobo u8 *dst); 8892ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 8902ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 8912ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 8922ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 8932ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 8942ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 8952ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 8962ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 89793da9cc1Scolin@cozybit.com int (*get_mesh_params)(struct wiphy *wiphy, 89893da9cc1Scolin@cozybit.com struct net_device *dev, 89993da9cc1Scolin@cozybit.com struct mesh_config *conf); 90093da9cc1Scolin@cozybit.com int (*set_mesh_params)(struct wiphy *wiphy, 90193da9cc1Scolin@cozybit.com struct net_device *dev, 90293da9cc1Scolin@cozybit.com const struct mesh_config *nconf, u32 mask); 9039f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 9049f1ba906SJouni Malinen struct bss_parameters *params); 90531888487SJouni Malinen 90631888487SJouni Malinen int (*set_txq_params)(struct wiphy *wiphy, 90731888487SJouni Malinen struct ieee80211_txq_params *params); 90872bdcf34SJouni Malinen 90972bdcf34SJouni Malinen int (*set_channel)(struct wiphy *wiphy, 91072bdcf34SJouni Malinen struct ieee80211_channel *chan, 911094d05dcSSujith enum nl80211_channel_type channel_type); 9129aed3cc1SJouni Malinen 9132a519311SJohannes Berg int (*scan)(struct wiphy *wiphy, struct net_device *dev, 9142a519311SJohannes Berg struct cfg80211_scan_request *request); 915636a5d36SJouni Malinen 916636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 917636a5d36SJouni Malinen struct cfg80211_auth_request *req); 918636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 919636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 920636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 921636a5d36SJouni Malinen struct cfg80211_deauth_request *req); 922636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 923636a5d36SJouni Malinen struct cfg80211_disassoc_request *req); 92404a773adSJohannes Berg 92504a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 92604a773adSJohannes Berg struct cfg80211_ibss_params *params); 92704a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 928b9a5f8caSJouni Malinen 929b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 930704232c2SJohannes Berg }; 931704232c2SJohannes Berg 932d3236553SJohannes Berg /* 933d3236553SJohannes Berg * wireless hardware and networking interfaces structures 934d3236553SJohannes Berg * and registration/helper functions 935d3236553SJohannes Berg */ 936d3236553SJohannes Berg 937d3236553SJohannes Berg /** 938d3236553SJohannes Berg * struct wiphy - wireless hardware description 939d3236553SJohannes Berg * @idx: the wiphy index assigned to this item 940d3236553SJohannes Berg * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 941d3236553SJohannes Berg * @custom_regulatory: tells us the driver for this device 942d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 943d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 944d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 945d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 946d3236553SJohannes Berg * @strict_regulatory: tells us the driver for this device will ignore 947d3236553SJohannes Berg * regulatory domain settings until it gets its own regulatory domain 948d3236553SJohannes Berg * via its regulatory_hint(). After its gets its own regulatory domain 949d3236553SJohannes Berg * it will only allow further regulatory domain settings to further 950d3236553SJohannes Berg * enhance compliance. For example if channel 13 and 14 are disabled 951d3236553SJohannes Berg * by this regulatory domain no user regulatory domain can enable these 952d3236553SJohannes Berg * channels at a later time. This can be used for devices which do not 953d3236553SJohannes Berg * have calibration information gauranteed for frequencies or settings 954d3236553SJohannes Berg * outside of its regulatory domain. 955d3236553SJohannes Berg * @reg_notifier: the driver's regulatory notification callback 956d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 957d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 958d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 959d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 960d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 961d3236553SJohannes Berg * @cipher_suites: supported cipher suites 962d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 963b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 964b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 965b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 966b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 967b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 968d3236553SJohannes Berg */ 969d3236553SJohannes Berg struct wiphy { 970d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 971d3236553SJohannes Berg 972d3236553SJohannes Berg /* permanent MAC address */ 973d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 974d3236553SJohannes Berg 975d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 976d3236553SJohannes Berg u16 interface_modes; 977d3236553SJohannes Berg 978d3236553SJohannes Berg bool custom_regulatory; 979d3236553SJohannes Berg bool strict_regulatory; 980d3236553SJohannes Berg 981d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 982d3236553SJohannes Berg 983d3236553SJohannes Berg int bss_priv_size; 984d3236553SJohannes Berg u8 max_scan_ssids; 985d3236553SJohannes Berg u16 max_scan_ie_len; 986d3236553SJohannes Berg 987d3236553SJohannes Berg int n_cipher_suites; 988d3236553SJohannes Berg const u32 *cipher_suites; 989d3236553SJohannes Berg 990b9a5f8caSJouni Malinen u8 retry_short; 991b9a5f8caSJouni Malinen u8 retry_long; 992b9a5f8caSJouni Malinen u32 frag_threshold; 993b9a5f8caSJouni Malinen u32 rts_threshold; 994b9a5f8caSJouni Malinen 995d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 996d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 997d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 998d3236553SJohannes Berg * or not. Assign this to something global to your driver to 999d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 1000d3236553SJohannes Berg void *privid; 1001d3236553SJohannes Berg 1002d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 1003d3236553SJohannes Berg 1004d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 1005d3236553SJohannes Berg int (*reg_notifier)(struct wiphy *wiphy, 1006d3236553SJohannes Berg struct regulatory_request *request); 1007d3236553SJohannes Berg 1008d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 1009d3236553SJohannes Berg 1010d3236553SJohannes Berg const struct ieee80211_regdomain *regd; 1011d3236553SJohannes Berg 1012d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 1013d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 1014d3236553SJohannes Berg struct device dev; 1015d3236553SJohannes Berg 1016d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 1017d3236553SJohannes Berg struct dentry *debugfsdir; 1018d3236553SJohannes Berg 1019d3236553SJohannes Berg char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1020d3236553SJohannes Berg }; 1021d3236553SJohannes Berg 1022d3236553SJohannes Berg /** 1023d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 1024d3236553SJohannes Berg * 1025d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 1026d3236553SJohannes Berg */ 1027d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 1028d3236553SJohannes Berg { 1029d3236553SJohannes Berg BUG_ON(!wiphy); 1030d3236553SJohannes Berg return &wiphy->priv; 1031d3236553SJohannes Berg } 1032d3236553SJohannes Berg 1033d3236553SJohannes Berg /** 1034d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 1035d3236553SJohannes Berg * 1036d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 1037d3236553SJohannes Berg * @dev: The device to parent it to 1038d3236553SJohannes Berg */ 1039d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1040d3236553SJohannes Berg { 1041d3236553SJohannes Berg wiphy->dev.parent = dev; 1042d3236553SJohannes Berg } 1043d3236553SJohannes Berg 1044d3236553SJohannes Berg /** 1045d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 1046d3236553SJohannes Berg * 1047d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 1048d3236553SJohannes Berg */ 1049d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 1050d3236553SJohannes Berg { 1051d3236553SJohannes Berg return wiphy->dev.parent; 1052d3236553SJohannes Berg } 1053d3236553SJohannes Berg 1054d3236553SJohannes Berg /** 1055d3236553SJohannes Berg * wiphy_name - get wiphy name 1056d3236553SJohannes Berg * 1057d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 1058d3236553SJohannes Berg */ 1059d3236553SJohannes Berg static inline const char *wiphy_name(struct wiphy *wiphy) 1060d3236553SJohannes Berg { 1061d3236553SJohannes Berg return dev_name(&wiphy->dev); 1062d3236553SJohannes Berg } 1063d3236553SJohannes Berg 1064d3236553SJohannes Berg /** 1065d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 1066d3236553SJohannes Berg * 1067d3236553SJohannes Berg * @ops: The configuration operations for this device 1068d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 1069d3236553SJohannes Berg * 1070d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 1071d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 1072d3236553SJohannes Berg * 1073d3236553SJohannes Berg * The returned pointer must be assigned to each netdev's 1074d3236553SJohannes Berg * ieee80211_ptr for proper operation. 1075d3236553SJohannes Berg */ 1076*3dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 1077d3236553SJohannes Berg 1078d3236553SJohannes Berg /** 1079d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 1080d3236553SJohannes Berg * 1081d3236553SJohannes Berg * @wiphy: The wiphy to register. 1082d3236553SJohannes Berg * 1083d3236553SJohannes Berg * Returns a non-negative wiphy index or a negative error code. 1084d3236553SJohannes Berg */ 1085d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 1086d3236553SJohannes Berg 1087d3236553SJohannes Berg /** 1088d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 1089d3236553SJohannes Berg * 1090d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 1091d3236553SJohannes Berg * 1092d3236553SJohannes Berg * After this call, no more requests can be made with this priv 1093d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 1094d3236553SJohannes Berg * request that is being handled. 1095d3236553SJohannes Berg */ 1096d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 1097d3236553SJohannes Berg 1098d3236553SJohannes Berg /** 1099d3236553SJohannes Berg * wiphy_free - free wiphy 1100d3236553SJohannes Berg * 1101d3236553SJohannes Berg * @wiphy: The wiphy to free 1102d3236553SJohannes Berg */ 1103d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 1104d3236553SJohannes Berg 1105d3236553SJohannes Berg /** 1106d3236553SJohannes Berg * struct wireless_dev - wireless per-netdev state 1107d3236553SJohannes Berg * 1108d3236553SJohannes Berg * This structure must be allocated by the driver/stack 1109d3236553SJohannes Berg * that uses the ieee80211_ptr field in struct net_device 1110d3236553SJohannes Berg * (this is intentional so it can be allocated along with 1111d3236553SJohannes Berg * the netdev.) 1112d3236553SJohannes Berg * 1113d3236553SJohannes Berg * @wiphy: pointer to hardware description 1114d3236553SJohannes Berg * @iftype: interface type 1115d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 1116d3236553SJohannes Berg * @netdev: (private) Used to reference back to the netdev 1117d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 1118d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 1119d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 1120d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 1121d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 1122d3236553SJohannes Berg * @wext_bssid: (private) Used by the internal wireless extensions compat code 1123d3236553SJohannes Berg */ 1124d3236553SJohannes Berg struct wireless_dev { 1125d3236553SJohannes Berg struct wiphy *wiphy; 1126d3236553SJohannes Berg enum nl80211_iftype iftype; 1127d3236553SJohannes Berg 1128d3236553SJohannes Berg /* private to the generic wireless code */ 1129d3236553SJohannes Berg struct list_head list; 1130d3236553SJohannes Berg struct net_device *netdev; 1131d3236553SJohannes Berg 1132d3236553SJohannes Berg /* currently used for IBSS - might be rearranged in the future */ 1133d3236553SJohannes Berg struct cfg80211_bss *current_bss; 1134d3236553SJohannes Berg u8 bssid[ETH_ALEN]; 1135d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 1136d3236553SJohannes Berg u8 ssid_len; 1137d3236553SJohannes Berg 1138d3236553SJohannes Berg #ifdef CONFIG_WIRELESS_EXT 1139d3236553SJohannes Berg /* wext data */ 1140cbe8fa9cSJohannes Berg struct { 1141cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 1142cbe8fa9cSJohannes Berg u8 bssid[ETH_ALEN]; 114308645126SJohannes Berg s8 default_key, default_mgmt_key; 1144cbe8fa9cSJohannes Berg } wext; 1145d3236553SJohannes Berg #endif 1146d3236553SJohannes Berg }; 1147d3236553SJohannes Berg 1148d3236553SJohannes Berg /** 1149d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 1150d3236553SJohannes Berg * 1151d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 1152d3236553SJohannes Berg */ 1153d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 1154d3236553SJohannes Berg { 1155d3236553SJohannes Berg BUG_ON(!wdev); 1156d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 1157d3236553SJohannes Berg } 1158d3236553SJohannes Berg 1159d3236553SJohannes Berg /* 1160d3236553SJohannes Berg * Utility functions 1161d3236553SJohannes Berg */ 1162d3236553SJohannes Berg 1163d3236553SJohannes Berg /** 1164d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 1165d3236553SJohannes Berg */ 1166d3236553SJohannes Berg extern int ieee80211_channel_to_frequency(int chan); 1167d3236553SJohannes Berg 1168d3236553SJohannes Berg /** 1169d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 1170d3236553SJohannes Berg */ 1171d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 1172d3236553SJohannes Berg 1173d3236553SJohannes Berg /* 1174d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 1175d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 1176d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 1177d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 1178d3236553SJohannes Berg * clash. 1179d3236553SJohannes Berg */ 1180d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 1181d3236553SJohannes Berg int freq); 1182d3236553SJohannes Berg /** 1183d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1184d3236553SJohannes Berg */ 1185d3236553SJohannes Berg static inline struct ieee80211_channel * 1186d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 1187d3236553SJohannes Berg { 1188d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 1189d3236553SJohannes Berg } 1190d3236553SJohannes Berg 1191d3236553SJohannes Berg /** 1192d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 1193d3236553SJohannes Berg * 1194d3236553SJohannes Berg * @sband: the band to look for rates in 1195d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 1196d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 1197d3236553SJohannes Berg * 1198d3236553SJohannes Berg * This function returns the basic rate corresponding to a given 1199d3236553SJohannes Berg * bitrate, that is the next lower bitrate contained in the basic 1200d3236553SJohannes Berg * rate map, which is, for this function, given as a bitmap of 1201d3236553SJohannes Berg * indices of rates in the band's bitrate table. 1202d3236553SJohannes Berg */ 1203d3236553SJohannes Berg struct ieee80211_rate * 1204d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 1205d3236553SJohannes Berg u32 basic_rates, int bitrate); 1206d3236553SJohannes Berg 1207d3236553SJohannes Berg /* 1208d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 1209d3236553SJohannes Berg * 1210d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 1211d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 1212d3236553SJohannes Berg */ 1213d3236553SJohannes Berg 1214d3236553SJohannes Berg /** 1215d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 1216d3236553SJohannes Berg * @rtheader: pointer to the radiotap header we are walking through 1217d3236553SJohannes Berg * @max_length: length of radiotap header in cpu byte ordering 1218d3236553SJohannes Berg * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 1219d3236553SJohannes Berg * @this_arg: pointer to current radiotap arg 1220d3236553SJohannes Berg * @arg_index: internal next argument index 1221d3236553SJohannes Berg * @arg: internal next argument pointer 1222d3236553SJohannes Berg * @next_bitmap: internal pointer to next present u32 1223d3236553SJohannes Berg * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 1224d3236553SJohannes Berg */ 1225d3236553SJohannes Berg 1226d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 1227d3236553SJohannes Berg struct ieee80211_radiotap_header *rtheader; 1228d3236553SJohannes Berg int max_length; 1229d3236553SJohannes Berg int this_arg_index; 1230d3236553SJohannes Berg u8 *this_arg; 1231d3236553SJohannes Berg 1232d3236553SJohannes Berg int arg_index; 1233d3236553SJohannes Berg u8 *arg; 1234d3236553SJohannes Berg __le32 *next_bitmap; 1235d3236553SJohannes Berg u32 bitmap_shifter; 1236d3236553SJohannes Berg }; 1237d3236553SJohannes Berg 1238d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 1239d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 1240d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 1241d3236553SJohannes Berg int max_length); 1242d3236553SJohannes Berg 1243d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 1244d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 1245d3236553SJohannes Berg 1246d3236553SJohannes Berg /* 1247d3236553SJohannes Berg * Regulatory helper functions for wiphys 1248d3236553SJohannes Berg */ 1249d3236553SJohannes Berg 1250d3236553SJohannes Berg /** 1251d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 1252d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 1253d3236553SJohannes Berg * conflicts) 1254d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 1255d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 1256d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 1257d3236553SJohannes Berg * alpha2. 1258d3236553SJohannes Berg * 1259d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 1260d3236553SJohannes Berg * what it believes should be the current regulatory domain by 1261d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 1262d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 1263d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 1264d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 1265d3236553SJohannes Berg * 1266d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 1267d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 1268d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 1269d3236553SJohannes Berg * 1270d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 1271d3236553SJohannes Berg * an -ENOMEM. 1272d3236553SJohannes Berg */ 1273d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1274d3236553SJohannes Berg 1275d3236553SJohannes Berg /** 1276d3236553SJohannes Berg * regulatory_hint_11d - hints a country IE as a regulatory domain 1277d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 1278d3236553SJohannes Berg * conflicts) 1279d3236553SJohannes Berg * @country_ie: pointer to the country IE 1280d3236553SJohannes Berg * @country_ie_len: length of the country IE 1281d3236553SJohannes Berg * 1282d3236553SJohannes Berg * We will intersect the rd with the what CRDA tells us should apply 1283d3236553SJohannes Berg * for the alpha2 this country IE belongs to, this prevents APs from 1284d3236553SJohannes Berg * sending us incorrect or outdated information against a country. 1285d3236553SJohannes Berg */ 1286d3236553SJohannes Berg extern void regulatory_hint_11d(struct wiphy *wiphy, 1287d3236553SJohannes Berg u8 *country_ie, 1288d3236553SJohannes Berg u8 country_ie_len); 1289d3236553SJohannes Berg /** 1290d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1291d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 1292d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 1293d3236553SJohannes Berg * 1294d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 1295d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 1296d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 1297d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 1298d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 1299d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 1300d3236553SJohannes Berg */ 1301d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 1302d3236553SJohannes Berg struct wiphy *wiphy, 1303d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 1304d3236553SJohannes Berg 1305d3236553SJohannes Berg /** 1306d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 1307d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 1308d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 1309038659e7SLuis R. Rodriguez * @desired_bw_khz: the desired max bandwidth you want to use per 1310038659e7SLuis R. Rodriguez * channel. Note that this is still 20 MHz if you want to use HT40 1311038659e7SLuis R. Rodriguez * as HT40 makes use of two channels for its 40 MHz width bandwidth. 1312038659e7SLuis R. Rodriguez * If set to 0 we'll assume you want the standard 20 MHz. 1313d3236553SJohannes Berg * @reg_rule: the regulatory rule which we have for this frequency 1314d3236553SJohannes Berg * 1315d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 1316d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 1317d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 1318d3236553SJohannes Berg * and processed already. 1319d3236553SJohannes Berg * 1320d3236553SJohannes Berg * Returns 0 if it was able to find a valid regulatory rule which does 1321d3236553SJohannes Berg * apply to the given center_freq otherwise it returns non-zero. It will 1322d3236553SJohannes Berg * also return -ERANGE if we determine the given center_freq does not even have 1323d3236553SJohannes Berg * a regulatory rule for a frequency range in the center_freq's band. See 1324d3236553SJohannes Berg * freq_in_rule_band() for our current definition of a band -- this is purely 1325d3236553SJohannes Berg * subjective and right now its 802.11 specific. 1326d3236553SJohannes Berg */ 1327038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy, 1328038659e7SLuis R. Rodriguez u32 center_freq, 1329038659e7SLuis R. Rodriguez u32 desired_bw_khz, 1330d3236553SJohannes Berg const struct ieee80211_reg_rule **reg_rule); 1331d3236553SJohannes Berg 1332d3236553SJohannes Berg /* 1333d3236553SJohannes Berg * Temporary wext handlers & helper functions 1334d3236553SJohannes Berg * 1335d3236553SJohannes Berg * In the future cfg80211 will simply assign the entire wext handler 1336d3236553SJohannes Berg * structure to netdevs it manages, but we're not there yet. 1337d3236553SJohannes Berg */ 1338fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev, 1339fee52678SJohannes Berg struct iw_request_info *info, 1340fee52678SJohannes Berg char *name, char *extra); 1341e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 1342e60c7744SJohannes Berg u32 *mode, char *extra); 1343e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 1344e60c7744SJohannes Berg u32 *mode, char *extra); 13452a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev, 13462a519311SJohannes Berg struct iw_request_info *info, 13472a519311SJohannes Berg union iwreq_data *wrqu, char *extra); 13482a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev, 13492a519311SJohannes Berg struct iw_request_info *info, 13502a519311SJohannes Berg struct iw_point *data, char *extra); 1351691597cbSJohannes Berg int cfg80211_wext_siwmlme(struct net_device *dev, 1352691597cbSJohannes Berg struct iw_request_info *info, 1353691597cbSJohannes Berg struct iw_point *data, char *extra); 13544aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev, 13554aa188e1SJohannes Berg struct iw_request_info *info, 13564aa188e1SJohannes Berg struct iw_point *data, char *extra); 135704a773adSJohannes Berg int cfg80211_ibss_wext_siwfreq(struct net_device *dev, 135804a773adSJohannes Berg struct iw_request_info *info, 135904a773adSJohannes Berg struct iw_freq *freq, char *extra); 136004a773adSJohannes Berg int cfg80211_ibss_wext_giwfreq(struct net_device *dev, 136104a773adSJohannes Berg struct iw_request_info *info, 136204a773adSJohannes Berg struct iw_freq *freq, char *extra); 136304a773adSJohannes Berg int cfg80211_ibss_wext_siwessid(struct net_device *dev, 136404a773adSJohannes Berg struct iw_request_info *info, 136504a773adSJohannes Berg struct iw_point *data, char *ssid); 136604a773adSJohannes Berg int cfg80211_ibss_wext_giwessid(struct net_device *dev, 136704a773adSJohannes Berg struct iw_request_info *info, 136804a773adSJohannes Berg struct iw_point *data, char *ssid); 136904a773adSJohannes Berg int cfg80211_ibss_wext_siwap(struct net_device *dev, 137004a773adSJohannes Berg struct iw_request_info *info, 137104a773adSJohannes Berg struct sockaddr *ap_addr, char *extra); 137204a773adSJohannes Berg int cfg80211_ibss_wext_giwap(struct net_device *dev, 137304a773adSJohannes Berg struct iw_request_info *info, 137404a773adSJohannes Berg struct sockaddr *ap_addr, char *extra); 137504a773adSJohannes Berg 137604a773adSJohannes Berg struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 137704a773adSJohannes Berg struct iw_freq *freq); 13782a519311SJohannes Berg 1379b9a5f8caSJouni Malinen int cfg80211_wext_siwrts(struct net_device *dev, 1380b9a5f8caSJouni Malinen struct iw_request_info *info, 1381b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 1382b9a5f8caSJouni Malinen int cfg80211_wext_giwrts(struct net_device *dev, 1383b9a5f8caSJouni Malinen struct iw_request_info *info, 1384b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 1385b9a5f8caSJouni Malinen int cfg80211_wext_siwfrag(struct net_device *dev, 1386b9a5f8caSJouni Malinen struct iw_request_info *info, 1387b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 1388b9a5f8caSJouni Malinen int cfg80211_wext_giwfrag(struct net_device *dev, 1389b9a5f8caSJouni Malinen struct iw_request_info *info, 1390b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 1391b9a5f8caSJouni Malinen int cfg80211_wext_siwretry(struct net_device *dev, 1392b9a5f8caSJouni Malinen struct iw_request_info *info, 1393b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 1394b9a5f8caSJouni Malinen int cfg80211_wext_giwretry(struct net_device *dev, 1395b9a5f8caSJouni Malinen struct iw_request_info *info, 1396b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 139708645126SJohannes Berg int cfg80211_wext_siwencodeext(struct net_device *dev, 139808645126SJohannes Berg struct iw_request_info *info, 139908645126SJohannes Berg struct iw_point *erq, char *extra); 140008645126SJohannes Berg int cfg80211_wext_siwencode(struct net_device *dev, 140108645126SJohannes Berg struct iw_request_info *info, 140208645126SJohannes Berg struct iw_point *erq, char *keybuf); 140308645126SJohannes Berg int cfg80211_wext_giwencode(struct net_device *dev, 140408645126SJohannes Berg struct iw_request_info *info, 140508645126SJohannes Berg struct iw_point *erq, char *keybuf); 1406b9a5f8caSJouni Malinen 1407d3236553SJohannes Berg /* 1408d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 1409d3236553SJohannes Berg * functions and BSS handling helpers 1410d3236553SJohannes Berg */ 1411d3236553SJohannes Berg 14122a519311SJohannes Berg /** 14132a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 14142a519311SJohannes Berg * 14152a519311SJohannes Berg * @request: the corresponding scan request 14162a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 14172a519311SJohannes Berg * userspace will be notified of that 14182a519311SJohannes Berg */ 14192a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 14202a519311SJohannes Berg 14212a519311SJohannes Berg /** 14222a519311SJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 14232a519311SJohannes Berg * 14242a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 14252a519311SJohannes Berg * @bss: the found BSS 142677965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 14272a519311SJohannes Berg * @gfp: context flags 14282a519311SJohannes Berg * 14292a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 14302a519311SJohannes Berg * the BSS should be updated/added. 14312a519311SJohannes Berg */ 14322a519311SJohannes Berg struct cfg80211_bss* 14332a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 14342a519311SJohannes Berg struct ieee80211_channel *channel, 14352a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 143677965c97SJohannes Berg s32 signal, gfp_t gfp); 14372a519311SJohannes Berg 143806aa7afaSJussi Kivilinna struct cfg80211_bss* 143906aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 144006aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 144106aa7afaSJussi Kivilinna const u8 *bssid, 144206aa7afaSJussi Kivilinna u64 timestamp, u16 capability, u16 beacon_interval, 144306aa7afaSJussi Kivilinna const u8 *ie, size_t ielen, 144406aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 144506aa7afaSJussi Kivilinna 14462a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 14472a519311SJohannes Berg struct ieee80211_channel *channel, 14482a519311SJohannes Berg const u8 *bssid, 144979420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 145079420f09SJohannes Berg u16 capa_mask, u16 capa_val); 145179420f09SJohannes Berg static inline struct cfg80211_bss * 145279420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 145379420f09SJohannes Berg struct ieee80211_channel *channel, 145479420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 145579420f09SJohannes Berg { 145679420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 145779420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 145879420f09SJohannes Berg } 145979420f09SJohannes Berg 14602a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 14612a519311SJohannes Berg struct ieee80211_channel *channel, 14622a519311SJohannes Berg const u8 *meshid, size_t meshidlen, 14632a519311SJohannes Berg const u8 *meshcfg); 14642a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss); 1465d3236553SJohannes Berg 1466d491af19SJohannes Berg /** 1467d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 1468d491af19SJohannes Berg * @wiphy: the wiphy 1469d491af19SJohannes Berg * @bss: the bss to remove 1470d491af19SJohannes Berg * 1471d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 1472d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 1473d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 1474d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 1475d491af19SJohannes Berg */ 1476d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 1477fee52678SJohannes Berg 14786039f6d2SJouni Malinen /** 14796039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 14806039f6d2SJouni Malinen * @dev: network device 14816039f6d2SJouni Malinen * @buf: authentication frame (header + body) 14826039f6d2SJouni Malinen * @len: length of the frame data 14836039f6d2SJouni Malinen * 14846039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 14851965c853SJouni Malinen * station mode. The driver is required to call either this function or 14861965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 14871965c853SJouni Malinen * call. 14886039f6d2SJouni Malinen */ 14896039f6d2SJouni Malinen void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 14906039f6d2SJouni Malinen 14916039f6d2SJouni Malinen /** 14921965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 14931965c853SJouni Malinen * @dev: network device 14941965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 14951965c853SJouni Malinen */ 14961965c853SJouni Malinen void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 14971965c853SJouni Malinen 14981965c853SJouni Malinen /** 14996039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 15006039f6d2SJouni Malinen * @dev: network device 15016039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 15026039f6d2SJouni Malinen * @len: length of the frame data 15036039f6d2SJouni Malinen * 15046039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 15051965c853SJouni Malinen * processed in station mode. The driver is required to call either this 15061965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 15071965c853SJouni Malinen * cfg80211_ops::assoc() call. 15086039f6d2SJouni Malinen */ 15096039f6d2SJouni Malinen void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 15106039f6d2SJouni Malinen 15116039f6d2SJouni Malinen /** 15121965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 15131965c853SJouni Malinen * @dev: network device 15141965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 15151965c853SJouni Malinen */ 15161965c853SJouni Malinen void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 15171965c853SJouni Malinen 15181965c853SJouni Malinen /** 151953b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 15206039f6d2SJouni Malinen * @dev: network device 15216039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 15226039f6d2SJouni Malinen * @len: length of the frame data 15236039f6d2SJouni Malinen * 15246039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 152553b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 152653b46b84SJouni Malinen * locally generated ones. 15276039f6d2SJouni Malinen */ 152853b46b84SJouni Malinen void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 15296039f6d2SJouni Malinen 15306039f6d2SJouni Malinen /** 153153b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 15326039f6d2SJouni Malinen * @dev: network device 15336039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 15346039f6d2SJouni Malinen * @len: length of the frame data 15356039f6d2SJouni Malinen * 15366039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 153753b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 153853b46b84SJouni Malinen * generated ones. 15396039f6d2SJouni Malinen */ 154053b46b84SJouni Malinen void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); 15416039f6d2SJouni Malinen 1542a08c1c1aSKalle Valo /** 1543a08c1c1aSKalle Valo * cfg80211_hold_bss - exclude bss from expiration 1544a08c1c1aSKalle Valo * @bss: bss which should not expire 1545a08c1c1aSKalle Valo * 1546a08c1c1aSKalle Valo * In a case when the BSS is not updated but it shouldn't expire this 1547a08c1c1aSKalle Valo * function can be used to mark the BSS to be excluded from expiration. 1548a08c1c1aSKalle Valo */ 1549a08c1c1aSKalle Valo void cfg80211_hold_bss(struct cfg80211_bss *bss); 1550a08c1c1aSKalle Valo 1551a08c1c1aSKalle Valo /** 1552a08c1c1aSKalle Valo * cfg80211_unhold_bss - remove expiration exception from the BSS 1553a08c1c1aSKalle Valo * @bss: bss which can expire again 1554a08c1c1aSKalle Valo * 1555a08c1c1aSKalle Valo * This function marks the BSS to be expirable again. 1556a08c1c1aSKalle Valo */ 1557a08c1c1aSKalle Valo void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1558a08c1c1aSKalle Valo 1559a3b8b056SJouni Malinen /** 1560a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1561a3b8b056SJouni Malinen * @dev: network device 1562a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 1563a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 1564a3b8b056SJouni Malinen * @key_id: Key identifier (0..3) 1565a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 1566a3b8b056SJouni Malinen * 1567a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 1568a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 1569a3b8b056SJouni Malinen * primitive. 1570a3b8b056SJouni Malinen */ 1571a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 1572a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 1573a3b8b056SJouni Malinen const u8 *tsc); 1574a3b8b056SJouni Malinen 157504a773adSJohannes Berg /** 157604a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 157704a773adSJohannes Berg * 157804a773adSJohannes Berg * @dev: network device 157904a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 158004a773adSJohannes Berg * @gfp: allocation flags 158104a773adSJohannes Berg * 158204a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 158304a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 158404a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 158504a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 158604a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 158704a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 158804a773adSJohannes Berg */ 158904a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 159004a773adSJohannes Berg 1591704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 1592